First pass regarding delete.

pull/2/head
Leonardo Galli 8 years ago
parent f6a37186aa
commit 40809f1d91

@ -0,0 +1,50 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Delete {{title}}</h3>
</div>
<div class="modal-body delete-series-modal">
<div class="row">
<div class="col-sm-3 hidden-xs">
{{poster}}
</div>
<div class="col-sm-9">
<div class="form-horizontal">
<h3 class="path">{{path}}</h3>
<div class="form-group">
<label class="col-sm-4 control-label">Delete all files</label>
<div class="col-sm-8">
<div class="input-group">
<label class="checkbox toggle well">
<input type="checkbox" class="x-delete-files"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn slide-button btn-danger"/>
</label>
<span class="help-inline-checkbox">
<i class="icon-sonarr-form-info" title="Do you want to delete all files from disk?"/>
<i class="icon-sonarr-form-warning" title="This option is irreversible, use with extreme caution"/>
</span>
</div>
</div>
</div>
<div class="col-md-offset-1 col-md-5 delete-files-info x-delete-files-info">
{{#if hasFile}}1{{#else}}0{{/if}} movie file(s) will be deleted
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<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-danger x-confirm-delete">Delete</button>
</div>
</div>

@ -0,0 +1,41 @@
var vent = require('vent');
var Marionette = require('marionette');
module.exports = Marionette.ItemView.extend({
template : 'Movies/Delete/DeleteMovieTemplate',
events : {
'click .x-confirm-delete' : 'removeSeries',
'change .x-delete-files' : 'changeDeletedFiles'
},
ui : {
deleteFiles : '.x-delete-files',
deleteFilesInfo : '.x-delete-files-info',
indicator : '.x-indicator'
},
removeSeries : function() {
var self = this;
var deleteFiles = this.ui.deleteFiles.prop('checked');
this.ui.indicator.show();
this.model.destroy({
data : { 'deleteFiles' : deleteFiles },
wait : true
}).done(function() {
vent.trigger(vent.Events.SeriesDeleted, { series : self.model });
vent.trigger(vent.Commands.CloseModalCommand);
});
},
changeDeletedFiles : function() {
var deleteFiles = this.ui.deleteFiles.prop('checked');
if (deleteFiles) {
this.ui.deleteFilesInfo.show();
} else {
this.ui.deleteFilesInfo.hide();
}
}
});

@ -43,7 +43,7 @@ var view = Marionette.ItemView.extend({
},
_removeSeries : function() {
vent.trigger(vent.Commands.DeleteSeriesCommand, { series : this.model });
vent.trigger(vent.Commands.DeleteMovieCommand, { movie : this.model });
}
});

@ -3,7 +3,7 @@ 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 DeleteMovieView = require('../../Movies/Delete/DeleteMovieView');
var EpisodeDetailsLayout = require('../../Episode/EpisodeDetailsLayout');
var HistoryDetailsLayout = require('../../Activity/History/Details/HistoryDetailsLayout');
var LogDetailsView = require('../../System/Logs/Table/Details/LogDetailsView');
@ -22,7 +22,7 @@ module.exports = Marionette.AppRouter.extend({
vent.on(vent.Commands.EditSeriesCommand, this._editSeries, this);
vent.on(vent.Commands.EditMovieCommand, this._editMovie, this);
vent.on(vent.Commands.EditFileCommand, this._editFile, this);
vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this);
vent.on(vent.Commands.DeleteMovieCommand, this._deleteMovie, this);
vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this);
vent.on(vent.Commands.ShowMovieDetails, this._showMovie, this);
vent.on(vent.Commands.ShowHistoryDetails, this._showHistory, this);
@ -64,8 +64,8 @@ module.exports = Marionette.AppRouter.extend({
AppLayout.modalRegion.show(view);
},
_deleteSeries : function(options) {
var view = new DeleteSeriesView({ model : options.series });
_deleteMovie : function(options) {
var view = new DeleteMovieView({ model : options.movie });
AppLayout.modalRegion.show(view);
},

Loading…
Cancel
Save