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 @@