{"size": 1407, "ext": "js", "max_stars_repo_path": "library/Denkmal/library/Denkmal/Component/Event.js", "max_stars_repo_name": "kris-lab/denkmal.org", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "library/Denkmal/library/Denkmal/Component/Event.js", "max_issues_repo_name": "kris-lab/denkmal.org", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "library/Denkmal/library/Denkmal/Component/Event.js", "max_forks_repo_name": "kris-lab/denkmal.org", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.3181818182, "max_line_length": 107, "alphanum_fraction": 0.5828002843}
/**
 * @class Denkmal_Component_Event
 * @extends Denkmal_Component_Abstract
 */
var Denkmal_Component_Event = Denkmal_Component_Abstract.extend({

  /** @type String */
  _class: 'Denkmal_Component_Event',

  /** @type {Object} */
  venue: null,

  /** @type {Object} */
  event: null,

  /** @type {Boolean} */
  _detailsVisible: false,

  events: {
    'click .showDetails': function() {
      this.toggleDetails();
    }
  },

  /**
   * @param {Boolean} [state]
   */
  toggleDetails: function(state) {
    if ('undefined' === typeof state) {
      state = !this._detailsVisible;
    }
    if (this._detailsVisible === state) {
      return;
    }

    var $event = this.$('.event');
    var details = this.findChild('Denkmal_Component_EventDetails');

    $event.toggleClass('event-details-open', state);

    var done = new $.Deferred();
    done.resolve();

    if (details) {
      if (state) {
        details.$el.slideDown('fast');
      } else {
        details.$el.slideUp('fast');
      }
    } else if (state) {
      done = this.loadComponent('Denkmal_Component_EventDetails', {venue: this.venue, event: this.event}, {
        'success': function() {
          this.$el.hide().appendTo($event.parent()).slideDown('fast');
        }
      });
    }

    var self = this;
    done.done(function() {
      self.trigger('toggleDetails', state)
    });

    this._detailsVisible = state;
  }
});
