Example #1
0
export default Ember.Component.extend({
  i18n: Ember.inject.service(),
  classNames: ['publication-display'],
  classNameBindings: ['isReviewMode:publication-review-list', 'isPreviewMode:publication-preview-list'],
  isReviewMode: Ember.computed.equal('mode', 'review'),
  isPreviewMode: Ember.computed.equal('mode', 'preview'),
  isCompareMode: Ember.computed.equal('mode', 'compare'),

  getCodeForPublicationType: function(id) {
    var publicationType = this.get('allPublicationTypes').findBy('id', id);
    return publicationType.code;
  },

  getLowercaseRefValue: Ember.computed('publication.ref_value_label', function() {
    return this.get('publication.ref_value_label').toLowerCase();
  }),

  getBaseUrlForIdentifier: Ember.computed('publication.publication_identifiers', function() {
    //@ TODO: ??:
    /*
       let arr = this.get('publication.publication_identifiers');
       let baseDOI = 'https://doi.org/';
       let handle = 'http://hdl.handle.net/';
       let libris = 'http://libris.kb.se/bib/';
       let pubmed = 'https://www.ncbi.nlm.nih.gov/pubmed/';
       */
    return "baseUrl";
  }),

  getPublishedInStr: Ember.computed('publication.id', function(){
Example #2
0
          moons: 2
        }
      ]
    }
  }
];

