Example #1
0
define(function(require) {
    'use strict';

    var Ember = require('ember'),
        moment = require('moment');

    require('bootstrap');
    require('nouislider');
    require('typeahead');
    require('bootstrap-material-design');
    require('components/init');

    Ember.TextSupport.reopen({
        classNames: ['form-control']
    });

    require('touch');

    Ember.$.event.special.swipe.horizontalDistanceThreshold = 100;

    Ember.LinkComponent.reopen({
        //TODO: init only needed because classNameBindings are execute in controller context instead of this
        init: function() {
            this.setProperties(this.get('properties'));

            this._super();
        },
        properties: null
    });

    Ember.Handlebars.registerBoundHelper('time', function(seconds) {
        return moment.utc(seconds * 1000).format('mm:ss');
    });
});
Example #2
0
	initialize: function() {
		Ember.TextSupport.reopen({
		    classNames: ['form-control']
		});
	}
Example #3
0
  initialize: function() {

    Ember.EasyForm.Input.reopen({
      classNameBindings: ['wrapperConfig.inputClass', 'wrapperErrorClass'],
      isCheckbox: function() {
        if (this.get('inputOptionsValues.as') === 'checkbox') {
          return true;
        }
        else {
          return false;
        }
      }.property('inputOptionsValues'),
      divWrapperClass: function() {
        if (this.get('inputOptionsValues.as') === 'checkbox') {
          return 'checkbox';
        }
        else {
          return '';
        }
      }.property('inputOptionsValues'),
      
      isEasyForm: true
    });

    Ember.EasyForm.Error.reopen({
      errorText: function() {
        return this.get('errors.firstObject');
      }.property('errors.firstObject').cacheable(),
      updateParentView: function() {
        var parentView = this.get('parentView');
        if(this.get('errors.length') > 0) {
          parentView.set('wrapperErrorClass', 'has-error');
        }else{
          parentView.set('wrapperErrorClass', false);
        }
      }.observes('errors.firstObject')
    });

    Ember.EasyForm.Submit.reopen({
      disabled: function() {
        return this.get('formForModel.disableSubmit');
      }.property('formForModel.disableSubmit')
    });

    //-- Bootstrap 3 Class Names --------------------------------------------
    //-- https://github.com/dockyard/ember-easyForm/issues/47
    Ember.TextSupport.reopen({
      classNames: ['form-control']
    });
    // And add the same classes to Select inputs
    Ember.Select.reopen({
      classNames: ['form-control']
    });

    Ember.EasyForm.Config.registerWrapper('default', {
      inputTemplate: 'form-fields/input',

      labelClass: 'control-label',
      inputClass: 'form-group',
      buttonClass: 'btn btn-primary',
      fieldErrorClass: 'has-error',
      errorClass: 'help-block'
    });
  }