1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Movies can now be edited, even from the detail view. Fixes #42

This commit is contained in:
Leonardo Galli 2017-01-08 10:58:51 +01:00
parent 07d2f5b6a0
commit 9376c02158
7 changed files with 165 additions and 6 deletions

View File

@ -42,7 +42,7 @@ module.exports = Marionette.Layout.extend({
events : { events : {
'click .x-episode-file-editor' : '_openEpisodeFileEditor', 'click .x-episode-file-editor' : '_openEpisodeFileEditor',
'click .x-monitored' : '_toggleMonitored', 'click .x-monitored' : '_toggleMonitored',
'click .x-edit' : '_editMovies', 'click .x-edit' : '_editMovie',
'click .x-refresh' : '_refreshMovies', 'click .x-refresh' : '_refreshMovies',
'click .x-rename' : '_renameMovies', 'click .x-rename' : '_renameMovies',
'click .x-search' : '_moviesSearch', 'click .x-search' : '_moviesSearch',
@ -167,8 +167,8 @@ module.exports = Marionette.Layout.extend({
} }
}, },
_editMovies : function() { _editMovie : function() {
vent.trigger(vent.Commands.EditMoviesCommand, { movie : this.model }); vent.trigger(vent.Commands.EditMovieCommand, { movie : this.model });
}, },
_refreshMovies : function() { _refreshMovies : function() {

View File

@ -0,0 +1,97 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{{title}}</h3>
</div>
<div class="modal-body edit-series-modal">
<div class="row">
<div class="col-sm-3 hidden-xs">
{{poster}}
</div>
<div class="col-sm-9">
<div class="form-horizontal">
<div class="form-group">
<label class="col-sm-4 control-label">Monitored</label>
<div class="col-sm-8">
<div class="input-group">
<label class="checkbox toggle well">
<input type="checkbox" name="monitored"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/>
</label>
<span class="help-inline-checkbox">
<i class="icon-sonarr-form-info" title="Should Radarr download the movie?"/>
</span>
</div>
</div>
</div>
<!--<div class="form-group">
<label class="col-sm-4 control-label">Use Season Folder</label>
<div class="col-sm-8">
<div class="input-group">
<label class="checkbox toggle well">
<input type="checkbox" name="seasonFolder"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/>
</label>
<span class="help-inline-checkbox">
<i class="icon-sonarr-form-info" title="Should downloaded episodes be stored in season folders?"/>
</span>
</div>
</div>
</div>-->
<div class="form-group">
<label class="col-sm-4 control-label">Profile</label>
<div class="col-sm-4">
<select class="form-control x-profile" id="inputProfile" name="profileId">
{{#each profiles.models}}
<option value="{{id}}">{{attributes.name}}</option>
{{/each}}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Path</label>
<div class="col-sm-6">
<input type="text" class="form-control x-path" placeholder="Path" name="path">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Tags</label>
<div class="col-sm-6">
<input type="text" class="form-control x-tags">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-danger pull-left x-remove">Delete</button>
<span class="indicator x-indicator"><i class="icon-sonarr-spinner fa-spin"></i></span>
<button class="btn" data-dismiss="modal">Cancel</button>
<button class="btn btn-primary x-save">Save</button>
</div>
</div>

View File

@ -0,0 +1,54 @@
var vent = require('vent');
var Marionette = require('marionette');
var Profiles = require('../../Profile/ProfileCollection');
var AsModelBoundView = require('../../Mixins/AsModelBoundView');
var AsValidatedView = require('../../Mixins/AsValidatedView');
var AsEditModalView = require('../../Mixins/AsEditModalView');
require('../../Mixins/TagInput');
require('../../Mixins/FileBrowser');
var view = Marionette.ItemView.extend({
template : 'Movies/Edit/EditMovieTemplate',
ui : {
profile : '.x-profile',
path : '.x-path',
tags : '.x-tags'
},
events : {
'click .x-remove' : '_removeSeries'
},
initialize : function() {
this.model.set('profiles', Profiles);
},
onRender : function() {
this.ui.path.fileBrowser();
this.ui.tags.tagInput({
model : this.model,
property : 'tags'
});
},
_onBeforeSave : function() {
var profileId = this.ui.profile.val();
this.model.set({ profileId : profileId });
},
_onAfterSave : function() {
this.trigger('saved');
vent.trigger(vent.Commands.CloseModalCommand);
},
_removeSeries : function() {
vent.trigger(vent.Commands.DeleteSeriesCommand, { series : this.model });
}
});
AsModelBoundView.call(view);
AsValidatedView.call(view);
AsEditModalView.call(view);
module.exports = view;

View File

@ -23,7 +23,7 @@ module.exports = Marionette.ItemView.extend({
}, },
_editSeries : function() { _editSeries : function() {
vent.trigger(vent.Commands.EditSeriesCommand, { series : this.model }); vent.trigger(vent.Commands.EditMovieCommand, { movie : this.model });
}, },
_refreshSeries : function() { _refreshSeries : function() {

View File

@ -14,8 +14,8 @@
</div> </div>
<div class="col-md-2 col-xs-2"> <div class="col-md-2 col-xs-2">
<div class="pull-right series-overview-list-actions"> <div class="pull-right series-overview-list-actions">
<i class="icon-sonarr-refresh x-refresh" title="Update series info and scan disk"/> <i class="icon-sonarr-refresh x-refresh" title="Update movie info and scan disk"/>
<i class="icon-sonarr-edit x-edit" title="Edit Series"/> <i class="icon-sonarr-edit x-edit" title="Edit Movie"/>
</div> </div>
</div> </div>
</div> </div>

View File

@ -2,6 +2,7 @@ var vent = require('vent');
var AppLayout = require('../../AppLayout'); var AppLayout = require('../../AppLayout');
var Marionette = require('marionette'); var Marionette = require('marionette');
var EditSeriesView = require('../../Series/Edit/EditSeriesView'); var EditSeriesView = require('../../Series/Edit/EditSeriesView');
var EditMovieView = require('../../Movies/Edit/EditMovieView');
var DeleteSeriesView = require('../../Series/Delete/DeleteSeriesView'); var DeleteSeriesView = require('../../Series/Delete/DeleteSeriesView');
var EpisodeDetailsLayout = require('../../Episode/EpisodeDetailsLayout'); var EpisodeDetailsLayout = require('../../Episode/EpisodeDetailsLayout');
var HistoryDetailsLayout = require('../../Activity/History/Details/HistoryDetailsLayout'); 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.OpenModal2Command, this._openModal2, this);
vent.on(vent.Commands.CloseModal2Command, this._closeModal2, this); vent.on(vent.Commands.CloseModal2Command, this._closeModal2, this);
vent.on(vent.Commands.EditSeriesCommand, this._editSeries, 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.DeleteSeriesCommand, this._deleteSeries, this);
vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this); vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this);
vent.on(vent.Commands.ShowMovieDetails, this._showMovie, this); vent.on(vent.Commands.ShowMovieDetails, this._showMovie, this);
@ -49,6 +51,11 @@ module.exports = Marionette.AppRouter.extend({
AppLayout.modalRegion.show(view); AppLayout.modalRegion.show(view);
}, },
_editMovie : function(options) {
var view = new EditMovieView({ model : options.movie });
AppLayout.modalRegion.show(view);
},
_deleteSeries : function(options) { _deleteSeries : function(options) {
var view = new DeleteSeriesView({ model : options.series }); var view = new DeleteSeriesView({ model : options.series });
AppLayout.modalRegion.show(view); AppLayout.modalRegion.show(view);

View File

@ -12,6 +12,7 @@ vent.Events = {
vent.Commands = { vent.Commands = {
EditSeriesCommand : 'EditSeriesCommand', EditSeriesCommand : 'EditSeriesCommand',
EditMovieCommand : 'EditMovieCommand',
DeleteSeriesCommand : 'DeleteSeriesCommand', DeleteSeriesCommand : 'DeleteSeriesCommand',
OpenModalCommand : 'OpenModalCommand', OpenModalCommand : 'OpenModalCommand',
CloseModalCommand : 'CloseModalCommand', CloseModalCommand : 'CloseModalCommand',