Ejemplo n.º 1
0
   *
   * @property canCancel
   * @type {Boolean}
   */
  canCancel: alias('hasExistingDonationGoals'),

  /**
   * Indicates if the user can start editing a donation goal.
   *
   * This is possible if no other donation goal
   * is currently being added or edited.
   *
   * @property canEdit
   * @type {Boolean}
   */
  canEdit: not('_currentlyEditingDonationGoals'),

  /**
   * Indicates if there are existing donations goals for this project.
   *
   * @property hasExistingDonationGoals
   * @type {Boolean}
   */
  hasExistingDonationGoals: notEmpty('_existingDonationGoals'),

  _currentlyEditingDonationGoals: notEmpty('_editedDonationGoals'),
  _editedDonationGoals: filterBy('project.donationGoals', 'isEditing'),
  _existingDonationGoals: setDiff('project.donationGoals', '_newDonationGoals'),
  _newDonationGoals: filterBy('project.donationGoals', 'isNew')
});
  initialAnimation: true,
  reset: false,

  init() {
    this._super(...arguments);
    this.selectImage();
  },

  willDestroyElement() {
    let followOnTimer = get(this, 'followOnTimer');
    let resetTimer = get(this, 'resetTimer');
    run.cancel(followOnTimer);
    run.cancel(resetTimer);
  },

  availableImages: setDiff('images', 'currentImageArray'),

  currentImageArray: computed('currentImage', function() {
    let currentImage = get(this, 'currentImage');
    return [currentImage];
  }),

  selectImage() {
    let images = get(this, 'availableImages');
    let image = images[Math.floor(Math.random() * images.length)];
    let that = this;

    set(this, 'currentImage', image);
    let followOnTimer = run.later((function() {
      set(that, 'followOnAnimation', false);
    }), 500);