From 50b843a4229476d7bf6ca868bf57cb3760372816 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 23 Jan 2015 18:42:28 -0800 Subject: [PATCH] New: Show naming format on rename preview --- src/UI/Rename/RenamePreviewFormatView.js | 27 +++++++++++++++++++ .../RenamePreviewFormatViewTemplate.hbs | 5 ++++ src/UI/Rename/RenamePreviewLayout.js | 17 +++++++++--- src/UI/Rename/RenamePreviewLayoutTemplate.hbs | 5 ++++ src/UI/Rename/rename.less | 6 +++++ 5 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 src/UI/Rename/RenamePreviewFormatView.js create mode 100644 src/UI/Rename/RenamePreviewFormatViewTemplate.hbs diff --git a/src/UI/Rename/RenamePreviewFormatView.js b/src/UI/Rename/RenamePreviewFormatView.js new file mode 100644 index 000000000..5f52f610d --- /dev/null +++ b/src/UI/Rename/RenamePreviewFormatView.js @@ -0,0 +1,27 @@ +'use strict'; +define( + [ + 'vent', + 'marionette', + 'Settings/MediaManagement/Naming/NamingModel' + ], function (vent, Marionette, NamingModel) { + return Marionette.ItemView.extend({ + template: 'Rename/RenamePreviewFormatViewTemplate', + + templateHelpers: function () { + var type = this.model.get('seriesType'); + + return { + rename : this.naming.get('renameEpisodes'), + format : this.naming.get(type + 'EpisodeFormat') + }; + }, + + initialize: function () { + this.naming = new NamingModel(); + this.naming.fetch(); + + this.listenTo(this.naming, 'sync', this.render); + } + }); + }); diff --git a/src/UI/Rename/RenamePreviewFormatViewTemplate.hbs b/src/UI/Rename/RenamePreviewFormatViewTemplate.hbs new file mode 100644 index 000000000..560ded964 --- /dev/null +++ b/src/UI/Rename/RenamePreviewFormatViewTemplate.hbs @@ -0,0 +1,5 @@ + +{{#if rename}} + {{format}} +{{/if}} + diff --git a/src/UI/Rename/RenamePreviewLayout.js b/src/UI/Rename/RenamePreviewLayout.js index e4bb7555e..1ed0457cc 100644 --- a/src/UI/Rename/RenamePreviewLayout.js +++ b/src/UI/Rename/RenamePreviewLayout.js @@ -7,22 +7,32 @@ define( 'Rename/RenamePreviewCollection', 'Rename/RenamePreviewCollectionView', 'Rename/RenamePreviewEmptyCollectionView', + 'Rename/RenamePreviewFormatView', 'Shared/LoadingView', 'Commands/CommandController' - ], function (_, vent, Marionette, RenamePreviewCollection, RenamePreviewCollectionView, EmptyCollectionView, LoadingView, CommandController) { + ], function (_, + vent, + Marionette, + RenamePreviewCollection, + RenamePreviewCollectionView, + EmptyCollectionView, + RenamePreviewFormatView, + LoadingView, + CommandController) { return Marionette.Layout.extend({ className : 'modal-lg', template : 'Rename/RenamePreviewLayoutTemplate', regions: { - renamePreviews : '#rename-previews' + renamePreviews : '#rename-previews', + formatRegion : '.x-format-region' }, ui: { pathInfo : '.x-path-info', renameAll : '.x-rename-all', - checkboxIcon: '.x-rename-all-button i' + checkboxIcon : '.x-rename-all-button i' }, events: { @@ -47,6 +57,7 @@ define( onRender: function() { this.renamePreviews.show(new LoadingView()); + this.formatRegion.show(new RenamePreviewFormatView({ model: this.model })); }, _showPreviews: function () { diff --git a/src/UI/Rename/RenamePreviewLayoutTemplate.hbs b/src/UI/Rename/RenamePreviewLayoutTemplate.hbs index d87a7a94d..066ccce79 100644 --- a/src/UI/Rename/RenamePreviewLayoutTemplate.hbs +++ b/src/UI/Rename/RenamePreviewLayoutTemplate.hbs @@ -9,9 +9,12 @@ + + diff --git a/src/UI/Rename/rename.less b/src/UI/Rename/rename.less index 84d92d836..ffd94f0f8 100644 --- a/src/UI/Rename/rename.less +++ b/src/UI/Rename/rename.less @@ -51,3 +51,9 @@ } } +.file-name-format { + color : #8c8c8c; + margin-left : 25px; + margin-top : 6px; + display : inline-block; +}