mirror of https://github.com/Radarr/Radarr
Display UI for MovieEditor, remove reference to SeasonPass
This commit is contained in:
parent
d006df8d7c
commit
cd4863b974
|
@ -4,8 +4,8 @@ module.exports = TemplatedCell.extend({
|
|||
className : 'series-title-cell',
|
||||
template : 'Cells/SeriesTitleTemplate',
|
||||
|
||||
render : function() {
|
||||
this.$el.html(this.model.get("movie").get("title")); //Hack, but somehow handlebar helper does not work.
|
||||
return this;
|
||||
}
|
||||
// render : function() {
|
||||
// this.$el.html(this.model.get("movie").get("title")); //Hack, but somehow handlebar helper does not work.
|
||||
// return this;
|
||||
// }
|
||||
});
|
||||
|
|
|
@ -11,6 +11,7 @@ var ReleaseLayout = require('./Release/ReleaseLayout');
|
|||
var SystemLayout = require('./System/SystemLayout');
|
||||
var SeasonPassLayout = require('./SeasonPass/SeasonPassLayout');
|
||||
var SeriesEditorLayout = require('./Series/Editor/SeriesEditorLayout');
|
||||
var MovieEditorLayout = require('./Movies/Editor/MovieEditorLayout');
|
||||
|
||||
module.exports = NzbDroneController.extend({
|
||||
addSeries : function(action) {
|
||||
|
@ -61,5 +62,10 @@ module.exports = NzbDroneController.extend({
|
|||
seriesEditor : function() {
|
||||
this.setTitle('Series Editor');
|
||||
this.showMainRegion(new SeriesEditorLayout());
|
||||
},
|
||||
|
||||
movieEditor : function() {
|
||||
this.setTitle('Movie Editor');
|
||||
this.showMainRegion(new MovieEditorLayout());
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
var _ = require('underscore');
|
||||
var Marionette = require('marionette');
|
||||
var vent = require('vent');
|
||||
var Profiles = require('../../Profile/ProfileCollection');
|
||||
var RootFolders = require('../../AddMovies/RootFolders/RootFolderCollection');
|
||||
var RootFolderLayout = require('../../AddMovies/RootFolders/RootFolderLayout');
|
||||
var UpdateFilesSeriesView = require('./Organize/OrganizeFilesView');
|
||||
var Config = require('../../Config');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Movies/Editor/MovieEditorFooterViewTemplate',
|
||||
|
||||
ui : {
|
||||
monitored : '.x-monitored',
|
||||
profile : '.x-profiles',
|
||||
seasonFolder : '.x-season-folder',
|
||||
rootFolder : '.x-root-folder',
|
||||
selectedCount : '.x-selected-count',
|
||||
container : '.series-editor-footer',
|
||||
actions : '.x-action'
|
||||
},
|
||||
|
||||
events : {
|
||||
'click .x-save' : '_updateAndSave',
|
||||
'change .x-root-folder' : '_rootFolderChanged',
|
||||
'click .x-organize-files' : '_organizeFiles'
|
||||
},
|
||||
|
||||
templateHelpers : function() {
|
||||
return {
|
||||
profiles : Profiles,
|
||||
rootFolders : RootFolders.toJSON()
|
||||
};
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
this.seriesCollection = options.collection;
|
||||
|
||||
RootFolders.fetch().done(function() {
|
||||
RootFolders.synced = true;
|
||||
});
|
||||
|
||||
this.editorGrid = options.editorGrid;
|
||||
this.listenTo(this.seriesCollection, 'backgrid:selected', this._updateInfo);
|
||||
this.listenTo(RootFolders, 'all', this.render);
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
this._updateInfo();
|
||||
},
|
||||
|
||||
_updateAndSave : function() {
|
||||
var selected = this.editorGrid.getSelectedModels();
|
||||
|
||||
var monitored = this.ui.monitored.val();
|
||||
var profile = this.ui.profile.val();
|
||||
var seasonFolder = this.ui.seasonFolder.val();
|
||||
var rootFolder = this.ui.rootFolder.val();
|
||||
|
||||
_.each(selected, function(model) {
|
||||
if (monitored === 'true') {
|
||||
model.set('monitored', true);
|
||||
} else if (monitored === 'false') {
|
||||
model.set('monitored', false);
|
||||
}
|
||||
|
||||
if (profile !== 'noChange') {
|
||||
model.set('profileId', parseInt(profile, 10));
|
||||
}
|
||||
|
||||
if (seasonFolder === 'true') {
|
||||
model.set('seasonFolder', true);
|
||||
} else if (seasonFolder === 'false') {
|
||||
model.set('seasonFolder', false);
|
||||
}
|
||||
|
||||
if (rootFolder !== 'noChange') {
|
||||
var rootFolderPath = RootFolders.get(parseInt(rootFolder, 10));
|
||||
|
||||
model.set('rootFolderPath', rootFolderPath.get('path'));
|
||||
}
|
||||
|
||||
model.edited = true;
|
||||
});
|
||||
|
||||
this.seriesCollection.save();
|
||||
},
|
||||
|
||||
_updateInfo : function() {
|
||||
var selected = this.editorGrid.getSelectedModels();
|
||||
var selectedCount = selected.length;
|
||||
|
||||
this.ui.selectedCount.html('{0} series selected'.format(selectedCount));
|
||||
|
||||
if (selectedCount === 0) {
|
||||
this.ui.actions.attr('disabled', 'disabled');
|
||||
} else {
|
||||
this.ui.actions.removeAttr('disabled');
|
||||
}
|
||||
},
|
||||
|
||||
_rootFolderChanged : function() {
|
||||
var rootFolderValue = this.ui.rootFolder.val();
|
||||
if (rootFolderValue === 'addNew') {
|
||||
var rootFolderLayout = new RootFolderLayout();
|
||||
this.listenToOnce(rootFolderLayout, 'folderSelected', this._setRootFolder);
|
||||
vent.trigger(vent.Commands.OpenModalCommand, rootFolderLayout);
|
||||
} else {
|
||||
Config.setValue(Config.Keys.DefaultRootFolderId, rootFolderValue);
|
||||
}
|
||||
},
|
||||
|
||||
_setRootFolder : function(options) {
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
this.ui.rootFolder.val(options.model.id);
|
||||
this._rootFolderChanged();
|
||||
},
|
||||
|
||||
_organizeFiles : function() {
|
||||
var selected = this.editorGrid.getSelectedModels();
|
||||
var updateFilesSeriesView = new UpdateFilesSeriesView({ series : selected });
|
||||
this.listenToOnce(updateFilesSeriesView, 'updatingFiles', this._afterSave);
|
||||
|
||||
vent.trigger(vent.Commands.OpenModalCommand, updateFilesSeriesView);
|
||||
}
|
||||
});
|
|
@ -0,0 +1,54 @@
|
|||
<div class="series-editor-footer">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-2">
|
||||
<label>Monitored</label>
|
||||
|
||||
<select class="form-control x-action x-monitored">
|
||||
<option value="noChange">No change</option>
|
||||
<option value="true">Monitored</option>
|
||||
<option value="false">Unmonitored</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label>Profile</label>
|
||||
|
||||
<select class="form-control x-action x-profiles">
|
||||
<option value="noChange">No change</option>
|
||||
{{#each profiles.models}}
|
||||
<option value="{{id}}">{{attributes.name}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{!--<div class="form-group col-md-2">
|
||||
<label>Season Folder</label>
|
||||
|
||||
<select class="form-control x-action x-season-folder">
|
||||
<option value="noChange">No change</option>
|
||||
<option value="true">Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>
|
||||
</div>--}}
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label>Root Folder</label>
|
||||
|
||||
<select class="form-control x-action x-root-folder" validation-name="RootFolderPath">
|
||||
<option value="noChange">No change</option>
|
||||
{{#each rootFolders}}
|
||||
<option value="{{id}}">{{path}}</option>
|
||||
{{/each}}
|
||||
<option value="addNew">Add a different path</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 actions">
|
||||
<label class="x-selected-count">0 series selected</label>
|
||||
<div>
|
||||
<button class="btn btn-primary x-action x-save">Save</button>
|
||||
<button class="btn btn-danger x-action x-organize-files" title="Organize and rename episode files">Organize</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,153 @@
|
|||
var vent = require('vent');
|
||||
var Marionette = require('marionette');
|
||||
var Backgrid = require('backgrid');
|
||||
var EmptyView = require('../Index/EmptyView');
|
||||
var MoviesCollection = require('../MoviesCollection');
|
||||
var MovieTitleCell = require('../../Cells/MovieTitleCell');
|
||||
var ProfileCell = require('../../Cells/ProfileCell');
|
||||
var SelectAllCell = require('../../Cells/SelectAllCell');
|
||||
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
|
||||
var FooterView = require('./MovieEditorFooterView');
|
||||
require('../../Mixins/backbone.signalr.mixin');
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Movies/Editor/MovieEditorLayoutTemplate',
|
||||
|
||||
regions : {
|
||||
seriesRegion : '#x-series-editor',
|
||||
toolbar : '#x-toolbar'
|
||||
},
|
||||
|
||||
ui : {
|
||||
monitored : '.x-monitored',
|
||||
profiles : '.x-profiles',
|
||||
rootFolder : '.x-root-folder',
|
||||
selectedCount : '.x-selected-count'
|
||||
},
|
||||
|
||||
events : {
|
||||
'click .x-save' : '_updateAndSave',
|
||||
'change .x-root-folder' : '_rootFolderChanged'
|
||||
},
|
||||
|
||||
columns : [
|
||||
{
|
||||
name : '',
|
||||
cell : SelectAllCell,
|
||||
headerCell : 'select-all',
|
||||
sortable : false
|
||||
},
|
||||
{
|
||||
name : 'title',
|
||||
label : 'Title',
|
||||
cell : MovieTitleCell,
|
||||
cellValue : 'this'
|
||||
},
|
||||
{
|
||||
name : 'profileId',
|
||||
label : 'Profile',
|
||||
cell : ProfileCell
|
||||
},
|
||||
{
|
||||
name : 'path',
|
||||
label : 'Path',
|
||||
cell : 'string'
|
||||
}
|
||||
],
|
||||
|
||||
leftSideButtons : {
|
||||
type : 'default',
|
||||
storeState : false,
|
||||
items : [
|
||||
{
|
||||
title : 'Update Library',
|
||||
icon : 'icon-sonarr-refresh',
|
||||
command : 'refreshseries',
|
||||
successMessage : 'Library was updated!',
|
||||
errorMessage : 'Library update failed!'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
this.movieCollection = MoviesCollection.clone();
|
||||
this.movieCollection.shadowCollection.bindSignalR();
|
||||
this.listenTo(this.movieCollection, 'save', this.render);
|
||||
|
||||
this.filteringOptions = {
|
||||
type : 'radio',
|
||||
storeState : true,
|
||||
menuKey : 'serieseditor.filterMode',
|
||||
defaultAction : 'all',
|
||||
items : [
|
||||
{
|
||||
key : 'all',
|
||||
title : '',
|
||||
tooltip : 'All',
|
||||
icon : 'icon-sonarr-all',
|
||||
callback : this._setFilter
|
||||
},
|
||||
{
|
||||
key : 'monitored',
|
||||
title : '',
|
||||
tooltip : 'Monitored Only',
|
||||
icon : 'icon-sonarr-monitored',
|
||||
callback : this._setFilter
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
this._showToolbar();
|
||||
this._showTable();
|
||||
},
|
||||
|
||||
onClose : function() {
|
||||
vent.trigger(vent.Commands.CloseControlPanelCommand);
|
||||
},
|
||||
|
||||
_showTable : function() {
|
||||
if (this.movieCollection.shadowCollection.length === 0) {
|
||||
this.seriesRegion.show(new EmptyView());
|
||||
this.toolbar.close();
|
||||
return;
|
||||
}
|
||||
|
||||
this.columns[0].sortedCollection = this.movieCollection;
|
||||
|
||||
this.editorGrid = new Backgrid.Grid({
|
||||
collection : this.movieCollection,
|
||||
columns : this.columns,
|
||||
className : 'table table-hover'
|
||||
});
|
||||
|
||||
this.seriesRegion.show(this.editorGrid);
|
||||
this._showFooter();
|
||||
},
|
||||
|
||||
_showToolbar : function() {
|
||||
this.toolbar.show(new ToolbarLayout({
|
||||
left : [
|
||||
this.leftSideButtons
|
||||
],
|
||||
right : [
|
||||
this.filteringOptions
|
||||
],
|
||||
context : this
|
||||
}));
|
||||
},
|
||||
|
||||
_showFooter : function() {
|
||||
vent.trigger(vent.Commands.OpenControlPanelCommand, new FooterView({
|
||||
editorGrid : this.editorGrid,
|
||||
collection : this.movieCollection
|
||||
}));
|
||||
},
|
||||
|
||||
_setFilter : function(buttonContext) {
|
||||
var mode = buttonContext.model.get('key');
|
||||
|
||||
this.movieCollection.setFilterMode(mode);
|
||||
}
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
<div id="x-toolbar"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div id="x-series-editor" class="table-responsive"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,33 @@
|
|||
var _ = require('underscore');
|
||||
var vent = require('vent');
|
||||
var Backbone = require('backbone');
|
||||
var Marionette = require('marionette');
|
||||
var CommandController = require('../../../Commands/CommandController');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Movies/Editor/Organize/OrganizeFilesViewTemplate',
|
||||
|
||||
events : {
|
||||
'click .x-confirm-organize' : '_organize'
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
this.series = options.series;
|
||||
this.templateHelpers = {
|
||||
numberOfSeries : this.series.length,
|
||||
series : new Backbone.Collection(this.series).toJSON()
|
||||
};
|
||||
},
|
||||
|
||||
_organize : function() {
|
||||
var seriesIds = _.pluck(this.series, 'id');
|
||||
|
||||
CommandController.Execute('renameSeries', {
|
||||
name : 'renameSeries',
|
||||
seriesIds : seriesIds
|
||||
});
|
||||
|
||||
this.trigger('organizingFiles');
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>Organize of Selected Movies</h3>
|
||||
</div>
|
||||
<div class="modal-body update-files-series-modal">
|
||||
<div class="alert alert-info">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
Tip: To preview a rename... select "Cancel" then any movie title and use the <i data-original-title="" class="icon-sonarr-rename" title=""></i>
|
||||
</div>
|
||||
|
||||
Are you sure you want to update all files in the {{numberOfSeries}} selected movie?
|
||||
|
||||
{{debug}}
|
||||
<ul class="selected-series">
|
||||
{{#each series}}
|
||||
<li>{{title}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">Cancel</button>
|
||||
<button class="btn btn-danger x-confirm-organize">Organize</button>
|
||||
</div>
|
||||
</div>
|
|
@ -75,14 +75,9 @@ module.exports = Marionette.Layout.extend({
|
|||
route : 'addmovies'
|
||||
},
|
||||
{
|
||||
title : 'Season Pass',
|
||||
icon : 'icon-sonarr-monitored',
|
||||
route : 'seasonpass'
|
||||
},
|
||||
{
|
||||
title : 'Series Editor',
|
||||
title : 'Movie Editor',
|
||||
icon : 'icon-sonarr-edit',
|
||||
route : 'serieseditor'
|
||||
route : 'movieeditor'
|
||||
},
|
||||
{
|
||||
title : 'RSS Sync',
|
||||
|
|
|
@ -21,7 +21,7 @@ module.exports = Marionette.AppRouter.extend({
|
|||
'system' : 'system',
|
||||
'system/:action' : 'system',
|
||||
'seasonpass' : 'seasonPass',
|
||||
'serieseditor' : 'seriesEditor',
|
||||
'movieeditor' : 'movieEditor',
|
||||
':whatever' : 'showNotFound'
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue