app/assets/javascripts/pageflow/dist/editor.js in pageflow-15.1.0.beta5 vs app/assets/javascripts/pageflow/dist/editor.js in pageflow-15.1.0.beta6

- old
+ new

@@ -3724,11 +3724,11 @@ this.commonPageConfigurationTabs.apply(view); return view; } }); - var editor = new EditorApi(); + var editor$1 = new EditorApi(); var startEditor = function startEditor(options) { $(function () { $.when($.getJSON('/editor/entries/' + options.entryId + '/seed'), pageflow.browser.detectFeatures()).done(function (result) { app.start(result[0]); }).fail(function () { @@ -3970,11 +3970,11 @@ this.transientReferences = {}; this.pendingReferences = {}; }, getReference: function getReference(attribute, collection) { if (typeof collection === 'string') { - var fileType = editor.fileTypes.findByCollectionName(collection); + var fileType = editor$1.fileTypes.findByCollectionName(collection); collection = state.entry.getFileCollection(fileType); } return this.transientReferences[attribute] || collection.getByPermaId(this.get(attribute)); }, @@ -4274,11 +4274,11 @@ }, pageLinks: function pageLinks() { return this.pageType().pageLinks(this.configuration); }, pageType: function pageType() { - return editor.pageTypes.findByName(this.get('template')); + return editor$1.pageTypes.findByName(this.get('template')); }, toJSON: function toJSON() { return _$1.extend(_$1.clone(this.attributes), { configuration: this.configuration.toJSON() }); @@ -4331,11 +4331,11 @@ if (this.options.depth === 'page') { this.page = this.chapter.buildPage(); } - editor.trigger('scaffold:storyline', this.storyline); + editor$1.trigger('scaffold:storyline', this.storyline); return this.storyline; }, load: function load(response) { this.storyline.set(response.storyline); this.chapter.set(response.chapter); @@ -4665,11 +4665,11 @@ this.getReferer = function () { return '/widgets/' + widget.id; }; }; - editor.registerFileSelectionHandler('widgetConfiguration', WidgetConfigurationFileSelectionHandler); + editor$1.registerFileSelectionHandler('widgetConfiguration', WidgetConfigurationFileSelectionHandler); var EncodingConfirmation = Backbone.Model.extend({ paramRoot: 'encoding_confirmation', initialize: function initialize() { this.videoFiles = new Backbone.Collection(); @@ -4770,13 +4770,28 @@ return ''; } }); - var EntryConfiguration = Configuration.extend({ + var EntryMetadataConfiguration = Configuration.extend({ + modelName: 'entry_metadata_configuration', + i18nKey: 'pageflow/entry_metadata_configuration', + defaults: {} + }); + + var EntryMetadata = Configuration.extend({ modelName: 'entry', - i18nKey: 'pageflow/entry' + i18nKey: 'pageflow/entry', + defaults: {}, + initialize: function initialize(attributes, options) { + Configuration.prototype.initialize.apply(this, attributes, options); + this.configuration = new EntryMetadataConfiguration(_$1.clone(attributes.configuration) || {}); + this.listenTo(this.configuration, 'change', function () { + this.trigger('change'); + this.parent.save(); + }); + } }); var StorylineConfiguration = Configuration.extend({ modelName: 'storyline', i18nKey: 'pageflow/storyline', @@ -4929,11 +4944,11 @@ this.getReferer = function () { return '/pages/' + page.id + '/' + (options.returnToTab || 'files'); }; }; - editor.registerFileSelectionHandler('pageConfiguration', PageConfigurationFileSelectionHandler); + editor$1.registerFileSelectionHandler('pageConfiguration', PageConfigurationFileSelectionHandler); var ImageFile = ReusableFile.extend({ stages: [{ name: 'uploading', activeStates: ['uploading'], @@ -4951,20 +4966,20 @@ isPositionable: function isPositionable() { return this.isReady(); } }); - var EntryConfigurationFileSelectionHandler = function EntryConfigurationFileSelectionHandler(options) { + var EntryMetadataFileSelectionHandler = function EntryMetadataFileSelectionHandler(options) { this.call = function (file) { - state.entry.configuration.setReference(options.attributeName, file); + state.entry.metadata.setReference(options.attributeName, file); }; this.getReferer = function () { return '/meta_data/' + (options.returnToTab || 'general'); }; }; - editor.registerFileSelectionHandler('entryConfiguration', EntryConfigurationFileSelectionHandler); + editor$1.registerFileSelectionHandler('entryMetadata', EntryMetadataFileSelectionHandler); var EntryPublication = Backbone.Model.extend({ paramRoot: 'entry_publication', quota: function quota() { return new Backbone.Model(this.get('quota') || {}); @@ -5289,26 +5304,26 @@ this.entry = options.entry; this.deferreds = []; }, add: function add(upload, options) { options = options || {}; - var editor$1 = options.editor || editor; + var editor = options.editor || editor$1; var fileType = this.fileTypes.findByUpload(upload); var file = new fileType.model({ state: 'uploadable', file_name: upload.name, content_type: upload.type, file_size: upload.size }, { fileType: fileType }); - var setTargetFile = editor$1.nextUploadTargetFile; + var setTargetFile = editor.nextUploadTargetFile; if (setTargetFile) { if (fileType.topLevelType || !setTargetFile.fileType().nestedFileTypes.contains(fileType)) { throw new InvalidNestedTypeError(upload, { - editor: editor$1, + editor: editor, fileType: fileType }); } file.set({ @@ -5384,11 +5399,11 @@ success: function success(response) { parentModel.trigger('sync', parentModel, response, {}); parentModel.trigger('sync:order', parentModel, response, {}); }, error: function error(jqXHR, textStatus, errorThrown) { - editor.failures.add(new OrderingFailure(parentModel, collection)); + editor$1.failures.add(new OrderingFailure(parentModel, collection)); } }); } }; @@ -5410,11 +5425,11 @@ page.chapter = chapter; }); this.listenTo(this, 'add', function (model) { model.chapter = chapter; model.set('chapter_id', chapter.id); - editor.trigger('add:page', model); + editor$1.trigger('add:page', model); }); this.listenTo(this, 'remove', function (model) { model.chapter = null; }); this.listenTo(chapter, 'destroy', function () { @@ -5489,11 +5504,11 @@ chapter.storyline = storyline; }); this.listenTo(this, 'add', function (model) { model.storyline = storyline; model.set('storyline_id', storyline.id); - editor.trigger('add:chapter', model); + editor$1.trigger('add:chapter', model); }); this.listenTo(this, 'remove', function (model) { model.storyline = null; }); } @@ -5615,11 +5630,11 @@ this.getReferer = function () { return '/page_links/' + pageLink.id; }; }; - editor.registerFileSelectionHandler('pageLink', PageLinkFileSelectionHandler); + editor$1.registerFileSelectionHandler('pageLink', PageLinkFileSelectionHandler); var persistedPromise = { persisted: function persisted() { var model = this; this._persistedDeferred = this._persistedDeferred || $.Deferred(function (deferred) { @@ -5700,15 +5715,15 @@ i18nKey: 'pageflow/entry', collectionName: 'entries', mixins: [filesCountWatcher, polling, failureTracking], initialize: function initialize(attributes, options) { options = options || {}; - this.configuration = new EntryConfiguration(this.get('configuration') || {}); - this.configuration.parent = this; + this.metadata = new EntryMetadata(this.get('metadata') || {}); + this.metadata.parent = this; this.themes = options.themes || state.themes; this.files = options.files || state.files; - this.fileTypes = options.fileTypes || editor.fileTypes; + this.fileTypes = options.fileTypes || editor$1.fileTypes; this.storylines = options.storylines || state.storylines; this.storylines.parentModel = this; this.chapters = options.chapters || state.chapters; this.chapters.parentModel = this; this.pages = state.pages; @@ -5723,24 +5738,24 @@ this.pages.sort(); }); this.listenTo(this.chapters, 'sort', function () { this.pages.sort(); }); - this.listenTo(this.configuration, 'change', function () { - this.trigger('change:configuration'); + this.listenTo(this.metadata, 'change', function () { + this.trigger('change:metadata'); this.save(); }); - this.listenTo(this.configuration, 'change:locale', function () { + this.listenTo(this.metadata, 'change:locale', function () { this.once('sync', function () { // No other way of updating page templates used in // EntryPreviewView at the moment. location.reload(); }); }); }, getTheme: function getTheme() { - return this.themes.findByName(this.configuration.get('theme_name')); + return this.themes.findByName(this.metadata.get('theme_name')); }, addStoryline: function addStoryline(attributes) { var storyline = this.buildStoryline(attributes); storyline.save(); return storyline; @@ -5819,11 +5834,14 @@ }, options)); delete response[fileType.collectionName]; }, this); }, toJSON: function toJSON() { - return this.configuration.toJSON(); + var metadataJSON = this.metadata.toJSON(); + var configJSON = this.metadata.configuration.toJSON(); + metadataJSON.configuration = configJSON; + return metadataJSON; } }); var AuthenticationProvider = BaseObject.extend({ authenticate: function authenticate(parent, provider) { @@ -5955,11 +5973,11 @@ return cFile.get('attachment_on_s3_file_name') == file.file_name && cFile.get('source_url') == file.source_url && cFile.get('state') == 'uploadable'; }); if (localFile) { state.files[collectionName].remove(localFile); - var fileType = editor.fileTypes.findByUpload(file); + var fileType = editor$1.fileTypes.findByUpload(file); var file = new fileType.model(file, { fileType: fileType }); currentEntry.getFileCollection(fileType).add(file); file.set('state', 'uploading'); @@ -6283,11 +6301,11 @@ }, onRender: function onRender() { this.outlet.show(this.options.view); }, goBack: function goBack() { - editor.navigate('/', { + editor$1.navigate('/', { trigger: true }); } }); @@ -6426,11 +6444,11 @@ modelEvents: { 'change:failed': 'updateFailIndicator' }, events: { 'click .retry': function clickRetry() { - editor.failures.retry(); + editor$1.failures.retry(); return false; } }, onRender: function onRender() { this.updateFailIndicator(); @@ -6490,11 +6508,11 @@ this.model.destroy(); this.goBack(); } }, goBack: function goBack() { - editor.navigate('/', { + editor$1.navigate('/', { trigger: true }); } }); @@ -6531,30 +6549,30 @@ window.location = '/admin/entries/' + state.entry.id; }); }, 'click a.publish': function clickAPublish() { if (!this.ui.publishButton.hasClass('disabled')) { - editor.navigate('/publish', { + editor$1.navigate('/publish', { trigger: true }); } return false; }, 'click .menu a': function clickMenuA(event) { - editor.navigate($(event.target).data('path'), { + editor$1.navigate($(event.target).data('path'), { trigger: true }); return false; } }, onRender: function onRender() { this._addMenuItems(); this._updatePublishButton(); - this.outlineRegion.show(new editor.entryType.outlineView({ + this.outlineRegion.show(new editor$1.entryType.outlineView({ entry: state.entry, navigatable: true, editable: true, displayInNavigationHint: true, rememberLastSelection: true, @@ -6572,11 +6590,11 @@ } }, _addMenuItems: function _addMenuItems() { var view = this; - _$1.each(editor.mainMenuItems, function (options) { + _$1.each(editor$1.mainMenuItems, function (options) { var item = $('<li><a href="#"></a></li>'); var link = item.find('a'); if (options.path) { link.data('path', options.path); @@ -6614,11 +6632,11 @@ modelEvents: { 'change:type_name': 'update' }, events: { 'click .settings': function clickSettings() { - editor.navigate('/widgets/' + this.model.role(), { + editor$1.navigate('/widgets/' + this.model.role(), { trigger: true }); return false; } }, @@ -7096,11 +7114,11 @@ fileName: '.file_name', thumbnail: '.file_thumbnail' }, events: { 'click .choose': function clickChoose() { - editor.selectFile({ + editor$1.selectFile({ name: this.options.collection.name, filter: this.options.filter }, this.options.fileSelectionHandler || 'pageConfiguration', _$1.extend({ id: this.model.getRoutableId ? this.model.getRoutableId() : this.model.id, attributeName: this.options.propertyName, @@ -7118,11 +7136,11 @@ positioning: true, textTrackFiles: state.textTrackFiles }, this.options); if (typeof this.options.collection === 'string') { - this.options.collection = state.entry.getFileCollection(editor.fileTypes.findByCollectionName(this.options.collection)); + this.options.collection = state.entry.getFileCollection(editor$1.fileTypes.findByCollectionName(this.options.collection)); } this.textTrackMenuItems = new Backbone.Collection(); }, onRender: function onRender() { @@ -7625,69 +7643,84 @@ events: { 'click a.back': 'goBack' }, onRender: function onRender() { var entry = this.model; + var state = this.options.state || {}; + var features = this.options.features || {}; + var editor = this.options.editor || {}; var configurationEditor = new ConfigurationEditorView({ - model: entry.configuration, + model: entry.metadata.configuration, tab: this.options.tab }); configurationEditor.tab('general', function () { this.input('title', TextInputView, { - placeholder: entry.get('entry_title') + placeholder: entry.get('entry_title'), + model: entry.metadata }); this.input('locale', SelectInputView, { values: state.config.availablePublicLocales, texts: _$1.map(state.config.availablePublicLocales, function (locale) { return I18n$1.t('pageflow.public._language', { locale: locale }); - }) + }), + model: entry.metadata }); - this.input('credits', TextAreaInputView); + this.input('credits', TextAreaInputView, { + model: entry.metadata + }); this.input('author', TextInputView, { - placeholder: state.config.defaultAuthorMetaTag + placeholder: state.config.defaultAuthorMetaTag, + model: entry.metadata }); this.input('publisher', TextInputView, { - placeholder: state.config.defaultPublisherMetaTag + placeholder: state.config.defaultPublisherMetaTag, + model: entry.metadata }); this.input('keywords', TextInputView, { - placeholder: state.config.defaultKeywordsMetaTag + placeholder: state.config.defaultKeywordsMetaTag, + model: entry.metadata }); }); configurationEditor.tab('widgets', function () { editor.entryType.appearanceInputs && editor.entryType.appearanceInputs(this, entry, state.theming); entry.widgets && this.view(EditWidgetsView, { model: entry, widgetTypes: editor.widgetTypes }); - if (pageflow.features && pageflow.features.isEnabled('selectable_themes') && state.themes.length > 1) { + if (features.isEnabled && features.isEnabled('selectable_themes') && state.themes.length > 1) { this.view(ThemeInputView, { themes: state.themes, - propertyName: 'theme_name' + propertyName: 'theme_name', + model: entry.metadata }); } }); configurationEditor.tab('social', function () { this.input('share_image_id', FileInputView, { collection: state.imageFiles, - fileSelectionHandler: 'entryConfiguration' + fileSelectionHandler: 'entryMetadata', + model: entry.metadata }); this.input('summary', TextAreaInputView, { disableRichtext: true, - disableLinks: true + disableLinks: true, + model: entry.metadata }); this.input('share_url', TextInputView, { - placeholder: state.entry.get('pretty_url') + placeholder: state.entry.get('pretty_url'), + model: entry.metadata }); this.input('share_providers', CheckBoxGroupInputView, { values: state.config.availableShareProviders, - translationKeyPrefix: 'activerecord.values.pageflow/entry.share_providers' + translationKeyPrefix: 'activerecord.values.pageflow/entry.share_providers', + model: entry.metadata }); }); - this.listenTo(entry.configuration, 'change:theme_name', function () { + this.listenTo(entry.metadata, 'change:theme_name', function () { configurationEditor.refresh(); }); this.formContainer.show(configurationEditor); }, goBack: function goBack() { @@ -7739,11 +7772,11 @@ this.model.remove(); this.goBack(); } }, goBack: function goBack() { - editor.navigate('/pages/' + this.options.page.id + '/links', { + editor$1.navigate('/pages/' + this.options.page.id + '/links', { trigger: true }); } }); @@ -7808,19 +7841,19 @@ this.model.destroy(); this.goBack(); } }, goBack: function goBack() { - editor.navigate('/', { + editor$1.navigate('/', { trigger: true }); } }); var PageLinkInputView = ReferenceInputView.extend({ choose: function choose() { - return editor.selectPage({ + return editor$1.selectPage({ isAllowed: this.options.isAllowed }); }, getTarget: function getTarget(permaId) { return state.pages.getByPermaId(permaId); @@ -7917,11 +7950,11 @@ this.model.destroy(); this.goBack(); } }, goBack: function goBack() { - editor.navigate('/?storyline=' + this.model.id, { + editor$1.navigate('/?storyline=' + this.model.id, { trigger: true }); } }); @@ -7936,11 +7969,11 @@ var EditWidgetView = Marionette.ItemView.extend({ template: template$E, className: 'edit_widget', events: { 'click a.back': function clickABack() { - editor.navigate('/meta_data/widgets', { + editor$1.navigate('/meta_data/widgets', { trigger: true }); } }, initialize: function initialize() { @@ -8150,11 +8183,11 @@ this.tabsView = new TabsView({ model: this.model, i18n: 'pageflow.editor.files.tabs', defaultTab: this.options.tabName }); - editor.fileTypes.each(function (fileType) { + editor$1.fileTypes.each(function (fileType) { if (fileType.topLevelType) { this.tab(fileType); } }, this); this.ui.filesPanel.append(this.subview(this.tabsView).el); @@ -8325,11 +8358,11 @@ events: { 'click .select': function clickSelect() { var result = this.options.selectionHandler.call(this.model); if (result !== false) { - editor.navigate(this.options.selectionHandler.getReferer(), { + editor$1.navigate(this.options.selectionHandler.getReferer(), { trigger: true }); } return false; @@ -8410,11 +8443,11 @@ }, cancel: function cancel() { this.model.cancelUpload(); }, confirm: function confirm() { - editor.navigate('/confirmable_files?type=' + this.model.modelName + '&id=' + this.model.id, { + editor$1.navigate('/confirmable_files?type=' + this.model.modelName + '&id=' + this.model.id, { trigger: true }); }, retry: function retry() { this.model.retry(); @@ -8446,11 +8479,11 @@ banner: '.filtered_files-banner', filterName: '.filtered_files-filter_name' }, events: { 'click .filtered_files-reset_filter': function clickFiltered_filesReset_filter() { - editor.navigate('/files/' + this.options.fileType.collectionName, { + editor$1.navigate('/files/' + this.options.fileType.collectionName, { trigger: true }); return false; } }, @@ -8565,11 +8598,11 @@ this.close(); }, onRender: function onRender() { var self = this; - editor.fileImporters.values().forEach(function (fileImporter) { + editor$1.fileImporters.values().forEach(function (fileImporter) { var importerSelectView = new ImporterSelectView({ importer: fileImporter, parentView: self }).render(); self.ui.importersList.append(importerSelectView.$el); @@ -8787,11 +8820,11 @@ if (metaData) { self.model.set('metaData', metaData); // add each selected file meta to state.files for (var i = 0; i < metaData.files.length; i++) { var file = metaData.files[i]; - var fileType = editor.fileTypes.findByUpload(file); + var fileType = editor$1.fileTypes.findByUpload(file); var file = new fileType.model({ state: 'uploadable', file_name: file.name, content_type: file.type, file_size: -1, @@ -8802,11 +8835,11 @@ }); state.entry.getFileCollection(fileType).add(file); } ConfirmFileImportUploadView.open({ - fileTypes: editor.fileTypes, + fileTypes: editor$1.fileTypes, fileImportModel: self.model, files: state.files }); } }); @@ -8897,11 +8930,11 @@ } }); } }]; - if (editor.fileImporters.keys().length > 0) { + if (editor$1.fileImporters.keys().length > 0) { menuOptions.push({ label: I18n$1.t('pageflow.editor.views.files_view.import'), handler: function handler() { ChooseImporterView.open({ callback: function callback(importer) { @@ -8924,11 +8957,11 @@ this.tabsView = new TabsView({ model: this.model, i18n: 'pageflow.editor.files.tabs', defaultTab: this.options.tabName }); - editor.fileTypes.each(function (fileType) { + editor$1.fileTypes.each(function (fileType) { if (fileType.topLevelType) { this.tab(fileType); } }, this); this.$el.append(this.subview(this.tabsView).el); @@ -8947,15 +8980,15 @@ this.tabsView.toggleSpinnerOnTab(fileType.collectionName, value > 0); }); }, goBack: function goBack() { if (this.options.selectionHandler) { - editor.navigate(this.options.selectionHandler.getReferer(), { + editor$1.navigate(this.options.selectionHandler.getReferer(), { trigger: true }); } else { - editor.navigate('/', { + editor$1.navigate('/', { trigger: true }); } }, upload: function upload() { @@ -9322,15 +9355,15 @@ })); }, files: function files(collectionName, handler, payload, filterName) { this.region.show(new FilesView({ model: this.entry, - selectionHandler: handler && editor.createFileSelectionHandler(handler, payload), + selectionHandler: handler && editor$1.createFileSelectionHandler(handler, payload), tabName: collectionName, filterName: filterName })); - editor.setDefaultHelpEntry('pageflow.help_entries.files'); + editor$1.setDefaultHelpEntry('pageflow.help_entries.files'); }, confirmableFiles: function confirmableFiles(preselectedFileType, preselectedFileId) { this.region.show(ConfirmEncodingView.create({ model: EncodingConfirmation.createWithPreselection({ fileType: preselectedFileType, @@ -9339,19 +9372,22 @@ })); }, metaData: function metaData(tab) { this.region.show(new EditMetaDataView({ model: this.entry, - tab: tab + tab: tab, + state: state, + features: pageflow.features, + editor: editor$1 })); }, publish: function publish() { this.region.show(PublishEntryView.create({ model: this.entry, entryPublication: new EntryPublication() })); - editor.setDefaultHelpEntry('pageflow.help_entries.publish'); + editor$1.setDefaultHelpEntry('pageflow.help_entries.publish'); }, storyline: function storyline(id) { this.region.show(new EditStorylineView({ model: this.entry.storylines.get(id) })); @@ -9363,22 +9399,22 @@ }, page: function page(id, tab) { var page = this.entry.pages.get(id); this.region.show(new EditPageView({ model: page, - api: editor, + api: editor$1, tab: tab })); - editor.setDefaultHelpEntry(page.pageType().help_entry_translation_key); + editor$1.setDefaultHelpEntry(page.pageType().help_entry_translation_key); }, pageLink: function pageLink(linkId) { var pageId = linkId.split(':')[0]; var page = state.pages.getByPermaId(pageId); this.region.show(new EditPageLinkView({ model: page.pageLinks().get(linkId), page: page, - api: editor + api: editor$1 })); }, widget: function widget(id) { this.region.show(new EditWidgetView({ model: this.entry.widgets.get(id) @@ -9512,11 +9548,11 @@ } }, initialize: function initialize() { this.listenTo(app, 'toggle-help', function (name) { this.toggle(); - this.showSection(name || editor.defaultHelpEntry || this.defaultHelpEntry(), { + this.showSection(name || editor$1.defaultHelpEntry || this.defaultHelpEntry(), { scrollIntoView: true }); }); }, onRender: function onRender() { @@ -9575,11 +9611,11 @@ editButton: '.edit', removeButton: '.remove' }, events: { 'click .edit': function clickEdit() { - editor.navigate(this.model.editPath(), { + editor$1.navigate(this.model.editPath(), { trigger: true }); return false; }, 'mouseenter': function mouseenter() { @@ -9633,11 +9669,11 @@ addButton: '.add_link' }, events: { 'click .add_link': function clickAdd_link() { var view = this; - editor.selectPage().then(function (page) { + editor$1.selectPage().then(function (page) { view.model.pageLinks().addLink(page.get('perma_id')); }); return false; } }, @@ -10086,27 +10122,27 @@ uploadingCount: '.uploading .count', confirmableFilesCount: '.confirmable_files .count' }, events: { 'click .retry': function clickRetry() { - editor.failures.retry(); + editor$1.failures.retry(); } }, onRender: function onRender() { this.listenTo(state.entry, 'change:uploading_files_count', this.notifyUploadCount); this.listenTo(state.entry, 'change:confirmable_files_count', this.notifyConfirmableFilesCount); this.listenTo(state.savingRecords, 'add', this.update); this.listenTo(state.savingRecords, 'remove', this.update); - this.listenTo(editor.failures, 'add', this.update); - this.listenTo(editor.failures, 'remove', this.update); + this.listenTo(editor$1.failures, 'add', this.update); + this.listenTo(editor$1.failures, 'remove', this.update); this.update(); this.notifyConfirmableFilesCount(); }, update: function update() { - this.$el.toggleClass('failed', !editor.failures.isEmpty()); + this.$el.toggleClass('failed', !editor$1.failures.isEmpty()); this.$el.toggleClass('saving', !state.savingRecords.isEmpty()); - this.ui.failedCount.text(editor.failures.count()); + this.ui.failedCount.text(editor$1.failures.count()); }, notifyUploadCount: function notifyUploadCount(model, uploadCount) { this.$el.toggleClass('uploading', uploadCount > 0); this.ui.uploadingCount.text(uploadCount); }, @@ -10120,11 +10156,11 @@ var FileProcessingStateDisplayView = Marionette.View.extend({ className: 'file_processing_state_display', mixins: [inputView], initialize: function initialize() { if (typeof this.options.collection === 'string') { - this.options.collection = state.entry.getFileCollection(editor.fileTypes.findByCollectionName(this.options.collection)); + this.options.collection = state.entry.getFileCollection(editor$1.fileTypes.findByCollectionName(this.options.collection)); } this.listenTo(this.model, 'change:' + this.options.propertyName, this._update); }, render: function render() { @@ -10279,21 +10315,21 @@ this.listenTo(this.selection, 'change', this.update); }, onRender: function onRender() { this.nestedFilesView = new NestedFilesView({ collection: this.model.nestedFiles(this.options.supersetCollection), - fileType: editor.fileTypes.findByCollectionName('text_track_files'), + fileType: editor$1.fileTypes.findByCollectionName('text_track_files'), selection: this.selection, model: this.model, tableBlankSlateText: I18n$1.t('pageflow.editor.nested_files.text_track_files.no_files_blank_slate') }); this.ui.filesPanel.append(this.subview(this.nestedFilesView).el); this.update(); - editor.setUploadTargetFile(this.model); + editor$1.setUploadTargetFile(this.model); }, onClose: function onClose() { - editor.setUploadTargetFile(undefined); + editor$1.setUploadTargetFile(undefined); }, update: function update() { var selectedFile = this.selection.get('file'); if (selectedFile) { @@ -10714,11 +10750,11 @@ values: Page.scrollIndicatorOrientations }); } }); - editor.widgetTypes.register('classic_loading_spinner', { + editor$1.widgetTypes.register('classic_loading_spinner', { configurationEditorView: ConfigurationEditorView.extend({ configure: function configure() { this.tab('loading_spinner', function () { this.view(InfoBoxView, { text: I18n$1.t('pageflow.editor.classic_loading_spinner.widget_type_info_box_text') @@ -10726,14 +10762,14 @@ }); } }) }); - editor.widgetTypes.registerRole('cookie_notice', { + editor$1.widgetTypes.registerRole('cookie_notice', { isOptional: true }); - editor.widgetTypes.register('cookie_notice_bar', { + editor$1.widgetTypes.register('cookie_notice_bar', { configurationEditorView: ConfigurationEditorView.extend({ configure: function configure() { this.tab('cookie_notice_bar', function () { this.view(InfoBoxView, { text: I18n$1.t('pageflow.editor.cookie_notice_bar.widget_type_info_box_text') @@ -10741,11 +10777,11 @@ }); } }) }); - editor.widgetTypes.register('media_loading_spinner', { + editor$1.widgetTypes.register('media_loading_spinner', { configurationEditorView: ConfigurationEditorView.extend({ configure: function configure() { this.tab('loading_spinner', function () { this.view(InfoBoxView, { text: I18n$1.t('pageflow.editor.media_loading_spinner.widget_type_info_box_text') @@ -10760,11 +10796,11 @@ }); } }) }); - editor.widgetTypes.register('phone_horizontal_slideshow_mode', { + editor$1.widgetTypes.register('phone_horizontal_slideshow_mode', { configurationEditorView: ConfigurationEditorView.extend({ configure: function configure() { this.tab('phone_horizontal_slideshow_mode', function () { this.view(InfoBoxView, { text: I18n$1.t('pageflow.editor.phone_horizontal_slideshow_mode.widget_type_info_box_text') @@ -10775,19 +10811,19 @@ }); } }) }); - editor.widgetTypes.register('title_loading_spinner', { + editor$1.widgetTypes.register('title_loading_spinner', { configurationEditorView: ConfigurationEditorView.extend({ configure: function configure() { this.tab('loading_spinner', function () { this.view(InfoBoxView, { text: I18n$1.t('pageflow.editor.title_loading_spinner.widget_type_info_box_text') }); this.input('title', TextInputView, { - placeholder: state.entry.configuration.get('title') || state.entry.get('entry_title') + placeholder: state.entry.metadata.get('title') || state.entry.get('entry_title') }); this.input('subtitle', TextInputView); this.input('custom_background_image_id', FileInputView, { collection: 'image_files', fileSelectionHandler: 'widgetConfiguration' @@ -10825,11 +10861,11 @@ }); }); app.addInitializer(function () { Backbone.history.on('route', function () { - editor.applyDefaultHelpEntry(); + editor$1.applyDefaultHelpEntry(); }); }); app.addInitializer(function (options) { var textTracksMetaDataAttribute = { @@ -10854,40 +10890,40 @@ valueViewOptions: { fromConfiguration: true, settingsDialogTabLink: 'general' } }; - editor.fileTypes.register('image_files', { + editor$1.fileTypes.register('image_files', { model: ImageFile, metaDataAttributes: ['dimensions', altMetaDataAttribute], matchUpload: /^image/, configurationEditorInputs: [{ name: 'alt', inputView: TextInputView }] }); - editor.fileTypes.register('video_files', { + editor$1.fileTypes.register('video_files', { model: VideoFile, metaDataAttributes: ['format', 'dimensions', 'duration', textTracksMetaDataAttribute, altMetaDataAttribute], matchUpload: /^video/, configurationEditorInputs: [{ name: 'alt', inputView: TextInputView }], settingsDialogTabs: [textTracksSettingsDialogTab] }); - editor.fileTypes.register('audio_files', { + editor$1.fileTypes.register('audio_files', { model: AudioFile, metaDataAttributes: ['format', 'duration', textTracksMetaDataAttribute, altMetaDataAttribute], matchUpload: /^audio/, configurationEditorInputs: [{ name: 'alt', inputView: TextInputView }], settingsDialogTabs: [textTracksSettingsDialogTab] }); - editor.fileTypes.register('text_track_files', { + editor$1.fileTypes.register('text_track_files', { model: TextTrackFile, matchUpload: function matchUpload(upload) { return upload.name.match(/\.vtt$/) || upload.name.match(/\.srt$/); }, skipUploadConfirmation: true, @@ -10938,34 +10974,34 @@ return textTrackFile.displayLabel().toLowerCase(); }, binding: 'label' } }); - editor.fileTypes.setup(options.config.fileTypes); + editor$1.fileTypes.setup(options.config.fileTypes); }); app.addInitializer(function (options) { - editor.widgetTypes.registerRole('navigation', { + editor$1.widgetTypes.registerRole('navigation', { isOptional: true }); - editor.widgetTypes.setup(options.widget_types); + editor$1.widgetTypes.setup(options.widget_types); }); app.addInitializer(function (options) { - state.files = FilesCollection.createForFileTypes(editor.fileTypes, options.files); + state.files = FilesCollection.createForFileTypes(editor$1.fileTypes, options.files); state.imageFiles = state.files.image_files; state.videoFiles = state.files.video_files; state.audioFiles = state.files.audio_files; state.textTrackFiles = state.files.text_track_files; var widgets = new WidgetsCollection(options.widgets, { - widgetTypes: editor.widgetTypes + widgetTypes: editor$1.widgetTypes }); state.themes = new ThemesCollection(options.themes); state.pages = new PagesCollection(options.pages); state.chapters = new ChaptersCollection(options.chapters); state.storylines = new StorylinesCollection(options.storylines); - state.entry = editor.createEntryModel(options, { + state.entry = editor$1.createEntryModel(options, { widgets: widgets }); state.theming = new Theming(options.theming); state.account = new Backbone.Model(options.account); widgets.subject = state.entry; @@ -10982,29 +11018,29 @@ state.storylineOrdering.watch(); state.pages.sort(); state.storylines.on('sort', _$1.debounce(function () { state.storylines.saveOrder(); }, 100)); - editor.failures.watch(state.entry); - editor.failures.watch(state.pages); - editor.failures.watch(state.chapters); + editor$1.failures.watch(state.entry); + editor$1.failures.watch(state.pages); + editor$1.failures.watch(state.chapters); state.savingRecords = new SavingRecordsCollection(); state.savingRecords.watch(state.pages); state.savingRecords.watch(state.chapters); pageflow.events.trigger('seed:loaded'); }); app.addInitializer(function (options) { state.fileUploader = new FileUploader({ entry: state.entry, - fileTypes: editor.fileTypes + fileTypes: editor$1.fileTypes }); - ConfirmUploadView.watch(state.fileUploader, editor.fileTypes, state.files); + ConfirmUploadView.watch(state.fileUploader, editor$1.fileTypes, state.files); }); app.addInitializer(function (options) { - editor.pageTypes.setup(options.page_types); + editor$1.pageTypes.setup(options.page_types); }); app.addInitializer(function (options) { var KEY_A = 65; var KEY_X = 88; @@ -11014,19 +11050,19 @@ pageflow.atmo.enable(); } else { pageflow.atmo.disable(); } } else if (event.altKey && event.which === KEY_X) { - editor.navigate('pages/' + pageflow.slides.currentPage().data('id'), { + editor$1.navigate('pages/' + pageflow.slides.currentPage().data('id'), { trigger: true }); } }); }); app.addInitializer(function (options) { - editor.fileImporters.setup(options.config.fileImporters); + editor$1.fileImporters.setup(options.config.fileImporters); }); app.addInitializer(function (options) { state.editLock = new EditLockContainer(); state.editLock.watchForErrors(); @@ -11044,33 +11080,33 @@ } }); state.entry.on('use:files', function () { pageflow.stylesheet.reload('entry'); }); - state.entry.configuration.on('change:theme_name', function () { + state.entry.metadata.on('change:theme_name', function () { var theme = state.entry.getTheme(); pageflow.stylesheet.update('theme', theme.get('stylesheet_path')); }); }); app.addInitializer(function () { - _$1.each(editor.sideBarRoutings, function (options) { + _$1.each(editor$1.sideBarRoutings, function (options) { new options.router({ controller: new options.controller({ region: app.sidebarRegion, entry: state.entry }) }); }); - editor.router = new SidebarRouter({ + editor$1.router = new SidebarRouter({ controller: new SidebarController({ region: app.sidebarRegion, entry: state.entry }) }); - window.editor = editor.router; + window.editor = editor$1.router; }); app.addInitializer(function () { app.on('error', function (e) { if (e.message) { @@ -11088,11 +11124,11 @@ /* args */ { var context = this; var args = arguments; - _$1.each(editor.initializers, function (fn) { + _$1.each(editor$1.initializers, function (fn) { fn.call(context, args); }); }); app.addInitializer(function (options) { @@ -11101,11 +11137,11 @@ }).render(); new ScrollingView({ el: $('sidebar .scrolling'), region: app.sidebarRegion }).render(); - app.previewRegion.show(new editor.entryType.previewView({ + app.previewRegion.show(new editor$1.entryType.previewView({ model: state.entry })); app.indicatorsRegion.show(new DisabledAtmoIndicatorView()); app.notificationsRegion.show(new NotificationsView()); app.sidebarFooterRegion.show(new SidebarFooterView({ @@ -11169,12 +11205,12 @@ exports.EditorView = EditorView; exports.EmulationModeButtonView = EmulationModeButtonView; exports.EncodedFile = EncodedFile; exports.EncodingConfirmation = EncodingConfirmation; exports.Entry = Entry; - exports.EntryConfiguration = EntryConfiguration; - exports.EntryConfigurationFileSelectionHandler = EntryConfigurationFileSelectionHandler; + exports.EntryMetadata = EntryMetadata; + exports.EntryMetadataFileSelectionHandler = EntryMetadataFileSelectionHandler; exports.EntryPublication = EntryPublication; exports.EntryPublicationQuotaDecoratorView = EntryPublicationQuotaDecoratorView; exports.EnumTableCellView = EnumTableCellView; exports.ExplorerFileItemView = ExplorerFileItemView; exports.ExtendedSelectInputView = ExtendedSelectInputView; @@ -11295,10 +11331,10 @@ exports.app = app; exports.authenticationProvider = authenticationProvider; exports.cssModulesUtils = cssModulesUtils; exports.delayedDestroying = delayedDestroying; exports.dialogView = dialogView; - exports.editor = editor; + exports.editor = editor$1; exports.failureIndicatingView = failureIndicatingView; exports.failureTracking = failureTracking; exports.fileWithType = fileWithType; exports.filesCountWatcher = filesCountWatcher; exports.formDataUtils = formDataUtils;