pageflow 16.0.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +210 -33
- data/README.md +0 -1
- data/Rakefile +1 -1
- data/admins/pageflow/entry.rb +0 -1
- data/admins/pageflow/sites.rb +3 -0
- data/app/assets/javascripts/pageflow/dist/ui.js +298 -72
- data/app/assets/stylesheets/pageflow/admin/permalink_input.scss +10 -0
- data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +6 -1
- data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -0
- data/app/assets/stylesheets/pageflow/editor/help.scss +3 -3
- data/app/assets/stylesheets/pageflow/editor/info_box.scss +7 -0
- data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +0 -5
- data/app/assets/stylesheets/pageflow/ui/forms.scss +1 -1
- data/app/controllers/pageflow/chapters_controller.rb +2 -2
- data/app/controllers/pageflow/editor/files_controller.rb +1 -1
- data/app/controllers/pageflow/entries_controller.rb +10 -0
- data/app/controllers/pageflow/feeds_controller.rb +18 -0
- data/app/controllers/pageflow/pages_controller.rb +2 -2
- data/app/controllers/pageflow/sitemaps_controller.rb +15 -0
- data/app/controllers/pageflow/storylines_controller.rb +2 -2
- data/app/helpers/pageflow/entries_helper.rb +2 -1
- data/app/helpers/pageflow/feeds_helper.rb +66 -0
- data/app/helpers/pageflow/page_types_helper.rb +9 -9
- data/app/inputs/pageflow_permalink_input.rb +15 -3
- data/app/models/concerns/pageflow/reusable_file.rb +3 -3
- data/app/models/pageflow/account.rb +8 -0
- data/app/models/pageflow/audio_file_url_templates.rb +2 -1
- data/app/models/pageflow/draft_entry.rb +1 -1
- data/app/models/pageflow/entries_feed.rb +32 -0
- data/app/models/pageflow/image_file.rb +14 -3
- data/app/models/pageflow/membership.rb +3 -2
- data/app/models/pageflow/other_file.rb +5 -0
- data/app/models/pageflow/other_file_url_templates.rb +16 -0
- data/app/models/pageflow/published_entry.rb +6 -0
- data/app/models/pageflow/revision.rb +4 -0
- data/app/models/pageflow/site.rb +8 -0
- data/app/models/pageflow/sitemaps.rb +13 -0
- data/app/models/pageflow/used_file.rb +2 -2
- data/app/models/pageflow/video_file_url_templates.rb +3 -1
- data/app/models/pageflow/widget.rb +9 -1
- data/app/views/admin/entries/_permalink_inputs.html.erb +1 -2
- data/app/views/admin/sites/_attributes_table.html.arb +3 -0
- data/app/views/admin/sites/_fields.html.erb +6 -0
- data/app/views/components/pageflow/admin/extensible_attributes_table.rb +8 -2
- data/app/views/components/pageflow/admin/sites_tab.rb +3 -0
- data/app/views/pageflow/editor/config/_seeds.json.jbuilder +1 -0
- data/app/views/pageflow/feeds/index.atom.builder +20 -0
- data/app/views/pageflow/sitemaps/index.xml.builder +9 -0
- data/config/initializers/features.rb +1 -0
- data/config/initializers/paperclip.rb +4 -0
- data/config/locales/de.yml +27 -6
- data/config/locales/en.yml +30 -4
- data/config/routes.rb +3 -0
- data/config/spring.rb +1 -1
- data/db/migrate/20230120092923_create_other_files.rb +23 -0
- data/db/migrate/20230323115745_add_feeds_enabled_to_sites.rb +5 -0
- data/db/migrate/20230323154323_add_sitemap_enabled_to_sites.rb +5 -0
- data/db/migrate/20230331103823_add_title_to_sites.rb +5 -0
- data/db/migrate/20230405103612_add_custom_feed_url_to_sites.rb +5 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +445 -109
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +26 -3
- data/entry_types/paged/app/controllers/pageflow_paged/editor/entries_controller.rb +0 -2
- data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +1 -0
- data/entry_types/paged/app/views/pageflow_paged/entries/show.html.erb +1 -0
- data/entry_types/paged/config/initializers/features.rb +0 -1
- data/entry_types/paged/lib/pageflow_paged/engine.rb +17 -1
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +3 -4
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +13 -6
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +2 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/cache_helper.rb +11 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/entry_json_seed_helper.rb +42 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +3 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +31 -10
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +9 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +3 -1
- data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +23 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +6 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -5
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/sections/_section_with_content_elements.json.jbuilder +10 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +44 -41
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_consent_vendors.json.jbuilder +16 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +3 -0
- data/entry_types/scrolled/config/initializers/features.rb +5 -0
- data/entry_types/scrolled/config/locales/consent_widget.de.yml +4 -0
- data/entry_types/scrolled/config/locales/consent_widget.en.yml +4 -0
- data/entry_types/scrolled/config/locales/de.yml +189 -8
- data/entry_types/scrolled/config/locales/en.yml +207 -2
- data/entry_types/scrolled/config/routes.rb +4 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +97 -5
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +1 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +96 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/content_element_consent_vendors.rb +38 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +17 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +24 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +6 -1
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +1 -2
- data/entry_types/scrolled/package/contentElements-editor.js +307 -22
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
- data/entry_types/scrolled/package/contentElements-frontend.js +690 -71
- data/entry_types/scrolled/package/editor.js +616 -220
- data/entry_types/scrolled/package/frontend/{EditableInlineText.module-14c7b097.js → EditableInlineText.module-fa9e3aff.js} +1669 -1674
- data/entry_types/scrolled/package/frontend/PhonePlatformContext-10a1d600.js +32 -0
- data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-727cce0d.js +107 -0
- data/entry_types/scrolled/package/frontend/Viewer-169e14ca.js +154 -0
- data/entry_types/scrolled/package/frontend/{Viewer-b6becc57.js → Viewer-ee1aa590.js} +32 -161
- data/entry_types/scrolled/package/frontend/arrowRight-92a34ccc.js +77 -0
- data/entry_types/scrolled/package/frontend/{components-b3160dd7.js → components-4a09bfa3.js} +185 -45
- data/entry_types/scrolled/package/frontend/{PhonePlatformContext-f6093cc6.js → i18n-ddd92820.js} +149 -107
- data/entry_types/scrolled/package/frontend/index-02378634.js +118 -0
- data/entry_types/scrolled/package/frontend/index.css +1 -1
- data/entry_types/scrolled/package/frontend/index.js +206 -54
- data/entry_types/scrolled/package/frontend/useContentElementEditorState-63045393.js +52 -0
- data/entry_types/scrolled/package/package.json +2 -1
- data/entry_types/scrolled/package/testHelpers.js +9 -2
- data/entry_types/scrolled/package/values/colors.module.css +15 -0
- data/entry_types/scrolled/package/widgets/consentBar.css +1 -0
- data/entry_types/scrolled/package/widgets/consentBar.js +426 -0
- data/entry_types/scrolled/package/widgets/defaultNavigation.css +1 -1
- data/lib/generators/pageflow/resque/resque_generator.rb +1 -1
- data/lib/pageflow/ability_mixin.rb +5 -5
- data/lib/pageflow/active_admin_can_can_fix.rb +2 -2
- data/lib/pageflow/built_in_file_type.rb +7 -0
- data/lib/pageflow/configuration.rb +21 -0
- data/lib/pageflow/engine.rb +60 -39
- data/lib/pageflow/entry_export_import/revision_serialization.rb +1 -1
- data/lib/pageflow/file_type.rb +2 -2
- data/lib/pageflow/global_config_api.rb +2 -2
- data/lib/pageflow/nested_revision_component.rb +23 -5
- data/lib/pageflow/rails_version.rb +19 -0
- data/lib/pageflow/seeds.rb +10 -7
- data/lib/pageflow/version.rb +1 -1
- data/lib/pageflow/widget_types.rb +4 -0
- data/package/config/webpack5.js +14 -0
- data/package/editor.js +141 -30
- data/package/frontend.js +26 -2
- data/package/testHelpers.js +1 -1
- data/package/ui.js +296 -71
- data/spec/factories/entries.rb +17 -3
- data/spec/factories/sites.rb +3 -0
- data/vendor/assets/javascripts/iscroll.js +4 -7
- metadata +65 -49
- data/app/helpers/pageflow/admin/permalinks_helper.rb +0 -15
- data/entry_types/scrolled/package/frontend/arrowRight-78a7cee4.js +0 -42
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, ChildViewContainer, IScroll, jquery_minicolors, wysihtml5, Cocktail, frontend, frontend$1) {
|
|
1
|
+
var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, ChildViewContainer, IScroll, jquery_minicolors, wysihtml5, jqueryUi, Cocktail, frontend, frontend$1) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Backbone = Backbone && Backbone.hasOwnProperty('default') ? Backbone['default'] : Backbone;
|
|
@@ -1062,6 +1062,107 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
1062
1062
|
}, this), 200);
|
|
1063
1063
|
}
|
|
1064
1064
|
});
|
|
1065
|
+
|
|
1066
|
+
function _defineProperty(obj, key, value) {
|
|
1067
|
+
if (key in obj) {
|
|
1068
|
+
Object.defineProperty(obj, key, {
|
|
1069
|
+
value: value,
|
|
1070
|
+
enumerable: true,
|
|
1071
|
+
configurable: true,
|
|
1072
|
+
writable: true
|
|
1073
|
+
});
|
|
1074
|
+
} else {
|
|
1075
|
+
obj[key] = value;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
return obj;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
function ownKeys(object, enumerableOnly) {
|
|
1082
|
+
var keys = Object.keys(object);
|
|
1083
|
+
|
|
1084
|
+
if (Object.getOwnPropertySymbols) {
|
|
1085
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1086
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
1087
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1088
|
+
});
|
|
1089
|
+
keys.push.apply(keys, symbols);
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
return keys;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
function _objectSpread2(target) {
|
|
1096
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1097
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1098
|
+
|
|
1099
|
+
if (i % 2) {
|
|
1100
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
1101
|
+
_defineProperty(target, key, source[key]);
|
|
1102
|
+
});
|
|
1103
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
1104
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1105
|
+
} else {
|
|
1106
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
1107
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
return target;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
var attributeBinding = {
|
|
1116
|
+
setupBooleanAttributeBinding: function setupBooleanAttributeBinding(optionName, updateMethod) {
|
|
1117
|
+
this.setupAttributeBinding(optionName, updateMethod, Boolean);
|
|
1118
|
+
},
|
|
1119
|
+
getBooleanAttributBoundOption: function getBooleanAttributBoundOption(optionName) {
|
|
1120
|
+
return this.getAttributeBoundOption(optionName, Boolean);
|
|
1121
|
+
},
|
|
1122
|
+
setupAttributeBinding: function setupAttributeBinding(optionName, updateMethod) {
|
|
1123
|
+
var _this = this;
|
|
1124
|
+
|
|
1125
|
+
var normalize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (value) {
|
|
1126
|
+
return value;
|
|
1127
|
+
};
|
|
1128
|
+
var binding = this.options["".concat(optionName, "Binding")];
|
|
1129
|
+
var view = this;
|
|
1130
|
+
|
|
1131
|
+
if (binding) {
|
|
1132
|
+
_.flatten([binding]).forEach(function (attribute) {
|
|
1133
|
+
_this.listenTo(_this.model, 'change:' + attribute, update);
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
update();
|
|
1138
|
+
|
|
1139
|
+
function update() {
|
|
1140
|
+
updateMethod.call(view, view.getAttributeBoundOption(optionName, normalize));
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
getAttributeBoundOption: function getAttributeBoundOption(optionName) {
|
|
1144
|
+
var _this2 = this;
|
|
1145
|
+
|
|
1146
|
+
var normalize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (value) {
|
|
1147
|
+
return value;
|
|
1148
|
+
};
|
|
1149
|
+
var binding = this.options["".concat(optionName, "Binding")];
|
|
1150
|
+
var bindingValueOptionName = "".concat(optionName, "BindingValue");
|
|
1151
|
+
var value = Array.isArray(binding) ? binding.map(function (attribute) {
|
|
1152
|
+
return _this2.model.get(attribute);
|
|
1153
|
+
}) : this.model.get(binding);
|
|
1154
|
+
|
|
1155
|
+
if (bindingValueOptionName in this.options) {
|
|
1156
|
+
return value === this.options[bindingValueOptionName];
|
|
1157
|
+
} else if (typeof this.options[optionName] === 'function') {
|
|
1158
|
+
return normalize(this.options[optionName](value));
|
|
1159
|
+
} else if (optionName in this.options) {
|
|
1160
|
+
return normalize(this.options[optionName]);
|
|
1161
|
+
} else if (binding) {
|
|
1162
|
+
return normalize(value);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
};
|
|
1065
1166
|
/**
|
|
1066
1167
|
* Mixin for input views handling common concerns like labels,
|
|
1067
1168
|
* inline help, visiblity and disabling.
|
|
@@ -1191,7 +1292,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
1191
1292
|
* @mixin
|
|
1192
1293
|
*/
|
|
1193
1294
|
|
|
1194
|
-
var inputView = {
|
|
1295
|
+
var inputView = _objectSpread2(_objectSpread2({}, attributeBinding), {}, {
|
|
1195
1296
|
ui: {
|
|
1196
1297
|
label: 'label',
|
|
1197
1298
|
labelText: 'label .name',
|
|
@@ -1235,8 +1336,8 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
1235
1336
|
this.ui.labelText.text(this.labelText());
|
|
1236
1337
|
this.updateInlineHelp();
|
|
1237
1338
|
this.setLabelFor();
|
|
1238
|
-
this.
|
|
1239
|
-
this.
|
|
1339
|
+
this.setupBooleanAttributeBinding('disabled', this.updateDisabled);
|
|
1340
|
+
this.setupBooleanAttributeBinding('visible', this.updateVisible);
|
|
1240
1341
|
},
|
|
1241
1342
|
|
|
1242
1343
|
/**
|
|
@@ -1285,7 +1386,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
1285
1386
|
}
|
|
1286
1387
|
},
|
|
1287
1388
|
isDisabled: function isDisabled() {
|
|
1288
|
-
return this.
|
|
1389
|
+
return this.getBooleanAttributBoundOption('disabled');
|
|
1289
1390
|
},
|
|
1290
1391
|
updateDisabled: function updateDisabled() {
|
|
1291
1392
|
this.$el.toggleClass('input-disabled', !!this.isDisabled());
|
|
@@ -1303,46 +1404,9 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
1303
1404
|
}
|
|
1304
1405
|
},
|
|
1305
1406
|
updateVisible: function updateVisible() {
|
|
1306
|
-
this.$el.toggleClass('
|
|
1307
|
-
},
|
|
1308
|
-
setupAttributeBinding: function setupAttributeBinding(optionName, updateMethod) {
|
|
1309
|
-
var _this = this;
|
|
1310
|
-
|
|
1311
|
-
var binding = this.options["".concat(optionName, "Binding")];
|
|
1312
|
-
var view = this;
|
|
1313
|
-
|
|
1314
|
-
if (binding) {
|
|
1315
|
-
_.flatten([binding]).forEach(function (attribute) {
|
|
1316
|
-
_this.listenTo(_this.model, 'change:' + attribute, update);
|
|
1317
|
-
});
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
update();
|
|
1321
|
-
|
|
1322
|
-
function update() {
|
|
1323
|
-
updateMethod.call(view, view.getAttributeBoundOption(optionName));
|
|
1324
|
-
}
|
|
1325
|
-
},
|
|
1326
|
-
getAttributeBoundOption: function getAttributeBoundOption(optionName) {
|
|
1327
|
-
var _this2 = this;
|
|
1328
|
-
|
|
1329
|
-
var binding = this.options["".concat(optionName, "Binding")];
|
|
1330
|
-
var bindingValueOptionName = "".concat(optionName, "BindingValue");
|
|
1331
|
-
var value = Array.isArray(binding) ? binding.map(function (attribute) {
|
|
1332
|
-
return _this2.model.get(attribute);
|
|
1333
|
-
}) : this.model.get(binding);
|
|
1334
|
-
|
|
1335
|
-
if (bindingValueOptionName in this.options) {
|
|
1336
|
-
return value === this.options[bindingValueOptionName];
|
|
1337
|
-
} else if (typeof this.options[optionName] === 'function') {
|
|
1338
|
-
return !!this.options[optionName](value);
|
|
1339
|
-
} else if (optionName in this.options) {
|
|
1340
|
-
return !!this.options[optionName];
|
|
1341
|
-
} else if (binding) {
|
|
1342
|
-
return !!value;
|
|
1343
|
-
}
|
|
1407
|
+
this.$el.toggleClass('hidden_via_binding', this.getBooleanAttributBoundOption('visible') === false);
|
|
1344
1408
|
}
|
|
1345
|
-
};
|
|
1409
|
+
});
|
|
1346
1410
|
|
|
1347
1411
|
function template$4(data) {
|
|
1348
1412
|
var __p = '';
|
|
@@ -1460,6 +1524,125 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
1460
1524
|
this.ui.link.attr('href', url);
|
|
1461
1525
|
}
|
|
1462
1526
|
});
|
|
1527
|
+
|
|
1528
|
+
function _classCallCheck(instance, Constructor) {
|
|
1529
|
+
if (!(instance instanceof Constructor)) {
|
|
1530
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
function _defineProperties(target, props) {
|
|
1535
|
+
for (var i = 0; i < props.length; i++) {
|
|
1536
|
+
var descriptor = props[i];
|
|
1537
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1538
|
+
descriptor.configurable = true;
|
|
1539
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1540
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
1545
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
1546
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1547
|
+
return Constructor;
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Input view for a number.
|
|
1551
|
+
*
|
|
1552
|
+
* See {@link inputView} for further options.
|
|
1553
|
+
*
|
|
1554
|
+
* @param {Object} [options]
|
|
1555
|
+
*
|
|
1556
|
+
* @param {string} [options.locale]
|
|
1557
|
+
* Locale used to fomat and parse numbers.
|
|
1558
|
+
*
|
|
1559
|
+
* @class
|
|
1560
|
+
*/
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
var NumberInputView = Marionette.ItemView.extend({
|
|
1564
|
+
mixins: [inputView],
|
|
1565
|
+
template: function template() {
|
|
1566
|
+
return "\n <label>\n <span class=\"name\"></span>\n <span class=\"inline_help\"></span>\n </label>\n <input type=\"text\" dir=\"auto\" />\n ";
|
|
1567
|
+
},
|
|
1568
|
+
ui: {
|
|
1569
|
+
input: 'input'
|
|
1570
|
+
},
|
|
1571
|
+
events: {
|
|
1572
|
+
'change': 'onChange'
|
|
1573
|
+
},
|
|
1574
|
+
initialize: function initialize() {
|
|
1575
|
+
this.parser = new NumberParser(this.options.locale);
|
|
1576
|
+
},
|
|
1577
|
+
onRender: function onRender() {
|
|
1578
|
+
this.load();
|
|
1579
|
+
this.listenTo(this.model, 'change:' + this.options.propertyName, this.load);
|
|
1580
|
+
},
|
|
1581
|
+
onChange: function onChange() {
|
|
1582
|
+
this.save();
|
|
1583
|
+
this.load();
|
|
1584
|
+
},
|
|
1585
|
+
onClose: function onClose() {
|
|
1586
|
+
this.save();
|
|
1587
|
+
},
|
|
1588
|
+
save: function save() {
|
|
1589
|
+
var inputValue = this.ui.input.val();
|
|
1590
|
+
this.model.set(this.options.propertyName, this.parser.parse(inputValue) || 0);
|
|
1591
|
+
},
|
|
1592
|
+
load: function load() {
|
|
1593
|
+
var input = this.ui.input;
|
|
1594
|
+
var value = this.model.get(this.options.propertyName) || 0;
|
|
1595
|
+
input.val(value.toLocaleString(this.options.locale, {
|
|
1596
|
+
useGrouping: false
|
|
1597
|
+
}));
|
|
1598
|
+
},
|
|
1599
|
+
displayValidationError: function displayValidationError(message) {
|
|
1600
|
+
this.$el.addClass('invalid');
|
|
1601
|
+
this.ui.input.attr('title', message);
|
|
1602
|
+
},
|
|
1603
|
+
resetValidationError: function resetValidationError(message) {
|
|
1604
|
+
this.$el.removeClass('invalid');
|
|
1605
|
+
this.ui.input.attr('title', '');
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
|
|
1609
|
+
var NumberParser = /*#__PURE__*/function () {
|
|
1610
|
+
function NumberParser(locale) {
|
|
1611
|
+
_classCallCheck(this, NumberParser);
|
|
1612
|
+
|
|
1613
|
+
var format = new Intl.NumberFormat(locale);
|
|
1614
|
+
var parts = format.formatToParts(12345.6);
|
|
1615
|
+
var numerals = Array.from({
|
|
1616
|
+
length: 10
|
|
1617
|
+
}).map(function (_, i) {
|
|
1618
|
+
return format.format(i);
|
|
1619
|
+
});
|
|
1620
|
+
var index = new Map(numerals.map(function (d, i) {
|
|
1621
|
+
return [d, i];
|
|
1622
|
+
}));
|
|
1623
|
+
this._group = new RegExp("[".concat(parts.find(function (d) {
|
|
1624
|
+
return d.type === "group";
|
|
1625
|
+
}).value, "]"), "g");
|
|
1626
|
+
this._decimal = new RegExp("[".concat(parts.find(function (d) {
|
|
1627
|
+
return d.type === "decimal";
|
|
1628
|
+
}).value, "]"));
|
|
1629
|
+
this._numeral = new RegExp("[".concat(numerals.join(""), "]"), "g");
|
|
1630
|
+
|
|
1631
|
+
this._index = function (d) {
|
|
1632
|
+
return index.get(d);
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
_createClass(NumberParser, [{
|
|
1637
|
+
key: "parse",
|
|
1638
|
+
value: function parse(string) {
|
|
1639
|
+
string = string.trim().replace(this._group, "").replace(this._decimal, ".").replace(this._numeral, this._index);
|
|
1640
|
+
return string ? +string : NaN;
|
|
1641
|
+
}
|
|
1642
|
+
}]);
|
|
1643
|
+
|
|
1644
|
+
return NumberParser;
|
|
1645
|
+
}();
|
|
1463
1646
|
/**
|
|
1464
1647
|
* Text based input view that can display a placeholder.
|
|
1465
1648
|
*
|
|
@@ -1482,6 +1665,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
1482
1665
|
* inside a given model.
|
|
1483
1666
|
*/
|
|
1484
1667
|
|
|
1668
|
+
|
|
1485
1669
|
var inputWithPlaceholderText = {
|
|
1486
1670
|
onRender: function onRender() {
|
|
1487
1671
|
this.updatePlaceholder();
|
|
@@ -1669,11 +1853,15 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
1669
1853
|
this.ui.input.minicolors({
|
|
1670
1854
|
changeDelay: 200,
|
|
1671
1855
|
change: _.bind(function (color) {
|
|
1856
|
+
this._saving = true;
|
|
1857
|
+
|
|
1672
1858
|
if (color === this.defaultValue()) {
|
|
1673
1859
|
this.model.unset(this.options.propertyName);
|
|
1674
1860
|
} else {
|
|
1675
1861
|
this.model.set(this.options.propertyName, color);
|
|
1676
1862
|
}
|
|
1863
|
+
|
|
1864
|
+
this._saving = false;
|
|
1677
1865
|
}, this)
|
|
1678
1866
|
});
|
|
1679
1867
|
this.listenTo(this.model, 'change:' + this.options.propertyName, this.load);
|
|
@@ -1702,7 +1890,10 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
1702
1890
|
}
|
|
1703
1891
|
},
|
|
1704
1892
|
load: function load() {
|
|
1705
|
-
|
|
1893
|
+
if (!this._saving) {
|
|
1894
|
+
this.ui.input.minicolors('value', this.model.get(this.options.propertyName) || this.defaultValue());
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1706
1897
|
this.$el.toggleClass('is_default', !this.model.has(this.options.propertyName));
|
|
1707
1898
|
},
|
|
1708
1899
|
refreshPicker: function refreshPicker() {
|
|
@@ -2258,21 +2449,6 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
2258
2449
|
}
|
|
2259
2450
|
});
|
|
2260
2451
|
|
|
2261
|
-
function _defineProperty(obj, key, value) {
|
|
2262
|
-
if (key in obj) {
|
|
2263
|
-
Object.defineProperty(obj, key, {
|
|
2264
|
-
value: value,
|
|
2265
|
-
enumerable: true,
|
|
2266
|
-
configurable: true,
|
|
2267
|
-
writable: true
|
|
2268
|
-
});
|
|
2269
|
-
} else {
|
|
2270
|
-
obj[key] = value;
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
return obj;
|
|
2274
|
-
}
|
|
2275
|
-
|
|
2276
2452
|
function template$9(data) {
|
|
2277
2453
|
var __p = '';
|
|
2278
2454
|
__p += '<label>\n <span class="name"></span>\n <span class="inline_help"></span>\n</label>\n<input type="text" />\n<div class="validation"></div>\n';
|
|
@@ -2537,6 +2713,25 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
2537
2713
|
*
|
|
2538
2714
|
* @param {Object} [options]
|
|
2539
2715
|
*
|
|
2716
|
+
* @param {number} [options.defaultValue]
|
|
2717
|
+
* Defaults value to display if property is not set.
|
|
2718
|
+
*
|
|
2719
|
+
* @param {number} [options.minValue=0]
|
|
2720
|
+
* Value when dragging slider to the very left.
|
|
2721
|
+
*
|
|
2722
|
+
* @param {number} [options.maxValue=100]
|
|
2723
|
+
* Value when dragging slider to the very right.
|
|
2724
|
+
*
|
|
2725
|
+
* @param {string} [options.unit="%"]
|
|
2726
|
+
* Unit to display after value.
|
|
2727
|
+
*
|
|
2728
|
+
* @param {function} [options.displayText]
|
|
2729
|
+
* Function that receives value and returns custom text to display as value.
|
|
2730
|
+
*
|
|
2731
|
+
* @param {boolean} [options.saveOnSlide]
|
|
2732
|
+
* Already update the model while dragging the handle - not only after
|
|
2733
|
+
* handle has been released.
|
|
2734
|
+
*
|
|
2540
2735
|
* @class
|
|
2541
2736
|
*/
|
|
2542
2737
|
|
|
@@ -2550,15 +2745,27 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
2550
2745
|
value: '.value'
|
|
2551
2746
|
},
|
|
2552
2747
|
events: {
|
|
2553
|
-
'slidechange': 'save'
|
|
2748
|
+
'slidechange': 'save',
|
|
2749
|
+
'slide': 'handleSlide'
|
|
2554
2750
|
},
|
|
2555
2751
|
onRender: function onRender() {
|
|
2752
|
+
var _this = this;
|
|
2753
|
+
|
|
2556
2754
|
this.ui.widget.slider({
|
|
2557
|
-
animate: 'fast'
|
|
2558
|
-
|
|
2559
|
-
|
|
2755
|
+
animate: 'fast'
|
|
2756
|
+
});
|
|
2757
|
+
this.setupAttributeBinding('minValue', function (value) {
|
|
2758
|
+
return _this.updateSliderOption('min', value || 0);
|
|
2759
|
+
});
|
|
2760
|
+
this.setupAttributeBinding('maxValue', function (value) {
|
|
2761
|
+
return _this.updateSliderOption('max', value || 100);
|
|
2560
2762
|
});
|
|
2561
2763
|
this.load();
|
|
2764
|
+
this.listenTo(this.model, 'change:' + this.options.propertyName, this.load);
|
|
2765
|
+
},
|
|
2766
|
+
updateSliderOption: function updateSliderOption(name, value) {
|
|
2767
|
+
this.ui.widget.slider('option', name, value);
|
|
2768
|
+
this.updateText(this.ui.widget.slider('value'));
|
|
2562
2769
|
},
|
|
2563
2770
|
updateDisabled: function updateDisabled(disabled) {
|
|
2564
2771
|
this.$el.toggleClass('disabled', !!disabled);
|
|
@@ -2569,11 +2776,15 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
2569
2776
|
this.ui.widget.slider('enable');
|
|
2570
2777
|
}
|
|
2571
2778
|
},
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
this.
|
|
2576
|
-
|
|
2779
|
+
handleSlide: function handleSlide(event, ui) {
|
|
2780
|
+
this.updateText(ui.value);
|
|
2781
|
+
|
|
2782
|
+
if (this.options.saveOnSlide) {
|
|
2783
|
+
this.save(event, ui);
|
|
2784
|
+
}
|
|
2785
|
+
},
|
|
2786
|
+
save: function save(event, ui) {
|
|
2787
|
+
this.model.set(this.options.propertyName, ui.value);
|
|
2577
2788
|
},
|
|
2578
2789
|
load: function load() {
|
|
2579
2790
|
var value;
|
|
@@ -2584,7 +2795,18 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
2584
2795
|
value = 'defaultValue' in this.options ? this.options.defaultValue : 0;
|
|
2585
2796
|
}
|
|
2586
2797
|
|
|
2587
|
-
this.ui.widget.slider('option', 'value', value);
|
|
2798
|
+
this.ui.widget.slider('option', 'value', this.clampValue(value));
|
|
2799
|
+
this.updateText(value);
|
|
2800
|
+
},
|
|
2801
|
+
clampValue: function clampValue(value) {
|
|
2802
|
+
var min = this.ui.widget.slider('option', 'min');
|
|
2803
|
+
var max = this.ui.widget.slider('option', 'max');
|
|
2804
|
+
return Math.min(max, Math.max(min, value));
|
|
2805
|
+
},
|
|
2806
|
+
updateText: function updateText(value) {
|
|
2807
|
+
var unit = 'unit' in this.options ? this.options.unit : '%';
|
|
2808
|
+
var text = 'displayText' in this.options ? this.options.displayText(value) : value + unit;
|
|
2809
|
+
this.ui.value.text(text);
|
|
2588
2810
|
}
|
|
2589
2811
|
});
|
|
2590
2812
|
|
|
@@ -2971,7 +3193,10 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
2971
3193
|
return view;
|
|
2972
3194
|
},
|
|
2973
3195
|
appendSubview: function appendSubview(view) {
|
|
2974
|
-
|
|
3196
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
3197
|
+
to = _ref.to;
|
|
3198
|
+
|
|
3199
|
+
return (to || this.$el).append(this.subview(view).el);
|
|
2975
3200
|
},
|
|
2976
3201
|
onClose: function onClose() {
|
|
2977
3202
|
if (this.subviews) {
|
|
@@ -3056,7 +3281,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
3056
3281
|
return obj;
|
|
3057
3282
|
}
|
|
3058
3283
|
|
|
3059
|
-
function ownKeys(object, enumerableOnly) {
|
|
3284
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
3060
3285
|
var keys = Object.keys(object);
|
|
3061
3286
|
|
|
3062
3287
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -3070,18 +3295,18 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
3070
3295
|
return keys;
|
|
3071
3296
|
}
|
|
3072
3297
|
|
|
3073
|
-
function _objectSpread2(target) {
|
|
3298
|
+
function _objectSpread2$1(target) {
|
|
3074
3299
|
for (var i = 1; i < arguments.length; i++) {
|
|
3075
3300
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
3076
3301
|
|
|
3077
3302
|
if (i % 2) {
|
|
3078
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
3303
|
+
ownKeys$1(Object(source), true).forEach(function (key) {
|
|
3079
3304
|
_defineProperty$1(target, key, source[key]);
|
|
3080
3305
|
});
|
|
3081
3306
|
} else if (Object.getOwnPropertyDescriptors) {
|
|
3082
3307
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
3083
3308
|
} else {
|
|
3084
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
3309
|
+
ownKeys$1(Object(source)).forEach(function (key) {
|
|
3085
3310
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
3086
3311
|
});
|
|
3087
3312
|
}
|
|
@@ -3252,7 +3477,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
3252
3477
|
});
|
|
3253
3478
|
var validFileTypeTranslationList = {
|
|
3254
3479
|
validFileTypeTranslations: function validFileTypeTranslations(validFileTypes) {
|
|
3255
|
-
return
|
|
3480
|
+
return validFileTypes.map(function (validFileType) {
|
|
3256
3481
|
return I18n$1.t('activerecord.models.' + validFileType.i18nKey + '.other');
|
|
3257
3482
|
}).join(', ');
|
|
3258
3483
|
}
|
|
@@ -3282,7 +3507,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
3282
3507
|
initialize: function initialize(upload, options) {
|
|
3283
3508
|
var editor = options.editor;
|
|
3284
3509
|
var fileType = options.fileType;
|
|
3285
|
-
var validFileTypes = editor.nextUploadTargetFile.fileType().nestedFileTypes
|
|
3510
|
+
var validFileTypes = editor.nextUploadTargetFile.fileType().nestedFileTypes;
|
|
3286
3511
|
var validFileTypeTranslations = this.validFileTypeTranslations(validFileTypes);
|
|
3287
3512
|
var typeI18nKey = fileType.i18nKey;
|
|
3288
3513
|
var typeSingularTranslation = I18n$1.t('activerecord.models.' + typeI18nKey + '.one');
|
|
@@ -3590,22 +3815,31 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
3590
3815
|
this.clientSideConfigModifications[name].push(config);
|
|
3591
3816
|
},
|
|
3592
3817
|
setup: function setup(serverSideConfigs) {
|
|
3818
|
+
var _this = this;
|
|
3819
|
+
|
|
3593
3820
|
var clientSideConfigs = this.clientSideConfigs;
|
|
3594
3821
|
this._setup = true;
|
|
3595
|
-
|
|
3822
|
+
|
|
3823
|
+
var configs = _.chain(serverSideConfigs).map(function (serverSideConfig) {
|
|
3596
3824
|
var clientSideConfig = clientSideConfigs[serverSideConfig.collectionName];
|
|
3597
3825
|
|
|
3598
3826
|
if (!clientSideConfig) {
|
|
3599
3827
|
throw 'Missing client side config for file type "' + serverSideConfig.collectionName + '"';
|
|
3600
3828
|
}
|
|
3601
3829
|
|
|
3602
|
-
_(
|
|
3830
|
+
_(_this.clientSideConfigModifications[serverSideConfig.collectionName]).each(function (modification) {
|
|
3603
3831
|
this.lintModification(modification, serverSideConfig.collectionName);
|
|
3604
3832
|
this.applyModification(clientSideConfig, modification);
|
|
3605
|
-
},
|
|
3833
|
+
}, _this);
|
|
3606
3834
|
|
|
3607
|
-
return
|
|
3608
|
-
}
|
|
3835
|
+
return _.extend({}, serverSideConfig, clientSideConfig);
|
|
3836
|
+
}).sortBy(function (config) {
|
|
3837
|
+
return config.priority || 10;
|
|
3838
|
+
}).value();
|
|
3839
|
+
|
|
3840
|
+
this.collection = new FileTypesCollection(_.map(configs, function (config) {
|
|
3841
|
+
return new FileType(config);
|
|
3842
|
+
}));
|
|
3609
3843
|
var those = this;
|
|
3610
3844
|
|
|
3611
3845
|
_.map(serverSideConfigs, function (serverSideConfig) {
|
|
@@ -3970,7 +4204,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
3970
4204
|
* Backbone view that will be rendered if the browser is not supported.
|
|
3971
4205
|
*/
|
|
3972
4206
|
registerEntryType: function registerEntryType(name, options) {
|
|
3973
|
-
this.entryType = _objectSpread2({
|
|
4207
|
+
this.entryType = _objectSpread2$1({
|
|
3974
4208
|
name: name
|
|
3975
4209
|
}, options);
|
|
3976
4210
|
},
|
|
@@ -4111,10 +4345,12 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
4111
4345
|
* Trigger selection of the given file type with the given
|
|
4112
4346
|
* handler. Payload hash is passed to selection handler as options.
|
|
4113
4347
|
*
|
|
4114
|
-
* @param {string|{name: string, filter: string}} fileType
|
|
4348
|
+
* @param {string|{name: string, filter: string}|{defaultTab: string, filter: string}} fileType
|
|
4115
4349
|
* Either collection name of a file type or and object containing
|
|
4116
4350
|
* the collection name a file type and a the name of a file type
|
|
4117
|
-
* filter
|
|
4351
|
+
* filter or an object containingn a defaultTab property that controls
|
|
4352
|
+
* which tab will visible initially, while allowing selecting files of
|
|
4353
|
+
* any type.
|
|
4118
4354
|
*
|
|
4119
4355
|
* @param {string} handlerName
|
|
4120
4356
|
* The name of a handler registered via {@link
|
|
@@ -4140,7 +4376,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
4140
4376
|
};
|
|
4141
4377
|
}
|
|
4142
4378
|
|
|
4143
|
-
this.navigate('/files/' + fileType.name + '?handler=' + handlerName + '&payload=' + encodeURIComponent(JSON.stringify(payload)) + (fileType.filter ? '&filter=' + fileType.filter : ''), {
|
|
4379
|
+
this.navigate('/files/' + (fileType.defaultTab ? "".concat(fileType.defaultTab, ":default") : fileType.name) + '?handler=' + handlerName + '&payload=' + encodeURIComponent(JSON.stringify(payload)) + (fileType.filter ? '&filter=' + fileType.filter : ''), {
|
|
4144
4380
|
trigger: true
|
|
4145
4381
|
});
|
|
4146
4382
|
},
|
|
@@ -4154,7 +4390,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
4154
4390
|
* whether the page is a valid selection
|
|
4155
4391
|
*/
|
|
4156
4392
|
selectPage: function selectPage(options) {
|
|
4157
|
-
return this.pageSelectionView.selectPage(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
4393
|
+
return this.pageSelectionView.selectPage(_objectSpread2$1(_objectSpread2$1({}, options), {}, {
|
|
4158
4394
|
entry: state.entry
|
|
4159
4395
|
}));
|
|
4160
4396
|
},
|
|
@@ -4164,7 +4400,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
4164
4400
|
}
|
|
4165
4401
|
|
|
4166
4402
|
var payloadJson = JSON.parse(decodeURIComponent(encodedPayload));
|
|
4167
|
-
return new this.fileSelectionHandlers[handlerName](_objectSpread2(_objectSpread2({}, payloadJson), {}, {
|
|
4403
|
+
return new this.fileSelectionHandlers[handlerName](_objectSpread2$1(_objectSpread2$1({}, payloadJson), {}, {
|
|
4168
4404
|
entry: state.entry
|
|
4169
4405
|
}));
|
|
4170
4406
|
},
|
|
@@ -6465,7 +6701,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
6465
6701
|
attrs: {
|
|
6466
6702
|
collection: collectionName,
|
|
6467
6703
|
files: selections.toJSON().map(function (item, index) {
|
|
6468
|
-
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
6704
|
+
return _objectSpread2$1(_objectSpread2$1({}, item), {}, {
|
|
6469
6705
|
url: selections.at(index).get('source_url')
|
|
6470
6706
|
});
|
|
6471
6707
|
})
|
|
@@ -6515,6 +6751,13 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
6515
6751
|
var parent = options.parent;
|
|
6516
6752
|
var parentModel = options.parentModel;
|
|
6517
6753
|
this.autoConsolidatePositions = options.autoConsolidatePositions;
|
|
6754
|
+
this.listenTo(this, 'add', function (model) {
|
|
6755
|
+
if (options.parentReferenceAttribute) {
|
|
6756
|
+
model[options.parentReferenceAttribute] = parentModel;
|
|
6757
|
+
}
|
|
6758
|
+
|
|
6759
|
+
model.set(options.foreignKeyAttribute, parentModel.id);
|
|
6760
|
+
});
|
|
6518
6761
|
SubsetCollection.prototype.constructor.call(this, {
|
|
6519
6762
|
parent: parent,
|
|
6520
6763
|
parentModel: parentModel,
|
|
@@ -6525,13 +6768,6 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
6525
6768
|
return item.get('position');
|
|
6526
6769
|
}
|
|
6527
6770
|
});
|
|
6528
|
-
this.listenTo(this, 'add', function (model) {
|
|
6529
|
-
if (options.parentReferenceAttribute) {
|
|
6530
|
-
model[options.parentReferenceAttribute] = parentModel;
|
|
6531
|
-
}
|
|
6532
|
-
|
|
6533
|
-
model.set(options.foreignKeyAttribute, parentModel.id);
|
|
6534
|
-
});
|
|
6535
6771
|
this.listenTo(parentModel, 'destroy dependentDestroy', function () {
|
|
6536
6772
|
this.invoke('trigger', 'dependentDestroy');
|
|
6537
6773
|
this.clear();
|
|
@@ -6775,6 +7011,64 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
6775
7011
|
}
|
|
6776
7012
|
});
|
|
6777
7013
|
|
|
7014
|
+
function _arrayWithHoles$1(arr) {
|
|
7015
|
+
if (Array.isArray(arr)) return arr;
|
|
7016
|
+
}
|
|
7017
|
+
|
|
7018
|
+
function _iterableToArrayLimit$1(arr, i) {
|
|
7019
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
7020
|
+
var _arr = [];
|
|
7021
|
+
var _n = true;
|
|
7022
|
+
var _d = false;
|
|
7023
|
+
var _e = undefined;
|
|
7024
|
+
|
|
7025
|
+
try {
|
|
7026
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
7027
|
+
_arr.push(_s.value);
|
|
7028
|
+
|
|
7029
|
+
if (i && _arr.length === i) break;
|
|
7030
|
+
}
|
|
7031
|
+
} catch (err) {
|
|
7032
|
+
_d = true;
|
|
7033
|
+
_e = err;
|
|
7034
|
+
} finally {
|
|
7035
|
+
try {
|
|
7036
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
7037
|
+
} finally {
|
|
7038
|
+
if (_d) throw _e;
|
|
7039
|
+
}
|
|
7040
|
+
}
|
|
7041
|
+
|
|
7042
|
+
return _arr;
|
|
7043
|
+
}
|
|
7044
|
+
|
|
7045
|
+
function _arrayLikeToArray$1(arr, len) {
|
|
7046
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
7047
|
+
|
|
7048
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
7049
|
+
arr2[i] = arr[i];
|
|
7050
|
+
}
|
|
7051
|
+
|
|
7052
|
+
return arr2;
|
|
7053
|
+
}
|
|
7054
|
+
|
|
7055
|
+
function _unsupportedIterableToArray$1(o, minLen) {
|
|
7056
|
+
if (!o) return;
|
|
7057
|
+
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
|
7058
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7059
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7060
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7061
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
|
7062
|
+
}
|
|
7063
|
+
|
|
7064
|
+
function _nonIterableRest$1() {
|
|
7065
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7066
|
+
}
|
|
7067
|
+
|
|
7068
|
+
function _slicedToArray$1(arr, i) {
|
|
7069
|
+
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
|
|
7070
|
+
}
|
|
7071
|
+
|
|
6778
7072
|
function template$3$1(data) {
|
|
6779
7073
|
var __t,
|
|
6780
7074
|
__p = '';
|
|
@@ -7440,6 +7734,13 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
7440
7734
|
* Require click to open menu. By default, menu opens on when the
|
|
7441
7735
|
* mouse enters the button.
|
|
7442
7736
|
*
|
|
7737
|
+
* @param {String} [options.alignMenu]
|
|
7738
|
+
* "right" to align menu on the right. Aligned on the left by
|
|
7739
|
+
* default.
|
|
7740
|
+
*
|
|
7741
|
+
* @param {String} [options.buttonClassName]
|
|
7742
|
+
* CSS class name for button element.
|
|
7743
|
+
*
|
|
7443
7744
|
* ## Item Models
|
|
7444
7745
|
*
|
|
7445
7746
|
* The following model attributes can be used to control the
|
|
@@ -7480,7 +7781,9 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
7480
7781
|
this.$el.toggleClass('full_width', !!this.options.fullWidth);
|
|
7481
7782
|
this.ui.button.toggleClass('has_icon_and_text', !!this.options.label);
|
|
7482
7783
|
this.ui.button.toggleClass('has_icon_only', !this.options.label);
|
|
7784
|
+
this.ui.button.toggleClass('ellipsis_icon', !!this.options.ellipsisIcon);
|
|
7483
7785
|
this.ui.button.text(this.options.label);
|
|
7786
|
+
this.ui.button.addClass(this.options.buttonClassName);
|
|
7484
7787
|
this.ui.menu.append(this.subview(new DropDownButtonItemListView({
|
|
7485
7788
|
items: this.options.items
|
|
7486
7789
|
})).el);
|
|
@@ -7504,7 +7807,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
7504
7807
|
var offset = this.$el.offset();
|
|
7505
7808
|
this.ui.menu.css({
|
|
7506
7809
|
top: offset.top + this.$el.height(),
|
|
7507
|
-
left: offset.left,
|
|
7810
|
+
left: this.options.alignMenu === 'right' ? offset.left + this.$el.width() - this.ui.menu.outerWidth() : offset.left,
|
|
7508
7811
|
width: this.options.fullWidth ? this.$el.width() : null
|
|
7509
7812
|
});
|
|
7510
7813
|
},
|
|
@@ -7638,6 +7941,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
7638
7941
|
if (dropDownMenuItems.length) {
|
|
7639
7942
|
this.appendSubview(new DropDownButtonView({
|
|
7640
7943
|
items: dropDownMenuItems,
|
|
7944
|
+
ellipsisIcon: true,
|
|
7641
7945
|
openOnClick: true
|
|
7642
7946
|
}));
|
|
7643
7947
|
}
|
|
@@ -9170,7 +9474,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
9170
9474
|
this.$el.append(this.subview(this.tabsView).el);
|
|
9171
9475
|
},
|
|
9172
9476
|
tab: function tab(fileType) {
|
|
9173
|
-
var selectionMode = this.options.tabName === fileType.collectionName;
|
|
9477
|
+
var selectionMode = this.options.allowSelectingAny || this.options.tabName === fileType.collectionName;
|
|
9174
9478
|
this.tabsView.tab(fileType.collectionName, _.bind(function () {
|
|
9175
9479
|
return this.subview(new FilteredFilesView({
|
|
9176
9480
|
entry: state.entry,
|
|
@@ -9318,10 +9622,10 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
9318
9622
|
this.ui.publishUntilField.datepicker('setDate', publishedUntil);
|
|
9319
9623
|
this.ui.publishUntilTimeField.val(timeStr(publishedUntil));
|
|
9320
9624
|
} else {
|
|
9321
|
-
this.ui.publishUntilField.datepicker('setDate',
|
|
9625
|
+
this.ui.publishUntilField.datepicker('setDate', this.defaultPublishedUntilDate());
|
|
9322
9626
|
}
|
|
9323
9627
|
|
|
9324
|
-
this.ui.userNameField.val(
|
|
9628
|
+
this.ui.userNameField.val(this.options.account.get('name'));
|
|
9325
9629
|
|
|
9326
9630
|
if (this.model.get('password_protected')) {
|
|
9327
9631
|
this.ui.passwordProtectedCheckBox.prop('checked', true);
|
|
@@ -9341,12 +9645,6 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
9341
9645
|
return ("0" + val).slice(-2);
|
|
9342
9646
|
}
|
|
9343
9647
|
}
|
|
9344
|
-
|
|
9345
|
-
function oneYearFromNow() {
|
|
9346
|
-
var date = new Date();
|
|
9347
|
-
date.setFullYear(date.getFullYear() + 1);
|
|
9348
|
-
return date;
|
|
9349
|
-
}
|
|
9350
9648
|
},
|
|
9351
9649
|
save: function save() {
|
|
9352
9650
|
var publishedUntil = null;
|
|
@@ -9421,6 +9719,11 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
9421
9719
|
return false;
|
|
9422
9720
|
}
|
|
9423
9721
|
},
|
|
9722
|
+
defaultPublishedUntilDate: function defaultPublishedUntilDate() {
|
|
9723
|
+
var date = new Date();
|
|
9724
|
+
date.setMonth(date.getMonth() + this.options.config.defaultPublishedUntilDurationInMonths);
|
|
9725
|
+
return date;
|
|
9726
|
+
},
|
|
9424
9727
|
enableSave: function enableSave() {
|
|
9425
9728
|
this.ui.saveButton.removeAttr('disabled');
|
|
9426
9729
|
},
|
|
@@ -9520,10 +9823,16 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
9520
9823
|
}));
|
|
9521
9824
|
},
|
|
9522
9825
|
files: function files(collectionName, handler, payload, filterName) {
|
|
9826
|
+
var _split = (collectionName || '').split(':'),
|
|
9827
|
+
_split2 = _slicedToArray$1(_split, 2),
|
|
9828
|
+
tabName = _split2[0],
|
|
9829
|
+
suffix = _split2[1];
|
|
9830
|
+
|
|
9523
9831
|
this.region.show(new FilesView({
|
|
9524
9832
|
model: this.entry,
|
|
9525
9833
|
selectionHandler: handler && editor.createFileSelectionHandler(handler, payload),
|
|
9526
|
-
tabName:
|
|
9834
|
+
tabName: tabName,
|
|
9835
|
+
allowSelectingAny: suffix === 'default',
|
|
9527
9836
|
filterName: filterName
|
|
9528
9837
|
}));
|
|
9529
9838
|
editor.setDefaultHelpEntry('pageflow.help_entries.files');
|
|
@@ -9550,7 +9859,9 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
9550
9859
|
publish: function publish() {
|
|
9551
9860
|
this.region.show(PublishEntryView.create({
|
|
9552
9861
|
model: this.entry,
|
|
9553
|
-
|
|
9862
|
+
account: state.account,
|
|
9863
|
+
entryPublication: new EntryPublication(),
|
|
9864
|
+
config: state.config
|
|
9554
9865
|
}));
|
|
9555
9866
|
editor.setDefaultHelpEntry('pageflow.help_entries.publish');
|
|
9556
9867
|
},
|
|
@@ -9909,7 +10220,15 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
9909
10220
|
});
|
|
9910
10221
|
var InfoBoxView = Marionette.View.extend({
|
|
9911
10222
|
className: 'info_box',
|
|
10223
|
+
mixins: [attributeBinding],
|
|
10224
|
+
initialize: function initialize() {
|
|
10225
|
+
this.setupBooleanAttributeBinding('visible', this.updateVisible);
|
|
10226
|
+
},
|
|
10227
|
+
updateVisible: function updateVisible() {
|
|
10228
|
+
this.$el.toggleClass('hidden_via_binding', this.getBooleanAttributBoundOption('visible') === false);
|
|
10229
|
+
},
|
|
9912
10230
|
render: function render() {
|
|
10231
|
+
this.$el.addClass(this.options.level);
|
|
9913
10232
|
this.$el.html(this.options.text);
|
|
9914
10233
|
return this;
|
|
9915
10234
|
}
|
|
@@ -10785,6 +11104,9 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
10785
11104
|
editor.applyDefaultHelpEntry();
|
|
10786
11105
|
});
|
|
10787
11106
|
});
|
|
11107
|
+
var OtherFile = UploadableFile.extend({
|
|
11108
|
+
thumbnailPictogram: 'other'
|
|
11109
|
+
});
|
|
10788
11110
|
app.addInitializer(function (options) {
|
|
10789
11111
|
var textTracksMetaDataAttribute = {
|
|
10790
11112
|
name: 'text_tracks',
|
|
@@ -10894,6 +11216,18 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
10894
11216
|
binding: 'label'
|
|
10895
11217
|
}
|
|
10896
11218
|
});
|
|
11219
|
+
editor.fileTypes.register('other_files', {
|
|
11220
|
+
model: OtherFile,
|
|
11221
|
+
metaDataAttributes: [altMetaDataAttribute],
|
|
11222
|
+
matchUpload: function matchUpload() {
|
|
11223
|
+
return true;
|
|
11224
|
+
},
|
|
11225
|
+
priority: 100,
|
|
11226
|
+
configurationEditorInputs: [{
|
|
11227
|
+
name: 'alt',
|
|
11228
|
+
inputView: TextInputView
|
|
11229
|
+
}]
|
|
11230
|
+
});
|
|
10897
11231
|
editor.fileTypes.setup(options.config.fileTypes);
|
|
10898
11232
|
});
|
|
10899
11233
|
app.addInitializer(function (options) {
|
|
@@ -12485,6 +12819,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
12485
12819
|
exports.NestedFilesView = NestedFilesView;
|
|
12486
12820
|
exports.NestedTypeError = NestedTypeError;
|
|
12487
12821
|
exports.NotificationsView = NotificationsView;
|
|
12822
|
+
exports.NumberInputView = NumberInputView;
|
|
12488
12823
|
exports.Object = BaseObject;
|
|
12489
12824
|
exports.OrderedPageLinksCollection = OrderedPageLinksCollection;
|
|
12490
12825
|
exports.OtherEntriesCollection = OtherEntriesCollection;
|
|
@@ -12561,6 +12896,7 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
12561
12896
|
exports.WidgetsCollection = WidgetsCollection;
|
|
12562
12897
|
exports.addAndReturnModel = addAndReturnModel;
|
|
12563
12898
|
exports.app = app;
|
|
12899
|
+
exports.attributeBinding = attributeBinding;
|
|
12564
12900
|
exports.authenticationProvider = authenticationProvider;
|
|
12565
12901
|
exports.configurationContainer = configurationContainer;
|
|
12566
12902
|
exports.cssModulesUtils = cssModulesUtils;
|
|
@@ -12596,4 +12932,4 @@ var pageflow_paged = (function (exports, Backbone, _, Marionette, $, I18n$1, Chi
|
|
|
12596
12932
|
|
|
12597
12933
|
return exports;
|
|
12598
12934
|
|
|
12599
|
-
}({}, Backbone, _, Backbone.Marionette, jQuery, I18n, Backbone.ChildViewContainer, IScroll, jQuery, wysihtml5, Cocktail, pageflow, pageflow));
|
|
12935
|
+
}({}, Backbone, _, Backbone.Marionette, jQuery, I18n, Backbone.ChildViewContainer, IScroll, jQuery, wysihtml5, jQuery, Cocktail, pageflow, pageflow));
|