From 437a28c10dfc892c1c2c82a36c3ace76eab63300 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Tue, 23 Jul 2013 21:16:52 -0700 Subject: [PATCH] Fixed issues with edit/delete series modal. --- UI/Calendar/CalendarView.js | 5 ++--- UI/Calendar/UpcomingItemView.js | 14 ++++++-------- UI/Cells/EpisodeTitleCell.js | 8 +++----- UI/Series/Edit/EditSeriesView.js | 6 ++---- UI/Series/Index/List/ItemView.js | 11 +++-------- UI/Series/Index/Posters/ItemView.js | 13 ++++--------- UI/Series/Index/Table/Row.js | 14 +++++--------- UI/Shared/Modal/Controller.js | 8 ++++---- 8 files changed, 29 insertions(+), 50 deletions(-) diff --git a/UI/Calendar/CalendarView.js b/UI/Calendar/CalendarView.js index 7539ef703..f6e897f05 100644 --- a/UI/Calendar/CalendarView.js +++ b/UI/Calendar/CalendarView.js @@ -7,7 +7,7 @@ define( 'moment', 'Calendar/Collection', 'fullcalendar' - ], function (App, Marionette, Moment, CalendarCollection, EpisodeLayout) { + ], function (App, Marionette, Moment, CalendarCollection) { var _instance; @@ -37,8 +37,7 @@ define( $(element).children('.fc-event-inner').addClass(event.statusLevel); }, eventClick : function (event) { - var view = new EpisodeLayout({ model: event.model }); - App.modalRegion.show(view); + App.vent.trigger(App.Commands.ShowEpisodeDetails, {episode: event.model}); } }); diff --git a/UI/Calendar/UpcomingItemView.js b/UI/Calendar/UpcomingItemView.js index 1e8a44780..3411ae859 100644 --- a/UI/Calendar/UpcomingItemView.js +++ b/UI/Calendar/UpcomingItemView.js @@ -3,20 +3,18 @@ define( [ 'app', - 'marionette', - 'Episode/Layout' - ], function (App, Marionette, EpisodeLayout) { + 'marionette' + ], function (App, Marionette) { return Marionette.ItemView.extend({ template: 'Calendar/UpcomingItemTemplate', tagName : 'div', - events : { - 'click .x-episode-title' : '_showEpisodeDetails' + events: { + 'click .x-episode-title': '_showEpisodeDetails' }, - _showEpisodeDetails : function() { - var view = new EpisodeLayout({ model: this.model }); - App.modalRegion.show(view); + _showEpisodeDetails: function () { + App.vent.trigger(App.Commands.ShowEpisodeDetails, {episode: this.model}); } }); }); diff --git a/UI/Cells/EpisodeTitleCell.js b/UI/Cells/EpisodeTitleCell.js index 9164b5bdc..c83447365 100644 --- a/UI/Cells/EpisodeTitleCell.js +++ b/UI/Cells/EpisodeTitleCell.js @@ -3,9 +3,8 @@ define( [ 'app', - 'Cells/NzbDroneCell', - 'Episode/Layout' - ], function (App, NzbDroneCell, EpisodeLayout) { + 'Cells/NzbDroneCell' + ], function (App, NzbDroneCell) { return NzbDroneCell.extend({ className: 'episode-title-cell', @@ -15,8 +14,7 @@ define( }, showDetails: function () { - var view = new EpisodeLayout({ model: this.cellValue }); - App.modalRegion.show(view); + App.vent.trigger(App.Commands.ShowEpisodeDetails, {episode: this.cellValue}); }, render: function () { diff --git a/UI/Series/Edit/EditSeriesView.js b/UI/Series/Edit/EditSeriesView.js index e7b72d88a..b00ec61c0 100644 --- a/UI/Series/Edit/EditSeriesView.js +++ b/UI/Series/Edit/EditSeriesView.js @@ -3,11 +3,10 @@ define( [ 'app', 'marionette', - 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection', 'Mixins/AsModelBoundView', 'Mixins/AutoComplete' - ], function (App, Marionette, DeleteSeriesView, QualityProfiles, AsModelBoundView) { + ], function (App, Marionette, QualityProfiles, AsModelBoundView) { var view = Marionette.ItemView.extend({ template: 'Series/Edit/EditSeriesTemplate', @@ -45,8 +44,7 @@ define( }, _removeSeries: function () { - var view = new DeleteSeriesView({ model: this.model }); - App.modalRegion.show(view); + App.vent.trigger(App.Commands.DeleteSeriesCommand, {series:this.model}); } }); diff --git a/UI/Series/Index/List/ItemView.js b/UI/Series/Index/List/ItemView.js index 6745de8eb..6cb776cab 100644 --- a/UI/Series/Index/List/ItemView.js +++ b/UI/Series/Index/List/ItemView.js @@ -4,10 +4,7 @@ define( [ 'app', 'marionette', - 'Series/Edit/EditSeriesView', - 'Series/Delete/DeleteSeriesView' - - ], function (App, Marionette, EditSeriesView, DeleteSeriesView) { + ], function (App, Marionette) { return Marionette.ItemView.extend({ template: 'Series/Index/List/ItemTemplate', @@ -21,13 +18,11 @@ define( }, editSeries: function () { - var view = new EditSeriesView({ model: this.model}); - App.modalRegion.show(view); + App.vent.trigger(App.Commands.EditSeriesCommand, {series: this.model}); }, removeSeries: function () { - var view = new DeleteSeriesView({ model: this.model }); - App.modalRegion.show(view); + App.vent.trigger(App.Commands.DeleteSeriesCommand, {series: this.model}); } }); }); diff --git a/UI/Series/Index/Posters/ItemView.js b/UI/Series/Index/Posters/ItemView.js index 153069633..1f474c8bc 100644 --- a/UI/Series/Index/Posters/ItemView.js +++ b/UI/Series/Index/Posters/ItemView.js @@ -3,11 +3,8 @@ define( [ 'app', - 'marionette', - 'Series/Edit/EditSeriesView', - 'Series/Delete/DeleteSeriesView' - - ], function (App, Marionette, EditSeriesView, DeleteSeriesView) { + 'marionette' + ], function (App, Marionette) { return Marionette.ItemView.extend({ tagName : 'li', @@ -28,13 +25,11 @@ define( editSeries: function () { - var view = new EditSeriesView({ model: this.model}); - App.modalRegion.show(view); + App.vent.trigger(App.Commands.EditSeriesCommand, {series:this.model}); }, removeSeries: function () { - var view = new DeleteSeriesView({ model: this.model }); - App.modalRegion.show(view); + App.vent.trigger(App.Commands.DeleteSeriesCommand, {series:this.model}); }, posterHoverAction: function () { diff --git a/UI/Series/Index/Table/Row.js b/UI/Series/Index/Table/Row.js index 3ab05e994..4e17c21c1 100644 --- a/UI/Series/Index/Table/Row.js +++ b/UI/Series/Index/Table/Row.js @@ -2,10 +2,8 @@ define( [ 'app', - 'backgrid', - 'Series/Edit/EditSeriesView', - 'Series/Delete/DeleteSeriesView' - ], function (App, Backgrid, EditSeriesView, DeleteSeriesView) { + 'backgrid' + ], function (App, Backgrid) { return Backgrid.Row.extend({ events: { 'click .x-edit' : 'editSeries', @@ -13,14 +11,12 @@ define( }, editSeries: function () { - var view = new EditSeriesView({ model: this.model}); - App.modalRegion.show(view); + App.vent.trigger(App.Commands.EditSeriesCommand, {series:this.model}); }, removeSeries: function () { - var view = new DeleteSeriesView({ model: this.model }); - App.modalRegion.show(view); - } + App.vent.trigger(App.Commands.DeleteSeriesCommand, {series:this.model}); + }, }); }); diff --git a/UI/Shared/Modal/Controller.js b/UI/Shared/Modal/Controller.js index 8779dd529..535a39b5e 100644 --- a/UI/Shared/Modal/Controller.js +++ b/UI/Shared/Modal/Controller.js @@ -19,21 +19,21 @@ define( }, _closeModal: function () { - App.vent.trigger(App.Commands.CloseModalCommand); + App.modalRegion.closeModal(); }, _editSeries: function (options) { - var view = new EditSeriesView({ model: options.model }); + var view = new EditSeriesView({ model: options.series }); App.modalRegion.show(view); }, _deleteSeries: function (options) { - var view = new DeleteSeriesView({ model: options.model }); + var view = new DeleteSeriesView({ model: options.series }); App.modalRegion.show(view); }, _showEpisode: function (options) { - var view = new EpisodeLayout({ model: options.model }); + var view = new EpisodeLayout({ model: options.episode }); App.modalRegion.show(view); } });