From 9376c0215837bf8539618f19e55a1ef2ac1a90cc Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sun, 8 Jan 2017 10:58:51 +0100 Subject: [PATCH] Movies can now be edited, even from the detail view. Fixes #42 --- src/UI/Movies/Details/MoviesDetailsLayout.js | 6 +- src/UI/Movies/Edit/EditMovieTemplate.hbs | 97 +++++++++++++++++++ src/UI/Movies/Edit/EditMovieView.js | 54 +++++++++++ src/UI/Movies/Index/MoviesIndexItemView.js | 2 +- .../SeriesOverviewItemViewTemplate.hbs | 4 +- src/UI/Shared/Modal/ModalController.js | 7 ++ src/UI/vent.js | 1 + 7 files changed, 165 insertions(+), 6 deletions(-) create mode 100644 src/UI/Movies/Edit/EditMovieTemplate.hbs create mode 100644 src/UI/Movies/Edit/EditMovieView.js diff --git a/src/UI/Movies/Details/MoviesDetailsLayout.js b/src/UI/Movies/Details/MoviesDetailsLayout.js index fc251a049..a38793aa4 100644 --- a/src/UI/Movies/Details/MoviesDetailsLayout.js +++ b/src/UI/Movies/Details/MoviesDetailsLayout.js @@ -42,7 +42,7 @@ module.exports = Marionette.Layout.extend({ events : { 'click .x-episode-file-editor' : '_openEpisodeFileEditor', 'click .x-monitored' : '_toggleMonitored', - 'click .x-edit' : '_editMovies', + 'click .x-edit' : '_editMovie', 'click .x-refresh' : '_refreshMovies', 'click .x-rename' : '_renameMovies', 'click .x-search' : '_moviesSearch', @@ -167,8 +167,8 @@ module.exports = Marionette.Layout.extend({ } }, - _editMovies : function() { - vent.trigger(vent.Commands.EditMoviesCommand, { movie : this.model }); + _editMovie : function() { + vent.trigger(vent.Commands.EditMovieCommand, { movie : this.model }); }, _refreshMovies : function() { diff --git a/src/UI/Movies/Edit/EditMovieTemplate.hbs b/src/UI/Movies/Edit/EditMovieTemplate.hbs new file mode 100644 index 000000000..c59520c7c --- /dev/null +++ b/src/UI/Movies/Edit/EditMovieTemplate.hbs @@ -0,0 +1,97 @@ +
- - + +
diff --git a/src/UI/Shared/Modal/ModalController.js b/src/UI/Shared/Modal/ModalController.js index 8339a69bc..9aaaeeeb1 100644 --- a/src/UI/Shared/Modal/ModalController.js +++ b/src/UI/Shared/Modal/ModalController.js @@ -2,6 +2,7 @@ var vent = require('vent'); var AppLayout = require('../../AppLayout'); var Marionette = require('marionette'); var EditSeriesView = require('../../Series/Edit/EditSeriesView'); +var EditMovieView = require('../../Movies/Edit/EditMovieView'); var DeleteSeriesView = require('../../Series/Delete/DeleteSeriesView'); var EpisodeDetailsLayout = require('../../Episode/EpisodeDetailsLayout'); var HistoryDetailsLayout = require('../../Activity/History/Details/HistoryDetailsLayout'); @@ -17,6 +18,7 @@ module.exports = Marionette.AppRouter.extend({ vent.on(vent.Commands.OpenModal2Command, this._openModal2, this); vent.on(vent.Commands.CloseModal2Command, this._closeModal2, this); vent.on(vent.Commands.EditSeriesCommand, this._editSeries, this); + vent.on(vent.Commands.EditMovieCommand, this._editMovie, this); vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this); vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this); vent.on(vent.Commands.ShowMovieDetails, this._showMovie, this); @@ -49,6 +51,11 @@ module.exports = Marionette.AppRouter.extend({ AppLayout.modalRegion.show(view); }, + _editMovie : function(options) { + var view = new EditMovieView({ model : options.movie }); + AppLayout.modalRegion.show(view); + }, + _deleteSeries : function(options) { var view = new DeleteSeriesView({ model : options.series }); AppLayout.modalRegion.show(view); diff --git a/src/UI/vent.js b/src/UI/vent.js index 3cd619eef..a623f2dbc 100644 --- a/src/UI/vent.js +++ b/src/UI/vent.js @@ -12,6 +12,7 @@ vent.Events = { vent.Commands = { EditSeriesCommand : 'EditSeriesCommand', + EditMovieCommand : 'EditMovieCommand', DeleteSeriesCommand : 'DeleteSeriesCommand', OpenModalCommand : 'OpenModalCommand', CloseModalCommand : 'CloseModalCommand',