fixed modal dialog.

pull/2/head
kay.one 12 years ago
parent 6a7e346bf2
commit 90332b8f01

1
.gitignore vendored

@ -131,3 +131,4 @@ NzbDrone.Web/cassette-cache/*
*.eq
NzbDrone.Web/_backboneApp/.idea/workspace.xml
*/.idea/workspace.xml
*workspace.xml

@ -1,4 +1,4 @@
define(['app', 'AddSeries/AddSeriesLayout','Series/SeriesCollectionView'], function () {
define(['app', 'Shared/ModalRegion', 'AddSeries/AddSeriesLayout','Series/SeriesCollectionView', 'Shared/NotificationView'], function (app, modalRegion) {
var controller = Backbone.Marionette.Controller.extend({
@ -32,6 +32,23 @@
}
});
NzbDrone.addInitializer(function () {
NzbDrone.addRegions({modalRegion: modalRegion});
NzbDrone.vent.on(NzbDrone.Events.OpenModalDialog, function (options) {
console.log('opening modal dialog ' + options.view.template );
NzbDrone.modalRegion.show(options.view);
});
NzbDrone.vent.on(NzbDrone.Events.CloseModalDialog, function () {
console.log('closing modal dialog');
NzbDrone.modalRegion.close();
});
});
return new controller();
});

@ -33,13 +33,17 @@ define([
editSeries: function () {
var view = new NzbDrone.Series.EditSeriesView({ model: this.model});
view.on('saved', this.render, this);
NzbDrone.modalRegion.show(view);
NzbDrone.vent.trigger(NzbDrone.Events.OpenModalDialog, {
view: view
});
},
removeSeries: function () {
var view = new NzbDrone.Series.DeleteSeriesView({ model: this.model });
NzbDrone.modalRegion.show(view);
NzbDrone.vent.trigger(NzbDrone.Events.OpenModalDialog, {
view: view
});
}
});
});

@ -1,5 +1,5 @@
define('modalRegion', ['Marionette'], function (Marionette) {
return Marionette.Region.extend({
define(['app'], function () {
return Backbone.Marionette.Region.extend({
el: "#modal-region",
constructor: function () {

@ -6,6 +6,13 @@
initialize: function () {
/* var model = new NzbDrone.Shared.NotificationModel();
model.set('title','test notification');
model.set('message','test message');
model.set('level', 'error');
this.push(model);
*/
var self = this;
window.onerror = function (msg, url, line) {

@ -29,6 +29,7 @@
});
NzbDrone.addInitializer(function () {
console.log('initializing notification view');
NzbDrone.notificationRegion.show(new collectionView());
});

@ -27,12 +27,6 @@
});
define('app', function () {
//window.$ = jquery;
//window.jquery = jquery;
//window.Backbone.ModelBinder = modelBinder;
//window.Backbone.Marionette = marionette;
//window.Handlebars = handlebars;
window.NzbDrone = new Backbone.Marionette.Application();
window.NzbDrone.Series = {};
@ -45,6 +39,11 @@ define('app', function () {
window.NzbDrone.Quality = {};
window.NzbDrone.Shared = {};
window.NzbDrone.Events = {
OpenModalDialog :'openModal',
CloseModalDialog : 'closeModal'
},
window.NzbDrone.Constants = {
ApiRoot: '/api'
};
@ -68,7 +67,6 @@ define('app', function () {
titleRegion: '#title-region',
mainRegion: '#main-region',
notificationRegion: '#notification-region',
modalRegion: '#modal-region'
});
});

Loading…
Cancel
Save