{"size": 981, "ext": "js", "max_stars_repo_path": "www/public/js/app/controllers/modal_controller.js", "max_stars_repo_name": "AnthonyBobsin/apollo", "max_stars_repo_stars_event_min_datetime": "2015-11-22T20:08:35.000Z", "max_stars_repo_stars_event_max_datetime": "2017-02-08T17:21:38.000Z", "max_issues_repo_path": "www/public/js/app/controllers/modal_controller.js", "max_issues_repo_name": "AnthonyBobsin/apollo", "max_issues_repo_issues_event_min_datetime": "2015-07-24T19:20:04.000Z", "max_issues_repo_issues_event_max_datetime": "2015-07-28T18:01:52.000Z", "max_forks_repo_path": "www/public/js/app/controllers/modal_controller.js", "max_forks_repo_name": "adparlor/conduit", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 15, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 28.0285714286, "max_line_length": 87, "alphanum_fraction": 0.6636085627}

define(['JSONModalView', 'HelperModalView'], function(JSONModalView, HelperModalView) {

  var ModalController = Backbone.Marionette.Object.extend({
    initialize: function(options) {
      this.options = options

      this.listenTo(this.options.vent, "openJSONModal", this.openJSONModal)
      this.listenTo(this.options.vent, "openHelperModal", this.openHelperModal)
    },

    // TODO: Close all other modals before opening this one.
    openHelperModal: function() {
      var helperModalView = new HelperModalView({
        vent: this.options.vent
      })

      this.options.modalRegion.show(helperModalView)
      $('#helperModal').modal({})
    },

    openJSONModal: function(header, json) {
      var jsonModalView = new JSONModalView({
        vent: this.options.vent,
        header: header,
        jsonToDisplay: JSON.parse(json)
      })

      this.options.modalRegion.show(jsonModalView)
      $('#jsonModal').modal({})
    }
  })

  return ModalController
})