pageflow 15.1.0.beta3 → 15.1.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pageflow might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/app/assets/javascripts/pageflow/dist/editor.js +125 -662
- data/app/assets/javascripts/pageflow/dist/react-client.js +1 -1
- data/app/assets/javascripts/pageflow/dist/react-server.js +1 -1
- data/app/assets/javascripts/pageflow/dist/ui.js +3 -118
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +126 -661
- data/lib/pageflow/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 166c3182b0589a880c80558131b53ef1ff295d2328465426ed3c092a70fc97cb
|
4
|
+
data.tar.gz: 55f8c842860cc5341fac1f229d74d129b0cfcccbcda396bba1e6939668172d95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e27a7162ef41977486a8f2b2ac7d8bf94711e71a44ca57add29b417ce5aadd4b5a971c265e4d151e5638e04564f8402ed30c99dc130540f4bad024646a6d557
|
7
|
+
data.tar.gz: 37b2612f199d9fdfcf6da88de329e4b9ebbad72c50ff11db1ded1b5c714a7157e9b2e9e951712fdd6726dfebf01aadbf2f8c64421aeb04faba52e71e8680ba7d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
### Version 15.1.0.beta4
|
4
|
+
|
5
|
+
2020-01-29
|
6
|
+
|
7
|
+
[Compare changes](https://github.com/codevise/pageflow/compare/v15.1.0.beta3...v15.1.0.beta4)
|
8
|
+
|
9
|
+
Forgot to build assets before doing previous release.
|
10
|
+
|
3
11
|
### Version 15.1.0.beta3
|
4
12
|
|
5
13
|
2020-01-29
|
@@ -186,48 +186,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
186
186
|
findKeyWithTranslation: findKeyWithTranslation,
|
187
187
|
translationKeysWithSuffix: translationKeysWithSuffix
|
188
188
|
});
|
189
|
-
|
190
|
-
function _arrayWithHoles(arr) {
|
191
|
-
if (Array.isArray(arr)) return arr;
|
192
|
-
}
|
193
|
-
|
194
|
-
function _iterableToArrayLimit(arr, i) {
|
195
|
-
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
196
|
-
return;
|
197
|
-
}
|
198
|
-
|
199
|
-
var _arr = [];
|
200
|
-
var _n = true;
|
201
|
-
var _d = false;
|
202
|
-
var _e = undefined;
|
203
|
-
|
204
|
-
try {
|
205
|
-
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
206
|
-
_arr.push(_s.value);
|
207
|
-
|
208
|
-
if (i && _arr.length === i) break;
|
209
|
-
}
|
210
|
-
} catch (err) {
|
211
|
-
_d = true;
|
212
|
-
_e = err;
|
213
|
-
} finally {
|
214
|
-
try {
|
215
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
216
|
-
} finally {
|
217
|
-
if (_d) throw _e;
|
218
|
-
}
|
219
|
-
}
|
220
|
-
|
221
|
-
return _arr;
|
222
|
-
}
|
223
|
-
|
224
|
-
function _nonIterableRest() {
|
225
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
226
|
-
}
|
227
|
-
|
228
|
-
function _slicedToArray(arr, i) {
|
229
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
230
|
-
}
|
231
189
|
/**
|
232
190
|
* Create object that can be passed to Marionette ui property from CSS
|
233
191
|
* module object.
|
@@ -258,7 +216,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
258
216
|
* <div class=${styles.container}></div>
|
259
217
|
* `,
|
260
218
|
*
|
261
|
-
* ui: cssModulesUtils.ui(styles, 'container')
|
219
|
+
* ui: cssModulesUtils.ui(styles, 'container');
|
262
220
|
*
|
263
221
|
* onRender() {
|
264
222
|
* this.ui.container // => JQuery wrapper for container element
|
@@ -268,98 +226,22 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
268
226
|
* @memberof cssModulesUtils
|
269
227
|
*/
|
270
228
|
|
271
|
-
|
272
229
|
function ui(styles) {
|
273
230
|
for (var _len = arguments.length, classNames = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
274
231
|
classNames[_key - 1] = arguments[_key];
|
275
232
|
}
|
276
233
|
|
277
234
|
return classNames.reduce(function (result, className) {
|
278
|
-
result[className] =
|
279
|
-
return result;
|
280
|
-
}, {});
|
281
|
-
}
|
282
|
-
/**
|
283
|
-
* Create object that can be passed to Marionette events property from CSS
|
284
|
-
* module object.
|
285
|
-
*
|
286
|
-
* @param {Object} styles
|
287
|
-
* Class name mapping imported from `.module.css` file.
|
288
|
-
*
|
289
|
-
* @param {Object} mapping
|
290
|
-
* Events mapping using keys from the `styles` instead of CSS class names.
|
291
|
-
*
|
292
|
-
* @return {Object}
|
293
|
-
*
|
294
|
-
* @example
|
295
|
-
*
|
296
|
-
* // MyView.module.css
|
297
|
-
*
|
298
|
-
* .addButton {}
|
299
|
-
*
|
300
|
-
* // MyView.js
|
301
|
-
*
|
302
|
-
* import Marionette from 'marionette';
|
303
|
-
* import {cssModulesUtils} from 'pageflow/ui';
|
304
|
-
*
|
305
|
-
* import styles from './MyView.module.css';
|
306
|
-
*
|
307
|
-
* export const MyView = Marionette.ItemView({
|
308
|
-
* template: () => `
|
309
|
-
* <button class=${styles.addButton}></button>
|
310
|
-
* `,
|
311
|
-
*
|
312
|
-
* events: cssModulesUtils.ui(styles, {
|
313
|
-
* 'click addButton': () => console.log('clicked add button');
|
314
|
-
* })
|
315
|
-
* });
|
316
|
-
*
|
317
|
-
* @memberof cssModulesUtils
|
318
|
-
*/
|
319
|
-
|
320
|
-
|
321
|
-
function events(styles, mapping) {
|
322
|
-
return Object.keys(mapping).reduce(function (result, key) {
|
323
|
-
var _key$split = key.split(' '),
|
324
|
-
_key$split2 = _slicedToArray(_key$split, 2),
|
325
|
-
event = _key$split2[0],
|
326
|
-
className = _key$split2[1];
|
327
|
-
|
328
|
-
result["".concat(event, " ").concat(selector(styles, className))] = mapping[key];
|
235
|
+
result[className] = ".".concat(styles[className]);
|
329
236
|
return result;
|
330
237
|
}, {});
|
331
238
|
}
|
332
|
-
/**
|
333
|
-
* Generates a CSS selector from a CSS module rule.
|
334
|
-
*
|
335
|
-
* @param {Object} styles
|
336
|
-
* Class name mapping imported from `.module.css` file.
|
337
|
-
*
|
338
|
-
* @param {String} className
|
339
|
-
* Key from the `styles` object.
|
340
|
-
*
|
341
|
-
* @return {String} CSS Selector
|
342
|
-
* @memberof cssModulesUtils
|
343
|
-
*/
|
344
|
-
|
345
|
-
|
346
|
-
function selector(styles, className) {
|
347
|
-
var classNames = styles[className];
|
348
|
-
|
349
|
-
if (!classNames) {
|
350
|
-
throw new Error("Unknown class name ".concat(className, " in mapping. Knwon names: ").concat(Object.keys(styles).join(', '), "."));
|
351
|
-
}
|
352
|
-
|
353
|
-
return ".".concat(classNames.replace(/ /g, '.'));
|
354
|
-
}
|
355
239
|
|
356
240
|
var cssModulesUtils =
|
357
241
|
/*#__PURE__*/
|
358
242
|
Object.freeze({
|
359
243
|
__proto__: null,
|
360
|
-
ui: ui
|
361
|
-
events: events,
|
362
|
-
selector: selector
|
244
|
+
ui: ui
|
363
245
|
}); // https://github.com/jashkenas/backbone/issues/2601
|
364
246
|
|
365
247
|
function BaseObject(options) {
|
@@ -3506,62 +3388,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
3506
3388
|
};
|
3507
3389
|
});
|
3508
3390
|
|
3509
|
-
// different model types. Backbone.Collection tries to merge records
|
3510
|
-
// if they have the same id.
|
3511
|
-
|
3512
|
-
var MultiCollection = function MultiCollection() {
|
3513
|
-
this.records = {};
|
3514
|
-
this.length = 0;
|
3515
|
-
};
|
3516
|
-
|
3517
|
-
_$1.extend(MultiCollection.prototype, {
|
3518
|
-
add: function add(record) {
|
3519
|
-
if (!this.records[record.cid]) {
|
3520
|
-
this.records[record.cid] = record;
|
3521
|
-
this.length = _$1.keys(this.records).length;
|
3522
|
-
this.trigger('add', record);
|
3523
|
-
}
|
3524
|
-
},
|
3525
|
-
remove: function remove(record) {
|
3526
|
-
if (this.records[record.cid]) {
|
3527
|
-
delete this.records[record.cid];
|
3528
|
-
this.length = _$1.keys(this.records).length;
|
3529
|
-
this.trigger('remove', record);
|
3530
|
-
}
|
3531
|
-
},
|
3532
|
-
isEmpty: function isEmpty() {
|
3533
|
-
return this.length === 0;
|
3534
|
-
}
|
3535
|
-
});
|
3536
|
-
|
3537
|
-
_$1.extend(MultiCollection.prototype, Backbone.Events);
|
3538
|
-
|
3539
|
-
MultiCollection.extend = Backbone.Collection.extend;
|
3540
|
-
|
3541
|
-
/**
|
3542
|
-
* Watch Backbone collections to track which models are currently
|
3543
|
-
* being saved. Used to update the notifications view displaying
|
3544
|
-
* saving status/failutes.
|
3545
|
-
*/
|
3546
|
-
|
3547
|
-
var SavingRecordsCollection = MultiCollection.extend({
|
3548
|
-
/**
|
3549
|
-
* Listen to events of models in collection to track when they are
|
3550
|
-
* being saved.
|
3551
|
-
*
|
3552
|
-
* @param {Backbone.Collection} collection - Collection to watch.
|
3553
|
-
*/
|
3554
|
-
watch: function watch(collection) {
|
3555
|
-
var that = this;
|
3556
|
-
this.listenTo(collection, 'request', function (model, xhr) {
|
3557
|
-
that.add(model);
|
3558
|
-
xhr.always(function () {
|
3559
|
-
that.remove(model);
|
3560
|
-
});
|
3561
|
-
});
|
3562
|
-
}
|
3563
|
-
});
|
3564
|
-
|
3565
3391
|
var WidgetType = BaseObject.extend({
|
3566
3392
|
initialize: function initialize(serverSideConfig, clientSideConfig) {
|
3567
3393
|
this.name = serverSideConfig.name;
|
@@ -3651,15 +3477,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
3651
3477
|
*/
|
3652
3478
|
|
3653
3479
|
this.failures = new FailuresAPI();
|
3654
|
-
/**
|
3655
|
-
* Tracking records that are currently being saved.
|
3656
|
-
*
|
3657
|
-
* @returns {SavingRecordsCollection}
|
3658
|
-
* @memberof editor
|
3659
|
-
* @since 15.1
|
3660
|
-
*/
|
3661
|
-
|
3662
|
-
this.savingRecords = new SavingRecordsCollection();
|
3663
3480
|
/**
|
3664
3481
|
* Set up editor integration for page types.
|
3665
3482
|
* @memberof editor
|
@@ -3706,9 +3523,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
3706
3523
|
* Backbone view that will be rendered in the side bar.
|
3707
3524
|
*/
|
3708
3525
|
registerEntryType: function registerEntryType(name, options) {
|
3709
|
-
this.entryType =
|
3710
|
-
name: name
|
3711
|
-
}, options);
|
3526
|
+
this.entryType = options;
|
3712
3527
|
},
|
3713
3528
|
createEntryModel: function createEntryModel(seed, options) {
|
3714
3529
|
var entry = new this.entryType.entryModel(seed.entry, options);
|
@@ -3900,9 +3715,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
3900
3715
|
}
|
3901
3716
|
|
3902
3717
|
var payloadJson = JSON.parse(decodeURIComponent(encodedPayload));
|
3903
|
-
return new this.fileSelectionHandlers[handlerName](
|
3904
|
-
entry: state.entry
|
3905
|
-
}));
|
3718
|
+
return new this.fileSelectionHandlers[handlerName](payloadJson);
|
3906
3719
|
},
|
3907
3720
|
createPageConfigurationEditorView: function createPageConfigurationEditorView(page, options) {
|
3908
3721
|
var view = this.pageTypes.findByPage(page).createConfigurationEditorView(_$1.extend(options, {
|
@@ -3924,79 +3737,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
3924
3737
|
});
|
3925
3738
|
};
|
3926
3739
|
|
3927
|
-
/**
|
3928
|
-
* Mixins for Backbone models and collections that use entry type
|
3929
|
-
* specific editor controllers registered via the `editor_app` entry
|
3930
|
-
* type option.
|
3931
|
-
*/
|
3932
|
-
|
3933
|
-
var entryTypeEditorControllerUrls = {
|
3934
|
-
/**
|
3935
|
-
* Mixins for Backbone collections that defines `url` method.
|
3936
|
-
*
|
3937
|
-
* @param {Object} options
|
3938
|
-
* @param {String} options.resources - Path suffix of the controller route
|
3939
|
-
*
|
3940
|
-
* @example
|
3941
|
-
*
|
3942
|
-
* import {editor, entryTypeEditorControllerUrls} from 'pageflow/editor';
|
3943
|
-
*
|
3944
|
-
* editor.registerEntryType('test', {
|
3945
|
-
// ...
|
3946
|
-
});
|
3947
|
-
*
|
3948
|
-
* export const ItemsCollection = Backbone.Collection.extend({
|
3949
|
-
* mixins: [entryTypeEditorControllerUrls.forCollection({resources: 'items'})
|
3950
|
-
* });
|
3951
|
-
*
|
3952
|
-
* new ItemsCollection().url() // => '/editor/entries/10/test/items'
|
3953
|
-
*/
|
3954
|
-
forCollection: function forCollection(_ref) {
|
3955
|
-
var resources = _ref.resources;
|
3956
|
-
return {
|
3957
|
-
url: function url() {
|
3958
|
-
return entryTypeEditorControllerUrl(resources);
|
3959
|
-
},
|
3960
|
-
urlSuffix: function urlSuffix() {
|
3961
|
-
return "/".concat(resources);
|
3962
|
-
}
|
3963
|
-
};
|
3964
|
-
},
|
3965
|
-
|
3966
|
-
/**
|
3967
|
-
* Mixins for Backbone models that defines `urlRoot` method.
|
3968
|
-
*
|
3969
|
-
* @param {Object} options
|
3970
|
-
* @param {String} options.resources - Path suffix of the controller route
|
3971
|
-
*
|
3972
|
-
* @example
|
3973
|
-
*
|
3974
|
-
* import {editor, entryTypeEditorControllerUrls} from 'pageflow/editor';
|
3975
|
-
*
|
3976
|
-
* editor.registerEntryType('test', {
|
3977
|
-
// ...
|
3978
|
-
});
|
3979
|
-
*
|
3980
|
-
* export const Item = Backbone.Model.extend({
|
3981
|
-
* mixins: [entryTypeEditorControllerUrls.forModel({resources: 'items'})
|
3982
|
-
* });
|
3983
|
-
*
|
3984
|
-
* new Item({id: 20}).url() // => '/editor/entries/10/test/items/20'
|
3985
|
-
*/
|
3986
|
-
forModel: function forModel(_ref2) {
|
3987
|
-
var resources = _ref2.resources;
|
3988
|
-
return {
|
3989
|
-
urlRoot: function urlRoot() {
|
3990
|
-
return this.isNew() ? this.collection.url() : entryTypeEditorControllerUrl(resources);
|
3991
|
-
}
|
3992
|
-
};
|
3993
|
-
}
|
3994
|
-
};
|
3995
|
-
|
3996
|
-
function entryTypeEditorControllerUrl(resources) {
|
3997
|
-
return [state.entry.url(), editor.entryType.name, resources].join('/');
|
3998
|
-
}
|
3999
|
-
|
4000
3740
|
var formDataUtils = {
|
4001
3741
|
fromModel: function fromModel(model) {
|
4002
3742
|
var object = {};
|
@@ -4104,7 +3844,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
4104
3844
|
this.reset();
|
4105
3845
|
},
|
4106
3846
|
url: function url() {
|
4107
|
-
return this.parentModel.url() +
|
3847
|
+
return this.parentModel.url() + _$1.result(this.parent, 'url');
|
4108
3848
|
},
|
4109
3849
|
dispose: function dispose() {
|
4110
3850
|
this.stopListening();
|
@@ -4413,22 +4153,10 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
4413
4153
|
Cocktail.mixin(Configuration, mixin);
|
4414
4154
|
});
|
4415
4155
|
|
4416
|
-
/**
|
4417
|
-
* Remove model from collection only after the `DELETE` request has
|
4418
|
-
* succeeded. Still allow tracking that the model is being destroyed
|
4419
|
-
* by triggering a `destroying` event and adding a `isDestroying`
|
4420
|
-
* method.
|
4421
|
-
*/
|
4422
|
-
|
4423
4156
|
var delayedDestroying = {
|
4424
4157
|
initialize: function initialize() {
|
4425
4158
|
this._destroying = false;
|
4426
4159
|
},
|
4427
|
-
|
4428
|
-
/**
|
4429
|
-
* Trigger `destroying` event and send `DELETE` request. Only remove
|
4430
|
-
* model from collection once the request is done.
|
4431
|
-
*/
|
4432
4160
|
destroyWithDelay: function destroyWithDelay() {
|
4433
4161
|
var model = this;
|
4434
4162
|
this._destroying = true;
|
@@ -4443,19 +4171,11 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
4443
4171
|
}
|
4444
4172
|
});
|
4445
4173
|
},
|
4446
|
-
|
4447
|
-
/**
|
4448
|
-
* Get whether the model is currently being destroyed.
|
4449
|
-
*/
|
4450
4174
|
isDestroying: function isDestroying() {
|
4451
4175
|
return this._destroying;
|
4452
4176
|
}
|
4453
4177
|
};
|
4454
4178
|
|
4455
|
-
/**
|
4456
|
-
* Mixin for Backbone models that shall be watched by {@link
|
4457
|
-
* modelLifecycleTrackingView} mixin.
|
4458
|
-
*/
|
4459
4179
|
var failureTracking = {
|
4460
4180
|
initialize: function initialize() {
|
4461
4181
|
this._saveFailed = false;
|
@@ -5052,23 +4772,9 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
5052
4772
|
}
|
5053
4773
|
});
|
5054
4774
|
|
5055
|
-
var
|
5056
|
-
modelName: 'entry_metadata_configuration',
|
5057
|
-
i18nKey: 'pageflow/entry_metadata_configuration',
|
5058
|
-
defaults: {}
|
5059
|
-
});
|
5060
|
-
|
5061
|
-
var EntryMetadata = Configuration.extend({
|
4775
|
+
var EntryConfiguration = Configuration.extend({
|
5062
4776
|
modelName: 'entry',
|
5063
|
-
i18nKey: 'pageflow/entry'
|
5064
|
-
defaults: {},
|
5065
|
-
initialize: function initialize(attributes, options) {
|
5066
|
-
this.configuration = new EntryMetadataConfiguration(_$1.clone(attributes.configuration) || {});
|
5067
|
-
this.listenTo(this.configuration, 'change', function () {
|
5068
|
-
this.trigger('change');
|
5069
|
-
this.parent.save();
|
5070
|
-
});
|
5071
|
-
}
|
4777
|
+
i18nKey: 'pageflow/entry'
|
5072
4778
|
});
|
5073
4779
|
|
5074
4780
|
var StorylineConfiguration = Configuration.extend({
|
@@ -5247,16 +4953,16 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
5247
4953
|
}
|
5248
4954
|
});
|
5249
4955
|
|
5250
|
-
var
|
4956
|
+
var EntryConfigurationFileSelectionHandler = function EntryConfigurationFileSelectionHandler(options) {
|
5251
4957
|
this.call = function (file) {
|
5252
|
-
state.entry.
|
4958
|
+
state.entry.configuration.setReference(options.attributeName, file);
|
5253
4959
|
};
|
5254
4960
|
|
5255
4961
|
this.getReferer = function () {
|
5256
4962
|
return '/meta_data/' + (options.returnToTab || 'general');
|
5257
4963
|
};
|
5258
4964
|
};
|
5259
|
-
editor.registerFileSelectionHandler('
|
4965
|
+
editor.registerFileSelectionHandler('entryConfiguration', EntryConfigurationFileSelectionHandler);
|
5260
4966
|
|
5261
4967
|
var EntryPublication = Backbone.Model.extend({
|
5262
4968
|
paramRoot: 'entry_publication',
|
@@ -5913,76 +5619,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
5913
5619
|
};
|
5914
5620
|
editor.registerFileSelectionHandler('pageLink', PageLinkFileSelectionHandler);
|
5915
5621
|
|
5916
|
-
/**
|
5917
|
-
* Mixins for models with a nested configuration model.
|
5918
|
-
*
|
5919
|
-
* Triggers events on the parent model of the form
|
5920
|
-
* `change:configuration` and `change:configuration:<attribute>`, when
|
5921
|
-
* the configuration changes.
|
5922
|
-
*
|
5923
|
-
* @param {Object} [options]
|
5924
|
-
* @param {Function} [options.configurationModel] -
|
5925
|
-
* Backbone model to use for nested configuration model.
|
5926
|
-
* @param {Boolean} [options.autoSave] -
|
5927
|
-
* Save model when configuration changes.
|
5928
|
-
* @param {Boolean|Array<String>} [options.includeAttributesInJSON] -
|
5929
|
-
* Include all or specific attributes of the parent model in the
|
5930
|
-
* data returned by `toJSON` besides the `configuration` property.
|
5931
|
-
* @returns {Object} - Mixin to be included in model.
|
5932
|
-
*
|
5933
|
-
* @example
|
5934
|
-
*
|
5935
|
-
* import {configurationContainer} from 'pageflow/editor';
|
5936
|
-
*
|
5937
|
-
* const Section = Backbone.Model.extend({
|
5938
|
-
* mixins: [configurationContainer({autoSave: true})]
|
5939
|
-
* });
|
5940
|
-
*
|
5941
|
-
* const section = new Section({configuration: {some: 'value'}});
|
5942
|
-
* section.configuration.get('some') // => 'value';
|
5943
|
-
*/
|
5944
|
-
|
5945
|
-
function configurationContainer() {
|
5946
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
5947
|
-
configurationModel = _ref.configurationModel,
|
5948
|
-
autoSave = _ref.autoSave,
|
5949
|
-
includeAttributesInJSON = _ref.includeAttributesInJSON;
|
5950
|
-
|
5951
|
-
configurationModel = configurationModel || Configuration.extend({
|
5952
|
-
defaults: {}
|
5953
|
-
});
|
5954
|
-
return {
|
5955
|
-
initialize: function initialize() {
|
5956
|
-
this.configuration = new configurationModel(this.get('configuration'));
|
5957
|
-
this.configuration.parent = this;
|
5958
|
-
this.listenTo(this.configuration, 'change', function () {
|
5959
|
-
if (!this.isNew() && autoSave) {
|
5960
|
-
this.save();
|
5961
|
-
}
|
5962
|
-
|
5963
|
-
this.trigger('change:configuration', this);
|
5964
|
-
|
5965
|
-
_$1.chain(this.configuration.changed).keys().each(function (name) {
|
5966
|
-
this.trigger('change:configuration:' + name, this, this.configuration.get(name));
|
5967
|
-
}, this);
|
5968
|
-
});
|
5969
|
-
},
|
5970
|
-
toJSON: function toJSON() {
|
5971
|
-
var attributes = {};
|
5972
|
-
|
5973
|
-
if (includeAttributesInJSON === true) {
|
5974
|
-
attributes = _$1.clone(this.attributes);
|
5975
|
-
} else if (includeAttributesInJSON) {
|
5976
|
-
attributes = _$1.pick(this.attributes, includeAttributesInJSON);
|
5977
|
-
}
|
5978
|
-
|
5979
|
-
return _$1.extend(attributes, {
|
5980
|
-
configuration: this.configuration.toJSON()
|
5981
|
-
});
|
5982
|
-
}
|
5983
|
-
};
|
5984
|
-
}
|
5985
|
-
|
5986
5622
|
var persistedPromise = {
|
5987
5623
|
persisted: function persisted() {
|
5988
5624
|
var model = this;
|
@@ -6066,8 +5702,8 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
6066
5702
|
mixins: [filesCountWatcher, polling, failureTracking],
|
6067
5703
|
initialize: function initialize(attributes, options) {
|
6068
5704
|
options = options || {};
|
6069
|
-
this.
|
6070
|
-
this.
|
5705
|
+
this.configuration = new EntryConfiguration(this.get('configuration') || {});
|
5706
|
+
this.configuration.parent = this;
|
6071
5707
|
this.themes = options.themes || state.themes;
|
6072
5708
|
this.files = options.files || state.files;
|
6073
5709
|
this.fileTypes = options.fileTypes || editor.fileTypes;
|
@@ -6089,11 +5725,11 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
6089
5725
|
this.listenTo(this.chapters, 'sort', function () {
|
6090
5726
|
this.pages.sort();
|
6091
5727
|
});
|
6092
|
-
this.listenTo(this.
|
6093
|
-
this.trigger('change:
|
5728
|
+
this.listenTo(this.configuration, 'change', function () {
|
5729
|
+
this.trigger('change:configuration');
|
6094
5730
|
this.save();
|
6095
5731
|
});
|
6096
|
-
this.listenTo(this.
|
5732
|
+
this.listenTo(this.configuration, 'change:locale', function () {
|
6097
5733
|
this.once('sync', function () {
|
6098
5734
|
// No other way of updating page templates used in
|
6099
5735
|
// EntryPreviewView at the moment.
|
@@ -6102,10 +5738,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
6102
5738
|
});
|
6103
5739
|
},
|
6104
5740
|
getTheme: function getTheme() {
|
6105
|
-
return this.themes.findByName(this.
|
6106
|
-
},
|
6107
|
-
supportsPhoneEmulation: function supportsPhoneEmulation() {
|
6108
|
-
return pageflow.features.isEnabled('editor_emulation_mode');
|
5741
|
+
return this.themes.findByName(this.configuration.get('theme_name'));
|
6109
5742
|
},
|
6110
5743
|
addStoryline: function addStoryline(attributes) {
|
6111
5744
|
var storyline = this.buildStoryline(attributes);
|
@@ -6188,10 +5821,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
6188
5821
|
}, this);
|
6189
5822
|
},
|
6190
5823
|
toJSON: function toJSON() {
|
6191
|
-
|
6192
|
-
var configJSON = this.metadata.configuration.toJSON();
|
6193
|
-
metadataJSON.configuration = configJSON;
|
6194
|
-
return metadataJSON;
|
5824
|
+
return this.configuration.toJSON();
|
6195
5825
|
}
|
6196
5826
|
});
|
6197
5827
|
|
@@ -6349,61 +5979,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
6349
5979
|
}
|
6350
5980
|
});
|
6351
5981
|
|
6352
|
-
/**
|
6353
|
-
* A Backbone collection that is automatically updated to only
|
6354
|
-
* contain models with a foreign key matching the id of a parent
|
6355
|
-
* model.
|
6356
|
-
*
|
6357
|
-
* @param {Object} options
|
6358
|
-
* @param {Backbone.Model} options.parentModel -
|
6359
|
-
* Model whose id is compared to foreign keys.
|
6360
|
-
* @param {Backbone.Collection} options.parent -
|
6361
|
-
* Collection to filter items with matching foreign key from.
|
6362
|
-
* @param {String} options.foreignKeyAttribute -
|
6363
|
-
* Attribute to compare to id of parent model.
|
6364
|
-
* @param {String} options.parentReferenceAttribute -
|
6365
|
-
* Set reference to parent model on models in collection.
|
6366
|
-
*
|
6367
|
-
* @since 15.1
|
6368
|
-
*/
|
6369
|
-
|
6370
|
-
var ForeignKeySubsetCollection = SubsetCollection.extend({
|
6371
|
-
mixins: [orderedCollection],
|
6372
|
-
constructor: function constructor(options) {
|
6373
|
-
var parent = options.parent;
|
6374
|
-
var parentModel = options.parentModel;
|
6375
|
-
SubsetCollection.prototype.constructor.call(this, {
|
6376
|
-
parent: parent,
|
6377
|
-
parentModel: parentModel,
|
6378
|
-
filter: function filter(item) {
|
6379
|
-
return !parentModel.isNew() && item.get(options.foreignKeyAttribute) === parentModel.id;
|
6380
|
-
},
|
6381
|
-
comparator: function comparator(item) {
|
6382
|
-
return item.get('position');
|
6383
|
-
}
|
6384
|
-
});
|
6385
|
-
this.listenTo(this, 'add', function (model) {
|
6386
|
-
if (options.parentReferenceAttribute) {
|
6387
|
-
model[options.parentReferenceAttribute] = parentModel;
|
6388
|
-
}
|
6389
|
-
|
6390
|
-
model.set(options.foreignKeyAttribute, parentModel.id);
|
6391
|
-
});
|
6392
|
-
this.listenTo(parentModel, 'destroy', function () {
|
6393
|
-
this.clear();
|
6394
|
-
});
|
6395
|
-
|
6396
|
-
if (options.parentReferenceAttribute) {
|
6397
|
-
this.each(function (model) {
|
6398
|
-
return model[options.parentReferenceAttribute] = parentModel;
|
6399
|
-
});
|
6400
|
-
this.listenTo(this, 'remove', function (model) {
|
6401
|
-
model[options.parentReferenceAttribute] = null;
|
6402
|
-
});
|
6403
|
-
}
|
6404
|
-
}
|
6405
|
-
});
|
6406
|
-
|
6407
5982
|
var PageLinksCollection = Backbone.Collection.extend({
|
6408
5983
|
model: PageLink,
|
6409
5984
|
initialize: function initialize(models, options) {
|
@@ -6623,6 +6198,50 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
6623
6198
|
};
|
6624
6199
|
Cocktail.mixin(Backbone.Collection, addAndReturnModel);
|
6625
6200
|
|
6201
|
+
// different model types. Backbone.Collection tries to merge records
|
6202
|
+
// if they have the same id.
|
6203
|
+
|
6204
|
+
var MultiCollection = function MultiCollection() {
|
6205
|
+
this.records = {};
|
6206
|
+
this.length = 0;
|
6207
|
+
};
|
6208
|
+
|
6209
|
+
_$1.extend(MultiCollection.prototype, {
|
6210
|
+
add: function add(record) {
|
6211
|
+
if (!this.records[record.cid]) {
|
6212
|
+
this.records[record.cid] = record;
|
6213
|
+
this.length = _$1.keys(this.records).length;
|
6214
|
+
this.trigger('add', record);
|
6215
|
+
}
|
6216
|
+
},
|
6217
|
+
remove: function remove(record) {
|
6218
|
+
if (this.records[record.cid]) {
|
6219
|
+
delete this.records[record.cid];
|
6220
|
+
this.length = _$1.keys(this.records).length;
|
6221
|
+
this.trigger('remove', record);
|
6222
|
+
}
|
6223
|
+
},
|
6224
|
+
isEmpty: function isEmpty() {
|
6225
|
+
return this.length === 0;
|
6226
|
+
}
|
6227
|
+
});
|
6228
|
+
|
6229
|
+
_$1.extend(MultiCollection.prototype, Backbone.Events);
|
6230
|
+
|
6231
|
+
MultiCollection.extend = Backbone.Collection.extend;
|
6232
|
+
|
6233
|
+
var SavingRecordsCollection = MultiCollection.extend({
|
6234
|
+
watch: function watch(collection) {
|
6235
|
+
var that = this;
|
6236
|
+
this.listenTo(collection, 'request', function (model, xhr) {
|
6237
|
+
that.add(model);
|
6238
|
+
xhr.always(function () {
|
6239
|
+
that.remove(model);
|
6240
|
+
});
|
6241
|
+
});
|
6242
|
+
}
|
6243
|
+
});
|
6244
|
+
|
6626
6245
|
var SidebarRouter = Marionette.AppRouter.extend({
|
6627
6246
|
appRoutes: {
|
6628
6247
|
'page_links/:id': 'pageLink',
|
@@ -6666,7 +6285,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
6666
6285
|
this.outlet.show(this.options.view);
|
6667
6286
|
},
|
6668
6287
|
goBack: function goBack() {
|
6669
|
-
this.options.view.onGoBack && this.options.view.onGoBack();
|
6670
6288
|
editor.navigate('/', {
|
6671
6289
|
trigger: true
|
6672
6290
|
});
|
@@ -6804,87 +6422,24 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
6804
6422
|
});
|
6805
6423
|
};
|
6806
6424
|
|
6807
|
-
|
6808
|
-
|
6809
|
-
|
6810
|
-
|
6811
|
-
|
6812
|
-
|
6813
|
-
* @param {String} options.classNames.creating -
|
6814
|
-
* Class name to add to root element while model is still being created.
|
6815
|
-
* @param {String} options.classNames.destroying -
|
6816
|
-
* Class name to add to root element while model is being destroyed.
|
6817
|
-
* @param {String} options.classNames.failed -
|
6818
|
-
* Class name to add to root element while model is in failed state.
|
6819
|
-
* Model needs to include {@link failureTracking} mixin.
|
6820
|
-
* @param {String} options.classNames.failureMessage -
|
6821
|
-
* Class name of the element that shall be updated with the failure
|
6822
|
-
* message. Model needs to include {@link failureTracking} mixin.
|
6823
|
-
* @param {String} options.classNames.retryButton -
|
6824
|
-
* Class name of the element that shall act as a retry button.
|
6825
|
-
*/
|
6826
|
-
|
6827
|
-
function modelLifecycleTrackingView(_ref) {
|
6828
|
-
var classNames = _ref.classNames;
|
6829
|
-
return {
|
6830
|
-
events: _defineProperty({}, "click .".concat(classNames.retryButton), function click() {
|
6425
|
+
var failureIndicatingView = {
|
6426
|
+
modelEvents: {
|
6427
|
+
'change:failed': 'updateFailIndicator'
|
6428
|
+
},
|
6429
|
+
events: {
|
6430
|
+
'click .retry': function clickRetry() {
|
6831
6431
|
editor.failures.retry();
|
6832
6432
|
return false;
|
6833
|
-
}),
|
6834
|
-
initialize: function initialize() {
|
6835
|
-
var _this = this;
|
6836
|
-
|
6837
|
-
if (classNames.creating) {
|
6838
|
-
this.listenTo(this.model, 'change:id', function () {
|
6839
|
-
this.$el.removeClass(classNames.creating);
|
6840
|
-
});
|
6841
|
-
}
|
6842
|
-
|
6843
|
-
if (classNames.destroying) {
|
6844
|
-
this.listenTo(this.model, 'destroying', function () {
|
6845
|
-
this.$el.addClass(classNames.destroying);
|
6846
|
-
});
|
6847
|
-
this.listenTo(this.model, 'error', function () {
|
6848
|
-
this.$el.removeClass(classNames.destroying);
|
6849
|
-
});
|
6850
|
-
}
|
6851
|
-
|
6852
|
-
if (classNames.failed || classNames.failureMessage) {
|
6853
|
-
this.listenTo(this.model, 'change:failed', function () {
|
6854
|
-
return _this.updateFailIndicator();
|
6855
|
-
});
|
6856
|
-
}
|
6857
|
-
},
|
6858
|
-
render: function render() {
|
6859
|
-
if (this.model.isNew()) {
|
6860
|
-
this.$el.addClass(classNames.creating);
|
6861
|
-
}
|
6862
|
-
|
6863
|
-
if (this.model.isDestroying && this.model.isDestroying()) {
|
6864
|
-
this.$el.addClass(classNames.destroying);
|
6865
|
-
}
|
6866
|
-
|
6867
|
-
this.updateFailIndicator();
|
6868
|
-
},
|
6869
|
-
updateFailIndicator: function updateFailIndicator() {
|
6870
|
-
if (classNames.failed) {
|
6871
|
-
this.$el.toggleClass(classNames.failed, this.model.isFailed());
|
6872
|
-
}
|
6873
|
-
|
6874
|
-
if (classNames.failureMessage) {
|
6875
|
-
this.$el.find(".".concat(classNames.failureMessage)).text(this.model.getFailureMessage());
|
6876
|
-
}
|
6877
6433
|
}
|
6878
|
-
}
|
6879
|
-
|
6880
|
-
|
6881
|
-
|
6882
|
-
|
6883
|
-
|
6884
|
-
|
6885
|
-
retryButton: 'retry'
|
6434
|
+
},
|
6435
|
+
onRender: function onRender() {
|
6436
|
+
this.updateFailIndicator();
|
6437
|
+
},
|
6438
|
+
updateFailIndicator: function updateFailIndicator() {
|
6439
|
+
this.$el.toggleClass('failed', this.model.isFailed());
|
6440
|
+
this.$el.find('.failure .message').text(this.model.getFailureMessage());
|
6886
6441
|
}
|
6887
|
-
}
|
6442
|
+
};
|
6888
6443
|
|
6889
6444
|
function template$k(data) {
|
6890
6445
|
var __t, __p = '';
|
@@ -8073,13 +7628,12 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
8073
7628
|
onRender: function onRender() {
|
8074
7629
|
var entry = this.model;
|
8075
7630
|
var configurationEditor = new ConfigurationEditorView({
|
8076
|
-
model: entry.
|
7631
|
+
model: entry.configuration,
|
8077
7632
|
tab: this.options.tab
|
8078
7633
|
});
|
8079
7634
|
configurationEditor.tab('general', function () {
|
8080
7635
|
this.input('title', TextInputView, {
|
8081
|
-
placeholder: entry.get('entry_title')
|
8082
|
-
model: entry.metadata
|
7636
|
+
placeholder: entry.get('entry_title')
|
8083
7637
|
});
|
8084
7638
|
this.input('locale', SelectInputView, {
|
8085
7639
|
values: state.config.availablePublicLocales,
|
@@ -8087,23 +7641,17 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
8087
7641
|
return I18n$1.t('pageflow.public._language', {
|
8088
7642
|
locale: locale
|
8089
7643
|
});
|
8090
|
-
})
|
8091
|
-
model: entry.metadata
|
8092
|
-
});
|
8093
|
-
this.input('credits', TextAreaInputView, {
|
8094
|
-
model: entry.metadata
|
7644
|
+
})
|
8095
7645
|
});
|
7646
|
+
this.input('credits', TextAreaInputView);
|
8096
7647
|
this.input('author', TextInputView, {
|
8097
|
-
placeholder: state.config.defaultAuthorMetaTag
|
8098
|
-
model: entry.metadata
|
7648
|
+
placeholder: state.config.defaultAuthorMetaTag
|
8099
7649
|
});
|
8100
7650
|
this.input('publisher', TextInputView, {
|
8101
|
-
placeholder: state.config.defaultPublisherMetaTag
|
8102
|
-
model: entry.metadata
|
7651
|
+
placeholder: state.config.defaultPublisherMetaTag
|
8103
7652
|
});
|
8104
7653
|
this.input('keywords', TextInputView, {
|
8105
|
-
placeholder: state.config.defaultKeywordsMetaTag
|
8106
|
-
model: entry.metadata
|
7654
|
+
placeholder: state.config.defaultKeywordsMetaTag
|
8107
7655
|
});
|
8108
7656
|
});
|
8109
7657
|
configurationEditor.tab('widgets', function () {
|
@@ -8123,25 +7671,21 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
8123
7671
|
configurationEditor.tab('social', function () {
|
8124
7672
|
this.input('share_image_id', FileInputView, {
|
8125
7673
|
collection: state.imageFiles,
|
8126
|
-
fileSelectionHandler: '
|
8127
|
-
model: entry.metadata
|
7674
|
+
fileSelectionHandler: 'entryConfiguration'
|
8128
7675
|
});
|
8129
7676
|
this.input('summary', TextAreaInputView, {
|
8130
7677
|
disableRichtext: true,
|
8131
|
-
disableLinks: true
|
8132
|
-
model: entry.metadata
|
7678
|
+
disableLinks: true
|
8133
7679
|
});
|
8134
7680
|
this.input('share_url', TextInputView, {
|
8135
|
-
placeholder: state.entry.get('pretty_url')
|
8136
|
-
model: entry.metadata
|
7681
|
+
placeholder: state.entry.get('pretty_url')
|
8137
7682
|
});
|
8138
7683
|
this.input('share_providers', CheckBoxGroupInputView, {
|
8139
7684
|
values: state.config.availableShareProviders,
|
8140
|
-
translationKeyPrefix: 'activerecord.values.pageflow/entry.share_providers'
|
8141
|
-
model: entry.metadata
|
7685
|
+
translationKeyPrefix: 'activerecord.values.pageflow/entry.share_providers'
|
8142
7686
|
});
|
8143
7687
|
});
|
8144
|
-
this.listenTo(entry.
|
7688
|
+
this.listenTo(entry.configuration, 'change:theme_name', function () {
|
8145
7689
|
configurationEditor.refresh();
|
8146
7690
|
});
|
8147
7691
|
this.formContainer.show(configurationEditor);
|
@@ -8415,12 +7959,28 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
8415
7959
|
}
|
8416
7960
|
});
|
8417
7961
|
|
8418
|
-
var loadable =
|
8419
|
-
|
8420
|
-
|
8421
|
-
|
7962
|
+
var loadable = {
|
7963
|
+
modelEvents: {
|
7964
|
+
'change:id': function changeId() {
|
7965
|
+
this.$el.removeClass('creating');
|
7966
|
+
},
|
7967
|
+
destroying: function destroying() {
|
7968
|
+
this.$el.addClass('destroying');
|
7969
|
+
},
|
7970
|
+
error: function error() {
|
7971
|
+
this.$el.removeClass('destroying');
|
7972
|
+
}
|
7973
|
+
},
|
7974
|
+
render: function render() {
|
7975
|
+
if (this.model.isNew()) {
|
7976
|
+
this.$el.addClass('creating');
|
7977
|
+
}
|
7978
|
+
|
7979
|
+
if (this.model.isDestroying && this.model.isDestroying()) {
|
7980
|
+
this.$el.addClass('destroying');
|
7981
|
+
}
|
8422
7982
|
}
|
8423
|
-
}
|
7983
|
+
};
|
8424
7984
|
|
8425
7985
|
function template$F(data) {
|
8426
7986
|
var __p = '';
|
@@ -10134,7 +9694,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
10134
9694
|
this.model.unset('emulation_mode');
|
10135
9695
|
},
|
10136
9696
|
'click .emulation_mode_button-phone a': function clickEmulation_mode_buttonPhoneA() {
|
10137
|
-
if (this.model.get('
|
9697
|
+
if (!this.model.get('current_page_supports_emulation_mode')) {
|
10138
9698
|
return;
|
10139
9699
|
}
|
10140
9700
|
|
@@ -10142,13 +9702,13 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
10142
9702
|
}
|
10143
9703
|
},
|
10144
9704
|
modelEvents: {
|
10145
|
-
'change:emulation_mode change:
|
9705
|
+
'change:emulation_mode change:current_page_supports_emulation_mode': 'update'
|
10146
9706
|
},
|
10147
9707
|
onRender: function onRender() {
|
10148
9708
|
this.update();
|
10149
9709
|
},
|
10150
9710
|
update: function update() {
|
10151
|
-
this.ui.phoneItem.toggleClass('disabled',
|
9711
|
+
this.ui.phoneItem.toggleClass('disabled', !this.model.get('current_page_supports_emulation_mode'));
|
10152
9712
|
this.ui.phoneItem.toggleClass('active', this.model.has('emulation_mode'));
|
10153
9713
|
this.ui.desktopItem.toggleClass('active', !this.model.has('emulation_mode'));
|
10154
9714
|
this.ui.phoneDisplay.toggleClass('active', this.model.has('emulation_mode'));
|
@@ -10176,7 +9736,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
10176
9736
|
var SidebarFooterView = Marionette.View.extend({
|
10177
9737
|
className: 'sidebar_footer',
|
10178
9738
|
render: function render() {
|
10179
|
-
if (
|
9739
|
+
if (pageflow.features.isEnabled('editor_emulation_mode')) {
|
10180
9740
|
this.appendSubview(new EmulationModeButtonView({
|
10181
9741
|
model: this.model
|
10182
9742
|
}));
|
@@ -10534,8 +10094,8 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
10534
10094
|
onRender: function onRender() {
|
10535
10095
|
this.listenTo(state.entry, 'change:uploading_files_count', this.notifyUploadCount);
|
10536
10096
|
this.listenTo(state.entry, 'change:confirmable_files_count', this.notifyConfirmableFilesCount);
|
10537
|
-
this.listenTo(
|
10538
|
-
this.listenTo(
|
10097
|
+
this.listenTo(state.savingRecords, 'add', this.update);
|
10098
|
+
this.listenTo(state.savingRecords, 'remove', this.update);
|
10539
10099
|
this.listenTo(editor.failures, 'add', this.update);
|
10540
10100
|
this.listenTo(editor.failures, 'remove', this.update);
|
10541
10101
|
this.update();
|
@@ -10543,7 +10103,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
10543
10103
|
},
|
10544
10104
|
update: function update() {
|
10545
10105
|
this.$el.toggleClass('failed', !editor.failures.isEmpty());
|
10546
|
-
this.$el.toggleClass('saving', !
|
10106
|
+
this.$el.toggleClass('saving', !state.savingRecords.isEmpty());
|
10547
10107
|
this.ui.failedCount.text(editor.failures.count());
|
10548
10108
|
},
|
10549
10109
|
notifyUploadCount: function notifyUploadCount(model, uploadCount) {
|
@@ -10922,100 +10482,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
10922
10482
|
app.dialogRegion.show(new ConfirmUploadView(options));
|
10923
10483
|
};
|
10924
10484
|
|
10925
|
-
/**
|
10926
|
-
* Base view to edit configuration container models. Extend and
|
10927
|
-
* override the `configure` method which receives a {@link
|
10928
|
-
* ConfigurationEditorView} to define the tabs and inputs that shall
|
10929
|
-
* be displayed.
|
10930
|
-
*
|
10931
|
-
* Add a `translationKeyPrefix` property to the prototype and define
|
10932
|
-
* the following translations:
|
10933
|
-
*
|
10934
|
-
* * `<translationKeyPrefix>.tabs`: used as `tabTranslationKeyPrefix`
|
10935
|
-
* of the `ConfigurationEditorView`.
|
10936
|
-
*
|
10937
|
-
* * `<translationKeyPrefix>.attributes`: used as one of the
|
10938
|
-
* `attributeTranslationKeyPrefixes` of the
|
10939
|
-
* `ConfigurationEditorView`.
|
10940
|
-
*
|
10941
|
-
* * `<translationKeyPrefix>.back` (optional): Back button label.
|
10942
|
-
*
|
10943
|
-
* * `<translationKeyPrefix>.destroy` (optional): Destroy button
|
10944
|
-
* label.
|
10945
|
-
*
|
10946
|
-
* * `<translationKeyPrefix>.confirm_destroy` (optional): Confirm
|
10947
|
-
* message displayed before destroying.
|
10948
|
-
*
|
10949
|
-
* * `<translationKeyPrefix>.save_error` (optional): Header of the
|
10950
|
-
* failure message that is displayed if the model cannot be saved.
|
10951
|
-
*
|
10952
|
-
* * `<translationKeyPrefix>.retry` (optional): Label of the retry
|
10953
|
-
* button of the failure message.
|
10954
|
-
*
|
10955
|
-
* @param {Object} options
|
10956
|
-
* @param {Backbone.Model} options.model -
|
10957
|
-
* Model including the {@link configurationContainer},
|
10958
|
-
* {@link failureTracking} and {@link delayedDestroying} mixins.
|
10959
|
-
*
|
10960
|
-
* @since 15.1
|
10961
|
-
*/
|
10962
|
-
|
10963
|
-
var EditConfigurationView = Marionette.Layout.extend({
|
10964
|
-
template: function template(_ref) {
|
10965
|
-
var t = _ref.t;
|
10966
|
-
return "\n <a class=\"back\">".concat(t('back'), "</a>\n <a class=\"destroy\">").concat(t('destroy'), "</a>\n\n <div class=\"failure\">\n <p>").concat(t('save_error'), "</p>\n <p class=\"message\"></p>\n <a class=\"retry\" href=\"\">").concat(t('retry'), "</a>\n </div>\n\n <div class=\"configuration_container\"></div>\n ");
|
10967
|
-
},
|
10968
|
-
serializeData: function serializeData() {
|
10969
|
-
var _this = this;
|
10970
|
-
|
10971
|
-
return {
|
10972
|
-
t: function t(key) {
|
10973
|
-
return _this.t(key);
|
10974
|
-
}
|
10975
|
-
};
|
10976
|
-
},
|
10977
|
-
mixins: [failureIndicatingView],
|
10978
|
-
regions: {
|
10979
|
-
configurationContainer: '.configuration_container'
|
10980
|
-
},
|
10981
|
-
events: {
|
10982
|
-
'click a.back': 'goBack',
|
10983
|
-
'click a.destroy': 'destroy'
|
10984
|
-
},
|
10985
|
-
onRender: function onRender() {
|
10986
|
-
var translationKeyPrefix = _$1.result(this, 'translationKeyPrefix');
|
10987
|
-
|
10988
|
-
this.configurationEditor = new ConfigurationEditorView({
|
10989
|
-
tabTranslationKeyPrefix: "".concat(translationKeyPrefix, ".tabs"),
|
10990
|
-
attributeTranslationKeyPrefixes: ["".concat(translationKeyPrefix, ".attributes")],
|
10991
|
-
model: this.model.configuration
|
10992
|
-
});
|
10993
|
-
this.configure(this.configurationEditor);
|
10994
|
-
this.configurationContainer.show(this.configurationEditor);
|
10995
|
-
},
|
10996
|
-
onShow: function onShow() {
|
10997
|
-
this.configurationEditor.refreshScroller();
|
10998
|
-
},
|
10999
|
-
destroy: function destroy() {
|
11000
|
-
if (window.confirm(this.t('confirm_destroy'))) {
|
11001
|
-
this.model.destroyWithDelay();
|
11002
|
-
this.goBack();
|
11003
|
-
}
|
11004
|
-
},
|
11005
|
-
goBack: function goBack() {
|
11006
|
-
editor.navigate('/', {
|
11007
|
-
trigger: true
|
11008
|
-
});
|
11009
|
-
},
|
11010
|
-
t: function t(suffix) {
|
11011
|
-
var translationKeyPrefix = _$1.result(this, 'translationKeyPrefix');
|
11012
|
-
|
11013
|
-
return I18n$1.t("".concat(translationKeyPrefix, ".").concat(suffix), {
|
11014
|
-
defaultValue: I18n$1.t("pageflow.editor.views.edit_configuration.".concat(suffix))
|
11015
|
-
});
|
11016
|
-
}
|
11017
|
-
});
|
11018
|
-
|
11019
10485
|
ConfigurationEditorView.register('audio', {
|
11020
10486
|
configure: function configure() {
|
11021
10487
|
this.tab('general', function () {
|
@@ -11319,7 +10785,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
11319
10785
|
text: I18n$1.t('pageflow.editor.title_loading_spinner.widget_type_info_box_text')
|
11320
10786
|
});
|
11321
10787
|
this.input('title', TextInputView, {
|
11322
|
-
placeholder: state.entry.
|
10788
|
+
placeholder: state.entry.configuration.get('title') || state.entry.get('entry_title')
|
11323
10789
|
});
|
11324
10790
|
this.input('subtitle', TextInputView);
|
11325
10791
|
this.input('custom_background_image_id', FileInputView, {
|
@@ -11521,8 +10987,9 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
11521
10987
|
editor.failures.watch(state.entry);
|
11522
10988
|
editor.failures.watch(state.pages);
|
11523
10989
|
editor.failures.watch(state.chapters);
|
11524
|
-
|
11525
|
-
|
10990
|
+
state.savingRecords = new SavingRecordsCollection();
|
10991
|
+
state.savingRecords.watch(state.pages);
|
10992
|
+
state.savingRecords.watch(state.chapters);
|
11526
10993
|
pageflow.events.trigger('seed:loaded');
|
11527
10994
|
});
|
11528
10995
|
|
@@ -11579,7 +11046,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
11579
11046
|
state.entry.on('use:files', function () {
|
11580
11047
|
pageflow.stylesheet.reload('entry');
|
11581
11048
|
});
|
11582
|
-
state.entry.
|
11049
|
+
state.entry.configuration.on('change:theme_name', function () {
|
11583
11050
|
var theme = state.entry.getTheme();
|
11584
11051
|
pageflow.stylesheet.update('theme', theme.get('stylesheet_path'));
|
11585
11052
|
});
|
@@ -11688,7 +11155,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
11688
11155
|
exports.DropDownButtonItemView = DropDownButtonItemView;
|
11689
11156
|
exports.DropDownButtonView = DropDownButtonView;
|
11690
11157
|
exports.EditChapterView = EditChapterView;
|
11691
|
-
exports.EditConfigurationView = EditConfigurationView;
|
11692
11158
|
exports.EditEntryView = EditEntryView;
|
11693
11159
|
exports.EditFileView = EditFileView;
|
11694
11160
|
exports.EditLock = EditLock;
|
@@ -11705,14 +11171,13 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
11705
11171
|
exports.EncodedFile = EncodedFile;
|
11706
11172
|
exports.EncodingConfirmation = EncodingConfirmation;
|
11707
11173
|
exports.Entry = Entry;
|
11708
|
-
exports.
|
11709
|
-
exports.
|
11174
|
+
exports.EntryConfiguration = EntryConfiguration;
|
11175
|
+
exports.EntryConfigurationFileSelectionHandler = EntryConfigurationFileSelectionHandler;
|
11710
11176
|
exports.EntryPublication = EntryPublication;
|
11711
11177
|
exports.EntryPublicationQuotaDecoratorView = EntryPublicationQuotaDecoratorView;
|
11712
11178
|
exports.EnumTableCellView = EnumTableCellView;
|
11713
11179
|
exports.ExplorerFileItemView = ExplorerFileItemView;
|
11714
11180
|
exports.ExtendedSelectInputView = ExtendedSelectInputView;
|
11715
|
-
exports.Failure = Failure;
|
11716
11181
|
exports.FileConfiguration = FileConfiguration;
|
11717
11182
|
exports.FileImport = FileImport;
|
11718
11183
|
exports.FileInputView = FileInputView;
|
@@ -11733,7 +11198,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
11733
11198
|
exports.FilesImporterView = FilesImporterView;
|
11734
11199
|
exports.FilesView = FilesView;
|
11735
11200
|
exports.FilteredFilesView = FilteredFilesView;
|
11736
|
-
exports.ForeignKeySubsetCollection = ForeignKeySubsetCollection;
|
11737
11201
|
exports.HelpButtonView = HelpButtonView;
|
11738
11202
|
exports.HelpImageView = HelpImageView;
|
11739
11203
|
exports.HelpView = HelpView;
|
@@ -11748,6 +11212,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
11748
11212
|
exports.LoadingView = LoadingView;
|
11749
11213
|
exports.LockedView = LockedView;
|
11750
11214
|
exports.ModelThumbnailView = ModelThumbnailView;
|
11215
|
+
exports.MultiCollection = MultiCollection;
|
11751
11216
|
exports.NestedFilesCollection = NestedFilesCollection;
|
11752
11217
|
exports.NestedFilesView = NestedFilesView;
|
11753
11218
|
exports.NestedTypeError = NestedTypeError;
|
@@ -11775,6 +11240,7 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
11775
11240
|
exports.PublishEntryView = PublishEntryView;
|
11776
11241
|
exports.ReferenceInputView = ReferenceInputView;
|
11777
11242
|
exports.ReusableFile = ReusableFile;
|
11243
|
+
exports.SavingRecordsCollection = SavingRecordsCollection;
|
11778
11244
|
exports.Scaffold = Scaffold;
|
11779
11245
|
exports.ScrollingView = ScrollingView;
|
11780
11246
|
exports.SelectButtonView = SelectButtonView;
|
@@ -11828,12 +11294,10 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
11828
11294
|
exports.addAndReturnModel = addAndReturnModel;
|
11829
11295
|
exports.app = app;
|
11830
11296
|
exports.authenticationProvider = authenticationProvider;
|
11831
|
-
exports.configurationContainer = configurationContainer;
|
11832
11297
|
exports.cssModulesUtils = cssModulesUtils;
|
11833
11298
|
exports.delayedDestroying = delayedDestroying;
|
11834
11299
|
exports.dialogView = dialogView;
|
11835
11300
|
exports.editor = editor;
|
11836
|
-
exports.entryTypeEditorControllerUrls = entryTypeEditorControllerUrls;
|
11837
11301
|
exports.failureIndicatingView = failureIndicatingView;
|
11838
11302
|
exports.failureTracking = failureTracking;
|
11839
11303
|
exports.fileWithType = fileWithType;
|
@@ -11843,7 +11307,6 @@ this.pageflow._editorGlobalInterop = (function (exports, Backbone, _$1, Marionet
|
|
11843
11307
|
exports.inputView = inputView;
|
11844
11308
|
exports.inputWithPlaceholderText = inputWithPlaceholderText;
|
11845
11309
|
exports.loadable = loadable;
|
11846
|
-
exports.modelLifecycleTrackingView = modelLifecycleTrackingView;
|
11847
11310
|
exports.orderedCollection = orderedCollection;
|
11848
11311
|
exports.persistedPromise = persistedPromise;
|
11849
11312
|
exports.polling = polling;
|