export default Ember.Controller.extend({
  json: '',
  pointer: '',
  queryParams: ['pointer', 'json'],
  pointerOrJsonIsPresent: Ember.computed.or('json', 'pointer'),
  disableClearButton: Ember.computed.not('pointerOrJsonIsPresent'),

  disableFormatJsonButton: Ember.computed('json', 'object', function() {
    return !this.get('object') || this.get('json') === JSON.stringify(this.get('object'), null, 2);
  }),

  object: Ember.computed('json', function() {
    try { return JSON.parse(this.get('json')); }
    catch (e) { return undefined; }
  }),

  stringifiedObject: Ember.computed('object', 'pointer', function() {
    if (typeof this.get('object') === 'undefined') {
      return 'The JSON object you entered is invalid.';
    }
    return jsonStringifier(this.get('object'), this.get('pointer'));
  }),

  pointerObject: Ember.computed('pointer', 'object', function() {
}}

Or can serve as a block helper for elements that needs to be wrapped within label element.
{{#em-form-label text="Active?"}}
    {{em-checkbox}}
{{/em-form-label}}
 */
export default Ember.Component.extend(InFormMixin, {
  layout: layout,
  tagName: 'label',
  classNames: ['control-label'],
  classNameBindings: ['extraClass', 'inlineClassCalc', 'horiClassCalc'],
  attributeBindings: ['for'],
  horiClass: 'col-sm-2',
  horiClassCalc: Ember.computed('form.isHorizontal', {
    get: function() {
      if (this.get('form.isHorizontal') && this.get('horiClass')) {
        return this.get('horiClass');
      }
    }
  }),
  inlineClass: 'sr-only',
  inlineClassCalc: Ember.computed('form.formLayout', {
    get: function() {
      if (this.get('form.isInline') && this.get('inlineClass')) {
        return this.get('inlineClass');
      }
    }
  })
});
  cssClass: Ember.computed('size', 'type', 'color', 'floating', 'compact', 'attached', 'visible', 'icon', function() {
    var isNonEmptyString = function(str) {
      return Ember.typeOf(str) === 'string' && str.trim().length > 0;
    };

    var result = 'ui ';

    // Message size ('small', 'large', 'huge', 'massive', or some custom size class).
    var sizeClass = this.get('size');
    var hasSize = isNonEmptyString(sizeClass);
    result += hasSize ? sizeClass + ' ' : '';

    // Message type ('info', 'positive', 'success', 'negative', 'error', or some custom type class).
    var typeClass = this.get('type');
    var hasType = isNonEmptyString(typeClass);
    result += hasType ? typeClass + ' ' : '';

    // Message color ('red', 'orange', 'yellow', 'olive', 'green', 'teal', 'blue', 'violet', 'purple',
    // 'pink', 'brown', 'black', or some custom color class).
    var colorClass = this.get('color');
    var hasColor = isNonEmptyString(colorClass);
    result += hasColor ? colorClass + ' ' : '';

    // Message block variations.
    // Note! Variations 'ui floating message', 'ui compact message', 'ui attached message' doesn't work
    // with 'icon', 'visible' and 'hidden' subclasses.
    // For example 'ui compact icon message' will be with icon, but not compact.
    var isFloating = this.get('floating');
    result += isFloating ? 'floating ' : '';

    var isCompact = this.get('compact');
    result += isCompact ? 'compact ' : '';

    var isAttached = this.get('attached');
    result += isAttached ? 'attached ' : '';

    // Message block visibility.
    // Note! It is better to use empty string '' instead of 'visible' subclass.
    var isVisible = this.get('visible');
    result += isVisible ? '' : 'hidden ';

    // Message icon.
    var iconClass = this.get('icon');
    var hasIcon = isNonEmptyString(iconClass);
    result += hasIcon ? 'icon ' : '';

    result += 'message';

    return result;
  }),
Example #5
0
import Ember from 'ember';
import AjaxService from 'ember-ajax/services/ajax';

export default AjaxService.extend({
  auth: Ember.inject.service(),

  headers: Ember.computed('auth.credentials.token', {
    get() {
      let headers = {};
      const token = this.get('auth.credentials.token');
      if (token) {
        headers['Authorization'] = `Token token=${token}`;
      }
      return headers;
    }
  })
});
Example #6
0
import Ember from 'ember';

export default Ember.Component.extend({
  i18n: Ember.inject.service(),
  selectedLanguage: {id: "en", text:"EN"},

  locales: Ember.computed('i18n.locales', function() {
    const i18n = this.get('i18n');
    return this.get('i18n.locales').map(function (loc) {
    	return { id: loc, text: i18n.t(loc).string };
    });
  }),
  
  actions: {
  	setLocale(selectedLocaleTemp) {
		this.set('selectedLanguage', selectedLocaleTemp);
      	this.set('i18n.locale', this.get('selectedLanguage').id);
      	this.sendAction('refreshModel');
	}
  }
});
Example #7
0
import Ember from 'ember';
import BaseFocusable from './base-focusable';
import RippleMixin from '../mixins/ripple-mixin';

export default BaseFocusable.extend(RippleMixin, {
  tagName: 'md-radio-button',
  classNames: ['md-radio-button', 'md-default-theme'],
  classNameBindings: ['checked:md-checked'],
  toggle: false,
  selected: null,

  center: true,
  rippleContainerSelector: '.md-container',

  checked: Ember.computed('value', 'selected', function() {
    return this.get('value') === this.get('selected');
  }),

  checkedDidChange: Ember.observer('checked', function() {
    if (this.get('checked')) {
      this.set('selected', this.get('value'));
      this.sendAction('changed', this.get('value'));
    }
  }),

  click: function() {
    if (this.get('disabled')) {
      return;
    }

    if (this.get('toggle')) {
	libYearDim: Ember.computed.alias('dataService.libYearDim'),
	libDistrictDimension: Ember.computed.alias('dataService.libDistrictDimension'),
	libNameDimension: Ember.computed.alias('dataService.libNameDimension'),
	year: Ember.computed.alias('dataService.libYear'),
	scope: 'Barcelona',
	zoneCode: null,
	showReset: false,
	reseted: false,
	dataMap: Ember.computed(
		'libYearDim', 'libDistrictDimension', 'year',
		function() {
			const yearDim = this.get('libYearDim');
			const districtDim = this.get('libDistrictDimension');
			const year = this.get('year');
			let group, data;
			
			yearDim.filter(year);
			group = districtDim.group(function(d) { return d; });
			data = group.reduceSum( function(d) { 
				return d3.round(d.attributes.visits / d.attributes.loans, 1);
			});

			return data.all();
	}),

	yearData: Ember.computed(
		'libYearDim', 'zoneCode', 
		function() {
			const yearDim = this.get('libYearDim');
			let data;

			data = yearDim.group().reduceSum( function(d) { 
export default Ember.Component.extend({
    tagName: 'div',
    classNames: ['js-story story'],
    classNameBindings: ['color', 'width', 'height'],
    attributeBindings: ['data-ss-colspan', 'data-id', 'data-canvas-order-index'],
    
    isDraggingStory: false,
    
    'data-id':Ember.computed.alias('target.storyModel.id'),
    'data-canvas-order-index':Ember.computed.alias('target.storyModel.canvasOrderIndex'),
    
    storyModel: Ember.computed.alias('target.storyModel'),
    
    configFields: Ember.computed({
        get() {
            return (!Ember.isEmpty(this.get('storyModel.config')) ? this.get('storyModel.config').copy() : []);
        }
    }),
    
    onFieldsChanged: function() {
        this.set('storyModel.config',this.get('configFields'));
    }.observes('configFields', 'configFields.@each.value'),
    
    didInsertElement: function () {
        // todo: ensure this is run minimal times throughout the entire app
        // possibly add to application route and ember.run once
        grunticon.embedSVG();
        this.setupDragEvents();
        this.set('action', 'onStoryLoaded');
        this.sendAction();
    },
Example #10
0
  days: Ember.computed.oneWay('model.days'),
  model: null,
  timeSlotHeight: null,
  timeSlots: Ember.computed.oneWay('model.timeSlots'),
  contentComponent: null,
  dayWidth: Ember.computed.oneWay('contentComponent.dayWidth'),
  referenceElement: Ember.computed.oneWay('contentComponent.element'),

  isTimerOn: false,
  timeInterval: null,

  startOfWeek: moment().startOf('isoWeek').day(),

  _dayStartingTime: Ember.computed('model.showAllHours', 'model.dayStartingTime', function () {
    return this.get('model.showAllHours') ? moment.duration(0) : this.get('model.dayStartingTime');
  }),
  _dayEndingTime: Ember.computed('model.showAllHours', 'model.dayEndingTime', function () {
    return this.get('model.showAllHours') ? moment.duration(1, 'day') : this.get('model.dayEndingTime');
  }),
  now: moment(),
  currentDayNumber: Ember.computed('now', function () {
    const nowDayNumber = this.get('now').day();
    const startOfWeek = this.get('startOfWeek');

    return nowDayNumber === 0 ? startOfWeek : nowDayNumber - startOfWeek;
  }),
  nowTime: Ember.computed('now', function () {
    return this.get('now').format(this.get('nowTimeLabelFormat'));
  }),
  computedNowTime: computedDuration('nowTime'),
  /**
    The url for the entity, e.g. /posts or /api/v1/posts

    defaults to config.APP.API_HOST/config.APP.API_PATH/pluralize(type) if
    not set explicitly.

    @property url
    @type String
    @required
  */
  url: Ember.computed('type', {
    get() {
      const config = getOwner(this).resolveRegistration('config:environment');
      const enclosingSlashes = /^\/|\/$/g;
      const host = config.APP.API_HOST.replace(enclosingSlashes, '');
      const path = config.APP.API_PATH.replace(enclosingSlashes, '');
      return [host, path, pluralize(this.get('type'))].join('/');
    }
  }),

  /**
    @method init
  */
  init() {
    this._super(...arguments);
    let fetchjax = new FetchOrAjax({
      useAjax: this.get('useAjax'),
      ajax: Ember.$.ajax,
      promise: Ember.RSVP.Promise,
      deserialize: this.deserialize.bind(this)
Example #12
0
import _ from 'lodash';

export default Ember.Controller.extend({
  mailboxtree: Ember.computed('model', function() {
    // build index by id
    let index = {};
    _.each(this.model, function(mbox) {
      mbox.children = [];
      index[mbox.id] = mbox;
    });

    // build mailbox tree structure
    let root = [];
    _.each(this.model, function(mbox) {
      if (mbox.parentId) {
        if (index[mbox.parentId]) {
          index[mbox.parentId].children.push(mbox);
        }
        else {
          // parent node was probably filtered by server so let's just ignore its childs
          // throw new Error("Invalid mailbox parentId reference: " + mbox.parentId);
        }
      }
      else {
        root.push(mbox);
      }
    });

    return root;
  })
});
Example #13
0
import Ember from 'ember';

export default Ember.Component.extend({
    tagName: 'form',
    classNames: ['login_form'],
    username: '',
    password: '',
    isSubmitted: false,

    usernameError: Ember.computed('username', 'isSubmitted', function() {
        return this.get('isSubmitted') && this.get('username.length') < 3;
    }),

    passwordError: Ember.computed('password', 'isSubmitted', function() {
        return this.get('isSubmitted') && this.get('password.length') < 3;
    }),

    isSubmitDisabled: Ember.computed('username', 'password', function() {
        return this.get('username.length') < 3 || this.get('password.length') < 3;
    }),    

    submit(event) {
        event.preventDefault();
        this.set('isSubmitted', true);
        if (this.get('isSubmitDisabled')) {
            return;
        }
        this.sendAction('onLogin', this.get('username'),this.get('password'));
    }
});
Example #14
0
});

export default DS.Model.extend(Validations, {
  email: DS.attr('string'),
  isAdmin: DS.attr('boolean'),
  firstName: DS.attr('string'),
  lastName: DS.attr('string'),
  password: DS.attr('string'),
  createdAt: DS.attr('string'),
  expirationDate: DS.attr('number'),
  credit: DS.attr('string'),
  ldapUser: DS.attr('boolean'),
  machines: DS.hasMany('machine'),

  expirationDateInMs: Ember.computed('expirationDate', function() {
    return this.get('expirationDate') * 1000;
  }),

  fullName: function() {
    if (this.get('firstName') && this.get('lastName')) {
      return `${this.get('firstName')} ${this.get('lastName')}`;
    }
    let email = this.get('email');
    return email ? email : 'Unknown user';
  }.property('firstName', 'lastName'),

  isNotAdmin: function() {
    return !this.get('isAdmin');
  }.property(),

  type: Ember.computed('isAdmin', 'isAdmin', function() {
Example #15
0
import Ember from 'ember';

export default Ember.Service.extend({
  votes: [],
  adminShowing: false,

  totalVote: Ember.computed('votes.length', function() {
    var totalVote = 0;
    for (let question of this.get('votes')){
      totalVote += 1;
    }
    return totalVote;

  }),
  add(question) {
    this.get('votes').pushObject(question);
  },
  testAdmin(){
      var adminShowing = this.get('adminShowing');
      if(adminShowing === true){
        this.set('adminShowing', false);
      } else if (adminShowing !== true) {
        this.set('adminShowing', true);
      }
    console.log(this.get('isAdminShow'));
  }

});
Example #16
0
import Ember from 'ember';

export default Ember.Route.extend({
  auth: Ember.inject.service(),
  isStudent: Ember.computed('profile', function() {
    if (this.get('profile.level')===1) {
      return false;
    } else {
      return true;
    }
  }),

  isNovice: Ember.computed('profile', function() {
    if ('profile.level'=== 2) {
      return true;
    } else {
      return false;
    }
  }),


  model () {
    return this.get('store').findAll('profile');
  },

  actions: {

    editName (profile) {
      this.transitionTo('profiles/edit', profile);
    },
import Ember from 'ember';

export default Ember.Component.extend({
  watchedQuestions: Ember.inject.service(),
  inWatched: Ember.computed('watchedQuestions.questions.[]', function() {
    return this.get('watchedQuestions').includes(this);
  }),


  actions: {
    update(question, params) {
      this.sendAction('update', question, params);
    },
    addToWatched(question) {
      this.get('watchedQuestions').add(question);
    },
  }
});
Example #18
0
import Ember from 'ember';
import DS from 'ember-data';

export default DS.Model.extend({
  email: DS.attr('string'),

  isValid: Ember.computed.match('email', /^.+@.+\..+$/),
  isNotValid: Ember.computed.not('isValid'),
  actualEmailAddress: Ember.computed('email', function () {
    console.log('actualEmailAddress function is called: ', this.get('email'));
  }),

  emailAddressChanged: Ember.observer('email', function() {
    console.log('observer is called', this.get('email'));
  }),

});
Example #19
0
import DS from 'ember-data';
import Ember from 'ember';

export default DS.Model.extend({
  title: DS.attr('string'),
  description: DS.attr('string'),
  company: DS.attr({'defaultValue': () => {return {}; } }),
  link: DS.attr('string'),
  tags: DS.attr({'defaultValue': () => [] }),
  how_to_apply: DS.attr('string'),
  published_at: DS.attr('date'),
  salary: DS.attr('string'),
  excerpt: Ember.computed('description', function(){
    let exp = new RegExp('.*');
    return exp.exec(this.get('description'))[0];
  }),
  isValid: Ember.computed('title', 'description','company.name', 'company.link', 'contactEmail', function() {
    var requiredFields = ['title', 'description', 'company.name', 'company.link', 'contactEmail'];
    return requiredFields.every((key) => !Ember.isEmpty(this.get(key)));
  }),
  isPublished: Ember.computed.notEmpty('published_at'),
  contactEmail: Ember.computed.alias('contact_email'),
  contact_email: DS.attr('string')
});
Example #20
0
import {sanitizeUrl}   from '../utils/sanitize-url';
import Phrases         from '../utils/phrases';

const {Component} = Ember;

export default Component.extend({
    store: Ember.inject.service(),
    classNames: ['gh-add-blog'],

    /**
     * A boolean value that is true if any errors are present
     */
    hasError: Ember.computed('isIdentificationInvalid', 'isUrlInvalid', 'isPasswordInvalid', {
        get() {
            let identification = this.get('isIdentificationInvalid');
            let url = this.get('isUrlInvalid');
            let password = this.get('isPasswordInvalid');
            return (identification || url || password);
        }
    }),

    /**
     * Validates that the passed url is actually a Ghost login page,
     * displaying errors if it isn't.
     *
     * @param url - Url to checl
     * @returns {Promise}
     */
    _validateUrlIsGhost(url = '') {
        return getIsGhost(url)
            .then((is) => {
                this.set('isUrlInvalid', !is);
import Ember from 'ember';

export default Ember.Component.extend({
	query: '',
	filter: Ember.computed(function(){
		if(window.location.pathname == "/results/players"){
			return 'players';
		}
		else{
			return 'events';
		}
	}),
	isEvent: Ember.computed.equal('filter', 'events'),
	isAdmin: false,
	name: Ember.computed(function(){
		var mod = this;
		$.ajax({
		      type: 'GET',
		      url: '/api/me'
		 }).then(function(response){
		 	mod.set('name', `${response.first_name} ${response.last_name}`);
		 	if(response.admin){
		 		mod.set('isAdmin', true);
		 	}
		 });
	}),

	loggedIn: Ember.computed.bool('name'),

  	actions:{
  		logout(){
Example #22
0
	sections: Ember.computed('model.lines.@each', 'reset', function () {
		var sections = [];
		var _this = this;
		if (this.get('model.lines')) {
			this.get('model.lines').forEach(function (line) {
				line.get('avalStatuses').forEach(function (avalStatus) {
					var electoralSection = avalStatus.get('electoralSection');
					var g = sections.findBy('id', electoralSection.get('id'));
					if (!g) {
						g = Ember.Object.create({
							id: avalStatus.get('electoralSection').get('id'), 
							electoralSection: electoralSection, 
							townStatuses: [],
							total: 0,
							lineAvalCount: [
								Ember.Object.create({order: 0, need: 0, entry: 0, name: 'Lista 2'}), 
								Ember.Object.create({order: 1, need: 0, entry: 0, name: 'Lista 1'}), 
								Ember.Object.create({order: 2, need: 0, entry: 0, name: 'Lista 10'}), 
								Ember.Object.create({order: 3, need: 0, entry: 0, name: 'Lista 4'}),
								Ember.Object.create({order: 4, need: 0, entry: 0, name: 'Lista 6'}),
								Ember.Object.create({order: 5, need: 0, entry: 0, name: 'Lista 8'}),
								Ember.Object.create({order: 6, need: 0, entry: 0, name: 'Lista 34'}),
								Ember.Object.create({order: 7, need: 0, entry: 0, name: 'Lista 36'}),
								Ember.Object.create({order: 8, need: 0, entry: 0, name: 'Lista 38'}),
							]
						});
						sections.pushObject(g);
					}
					var t = g.get('townStatuses').findBy('name', avalStatus.get('townName'));
					if (!t) {
						t = Ember.Object.create({
							name: avalStatus.get('townName'), 
							lineStatuses: [
								Ember.Object.create({order: 0, need: 0, entry: 0, name: 'Lista 2', type: 0}), 
								Ember.Object.create({order: 1, need: 0, entry: 0, name: 'Lista 1', type: 1}), 
								Ember.Object.create({order: 2, need: 0, entry: 0, name: 'Lista 10', type: 1}), 
								Ember.Object.create({order: 3, need: 0, entry: 0, name: 'Lista 4', type: 2}),
								Ember.Object.create({order: 4, need: 0, entry: 0, name: 'Lista 6', type: 2}),
								Ember.Object.create({order: 5, need: 0, entry: 0, name: 'Lista 8', type: 2}),
								Ember.Object.create({order: 6, need: 0, entry: 0, name: 'Lista 34', type: 2}),
								Ember.Object.create({order: 7, need: 0, entry: 0, name: 'Lista 36', type: 2}),
								Ember.Object.create({order: 8, need: 0, entry: 0, name: 'Lista 38', type: 2}),
							],
							total: 0,
							need: avalStatus.get('avalesNeed'),
							needDouble: parseInt(avalStatus.get('avalesNeed')) * 2,
						});
						g.get('townStatuses').pushObject(t);
					}
					var l = t.get('lineStatuses').findBy('order', line.get('avalesNeed'));
					var lt = g.get('lineAvalCount').findBy('order', line.get('avalesNeed'));
					lt.set('entry', lt.get('entry') + parseInt(avalStatus.get('avalesEntry')))
					t.set('total', t.get('total') + parseInt(avalStatus.get('avalesEntry')));
					g.set('total', g.get('total') + parseInt(avalStatus.get('avalesEntry')));
					l.set('need', avalStatus.get('avalesNeed'));
					l.set('entry', avalStatus.get('avalesEntry'));
					//l.set('name', line.get('number'));
					l.set('type', line.get('avalesEntry'));
					_this.set('linesName', t.get('lineStatuses'));

					var type = _this.get('typeList').findBy('id', line.get('avalesEntry'));
					if (type.id == 2) {
						if ((l.get('need') * type.multiplier) < 200) {
							if (l.get('entry') >= (l.get('need') * type.multiplier)) {
								l.set('valid', true);
							}
						} else {
							if (parseInt(l.get('entry')) >= 200) {
								l.set('valid', true);
							}
						}
					} else {
						if (l.get('entry') >= (l.get('need') * type.multiplier)) {
							l.set('valid', true);
						}						
					}					
				}, this);
			});
		}
		return sections;
	}),	
Example #23
0
 *   loginAction=loginAction
 * }}
 * ```
 *
 * @class osf-navbar
 */
export default Ember.Component.extend(hostAppName, {
    layout,
    session: Ember.inject.service(),
    osfServices: osfServices,
    serviceLinks: serviceLinks,
    host: config.OSF.url,
    currentService: Ember.computed('hostAppName', function() { // Pulls current service name from consuming service's config file
        let appName = this.get('hostAppName') || 'Home';
        if (appName === 'Dummy App') {
            appName = 'Home';
        }
        return appName.toUpperCase();
    }),
    currentServiceLink: Ember.computed('serviceLinks', 'currentService', function() {
        const serviceMapping = {
            HOME: 'osfHome',
            PREPRINTS: 'preprintsHome',
            REGISTRIES: 'registriesHome',
            MEETINGS: 'meetingsHome'
        };
        const service = this.get('currentService');
        return this.get('serviceLinks')[serviceMapping[service]];
    }),
    showSearch: false,
    actions: {
import Ember from 'ember';
import UIComponent from './ui-component';
import layout from '../templates/components/ui-button-group';

export default UIComponent.extend({
  layout,

  buttons: Ember.computed(function() {
    return Ember.A([]);
  }),

  firstChild: Ember.computed.alias('buttons.firstObject'),
  lastChild: Ember.computed.alias('buttons.lastObject'),

  actions: {
    registerButton(button) {
      this.get('buttons').pushObject(button);
    }
  }
});
Example #25
0
   *
   */

  classNames: ['event-list-item'],

  /**
   * Track user's voting status
   * @property voteValue
   * @type {Number}
   * @default 0
   */
  voteValue: 0,

  isUpvoted: Ember.computed('voteValue', {
    get: function() {
      return this.get('voteValue') === 1;
    }
  }),

  isDownvoted: Ember.computed('voteValue', {
    get: function() {
      return this.get('voteValue') === -1;
    }
  }),

  title: Ember.computed.alias('event.title'),
  score: Ember.computed.alias('event.totalvotes'),

  socket: Ember.inject.service(),

  actions: {
import Ember from 'ember';

export default Ember.Component.extend({

  title: Ember.computed('deployment.name', function() {
      return "Continue QCI Deployment - " + this.get('deployment.name');
  }),

  actions: {
    installDeployment() {
      this.set('openModal', false);
      this.sendAction('installDeployment', this.get('deployment'));
    },

    cancelModal() {
      this.set('openModal', false);
    }
  }

});
Example #27
0
/* global marked:false */

import Ember from 'ember';
import DS from 'ember-data';

export default DS.Model.extend({
  announcements: DS.hasMany('announcement', { async: true }),
  bannerUrl: DS.attr('string'),
  group: DS.belongsTo('group', { async: true }),
  name: DS.attr('string'),
  publishedAt: DS.attr('date'),
  serviceOrder: DS.attr('string'),
  sermon: DS.belongsTo("sermon", { async: true }),
  sermonAudioUrl: Ember.computed("sermon.audioUrl", function() {
    return this.get("sermon.audioUrl");
  }),
  serviceOrderHtml: Ember.computed("serviceOrder", function() {
    return markedOrEmptyString(this.get("serviceOrder"));
  }),
  sermonName: Ember.computed("sermon.name", function() {
    return this.get("sermon.name");
  }),
  sermonNotes: Ember.computed("sermon.notes", function() {
    return this.get("sermon.notes");
  }),
  sortedAnnouncements: Ember.computed('announcements.@each.position',
                                      function() {
    return this.get('announcements').sortBy('position');
  }),
  unsavedAnnouncements: Ember.computed('sortedAnnouncements.@each.hasDirtyAttributes',
                                       function() {
Example #28
0
import DS from 'ember-data';
import Ember from 'ember';
var model = DS.Model.extend({
	answer: null,
	text: DS.attr('string'),
	question: DS.belongsTo('question'),
	style: DS.attr('string'),
	ord: DS.attr('number'),
	color: DS.attr('string'),
	index: DS.attr('number'),
	percent: DS.attr('number'),
	isSelected: Ember.computed('answer',function(){
		return this.get('answer')===this.get('id');
	})

});
Ember.Inflector.inflector.uncountable('option');

export default model;
Example #29
0
import Ember from 'ember';
var LabsController = Ember.Controller.extend(Ember.Evented, {
    needs: ['feature'],

    uploadButtonText: 'Import',
    importErrors: '',
    labsJSON: Ember.computed('model.labs', function () {
        return JSON.parse(this.get('model.labs') || {});
    }),

    saveLabs: function (optionName, optionValue) {
        var self = this,
            labsJSON =  this.get('labsJSON');

        // Set new value in the JSON object
        labsJSON[optionName] = optionValue;

        this.set('model.labs', JSON.stringify(labsJSON));

        this.get('model').save().catch(function (errors) {
            self.showErrors(errors);
            self.get('model').rollback();
        });
    },

    codeUIFlag: Ember.computed.alias('config.codeInjectionUI'),

    useCodeInjectionUI: Ember.computed('controllers.feature.codeInjectionUI', function (key, value) {
        // setter
        if (arguments.length > 1) {
            this.saveLabs('codeInjectionUI', value);
        if(typeof this.attrs.update === 'function'){
            this.attrs.update(this.get('value'));
        }
    },
    _removeValue(value){
        this.get('value').removeObject(value);
        if(typeof this.attrs.update === 'function'){
            this.attrs.update(this.get('value'));
        }
    },
    init(){
        this._super(...arguments);
        //if value do not be passed to component
        if(this.value === undefined){
            this.set('value', Ember.A());
        }

        for (var i = this.value.length - 1; i >= 0; i--) {
            this.value.set(String(i), String(this.value[i]));
        };
    },
    hiddenValue: Ember.computed('value', {
        get(){
            if(Ember.isArray(this.value)){
                return this.value.join(',');
            }else{
                return '';
            }
        }
    })
});