Gitter migration: Point people to app.gitter.im (rollout pt. 1)
[gitter.git] / public / js / views / modals / login-view.js
blobb955e8401f1b102c704717ce196eb6664f6db5a4
1 'use strict';
3 var Marionette = require('backbone.marionette');
4 var ModalView = require('./modal');
5 var template = require('./tmpl/login-view.hbs');
7 require('@gitterhq/styleguide/css/components/buttons.css');
9 var View = Marionette.ItemView.extend({
10 template: template,
11 className: 'login-view',
13 initialize: function(options) {
14 options = options || {};
16 // these are mixpanel variables that we have to pass on
17 // TODO action and source can be probably remove since we aren't using mixpanel anymore
18 this.action = options.action || '';
19 this.source = options.source || '';
20 this.returnTo = options.returnTo || '';
21 if (options.returnTo === 'CURRENT') {
22 this.returnTo = window.location.pathname;
25 this.listenTo(this, 'menuItemClicked', this.menuItemClicked);
28 menuItemClicked: function(button) {
29 switch (button) {
30 case 'cancel':
31 this.dialog.hide();
32 break;
36 serializeData: function() {
37 return {
38 action: this.action,
39 source: this.source,
40 returnTo: this.returnTo
43 });
45 var Modal = ModalView.extend({
46 initialize: function(options) {
47 options = options || {};
48 options.modalClassVariation = 'modal--default__narrow';
50 ModalView.prototype.initialize.call(this, options);
51 this.view = new View(options);
53 });
55 module.exports = Modal;