this.pageflow = this.pageflow || {}; this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionette, $, I18n$1, ChildViewContainer, IScroll, jquery_minicolors, wysihtml5, Cocktail) { 'use strict'; Backbone = Backbone && Backbone.hasOwnProperty('default') ? Backbone['default'] : Backbone; _$1 = _$1 && _$1.hasOwnProperty('default') ? _$1['default'] : _$1; Marionette = Marionette && Marionette.hasOwnProperty('default') ? Marionette['default'] : Marionette; $ = $ && $.hasOwnProperty('default') ? $['default'] : $; I18n$1 = I18n$1 && I18n$1.hasOwnProperty('default') ? I18n$1['default'] : I18n$1; ChildViewContainer = ChildViewContainer && ChildViewContainer.hasOwnProperty('default') ? ChildViewContainer['default'] : ChildViewContainer; IScroll = IScroll && IScroll.hasOwnProperty('default') ? IScroll['default'] : IScroll; wysihtml5 = wysihtml5 && wysihtml5.hasOwnProperty('default') ? wysihtml5['default'] : wysihtml5; Cocktail = Cocktail && Cocktail.hasOwnProperty('default') ? Cocktail['default'] : Cocktail; (function () { var sync = Backbone.sync; Backbone.sync = function (method, model, options) { if (model.paramRoot && !options.attrs) { options.attrs = options.queryParams || {}; options.attrs[model.paramRoot] = model.toJSON(options); } return sync(method, model, options); }; })(); /*global JST*/ Marionette.Renderer.render = function (template, data) { if (_$1.isFunction(template)) { return template(data); } if (template.indexOf('templates/') === 0) { template = 'pageflow/editor/' + template; } if (!JST[template]) { throw "Template '" + template + "' not found!"; } return JST[template](data); }; /** * Helpers functions for handling translations. * * @memberof module:pageflow/ui */ /** * Returns an array of translation keys based on the `prefixes` * option and the given `keyName`. * * @param {string} keyName * Suffix to append to prefixes. * * @param {string[]} [options.prefixes] * Array of translation key prefixes. * * @param {string} [options.fallbackPrefix] * Optional additional prefix to form a model based translation * key of the form * `prefix.fallbackModelI18nKey.propertyName.keyName`. * * @param {string} [options.fallbackModelI18nKey] * Required if `fallbackPrefix` option is present. * * @return {string[]} * @since 12.0 */ function attributeTranslationKeys(attributeName, keyName, options) { var result = []; if (options.prefixes) { result = result.concat(_$1(options.prefixes).map(function (prefix) { return prefix + '.' + attributeName + '.' + keyName; }, this)); } if (options && options.fallbackPrefix) { result.push(options.fallbackPrefix + '.' + options.fallbackModelI18nKey + '.' + attributeName); } return result; } /** * Takes the same parameters as {@link * module:pageflow/ui.attributeTranslationKeys * i18nUtils.attributeTranslationKeys}, but returns the first * existing translation. * * @return {string} * @since 12.0 */ function attributeTranslation(attributeName, keyName, options) { return findTranslation(attributeTranslationKeys(attributeName, keyName, options)); } /** * Find the first key for which a translation exists and return the * translation. * * @param {string[]} keys * Translation key candidates. * * @param {string} [options.defaultValue] * Value to return if none of the keys has a translation. Is * treated like an HTML translation if html flag is set. * * @param {boolean} [options.html] * If true, also search for keys ending in '_html' and HTML-escape * keys that do not end in 'html' * * @return {string} */ function findTranslation(keys, options) { options = options || {}; if (options.html) { keys = translationKeysWithSuffix(keys, 'html'); } return _$1.chain(keys).reverse().reduce(function (result, key) { var unescapedTranslation = I18n$1.t(key, _$1.extend({}, options, { defaultValue: result })); if (!options.html || key.match(/_html$/) || result == unescapedTranslation) { return unescapedTranslation; } else { return $('
').text(unescapedTranslation).html(); } }, options.defaultValue).value(); } /** * Return the first key for which a translation exists. Returns the * first if non of the keys has a translation. * * @param {string[]} keys * Translation key candidates. * * @return {string} */ function findKeyWithTranslation(keys) { var missing = '_not_translated'; return _$1(keys).detect(function (key) { return I18n$1.t(key, { defaultValue: missing }) !== missing; }) || _$1.first(keys); } function translationKeysWithSuffix(keys, suffix) { return _$1.chain(keys).map(function (key) { return [key + '_' + suffix, key]; }).flatten().value(); } var i18nUtils = /*#__PURE__*/Object.freeze({ __proto__: null, attributeTranslationKeys: attributeTranslationKeys, attributeTranslation: attributeTranslation, findTranslation: findTranslation, findKeyWithTranslation: findKeyWithTranslation, translationKeysWithSuffix: translationKeysWithSuffix }); // https://github.com/jashkenas/backbone/issues/2601 function BaseObject(options) { this.initialize.apply(this, arguments); } _$1.extend(BaseObject.prototype, Backbone.Events, { initialize: function initialize(options) {} }); // The self-propagating extend function that Backbone classes use. BaseObject.extend = Backbone.Model.extend; var CollectionView = Marionette.View.extend({ initialize: function initialize() { this.rendered = false; this.itemViews = new ChildViewContainer(); this.collection.map(this.addItem, this); this.listenTo(this.collection, 'add', this.addItem); this.listenTo(this.collection, 'remove', this.removeItem); this.listenTo(this.collection, 'sort', this.sort); if (this.options.loadingViewConstructor) { this.listenTo(this.collection, 'request', function () { this.loading = true; this.togglePlaceHolder(); }); this.listenTo(this.collection, 'sync', function () { this.loading = false; this.togglePlaceHolder(); }); } }, render: function render() { if (!this.rendered) { this.$el.append(this.itemViews.map(function (itemView) { itemView.$el.data('view', itemView); return itemView.render().el; })); this.togglePlaceHolder(); this.rendered = true; } return this; }, onClose: function onClose() { this.itemViews.call('close'); this.closePlaceHolderView(); }, addItem: function addItem(item) { var view = new this.options.itemViewConstructor(_$1.extend({ model: item }, this.getItemViewOptions(item))); this.itemViews.add(view); if (this.rendered) { var index = this.collection.indexOf(item); view.render(); view.$el.data('view', view); if (index > 0) { this.$el.children().eq(index - 1).after(view.el); } else { this.$el.prepend(view.el); } this.togglePlaceHolder(); } }, removeItem: function removeItem(item) { var view = this.itemViews.findByModel(item); if (view) { this.itemViews.remove(view); view.close(); this.togglePlaceHolder(); } }, sort: function sort() { var last = null; this.collection.each(function (item) { var itemView = this.itemViews.findByModel(item); var element; if (!itemView) { return; } element = itemView.$el; if (last) { last.after(element); } else { this.$el.prepend(element); } last = element; }, this); }, getItemViewOptions: function getItemViewOptions(item) { if (typeof this.options.itemViewOptions === 'function') { return this.options.itemViewOptions(item); } else { return this.options.itemViewOptions || {}; } }, closePlaceHolderView: function closePlaceHolderView() { if (this.placeHolderView) { this.placeHolderView.close(); this.placeHolderView = null; } }, togglePlaceHolder: function togglePlaceHolder() { var lastPlaceholderConstructor = this.placeHolderConstructor; this.placeHolderConstructor = this.getPlaceHolderConstructor(); if (this.itemViews.length || !this.placeHolderConstructor) { this.closePlaceHolderView(); } else if (!this.placeHolderView || lastPlaceholderConstructor !== this.placeHolderConstructor) { this.closePlaceHolderView(); this.placeHolderView = new this.placeHolderConstructor(); this.$el.append(this.placeHolderView.render().el); } }, getPlaceHolderConstructor: function getPlaceHolderConstructor() { if (this.loading && this.options.loadingViewConstructor) { return this.options.loadingViewConstructor; } else if (this.options.blankSlateViewConstructor) { return this.options.blankSlateViewConstructor; } } }); var SortableCollectionView = CollectionView.extend({ render: function render() { CollectionView.prototype.render.call(this); this.$el.sortable({ connectWith: this.options.connectWith, placeholder: 'sortable-placeholder', forcePlaceholderSize: true, delay: 200, update: _$1.bind(function (event, ui) { if (ui.item.parent().is(this.el)) { this.updateOrder(); } }, this), receive: _$1.bind(function (event, ui) { var view = ui.item.data('view'); this.reindexPositions(); this.itemViews.add(view); this.collection.add(view.model); }, this), remove: _$1.bind(function (event, ui) { var view = ui.item.data('view'); this.itemViews.remove(view); this.collection.remove(view.model); }, this) }); return this; }, addItem: function addItem(item) { if (!this.itemViews.findByModel(item)) { CollectionView.prototype.addItem.call(this, item); } }, removeItem: function removeItem(item) { if (this.itemViews.findByModel(item)) { CollectionView.prototype.removeItem.call(this, item); } }, updateOrder: function updateOrder() { this.reindexPositions(); this.collection.sort(); this.collection.saveOrder(); }, reindexPositions: function reindexPositions() { this.$el.children().each(function (index) { $(this).data('view').model.set('position', index); }); } }); var ConfigurationEditorTabView = Marionette.View.extend({ className: 'configuration_editor_tab', initialize: function initialize() { this.inputs = new ChildViewContainer(); this.groups = this.options.groups || ConfigurationEditorTabView.groups; }, input: function input(propertyName, view, options) { this.view(view, _$1.extend({ placeholderModel: this.options.placeholderModel, propertyName: propertyName, attributeTranslationKeyPrefixes: this.options.attributeTranslationKeyPrefixes }, options || {})); }, view: function view(_view, options) { this.inputs.add(new _view(_$1.extend({ model: this.model, parentTab: this.options.tab }, options || {}))); }, group: function group(name, options) { this.groups.apply(name, this, options); }, render: function render() { this.inputs.each(function (input) { this.$el.append(input.render().el); }, this); return this; }, onClose: function onClose() { if (this.inputs) { this.inputs.call('close'); } } }); ConfigurationEditorTabView.Groups = function () { var groups = {}; this.define = function (name, fn) { if (typeof fn !== 'function') { throw 'Group has to be function.'; } groups[name] = fn; }; this.apply = function (name, context, options) { if (!(name in groups)) { throw 'Undefined group named "' + name + '".'; } groups[name].call(context, options || {}); }; }; ConfigurationEditorTabView.groups = new ConfigurationEditorTabView.Groups(); function template(data) { var __p = ''; __p += '', { text: item.label, "class": 'item-text' }).appendTo(container); $('
', {
text: options.descriptions[index],
"class": 'item-description'
}).appendTo(container);
if (options.helpLinkClicked) {
$('', {
href: '#',
title: I18n$1.t('pageflow.ui.views.extended_select_input_view.display_help')
}).on('click', function () {
widget.close();
options.helpLinkClicked(item.value);
return false;
}).appendTo(li);
}
return li.appendTo(ul);
},
_resizeMenu: function _resizeMenu() {
this.menuWrap.addClass('extended_select_input_menu');
var menuHeight = this.menu.height(),
menuOffset = this.button.offset().top + this.button.outerHeight(),
bodyHeight = $('body').height();
if (menuHeight + menuOffset > bodyHeight) {
this.menuWrap.outerHeight(bodyHeight - menuOffset - 5).css({
'overflow-y': 'scroll'
});
} else {
this.menuWrap.css({
height: 'initial',
'overflow-y': 'initial'
});
}
}
});
this.ui.select.extendedselectmenu({
select: view.select.bind(view),
width: '100%',
position: {
my: 'right top',
at: 'right bottom'
}
});
},
select: function select(event, ui) {
this.ui.select.val(ui.item.value);
this.save();
}
});
function template$8(data) {
var __t, __p = '';
__p += '\n\n\n\n\n \n ' +
((__t = ( I18n.t('pageflow.editor.templates.confirm_encoding.all_released') )) == null ? '' : __t) +
'\n \n ' +
((__t = ( I18n.t('pageflow.editor.templates.confirm_encoding.link_to_progress', {
link: ''+I18n.t('pageflow.editor.templates.confirm_encoding.manage_files')+''})
)) == null ? '' : __t) +
'\n ' +
((__t = ( I18n.t('pageflow.editor.templates.edit_chapter.save_error') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.templates.background_positioning.help') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.templates.edit_meta_data.save_error') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.templates.edit_page.save_error') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.templates.edit_storyline.save_error') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.templates.confirm_upload.hint') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.templates.publish_entry.files_pending_notice') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.templates.publish_entry.published_notice') )) == null ? '' : __t) +
' \n ' +
((__t = ( I18n.t('pageflow.editor.templates.publish_entry.already_published_with_password_help') )) == null ? '' : __t) +
'\n \n ' +
((__t = ( I18n.t('pageflow.editor.templates.publish_entry.previously_published_with_password_help') )) == null ? '' : __t) +
'\n \n ' +
((__t = ( I18n.t('pageflow.editor.templates.publish_entry.already_published_without_password_help') )) == null ? '' : __t) +
'\n ' +
((__t = ( I18n.t('pageflow.editor.templates.publish_entry.publish_success') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.templates.publish_entry.published_url_hint') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.blank_entry.intro') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.blank_entry.outro') )) == null ? '' : __t) +
' ' +
((__t = ( I18n.t('pageflow.editor.templates.locked.loading') )) == null ? '' : __t) +
'' +
((__t = ( I18n.t('pageflow.editor.templates.confirm_encoding.videos_tab') )) == null ? '' : __t) +
'
\n' +
((__t = ( I18n.t('pageflow.editor.templates.confirm_encoding.audios_tab') )) == null ? '' : __t) +
'
\n\n\n' +
((__t = ( I18n.t('pageflow.editor.templates.chapter_item.new_page') )) == null ? '' : __t) +
'\n';
return __p
}
var ChapterItemView = Marionette.ItemView.extend({
tagName: 'li',
template: template$o,
ui: {
title: '> a > .title',
number: '> a > .number',
pages: 'ul.pages'
},
modelEvents: {
change: 'update'
},
onRender: function onRender() {
var collectionView = this.options.sortable ? SortableCollectionView : CollectionView;
this.subview(new collectionView({
el: this.ui.pages,
collection: this.model.pages,
itemViewConstructor: this.options.pageItemView || NavigatablePageItemView,
itemViewOptions: this.options.pageItemViewOptions,
connectWith: 'ul.pages'
}));
this.update();
},
update: function update() {
this.ui.title.text(this.model.get('title') || I18n$1.t('pageflow.editor.views.chapter_item_view.unnamed'));
this.ui.number.text(I18n$1.t('pageflow.editor.views.chapter_item_view.chapter') + ' ' + (this.model.get('position') + 1));
}
});
var NavigatableChapterItemView = ChapterItemView.extend({
mixins: [loadable, failureIndicatingView],
events: {
'click a.add_page': function clickAAdd_page() {
this.model.addPage();
},
'click a.edit_chapter': function clickAEdit_chapter() {
if (!this.model.isNew() && !this.model.isDestroying()) {
editor.navigate('/chapters/' + this.model.get('id'), {
trigger: true
});
}
return false;
}
}
});
function template$p(data) {
var __t, __p = '';
__p += '
' +
((__t = ( I18n.t('pageflow.editor.templates.storyline_outline.header') )) == null ? '' : __t) +
'
\n\n\n' +
((__t = ( I18n.t('pageflow.editor.templates.storyline_outline.new_chapter') )) == null ? '' : __t) +
'\n';
return __p
}
var StorylineOutlineView = Marionette.Layout.extend({
template: template$p,
className: 'storyline_outline',
ui: {
chapters: 'ul.storyline_outline_chapters'
},
events: {
'click a.add_chapter': function clickAAdd_chapter() {
this.model.scaffoldChapter();
}
},
onRender: function onRender() {
this.ui.chapters.toggleClass('outline navigatable', !!this.options.navigatable);
var collectionView = this.options.sortable ? SortableCollectionView : CollectionView;
new collectionView({
el: this.ui.chapters,
collection: this.model.chapters,
itemViewConstructor: this.options.navigatable ? NavigatableChapterItemView : ChapterItemView,
itemViewOptions: {
sortable: this.options.sortable,
pageItemView: this.options.navigatable ? NavigatablePageItemView : PageItemView,
pageItemViewOptions: _$1.extend({
displayInNavigationHint: this.options.displayInNavigationHint
}, this.options.pageItemViewOptions || {})
}
}).render();
}
});
function template$q(data) {
var __t, __p = '';
__p += '\n\n\n';
return __p
}
var StorylinePickerView = Marionette.Layout.extend({
template: template$q,
className: 'storyline_picker',
regions: {
selectRegion: '.storyline_picker_select_region',
mainRegion: '.storyline_picker_main_region'
},
ui: {
storylines: '.storyline_picker_storylines'
},
events: {
'click .add_storyline': function clickAdd_storyline() {
var storyline = state.entry.scaffoldStoryline({
depth: 'page'
}).storyline;
this.listenToOnce(storyline, 'sync', function () {
this.updateSelect();
this.model.set('storyline_id', storyline.id);
});
return false;
},
'click .edit_storyline': function clickEdit_storyline() {
editor.navigate('storylines/' + this.model.get('storyline_id'), {
trigger: true
});
return false;
}
},
initialize: function initialize() {
this.model = new Backbone.Model({
storyline_id: this.defaultStorylineId()
});
this.listenTo(state.storylines, 'add sort remove', this.updateSelect);
this.listenTo(this.model, 'change', this.load);
},
onRender: function onRender() {
this.$el.toggleClass('editable', !!this.options.editable);
this.ui.storylines.toggle(!!pageflow.features.isEnabled('storylines'));
this.updateSelect();
this.load();
},
updateSelect: function updateSelect() {
this.selectRegion.show(new SelectInputView({
model: this.model,
label: I18n$1.t('pageflow.editor.views.storylines_picker_view.label'),
propertyName: 'storyline_id',
values: state.storylines.pluck('id'),
texts: state.storylines.map(function (storyline) {
return this.indentation(storyline) + storyline.displayTitle();
}, this),
groups: state.storylines.reduce(function (result, storyline) {
if (storyline.isMain() || storyline.parentPage()) {
result.push(_$1.last(result));
} else {
result.push(I18n$1.t('pageflow.editor.views.storylines_picker_view.without_parent_page'));
}
return result;
}, [])
}));
},
load: function load() {
var storyline = state.storylines.get(this.model.get('storyline_id'));
this.saveRememberedStorylineId(storyline.id);
this.mainRegion.show(new StorylineOutlineView({
model: storyline,
navigatable: this.options.navigatable,
sortable: this.options.editable,
chapterItemView: this.options.chapterItemView,
pageItemView: this.options.pageItemView,
pageItemViewOptions: this.options.pageItemViewOptions,
displayInNavigationHint: this.options.displayInNavigationHint
}));
},
defaultStorylineId: function defaultStorylineId() {
var storyline = state.storylines.get(this.options.storylineId) || state.storylines.get(this.rememberedStorylineId()) || state.storylines.first();
return storyline.id;
},
rememberedStorylineId: function rememberedStorylineId() {
if (this.options.rememberLastSelection) {
return StorylinePickerView._rememberedStorylineId;
}
},
saveRememberedStorylineId: function saveRememberedStorylineId(id) {
if (this.options.rememberLastSelection) {
StorylinePickerView._rememberedStorylineId = id;
}
},
indentation: function indentation(storyline) {
return _$1(storyline.get('level') || 0).times(function () {
return "\xA0\xA0\xA0";
}).join('');
}
});
function template$r(data) {
var __t, __p = '';
__p += '' +
((__t = ( I18n.t('pageflow.editor.templates.edit_entry.close') )) == null ? '' : __t) +
'\n\n ' +
((__t = ( I18n.t('pageflow.editor.templates.edit_entry.publish') )) == null ? '' : __t) +
'\n\n\n \n\n\n';
return __p
}
var EditEntryView = Marionette.ItemView.extend({
template: template$r,
mixins: [failureIndicatingView, tooltipContainer],
ui: {
publishButton: 'a.publish',
publicationStateButton: 'a.publication_state',
menu: '.menu',
storylines: '.edit_entry_storylines'
},
events: {
'click a.close': function clickAClose() {
$.when(state.editLock.release()).then(function () {
window.location = '/admin/entries/' + state.entry.id;
});
},
'click a.publish': function clickAPublish() {
if (!this.ui.publishButton.hasClass('disabled')) {
editor.navigate('/publish', {
trigger: true
});
}
return false;
},
'click .menu a': function clickMenuA(event) {
editor.navigate($(event.target).data('path'), {
trigger: true
});
return false;
}
},
onRender: function onRender() {
this._addMenuItems();
this._updatePublishButton();
this.subview(new StorylinePickerView({
el: this.ui.storylines,
navigatable: true,
editable: true,
displayInNavigationHint: true,
rememberLastSelection: true,
storylineId: this.options.storylineId
}));
},
_updatePublishButton: function _updatePublishButton() {
var disabled = !state.entry.get('publishable');
this.ui.publishButton.toggleClass('disabled', disabled);
if (disabled) {
this.ui.publishButton.attr('data-tooltip', 'pageflow.editor.views.edit_entry_view.cannot_publish');
} else {
this.ui.publishButton.removeAttr('data-tooltip');
}
},
_addMenuItems: function _addMenuItems() {
var view = this;
_$1.each(editor.mainMenuItems, function (options) {
var item = $('
' +
((__t = ( I18n.t('pageflow.editor.templates.background_positioning.title') )) == null ? '' : __t) +
'
\n ' +
((__t = ( I18n.t('pageflow.editor.templates.background_positioning.preview_title') )) == null ? '' : __t) +
'
\n ' +
((__t = ( I18n.t('pageflow.editor.templates.change_theme_dialog.header') )) == null ? '' : __t) +
'
\n ' +
((__t = ( I18n.t('pageflow.editor.templates.change_theme_dialog.preview_header_prefix') )) == null ? '' : __t) +
'\n ' +
((__t = ( I18n.t('pageflow.editor.templates.change_theme_dialog.preview_header_suffix') )) == null ? '' : __t) +
'\n
\n ' +
((__t = ( I18n.t('pageflow.editor.templates.files_explorer.reuse_files') )) == null ? '' : __t) +
'
\n\n \n
\n\n \n ';
return __p
}
var FileMetaDataItemView = Marionette.ItemView.extend({
tagName: 'tr',
template: template$N,
ui: {
label: 'th',
value: 'td'
},
onRender: function onRender() {
this.subview(new this.options.valueView(_$1.extend({
el: this.ui.value,
model: this.model,
name: this.options.name
}, this.options.valueViewOptions || {})));
this.ui.label.text(this.labelText());
},
labelText: function labelText() {
return attributeTranslation(this.options.name, 'label', {
prefixes: ['pageflow.editor.files.attributes.' + this.model.fileType().collectionName, 'pageflow.editor.files.common_attributes'],
fallbackPrefix: 'activerecord.attributes',
fallbackModelI18nKey: this.model.i18nKey
});
}
});
function template$O(data) {
var __p = '';
__p += '\n\n';
return __p
}
var FileStageItemView = Marionette.ItemView.extend({
tagName: 'li',
className: 'file_stage_item',
template: template$O,
ui: {
description: '.description',
percent: '.percent',
errorMessage: '.error_message'
},
modelEvents: {
'change': 'update'
},
onRender: function onRender() {
this.update();
this.$el.addClass(this.model.get('name'));
if (this.options.standAlone) {
this.$el.addClass('stand_alone');
} else {
this.$el.addClass('indented');
}
},
update: function update() {
this.ui.description.text(this.model.localizedDescription());
if (typeof this.model.get('progress') === 'number' && this.model.get('active')) {
this.ui.percent.text(this.model.get('progress') + '%');
} else {
this.ui.percent.text('');
}
this.ui.errorMessage.toggle(!!this.model.get('error_message')).text(this._translatedErrorMessage());
this.$el.toggleClass('active', this.model.get('active'));
this.$el.toggleClass('finished', this.model.get('finished'));
this.$el.toggleClass('failed', this.model.get('failed'));
this.$el.toggleClass('action_required', this.model.get('action_required'));
},
_translatedErrorMessage: function _translatedErrorMessage() {
return this.model.get('error_message') && I18n$1.t(this.model.get('error_message'), {
defaultValue: this.model.get('error_message')
});
}
});
function template$P(data) {
var __t, __p = '';
__p += '\n\n\n' +
((__t = ( I18n.t('pageflow.editor.templates.file_item.select') )) == null ? '' : __t) +
'\n\n\n\n \n\n \n
' +
((__t = ( I18n.t('pageflow.editor.views.files_view.importer.heading') )) == null ? '' : __t) +
'
\n\n \n
\n ' +
((__t = ( I18n.t('pageflow.editor.file_importers.'+data.importerKey+'.dialog_label') )) == null ? '' : __t) +
'
\n\n ' +
((__t = ( I18n.t('pageflow.editor.templates.confirm_upload.header') )) == null ? '' : __t) +
'
\n ' +
((__t = ( I18n.t('pageflow.editor.templates.confirm_upload.edit_file_header') )) == null ? '' : __t) +
'
\n ' +
((__t = ( I18n.t('pageflow.editor.templates.publish_entry.publish_current') )) == null ? '' : __t) +
'
\n\n ' +
((__t = ( I18n.t('pageflow.editor.blank_entry.header') )) == null ? '' : __t) +
'
\n\n
\n' +
((__t = ( I18n.t('pageflow.editor.templates.help.title') )) == null ? '' : __t) +
'
\n\n \n\n \n\n\n' +
((__t = ( I18n.t('pageflow.editor.templates.page_links.add') )) == null ? '' : __t) +
'\n';
return __p
}
var PageLinksView = Marionette.ItemView.extend({
template: template$11,
className: 'page_links',
ui: {
links: 'ul.links',
addButton: '.add_link'
},
events: {
'click .add_link': function clickAdd_link() {
var view = this;
editor.selectPage().then(function (page) {
view.model.pageLinks().addLink(page.get('perma_id'));
});
return false;
}
},
onRender: function onRender() {
var pageLinks = this.model.pageLinks();
var collectionViewConstructor = pageLinks.saveOrder ? SortableCollectionView : CollectionView;
this.subview(new collectionViewConstructor({
el: this.ui.links,
collection: pageLinks,
itemViewConstructor: PageLinkItemView,
itemViewOptions: {
pageLinks: pageLinks
}
}));
this.listenTo(pageLinks, 'add remove', function () {
this.updateAddButton(pageLinks);
});
this.updateAddButton(pageLinks);
},
updateAddButton: function updateAddButton(pageLinks) {
this.ui.addButton.css('display', pageLinks.canAddLink() ? 'inline-block' : 'none');
}
});
function template$12(data) {
var __t, __p = '';
__p += ' \n \n \n';
return __p
}
var EmulationModeButtonView = Marionette.ItemView.extend({
template: template$12,
className: 'emulation_mode_button',
ui: {
phoneItem: '.emulation_mode_button-phone',
desktopItem: '.emulation_mode_button-desktop',
phoneDisplay: '.emulation_mode_button-display.emulation_mode_button-phone',
desktopDisplay: '.emulation_mode_button-display.emulation_mode_button-desktop'
},
events: {
'click .emulation_mode_button-desktop a': function clickEmulation_mode_buttonDesktopA() {
this.model.unset('emulation_mode');
},
'click .emulation_mode_button-phone a': function clickEmulation_mode_buttonPhoneA() {
if (!this.model.get('current_page_supports_emulation_mode')) {
return;
}
this.model.set('emulation_mode', 'phone');
}
},
modelEvents: {
'change:emulation_mode change:current_page_supports_emulation_mode': 'update'
},
onRender: function onRender() {
this.update();
},
update: function update() {
this.ui.phoneItem.toggleClass('disabled', !this.model.get('current_page_supports_emulation_mode'));
this.ui.phoneItem.toggleClass('active', this.model.has('emulation_mode'));
this.ui.desktopItem.toggleClass('active', !this.model.has('emulation_mode'));
this.ui.phoneDisplay.toggleClass('active', this.model.has('emulation_mode'));
this.ui.desktopDisplay.toggleClass('active', !this.model.has('emulation_mode'));
}
});
function template$13(data) {
var __t, __p = '';
__p +=
((__t = ( I18n.t('pageflow.editor.templates.help_button.open_help') )) == null ? '' : __t);
return __p
}
var HelpButtonView = Marionette.ItemView.extend({
template: template$13,
className: 'help_button',
events: {
'click': function click() {
app.trigger('toggle-help');
}
}
});
var SidebarFooterView = Marionette.View.extend({
className: 'sidebar_footer',
render: function render() {
if (pageflow.features.isEnabled('editor_emulation_mode')) {
this.appendSubview(new EmulationModeButtonView({
model: this.model
}));
}
this.appendSubview(new HelpButtonView());
return this;
}
});
function template$14(data) {
var __t, __p = '';
__p += '
' +
((__t = ( I18n.t('pageflow.editor.templates.page_selection.title') )) == null ? '' : __t) +
'
\n\n ' +
((__t = ( I18n.t('pageflow.editor.templates.text_tracks.edit_file_header') )) == null ? '' : __t) +
'
\n \n';
return __p
}
function blankSlateTemplate$2(data) {
var __t, __p = '';
__p +=
((__t = ( I18n.t('pageflow.editor.templates.list_blank_slate.text') )) == null ? '' : __t) +
'\n';
return __p
}
/**
* A generic list view with items consisting of a thumbnail, text and
* possibly some buttons or a navigation arrow.
*
* Models inside the collection must implement the following methods:
*
* @param {Backbone.Collection} options.collection
*
* @param {string} options.label
* Text of the label to display above the list.
*
* @param {boolean} [options.highlight=false]
*
* @param {boolean} [options.sortable=false]
*
* @param {string|function} [options.itemDescription]
*
* @param {string|function} [options.itemTypeName]
*
* @param {string|function} [options.itemTypeDescription]
*
* @param {string|function} [options.itemIsInvalid]
*
* @param {function} [options.onEdit]
*
* @param {function} [options.onRemove]
*
* @class
* @memberof module:pageflow/editor
*/
var ListView = Marionette.ItemView.extend({
template: template$1b,
className: 'list',
ui: {
label: '.list_label',
items: '.list_items'
},
onRender: function onRender() {
var collectionViewConstructor = this.options.sortable ? SortableCollectionView : CollectionView;
this.subview(new collectionViewConstructor({
el: this.ui.items,
collection: this.collection,
itemViewConstructor: ListItemView,
itemViewOptions: _$1.extend({
description: this.options.itemDescription,
typeName: this.options.itemTypeName,
typeDescription: this.options.itemTypeDescription,
isInvalid: this.options.itemIsInvalid
}, _$1(this.options).pick('onEdit', 'onDelete', 'highlight')),
blankSlateViewConstructor: Marionette.ItemView.extend({
tagName: 'li',
className: 'list_blank_slate',
template: blankSlateTemplate$2
})
}));
this.ui.label.text(this.options.label);
this.$el.toggleClass('with_type_pictogram', !!this.options.itemTypeName);
}
});
var ConfirmUploadView = Marionette.Layout.extend({
template: template$U,
className: 'confirm_upload editor dialog',
mixins: [dialogView],
regions: {
selectedFileRegion: '.selected_file_region'
},
ui: {
filesPanel: '.files_panel'
},
events: {
'click .upload': function clickUpload() {
this.options.fileUploader.submit();
this.close();
}
},
initialize: function initialize() {
this.selection = new Backbone.Model();
this.listenTo(this.selection, 'change', this.update);
},
onRender: function onRender() {
this.options.fileTypes.each(function (fileType) {
this.ui.filesPanel.append(this.subview(new UploadableFilesView({
collection: this.options.files[fileType.collectionName],
fileType: fileType,
selection: this.selection
})).el);
}, this);
this.update();
},
onClose: function onClose() {
this.options.fileUploader.abort();
},
update: function update() {
var file = this.selection.get('file');
if (file) {
this.selectedFileRegion.show(new EditFileView({
model: file
}));
} else {
this.selectedFileRegion.close();
}
}
});
ConfirmUploadView.watch = function (fileUploader, fileTypes, files) {
fileUploader.on('new:batch', function () {
ConfirmUploadView.open({
fileUploader: fileUploader,
fileTypes: fileTypes,
files: files
});
});
};
ConfirmUploadView.open = function (options) {
app.dialogRegion.show(new ConfirmUploadView(options));
};
ConfigurationEditorView.register('audio', {
configure: function configure() {
this.tab('general', function () {
this.group('general', {
supportsTextPositionCenter: true
});
this.input('additional_title', TextInputView);
this.input('additional_description', TextAreaInputView, {
size: 'short'
});
});
this.tab('files', function () {
this.input('audio_file_id', FileInputView, {
collection: state.audioFiles,
defaultTextTrackFilePropertyName: 'default_text_track_file_id'
});
this.group('background');
this.input('thumbnail_image_id', FileInputView, {
collection: state.imageFiles,
positioning: false
});
});
this.tab('options', function () {
if (pageflow.features.isEnabled('waveform_player_controls')) {
this.input('audio_player_controls_variant', SelectInputView, {
values: ['default', 'waveform']
});
}
this.input('waveform_color', ColorInputView, {
visibleBinding: 'audio_player_controls_variant',
visibleBindingValue: 'waveform',
defaultValue: pageflow.theme.mainColor(),
swatches: usedWaveformColors()
});
this.input('autoplay', CheckBoxInputView);
this.group('options', {
canPauseAtmo: true
});
});
function usedWaveformColors() {
return _$1.chain(state.pages.map(function (page) {
return page.configuration.get('waveform_color');
})).uniq().compact().value();
}
}
});
ConfigurationEditorView.register('background_image', {
configure: function configure() {
this.tab('general', function () {
this.group('general', {
supportsTextPositionCenter: true
});
});
this.tab('files', function () {
this.group('background');
this.input('thumbnail_image_id', FileInputView, {
collection: state.imageFiles,
positioning: false
});
});
this.tab('options', function () {
this.group('options');
});
}
});
ConfigurationEditorView.register('video', {
configure: function configure() {
this.tab('general', function () {
this.group('general', {
supportsTextPositionCenter: true
});
this.input('additional_title', TextInputView);
this.input('additional_description', TextAreaInputView, {
size: 'short'
});
});
this.tab('files', function () {
this.input('video_file_id', FileInputView, {
collection: state.videoFiles,
positioning: false,
defaultTextTrackFilePropertyName: 'default_text_track_file_id'
});
this.input('poster_image_id', FileInputView, {
collection: state.imageFiles,
positioning: false
});
this.input('mobile_poster_image_id', FileInputView, {
collection: state.imageFiles,
positioning: true
});
this.input('thumbnail_image_id', FileInputView, {
collection: state.imageFiles,
positioning: false
});
});
this.tab('options', function () {
this.input('autoplay', CheckBoxInputView);
if (pageflow.features.isEnabled('auto_change_page')) {
this.input('auto_change_page_on_ended', CheckBoxInputView);
}
this.group('options', {
canPauseAtmo: true
});
});
}
});
ConfigurationEditorTabView.groups.define('background', function (options) {
options = options || {};
var prefix = options.propertyNamePrefix ? options.propertyNamePrefix + '_' : '';
var backgroundTypeProperty = prefix + 'background_type';
this.input(backgroundTypeProperty, SelectInputView, {
values: ['image', 'video'],
ensureValueDefined: true
});
this.input(prefix + 'background_image_id', FileInputView, {
collection: state.imageFiles,
visibleBinding: backgroundTypeProperty,
visibleBindingValue: 'image',
fileSelectionHandlerOptions: options
});
this.input(prefix + 'video_file_id', FileInputView, {
collection: state.videoFiles,
visibleBinding: backgroundTypeProperty,
visibleBindingValue: 'video',
fileSelectionHandlerOptions: options
});
this.input(prefix + 'poster_image_id', FileInputView, {
collection: state.imageFiles,
visibleBinding: backgroundTypeProperty,
visibleBindingValue: 'video',
fileSelectionHandlerOptions: options
});
this.input(prefix + 'mobile_poster_image_id', FileInputView, {
collection: state.imageFiles,
visibleBinding: backgroundTypeProperty,
visibleBindingValue: 'video',
fileSelectionHandlerOptions: options
});
});
ConfigurationEditorTabView.groups.define('general', function (options) {
this.input('title', TextInputView, {
required: true,
maxLength: 5000
});
this.input('hide_title', CheckBoxInputView);
this.input('tagline', TextInputView, {
maxLength: 5000
});
this.input('subtitle', TextInputView, {
maxLength: 5000
});
this.input('text', TextAreaInputView, {
fragmentLinkInputView: PageLinkInputView,
enableLists: true
});
this.input('text_position', SelectInputView, {
values: options.supportsTextPositionCenter ? Page.textPositions : Page.textPositionsWithoutCenterOption
});
this.input('gradient_opacity', SliderInputView);
this.input('invert', CheckBoxInputView);
});
ConfigurationEditorTabView.groups.define('page_link', function () {
this.input('label', TextInputView);
this.input('target_page_id', PageLinkInputView);
this.group('page_transitions', {
includeBlank: true
});
});
ConfigurationEditorTabView.groups.define('page_transitions', function (options) {
var inputOptions = {
translationKeyPrefix: 'pageflow.page_transitions',
blankTranslationKey: 'pageflow.page_transitions.default',
values: pageflow.pageTransitions.names()
};
if (pageflow.navigationDirection.isHorizontalOnPhone()) {
inputOptions.additionalInlineHelpText = I18n$1.t('pageflow.editor.phone_horizontal_slideshow_mode.page_transitions_inline_help');
}
this.input(options.propertyName || 'page_transition', SelectInputView, _$1.extend(inputOptions, options));
});
ConfigurationEditorTabView.groups.define('options', function (options) {
var theme = state.entry.getTheme();
this.input('display_in_navigation', CheckBoxInputView);
if (theme.supportsEmphasizedPages()) {
this.input('emphasize_in_navigation', CheckBoxInputView);
}
this.group('page_transitions', {
propertyName: 'transition'
});
if (pageflow.features.isEnabled('delayed_text_fade_in')) {
this.input('delayed_text_fade_in', SelectInputView, {
values: Page.delayedTextFadeIn
});
}
this.input('description', TextAreaInputView, {
size: 'short',
disableLinks: true
});
this.input('atmo_audio_file_id', FileInputView, {
collection: state.audioFiles
});
if (options.canPauseAtmo) {
this.input('atmo_during_playback', SelectInputView, {
values: pageflow.Atmo.duringPlaybackModes
});
}
if (theme.supportsScrollIndicatorModes()) {
this.input('scroll_indicator_mode', SelectInputView, {
values: Page.scrollIndicatorModes
});
this.input('scroll_indicator_orientation', SelectInputView, {
values: Page.scrollIndicatorOrientations
});
}
});
editor.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')
});
});
}
})
});
editor.widgetTypes.registerRole('cookie_notice', {
isOptional: true
});
editor.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')
});
});
}
})
});
editor.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')
});
this.input('custom_background_image_id', FileInputView, {
collection: 'image_files',
fileSelectionHandler: 'widgetConfiguration'
});
this.input('invert', CheckBoxInputView);
this.input('remove_logo', CheckBoxInputView);
this.input('blur_strength', SliderInputView);
});
}
})
});
editor.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')
});
this.view(HelpImageView, {
imageName: 'phone_horizontal_slideshow_mode'
});
});
}
})
});
editor.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')
});
this.input('subtitle', TextInputView);
this.input('custom_background_image_id', FileInputView, {
collection: 'image_files',
fileSelectionHandler: 'widgetConfiguration'
});
this.input('invert', CheckBoxInputView);
this.input('remove_logo', CheckBoxInputView);
this.input('blur_strength', SliderInputView);
});
}
})
});
app.addInitializer(function (options) {
state.config = options.config;
});
app.addInitializer(function (options) {
state.editorAssetUrls = options.asset_urls;
});
app.addInitializer(function (options) {
state.seed = options.common;
});
app.addInitializer(function (options) {
pageflow.features.enable('editor', options.entry.enabled_feature_names);
});
app.addInitializer(function (options) {
pageflow.Audio.setup({
getSources: function getSources(audioFileId) {
var file = state.audioFiles.getByPermaId(audioFileId);
return file ? file.getSources() : '';
}
});
});
app.addInitializer(function () {
Backbone.history.on('route', function () {
editor.applyDefaultHelpEntry();
});
});
app.addInitializer(function (options) {
var textTracksMetaDataAttribute = {
name: 'text_tracks',
valueView: TextTracksFileMetaDataItemValueView,
valueViewOptions: {
settingsDialogTabLink: 'text_tracks'
}
};
var textTracksSettingsDialogTab = {
name: 'text_tracks',
view: TextTracksView,
viewOptions: {
supersetCollection: function supersetCollection() {
return state.textTrackFiles;
}
}
};
var altMetaDataAttribute = {
name: 'alt',
valueView: TextFileMetaDataItemValueView,
valueViewOptions: {
fromConfiguration: true,
settingsDialogTabLink: 'general'
}
};
editor.fileTypes.register('image_files', {
model: ImageFile,
metaDataAttributes: ['dimensions', altMetaDataAttribute],
matchUpload: /^image/,
configurationEditorInputs: [{
name: 'alt',
inputView: TextInputView
}]
});
editor.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', {
model: AudioFile,
metaDataAttributes: ['format', 'duration', textTracksMetaDataAttribute, altMetaDataAttribute],
matchUpload: /^audio/,
configurationEditorInputs: [{
name: 'alt',
inputView: TextInputView
}],
settingsDialogTabs: [textTracksSettingsDialogTab]
});
editor.fileTypes.register('text_track_files', {
model: TextTrackFile,
matchUpload: function matchUpload(upload) {
return upload.name.match(/\.vtt$/) || upload.name.match(/\.srt$/);
},
skipUploadConfirmation: true,
configurationEditorInputs: [{
name: 'label',
inputView: TextInputView,
inputViewOptions: {
placeholder: function placeholder(configuration) {
var textTrackFile = configuration.parent;
return textTrackFile.inferredLabel();
},
placeholderBinding: TextTrackFile.displayLabelBinding
}
}, {
name: 'kind',
inputView: SelectInputView,
inputViewOptions: {
values: state.config.availableTextTrackKinds,
translationKeyPrefix: 'pageflow.config.text_track_kind'
}
}, {
name: 'srclang',
inputView: TextInputView,
inputViewOptions: {
required: true
}
}],
nestedFileTableColumns: [{
name: 'label',
cellView: TextTableCellView,
value: function value(textTrackFile) {
return textTrackFile.displayLabel();
},
contentBinding: TextTrackFile.displayLabelBinding
}, {
name: 'srclang',
cellView: TextTableCellView,
"default": I18n$1.t('pageflow.editor.text_track_files.srclang_missing')
}, {
name: 'kind',
cellView: IconTableCellView,
cellViewOptions: {
icons: state.config.availableTextTrackKinds
}
}],
nestedFilesOrder: {
comparator: function comparator(textTrackFile) {
return textTrackFile.displayLabel().toLowerCase();
},
binding: 'label'
}
});
editor.fileTypes.setup(options.config.fileTypes);
});
app.addInitializer(function (options) {
editor.widgetTypes.registerRole('navigation', {
isOptional: true
});
editor.widgetTypes.setup(options.widget_types);
});
app.addInitializer(function (options) {
state.files = FilesCollection.createForFileTypes(editor.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
});
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 = new Entry(options.entry, {
widgets: widgets
});
state.theming = new Theming(options.theming);
state.account = new Backbone.Model(options.account);
widgets.subject = state.entry;
state.entryData = new PreviewEntryData({
entry: state.entry,
storylines: state.storylines,
chapters: state.chapters,
pages: state.pages
});
state.storylineOrdering = new StorylineOrdering(state.storylines, state.pages);
state.storylineOrdering.sort({
silent: true
});
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);
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
});
ConfirmUploadView.watch(state.fileUploader, editor.fileTypes, state.files);
});
app.addInitializer(function (options) {
editor.pageTypes.setup(options.page_types);
});
app.addInitializer(function (options) {
var KEY_A = 65;
var KEY_X = 88;
$(document).on('keydown', function (event) {
if (event.altKey && event.which === KEY_A) {
if (pageflow.atmo.disabled) {
pageflow.atmo.enable();
} else {
pageflow.atmo.disable();
}
} else if (event.altKey && event.which === KEY_X) {
editor.navigate('pages/' + pageflow.slides.currentPage().data('id'), {
trigger: true
});
}
});
});
app.addInitializer(function (options) {
editor.fileImporters.setup(options.config.fileImporters);
});
app.addInitializer(function (options) {
state.editLock = new EditLockContainer();
state.editLock.watchForErrors();
state.editLock.acquire();
});
app.addInitializer(function (options) {
state.entry.pollForPendingFiles();
});
app.addInitializer(function (options) {
state.entry.on('change:pending_files_count', function (model, value) {
if (value < state.entry.previous('pending_files_count')) {
pageflow.stylesheet.reload('entry');
}
});
state.entry.on('use:files', function () {
pageflow.stylesheet.reload('entry');
});
state.entry.configuration.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) {
new options.router({
controller: new options.controller({
region: app.sidebarRegion,
entry: state.entry
})
});
});
editor.router = new SidebarRouter({
controller: new SidebarController({
region: app.sidebarRegion,
entry: state.entry
})
});
window.editor = editor.router;
});
app.addInitializer(function () {
app.on('error', function (e) {
if (e.message) {
alert(e.message);
} else {
alert(I18n$1.t(e.name, {
scope: 'pageflow.editor.errors',
defaultValue: I18n$1.t('pageflow.editor.errors.unknown')
}));
}
});
});
app.addInitializer(function ()
/* args */
{
var context = this;
var args = arguments;
_$1.each(editor.initializers, function (fn) {
fn.call(context, args);
});
});
app.addInitializer(function (options) {
new EditorView({
el: $('body')
}).render();
new ScrollingView({
el: $('sidebar .scrolling'),
region: app.sidebarRegion
}).render();
app.previewRegion.show(new EntryPreviewView({
model: state.entry
}));
app.indicatorsRegion.show(new DisabledAtmoIndicatorView());
app.notificationsRegion.show(new NotificationsView());
app.sidebarFooterRegion.show(new SidebarFooterView({
model: state.entry
}));
Backbone.history.start({
root: options.root
});
});
app.addRegions({
previewRegion: '#entry_preview',
mainRegion: '#main_content',
indicatorsRegion: '#editor_indicators',
sidebarRegion: 'sidebar .container',
dialogRegion: '.dialog_container',
notificationsRegion: 'sidebar .notifications_container',
sidebarFooterRegion: 'sidebar .sidebar_footer_container'
});
exports.AudioFile = AudioFile;
exports.BackButtonDecoratorView = BackButtonDecoratorView;
exports.BackgroundImageEmbeddedView = BackgroundImageEmbeddedView;
exports.BackgroundPositioningPreviewView = BackgroundPositioningPreviewView;
exports.BackgroundPositioningSlidersView = BackgroundPositioningSlidersView;
exports.BackgroundPositioningView = BackgroundPositioningView;
exports.BlankEntryView = BlankEntryView;
exports.ChangeThemeDialogView = ChangeThemeDialogView;
exports.Chapter = Chapter;
exports.ChapterConfiguration = ChapterConfiguration;
exports.ChapterItemView = ChapterItemView;
exports.ChapterPagesCollection = ChapterPagesCollection;
exports.ChapterScaffold = ChapterScaffold;
exports.ChaptersCollection = ChaptersCollection;
exports.CheckBoxGroupInputView = CheckBoxGroupInputView;
exports.CheckBoxInputView = CheckBoxInputView;
exports.ChooseImporterView = ChooseImporterView;
exports.CollectionView = CollectionView;
exports.ColorInputView = ColorInputView;
exports.Configuration = Configuration;
exports.ConfigurationEditorTabView = ConfigurationEditorTabView;
exports.ConfigurationEditorView = ConfigurationEditorView;
exports.ConfirmEncodingView = ConfirmEncodingView;
exports.ConfirmFileImportUploadView = ConfirmFileImportUploadView;
exports.ConfirmUploadView = ConfirmUploadView;
exports.ConfirmableFileItemView = ConfirmableFileItemView;
exports.DeleteRowTableCellView = DeleteRowTableCellView;
exports.DisabledAtmoIndicatorView = DisabledAtmoIndicatorView;
exports.DropDownButtonItemListView = DropDownButtonItemListView;
exports.DropDownButtonItemView = DropDownButtonItemView;
exports.DropDownButtonView = DropDownButtonView;
exports.EditChapterView = EditChapterView;
exports.EditEntryView = EditEntryView;
exports.EditFileView = EditFileView;
exports.EditLock = EditLock;
exports.EditLockContainer = EditLockContainer;
exports.EditMetaDataView = EditMetaDataView;
exports.EditPageLinkView = EditPageLinkView;
exports.EditPageView = EditPageView;
exports.EditStorylineView = EditStorylineView;
exports.EditWidgetView = EditWidgetView;
exports.EditWidgetsView = EditWidgetsView;
exports.EditorApi = EditorApi;
exports.EditorView = EditorView;
exports.EmulationModeButtonView = EmulationModeButtonView;
exports.EncodedFile = EncodedFile;
exports.EncodingConfirmation = EncodingConfirmation;
exports.Entry = Entry;
exports.EntryConfiguration = EntryConfiguration;
exports.EntryConfigurationFileSelectionHandler = EntryConfigurationFileSelectionHandler;
exports.EntryPreviewView = EntryPreviewView;
exports.EntryPublication = EntryPublication;
exports.EntryPublicationQuotaDecoratorView = EntryPublicationQuotaDecoratorView;
exports.EnumTableCellView = EnumTableCellView;
exports.ExplorerFileItemView = ExplorerFileItemView;
exports.ExtendedSelectInputView = ExtendedSelectInputView;
exports.FileConfiguration = FileConfiguration;
exports.FileImport = FileImport;
exports.FileInputView = FileInputView;
exports.FileItemView = FileItemView;
exports.FileMetaDataItemValueView = FileMetaDataItemValueView;
exports.FileMetaDataItemView = FileMetaDataItemView;
exports.FileProcessingStateDisplayView = FileProcessingStateDisplayView;
exports.FileReuse = FileReuse;
exports.FileSettingsDialogView = FileSettingsDialogView;
exports.FileStage = FileStage;
exports.FileStageItemView = FileStageItemView;
exports.FileThumbnailView = FileThumbnailView;
exports.FileTypesCollection = FileTypesCollection;
exports.FileUploader = FileUploader;
exports.FilesCollection = FilesCollection;
exports.FilesExplorerView = FilesExplorerView;
exports.FilesImporterView = FilesImporterView;
exports.FilesView = FilesView;
exports.FilteredFilesView = FilteredFilesView;
exports.HelpButtonView = HelpButtonView;
exports.HelpImageView = HelpImageView;
exports.HelpView = HelpView;
exports.IconTableCellView = IconTableCellView;
exports.ImageFile = ImageFile;
exports.InfoBoxView = InfoBoxView;
exports.InvalidNestedTypeError = InvalidNestedTypeError;
exports.JsonInputView = JsonInputView;
exports.LazyVideoEmbeddedView = LazyVideoEmbeddedView;
exports.ListItemView = ListItemView;
exports.ListView = ListView;
exports.LoadingView = LoadingView;
exports.LockedView = LockedView;
exports.ModelThumbnailView = ModelThumbnailView;
exports.MultiCollection = MultiCollection;
exports.NavigatableChapterItemView = NavigatableChapterItemView;
exports.NavigatablePageItemView = NavigatablePageItemView;
exports.NestedFilesCollection = NestedFilesCollection;
exports.NestedFilesView = NestedFilesView;
exports.NestedTypeError = NestedTypeError;
exports.NotificationsView = NotificationsView;
exports.Object = BaseObject;
exports.OrderedPageLinksCollection = OrderedPageLinksCollection;
exports.OtherEntriesCollection = OtherEntriesCollection;
exports.OtherEntriesCollectionView = OtherEntriesCollectionView;
exports.OtherEntry = OtherEntry;
exports.OtherEntryItemView = OtherEntryItemView;
exports.Page = Page;
exports.PageConfigurationFileSelectionHandler = PageConfigurationFileSelectionHandler;
exports.PageItemView = PageItemView;
exports.PageLink = PageLink;
exports.PageLinkConfigurationEditorView = PageLinkConfigurationEditorView;
exports.PageLinkFileSelectionHandler = PageLinkFileSelectionHandler;
exports.PageLinkInputView = PageLinkInputView;
exports.PageLinkItemView = PageLinkItemView;
exports.PageLinksCollection = PageLinksCollection;
exports.PageLinksView = PageLinksView;
exports.PagePreviewView = PagePreviewView;
exports.PageSelectionView = PageSelectionView;
exports.PageThumbnailView = PageThumbnailView;
exports.PagesCollection = PagesCollection;
exports.PresenceTableCellView = PresenceTableCellView;
exports.PreviewEntryData = PreviewEntryData;
exports.ProxyUrlInputView = ProxyUrlInputView;
exports.PublishEntryView = PublishEntryView;
exports.ReferenceInputView = ReferenceInputView;
exports.ReusableFile = ReusableFile;
exports.SavingRecordsCollection = SavingRecordsCollection;
exports.Scaffold = Scaffold;
exports.ScrollingView = ScrollingView;
exports.SelectButtonView = SelectButtonView;
exports.SelectInputView = SelectInputView;
exports.SidebarController = SidebarController;
exports.SidebarFooterView = SidebarFooterView;
exports.SidebarRouter = SidebarRouter;
exports.SliderInputView = SliderInputView;
exports.SortableCollectionView = SortableCollectionView;
exports.StaticThumbnailView = StaticThumbnailView;
exports.Storyline = Storyline;
exports.StorylineChaptersCollection = StorylineChaptersCollection;
exports.StorylineConfiguration = StorylineConfiguration;
exports.StorylineOrdering = StorylineOrdering;
exports.StorylineOutlineView = StorylineOutlineView;
exports.StorylinePickerView = StorylinePickerView;
exports.StorylineScaffold = StorylineScaffold;
exports.StorylineTransitiveChildPages = StorylineTransitiveChildPages;
exports.StorylinesCollection = StorylinesCollection;
exports.SubsetCollection = SubsetCollection;
exports.TableCellView = TableCellView;
exports.TableHeaderCellView = TableHeaderCellView;
exports.TableRowView = TableRowView;
exports.TableView = TableView;
exports.TabsView = TabsView;
exports.TextAreaInputView = TextAreaInputView;
exports.TextFileMetaDataItemValueView = TextFileMetaDataItemValueView;
exports.TextInputView = TextInputView;
exports.TextTableCellView = TextTableCellView;
exports.TextTrackFile = TextTrackFile;
exports.TextTracksFileMetaDataItemValueView = TextTracksFileMetaDataItemValueView;
exports.TextTracksView = TextTracksView;
exports.Theme = Theme;
exports.ThemeInputView = ThemeInputView;
exports.ThemeItemView = ThemeItemView;
exports.ThemesCollection = ThemesCollection;
exports.Theming = Theming;
exports.TooltipView = TooltipView;
exports.UnmatchedUploadError = UnmatchedUploadError;
exports.UploadError = UploadError;
exports.UploadableFile = UploadableFile;
exports.UploadableFilesView = UploadableFilesView;
exports.UploaderView = UploaderView;
exports.UrlDisplayView = UrlDisplayView;
exports.UrlInputView = UrlInputView;
exports.VideoFile = VideoFile;
exports.Widget = Widget;
exports.WidgetConfiguration = WidgetConfiguration;
exports.WidgetConfigurationFileSelectionHandler = WidgetConfigurationFileSelectionHandler;
exports.WidgetItemView = WidgetItemView;
exports.WidgetsCollection = WidgetsCollection;
exports.addAndReturnModel = addAndReturnModel;
exports.app = app;
exports.authenticationProvider = authenticationProvider;
exports.delayedDestroying = delayedDestroying;
exports.dialogView = dialogView;
exports.editor = editor;
exports.failureIndicatingView = failureIndicatingView;
exports.failureTracking = failureTracking;
exports.fileWithType = fileWithType;
exports.filesCountWatcher = filesCountWatcher;
exports.formDataUtils = formDataUtils;
exports.i18nUtils = i18nUtils;
exports.inputView = inputView;
exports.inputWithPlaceholderText = inputWithPlaceholderText;
exports.loadable = loadable;
exports.orderedCollection = orderedCollection;
exports.persistedPromise = persistedPromise;
exports.polling = polling;
exports.retryable = retryable;
exports.selectableView = selectableView;
exports.stageProvider = stageProvider;
exports.startEditor = startEditor;
exports.state = state;
exports.stylesheet = stylesheet;
exports.subviewContainer = subviewContainer;
exports.tooltipContainer = tooltipContainer;
exports.transientReferences = transientReferences;
exports.validFileTypeTranslationList = validFileTypeTranslationList;
return exports;
}({}, Backbone, _, Backbone.Marionette, jQuery, I18n, Backbone.ChildViewContainer, IScroll, jQuery, wysihtml5, Cocktail));