pageflow 15.8.0 → 16.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +183 -103
  3. data/README.md +0 -1
  4. data/Rakefile +1 -1
  5. data/admins/pageflow/accounts.rb +12 -16
  6. data/admins/pageflow/entry.rb +28 -26
  7. data/admins/pageflow/entry_templates.rb +5 -7
  8. data/admins/pageflow/sites.rb +53 -0
  9. data/app/assets/javascripts/pageflow/admin/entries.js +16 -7
  10. data/app/assets/javascripts/pageflow/dist/ui.js +298 -72
  11. data/app/assets/stylesheets/pageflow/admin/permalink_input.scss +10 -0
  12. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +6 -1
  13. data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -0
  14. data/app/assets/stylesheets/pageflow/editor/help.scss +3 -3
  15. data/app/assets/stylesheets/pageflow/editor/info_box.scss +7 -0
  16. data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +0 -5
  17. data/app/assets/stylesheets/pageflow/ui/forms.scss +1 -1
  18. data/app/controllers/pageflow/chapters_controller.rb +2 -2
  19. data/app/controllers/pageflow/editor/files_controller.rb +1 -1
  20. data/app/controllers/pageflow/entries_controller.rb +12 -2
  21. data/app/controllers/pageflow/feeds_controller.rb +18 -0
  22. data/app/controllers/pageflow/pages_controller.rb +2 -2
  23. data/app/controllers/pageflow/sitemaps_controller.rb +15 -0
  24. data/app/controllers/pageflow/storylines_controller.rb +2 -2
  25. data/app/helpers/pageflow/common_entry_seed_helper.rb +1 -1
  26. data/app/helpers/pageflow/embed_code_helper.rb +1 -1
  27. data/app/helpers/pageflow/entries_helper.rb +16 -15
  28. data/app/helpers/pageflow/feeds_helper.rb +66 -0
  29. data/app/helpers/pageflow/page_types_helper.rb +9 -9
  30. data/app/helpers/pageflow/sites_helper.rb +11 -0
  31. data/app/helpers/pageflow/social_share_helper.rb +2 -2
  32. data/app/inputs/pageflow_permalink_input.rb +15 -3
  33. data/app/models/concerns/pageflow/reusable_file.rb +3 -3
  34. data/app/models/pageflow/account.rb +13 -31
  35. data/app/models/pageflow/audio_file_url_templates.rb +2 -1
  36. data/app/models/pageflow/{cname_theming_request_scope.rb → cname_site_request_scope.rb} +3 -3
  37. data/app/models/pageflow/customized_theme.rb +1 -1
  38. data/app/models/pageflow/draft_entry.rb +1 -1
  39. data/app/models/pageflow/entries_feed.rb +32 -0
  40. data/app/models/pageflow/entry.rb +3 -4
  41. data/app/models/pageflow/entry_at_revision.rb +2 -2
  42. data/app/models/pageflow/entry_duplicate.rb +1 -1
  43. data/app/models/pageflow/entry_template.rb +4 -4
  44. data/app/models/pageflow/home_button.rb +7 -7
  45. data/app/models/pageflow/image_file.rb +14 -3
  46. data/app/models/pageflow/membership.rb +3 -2
  47. data/app/models/pageflow/other_file.rb +5 -0
  48. data/app/models/pageflow/other_file_url_templates.rb +16 -0
  49. data/app/models/pageflow/permalink.rb +3 -3
  50. data/app/models/pageflow/permalink_directory.rb +2 -2
  51. data/app/models/pageflow/published_entry.rb +8 -2
  52. data/app/models/pageflow/revision.rb +4 -0
  53. data/app/models/pageflow/site.rb +67 -0
  54. data/app/models/pageflow/sitemaps.rb +13 -0
  55. data/app/models/pageflow/theme_customization.rb +1 -1
  56. data/app/models/pageflow/used_file.rb +2 -2
  57. data/app/models/pageflow/video_file_url_templates.rb +3 -1
  58. data/app/models/pageflow/widget.rb +9 -1
  59. data/app/policies/pageflow/account_policy.rb +2 -2
  60. data/app/policies/pageflow/entry_policy.rb +2 -2
  61. data/app/policies/pageflow/entry_template_policy.rb +1 -1
  62. data/app/policies/pageflow/{theming_policy.rb → site_policy.rb} +13 -11
  63. data/app/views/admin/accounts/_entry_template_details.html.arb +1 -1
  64. data/app/views/admin/accounts/_form.html.erb +4 -22
  65. data/app/views/admin/accounts/_site_defaults_inline_help.html.erb +5 -0
  66. data/app/views/admin/entries/_form.html.erb +4 -13
  67. data/app/views/admin/entries/_permalink_inputs.html.erb +2 -3
  68. data/app/views/admin/entries/_site_input.html.erb +15 -0
  69. data/app/views/admin/entries/{entry_type_name_input.html.erb → entry_site_and_type_name_input.html.erb} +3 -0
  70. data/app/views/admin/entry_templates/_form.html.erb +5 -5
  71. data/app/views/admin/sites/_attributes_table.html.arb +12 -0
  72. data/app/views/admin/sites/_fields.html.erb +23 -0
  73. data/app/views/admin/sites/_form.html.erb +5 -0
  74. data/app/views/components/pageflow/admin/entries_tab.rb +1 -2
  75. data/app/views/components/pageflow/admin/entry_templates_tab.rb +10 -11
  76. data/app/views/components/pageflow/admin/extensible_attributes_table.rb +8 -2
  77. data/app/views/components/pageflow/admin/features_tab.rb +1 -1
  78. data/app/views/components/pageflow/admin/sites_tab.rb +35 -0
  79. data/app/views/components/pageflow/admin/users_tab.rb +1 -2
  80. data/app/views/pageflow/editor/config/_seeds.json.jbuilder +1 -0
  81. data/app/views/pageflow/editor/entries/seed.json.erb +1 -1
  82. data/app/views/pageflow/editor/sites/_site.json.jbuilder +1 -0
  83. data/app/views/pageflow/entries/stylesheet.css.erb +1 -1
  84. data/app/views/pageflow/feeds/index.atom.builder +20 -0
  85. data/app/views/pageflow/sitemaps/index.xml.builder +9 -0
  86. data/app/views/pageflow/social_share/_entry_meta_tags.html.erb +1 -1
  87. data/app/views/pageflow/social_share/_page_meta_tags.html.erb +1 -1
  88. data/config/initializers/admin_resource_tabs.rb +29 -12
  89. data/config/initializers/features.rb +1 -0
  90. data/config/initializers/paperclip.rb +4 -0
  91. data/config/locales/de.yml +42 -19
  92. data/config/locales/en.yml +45 -17
  93. data/config/routes.rb +3 -0
  94. data/config/spring.rb +1 -1
  95. data/db/migrate/20221215101134_rename_theming_to_site.rb +9 -0
  96. data/db/migrate/20221215120856_associate_entry_templates_with_sites.rb +34 -0
  97. data/db/migrate/20221219203023_add_name_to_sites.rb +5 -0
  98. data/db/migrate/20230103155934_associate_theme_customizations_with_sites.rb +27 -0
  99. data/db/migrate/20230120092923_create_other_files.rb +23 -0
  100. data/db/migrate/20230323115745_add_feeds_enabled_to_sites.rb +5 -0
  101. data/db/migrate/20230323154323_add_sitemap_enabled_to_sites.rb +5 -0
  102. data/db/migrate/20230331103823_add_title_to_sites.rb +5 -0
  103. data/db/migrate/20230405103612_add_custom_feed_url_to_sites.rb +5 -0
  104. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +455 -119
  105. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +31 -8
  106. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +1 -1
  107. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +1 -1
  108. data/entry_types/paged/app/controllers/pageflow_paged/editor/entries_controller.rb +0 -2
  109. data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +1 -0
  110. data/entry_types/paged/app/views/pageflow_paged/entries/show.html.erb +1 -0
  111. data/entry_types/paged/config/initializers/features.rb +0 -1
  112. data/entry_types/paged/lib/pageflow_paged/engine.rb +17 -1
  113. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
  114. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +3 -4
  115. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +13 -6
  116. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +2 -0
  117. data/entry_types/scrolled/app/helpers/pageflow_scrolled/cache_helper.rb +11 -0
  118. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/entry_json_seed_helper.rb +42 -0
  119. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +3 -0
  120. data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +31 -10
  121. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +9 -1
  122. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +3 -1
  123. data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +23 -0
  124. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +6 -1
  125. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -5
  126. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/sections/_section_with_content_elements.json.jbuilder +10 -0
  127. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +44 -41
  128. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_consent_vendors.json.jbuilder +16 -0
  129. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +8 -5
  130. data/entry_types/scrolled/config/initializers/features.rb +5 -0
  131. data/entry_types/scrolled/config/locales/consent_widget.de.yml +4 -0
  132. data/entry_types/scrolled/config/locales/consent_widget.en.yml +4 -0
  133. data/entry_types/scrolled/config/locales/de.yml +189 -8
  134. data/entry_types/scrolled/config/locales/en.yml +207 -2
  135. data/entry_types/scrolled/config/routes.rb +4 -0
  136. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +97 -5
  137. data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +1 -1
  138. data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +96 -0
  139. data/entry_types/scrolled/lib/pageflow_scrolled/content_element_consent_vendors.rb +38 -0
  140. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +17 -1
  141. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +24 -0
  142. data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +6 -1
  143. data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +1 -1
  144. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +1 -2
  145. data/entry_types/scrolled/package/contentElements-editor.js +307 -22
  146. data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
  147. data/entry_types/scrolled/package/contentElements-frontend.js +690 -71
  148. data/entry_types/scrolled/package/editor.js +616 -220
  149. data/entry_types/scrolled/package/frontend/{EditableInlineText.module-c6672f27.js → EditableInlineText.module-fa9e3aff.js} +1669 -1674
  150. data/entry_types/scrolled/package/frontend/PhonePlatformContext-10a1d600.js +32 -0
  151. data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-727cce0d.js +107 -0
  152. data/entry_types/scrolled/package/frontend/Viewer-169e14ca.js +154 -0
  153. data/entry_types/scrolled/package/frontend/{Viewer-6b05522f.js → Viewer-ee1aa590.js} +32 -161
  154. data/entry_types/scrolled/package/frontend/arrowRight-92a34ccc.js +77 -0
  155. data/entry_types/scrolled/package/frontend/{components-487daafa.js → components-4a09bfa3.js} +185 -45
  156. data/entry_types/scrolled/package/frontend/{PhonePlatformContext-22e65f92.js → i18n-ddd92820.js} +162 -292
  157. data/entry_types/scrolled/package/frontend/index-02378634.js +118 -0
  158. data/entry_types/scrolled/package/frontend/index.css +1 -1
  159. data/entry_types/scrolled/package/frontend/index.js +375 -40
  160. data/entry_types/scrolled/package/frontend/useContentElementEditorState-63045393.js +52 -0
  161. data/entry_types/scrolled/package/package.json +2 -1
  162. data/entry_types/scrolled/package/testHelpers.js +9 -2
  163. data/entry_types/scrolled/package/values/colors.module.css +15 -0
  164. data/entry_types/scrolled/package/widgets/consentBar.css +1 -0
  165. data/entry_types/scrolled/package/widgets/consentBar.js +426 -0
  166. data/entry_types/scrolled/package/widgets/defaultNavigation.css +2 -2
  167. data/entry_types/scrolled/package/widgets/defaultNavigation.js +16 -9
  168. data/lib/generators/pageflow/resque/resque_generator.rb +1 -1
  169. data/lib/pageflow/ability_mixin.rb +21 -13
  170. data/lib/pageflow/active_admin_can_can_fix.rb +2 -2
  171. data/lib/pageflow/admin/attributes_table_rows.rb +1 -1
  172. data/lib/pageflow/admin/form_inputs.rb +1 -1
  173. data/lib/pageflow/admin/tabs.rb +1 -1
  174. data/lib/pageflow/built_in_file_type.rb +7 -0
  175. data/lib/pageflow/configuration/permissions.rb +3 -3
  176. data/lib/pageflow/configuration.rb +38 -17
  177. data/lib/pageflow/engine.rb +60 -39
  178. data/lib/pageflow/entry_export_import/entry_serialization.rb +1 -1
  179. data/lib/pageflow/entry_export_import/revision_serialization.rb +1 -1
  180. data/lib/pageflow/file_type.rb +2 -2
  181. data/lib/pageflow/global_config_api.rb +2 -2
  182. data/lib/pageflow/nested_revision_component.rb +23 -5
  183. data/lib/pageflow/primary_domain_entry_redirect.rb +7 -7
  184. data/lib/pageflow/rails_version.rb +19 -0
  185. data/lib/pageflow/seeds.rb +20 -17
  186. data/lib/pageflow/theme_customizations.rb +10 -10
  187. data/lib/pageflow/version.rb +1 -1
  188. data/lib/pageflow/widget_types.rb +4 -0
  189. data/package/config/webpack5.js +14 -0
  190. data/package/editor.js +148 -37
  191. data/package/frontend.js +26 -2
  192. data/package/testHelpers.js +1 -1
  193. data/package/ui.js +296 -71
  194. data/spec/factories/accounts.rb +5 -2
  195. data/spec/factories/draft_entries.rb +2 -2
  196. data/spec/factories/entries.rb +19 -5
  197. data/spec/factories/entry_templates.rb +1 -1
  198. data/spec/factories/permalink_directory.rb +1 -1
  199. data/spec/factories/published_entries.rb +2 -2
  200. data/spec/factories/sites.rb +12 -0
  201. data/vendor/assets/javascripts/iscroll.js +4 -7
  202. metadata +84 -59
  203. data/app/helpers/pageflow/admin/permalinks_helper.rb +0 -15
  204. data/app/helpers/pageflow/themings_helper.rb +0 -11
  205. data/app/models/pageflow/theming.rb +0 -30
  206. data/app/views/admin/accounts/_theming_defaults_inline_help.html.erb +0 -5
  207. data/app/views/admin/accounts/_theming_details.html.arb +0 -5
  208. data/app/views/pageflow/editor/themings/_theming.json.jbuilder +0 -1
  209. data/entry_types/scrolled/package/frontend/arrowRight-7e3d9dd5.js +0 -42
  210. data/spec/factories/themings.rb +0 -7
  211. /data/app/views/pageflow/entries/{_theming.css.erb → _site.css.erb} +0 -0
data/package/ui.js CHANGED
@@ -7,6 +7,7 @@ import ChildViewContainer from 'backbone.babysitter';
7
7
  import IScroll from 'iscroll';
8
8
  import 'jquery.minicolors';
9
9
  import wysihtml5 from 'wysihtml5';
10
+ import 'jquery-ui';
10
11
  import Cocktail from 'cocktail';
11
12
 
12
13
  /*global JST*/
@@ -1064,6 +1065,107 @@ var TooltipView = Marionette.ItemView.extend({
1064
1065
  }
1065
1066
  });
1066
1067
 
1068
+ function _defineProperty(obj, key, value) {
1069
+ if (key in obj) {
1070
+ Object.defineProperty(obj, key, {
1071
+ value: value,
1072
+ enumerable: true,
1073
+ configurable: true,
1074
+ writable: true
1075
+ });
1076
+ } else {
1077
+ obj[key] = value;
1078
+ }
1079
+
1080
+ return obj;
1081
+ }
1082
+
1083
+ function ownKeys(object, enumerableOnly) {
1084
+ var keys = Object.keys(object);
1085
+
1086
+ if (Object.getOwnPropertySymbols) {
1087
+ var symbols = Object.getOwnPropertySymbols(object);
1088
+ if (enumerableOnly) symbols = symbols.filter(function (sym) {
1089
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1090
+ });
1091
+ keys.push.apply(keys, symbols);
1092
+ }
1093
+
1094
+ return keys;
1095
+ }
1096
+
1097
+ function _objectSpread2(target) {
1098
+ for (var i = 1; i < arguments.length; i++) {
1099
+ var source = arguments[i] != null ? arguments[i] : {};
1100
+
1101
+ if (i % 2) {
1102
+ ownKeys(Object(source), true).forEach(function (key) {
1103
+ _defineProperty(target, key, source[key]);
1104
+ });
1105
+ } else if (Object.getOwnPropertyDescriptors) {
1106
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1107
+ } else {
1108
+ ownKeys(Object(source)).forEach(function (key) {
1109
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1110
+ });
1111
+ }
1112
+ }
1113
+
1114
+ return target;
1115
+ }
1116
+
1117
+ var attributeBinding = {
1118
+ setupBooleanAttributeBinding: function setupBooleanAttributeBinding(optionName, updateMethod) {
1119
+ this.setupAttributeBinding(optionName, updateMethod, Boolean);
1120
+ },
1121
+ getBooleanAttributBoundOption: function getBooleanAttributBoundOption(optionName) {
1122
+ return this.getAttributeBoundOption(optionName, Boolean);
1123
+ },
1124
+ setupAttributeBinding: function setupAttributeBinding(optionName, updateMethod) {
1125
+ var _this = this;
1126
+
1127
+ var normalize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (value) {
1128
+ return value;
1129
+ };
1130
+ var binding = this.options["".concat(optionName, "Binding")];
1131
+ var view = this;
1132
+
1133
+ if (binding) {
1134
+ _.flatten([binding]).forEach(function (attribute) {
1135
+ _this.listenTo(_this.model, 'change:' + attribute, update);
1136
+ });
1137
+ }
1138
+
1139
+ update();
1140
+
1141
+ function update() {
1142
+ updateMethod.call(view, view.getAttributeBoundOption(optionName, normalize));
1143
+ }
1144
+ },
1145
+ getAttributeBoundOption: function getAttributeBoundOption(optionName) {
1146
+ var _this2 = this;
1147
+
1148
+ var normalize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (value) {
1149
+ return value;
1150
+ };
1151
+ var binding = this.options["".concat(optionName, "Binding")];
1152
+ var bindingValueOptionName = "".concat(optionName, "BindingValue");
1153
+ var value = Array.isArray(binding) ? binding.map(function (attribute) {
1154
+ return _this2.model.get(attribute);
1155
+ }) : this.model.get(binding);
1156
+
1157
+ if (bindingValueOptionName in this.options) {
1158
+ return value === this.options[bindingValueOptionName];
1159
+ } else if (typeof this.options[optionName] === 'function') {
1160
+ return normalize(this.options[optionName](value));
1161
+ } else if (optionName in this.options) {
1162
+ return normalize(this.options[optionName]);
1163
+ } else if (binding) {
1164
+ return normalize(value);
1165
+ }
1166
+ }
1167
+ };
1168
+
1067
1169
  /**
1068
1170
  * Mixin for input views handling common concerns like labels,
1069
1171
  * inline help, visiblity and disabling.
@@ -1193,7 +1295,7 @@ var TooltipView = Marionette.ItemView.extend({
1193
1295
  * @mixin
1194
1296
  */
1195
1297
 
1196
- var inputView = {
1298
+ var inputView = _objectSpread2(_objectSpread2({}, attributeBinding), {}, {
1197
1299
  ui: {
1198
1300
  label: 'label',
1199
1301
  labelText: 'label .name',
@@ -1237,8 +1339,8 @@ var inputView = {
1237
1339
  this.ui.labelText.text(this.labelText());
1238
1340
  this.updateInlineHelp();
1239
1341
  this.setLabelFor();
1240
- this.setupAttributeBinding('disabled', this.updateDisabled);
1241
- this.setupAttributeBinding('visible', this.updateVisible);
1342
+ this.setupBooleanAttributeBinding('disabled', this.updateDisabled);
1343
+ this.setupBooleanAttributeBinding('visible', this.updateVisible);
1242
1344
  },
1243
1345
 
1244
1346
  /**
@@ -1287,7 +1389,7 @@ var inputView = {
1287
1389
  }
1288
1390
  },
1289
1391
  isDisabled: function isDisabled() {
1290
- return this.getAttributeBoundOption('disabled');
1392
+ return this.getBooleanAttributBoundOption('disabled');
1291
1393
  },
1292
1394
  updateDisabled: function updateDisabled() {
1293
1395
  this.$el.toggleClass('input-disabled', !!this.isDisabled());
@@ -1305,46 +1407,9 @@ var inputView = {
1305
1407
  }
1306
1408
  },
1307
1409
  updateVisible: function updateVisible() {
1308
- this.$el.toggleClass('input-hidden_via_binding', this.getAttributeBoundOption('visible') === false);
1309
- },
1310
- setupAttributeBinding: function setupAttributeBinding(optionName, updateMethod) {
1311
- var _this = this;
1312
-
1313
- var binding = this.options["".concat(optionName, "Binding")];
1314
- var view = this;
1315
-
1316
- if (binding) {
1317
- _.flatten([binding]).forEach(function (attribute) {
1318
- _this.listenTo(_this.model, 'change:' + attribute, update);
1319
- });
1320
- }
1321
-
1322
- update();
1323
-
1324
- function update() {
1325
- updateMethod.call(view, view.getAttributeBoundOption(optionName));
1326
- }
1327
- },
1328
- getAttributeBoundOption: function getAttributeBoundOption(optionName) {
1329
- var _this2 = this;
1330
-
1331
- var binding = this.options["".concat(optionName, "Binding")];
1332
- var bindingValueOptionName = "".concat(optionName, "BindingValue");
1333
- var value = Array.isArray(binding) ? binding.map(function (attribute) {
1334
- return _this2.model.get(attribute);
1335
- }) : this.model.get(binding);
1336
-
1337
- if (bindingValueOptionName in this.options) {
1338
- return value === this.options[bindingValueOptionName];
1339
- } else if (typeof this.options[optionName] === 'function') {
1340
- return !!this.options[optionName](value);
1341
- } else if (optionName in this.options) {
1342
- return !!this.options[optionName];
1343
- } else if (binding) {
1344
- return !!value;
1345
- }
1410
+ this.$el.toggleClass('hidden_via_binding', this.getBooleanAttributBoundOption('visible') === false);
1346
1411
  }
1347
- };
1412
+ });
1348
1413
 
1349
1414
  function template$4(data) {
1350
1415
  var __p = '';
@@ -1463,6 +1528,125 @@ var UrlDisplayView = Marionette.ItemView.extend({
1463
1528
  }
1464
1529
  });
1465
1530
 
1531
+ function _classCallCheck(instance, Constructor) {
1532
+ if (!(instance instanceof Constructor)) {
1533
+ throw new TypeError("Cannot call a class as a function");
1534
+ }
1535
+ }
1536
+
1537
+ function _defineProperties(target, props) {
1538
+ for (var i = 0; i < props.length; i++) {
1539
+ var descriptor = props[i];
1540
+ descriptor.enumerable = descriptor.enumerable || false;
1541
+ descriptor.configurable = true;
1542
+ if ("value" in descriptor) descriptor.writable = true;
1543
+ Object.defineProperty(target, descriptor.key, descriptor);
1544
+ }
1545
+ }
1546
+
1547
+ function _createClass(Constructor, protoProps, staticProps) {
1548
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1549
+ if (staticProps) _defineProperties(Constructor, staticProps);
1550
+ return Constructor;
1551
+ }
1552
+
1553
+ /**
1554
+ * Input view for a number.
1555
+ *
1556
+ * See {@link inputView} for further options.
1557
+ *
1558
+ * @param {Object} [options]
1559
+ *
1560
+ * @param {string} [options.locale]
1561
+ * Locale used to fomat and parse numbers.
1562
+ *
1563
+ * @class
1564
+ */
1565
+
1566
+ var NumberInputView = Marionette.ItemView.extend({
1567
+ mixins: [inputView],
1568
+ template: function template() {
1569
+ return "\n <label>\n <span class=\"name\"></span>\n <span class=\"inline_help\"></span>\n </label>\n <input type=\"text\" dir=\"auto\" />\n ";
1570
+ },
1571
+ ui: {
1572
+ input: 'input'
1573
+ },
1574
+ events: {
1575
+ 'change': 'onChange'
1576
+ },
1577
+ initialize: function initialize() {
1578
+ this.parser = new NumberParser(this.options.locale);
1579
+ },
1580
+ onRender: function onRender() {
1581
+ this.load();
1582
+ this.listenTo(this.model, 'change:' + this.options.propertyName, this.load);
1583
+ },
1584
+ onChange: function onChange() {
1585
+ this.save();
1586
+ this.load();
1587
+ },
1588
+ onClose: function onClose() {
1589
+ this.save();
1590
+ },
1591
+ save: function save() {
1592
+ var inputValue = this.ui.input.val();
1593
+ this.model.set(this.options.propertyName, this.parser.parse(inputValue) || 0);
1594
+ },
1595
+ load: function load() {
1596
+ var input = this.ui.input;
1597
+ var value = this.model.get(this.options.propertyName) || 0;
1598
+ input.val(value.toLocaleString(this.options.locale, {
1599
+ useGrouping: false
1600
+ }));
1601
+ },
1602
+ displayValidationError: function displayValidationError(message) {
1603
+ this.$el.addClass('invalid');
1604
+ this.ui.input.attr('title', message);
1605
+ },
1606
+ resetValidationError: function resetValidationError(message) {
1607
+ this.$el.removeClass('invalid');
1608
+ this.ui.input.attr('title', '');
1609
+ }
1610
+ });
1611
+
1612
+ var NumberParser = /*#__PURE__*/function () {
1613
+ function NumberParser(locale) {
1614
+ _classCallCheck(this, NumberParser);
1615
+
1616
+ var format = new Intl.NumberFormat(locale);
1617
+ var parts = format.formatToParts(12345.6);
1618
+ var numerals = Array.from({
1619
+ length: 10
1620
+ }).map(function (_, i) {
1621
+ return format.format(i);
1622
+ });
1623
+ var index = new Map(numerals.map(function (d, i) {
1624
+ return [d, i];
1625
+ }));
1626
+ this._group = new RegExp("[".concat(parts.find(function (d) {
1627
+ return d.type === "group";
1628
+ }).value, "]"), "g");
1629
+ this._decimal = new RegExp("[".concat(parts.find(function (d) {
1630
+ return d.type === "decimal";
1631
+ }).value, "]"));
1632
+ this._numeral = new RegExp("[".concat(numerals.join(""), "]"), "g");
1633
+
1634
+ this._index = function (d) {
1635
+ return index.get(d);
1636
+ };
1637
+ }
1638
+
1639
+ _createClass(NumberParser, [{
1640
+ key: "parse",
1641
+ value: function parse(string) {
1642
+ string = string.trim().replace(this._group, "").replace(this._decimal, ".").replace(this._numeral, this._index);
1643
+ return string ? +string : NaN;
1644
+ }
1645
+ }]);
1646
+
1647
+ return NumberParser;
1648
+ }();
1649
+
1466
1650
  /**
1467
1651
  * Text based input view that can display a placeholder.
1468
1652
  *
@@ -1673,11 +1857,15 @@ var ColorInputView = Marionette.ItemView.extend({
1673
1857
  this.ui.input.minicolors({
1674
1858
  changeDelay: 200,
1675
1859
  change: _.bind(function (color) {
1860
+ this._saving = true;
1861
+
1676
1862
  if (color === this.defaultValue()) {
1677
1863
  this.model.unset(this.options.propertyName);
1678
1864
  } else {
1679
1865
  this.model.set(this.options.propertyName, color);
1680
1866
  }
1867
+
1868
+ this._saving = false;
1681
1869
  }, this)
1682
1870
  });
1683
1871
  this.listenTo(this.model, 'change:' + this.options.propertyName, this.load);
@@ -1706,7 +1894,10 @@ var ColorInputView = Marionette.ItemView.extend({
1706
1894
  }
1707
1895
  },
1708
1896
  load: function load() {
1709
- this.ui.input.minicolors('value', this.model.get(this.options.propertyName) || this.defaultValue());
1897
+ if (!this._saving) {
1898
+ this.ui.input.minicolors('value', this.model.get(this.options.propertyName) || this.defaultValue());
1899
+ }
1900
+
1710
1901
  this.$el.toggleClass('is_default', !this.model.has(this.options.propertyName));
1711
1902
  },
1712
1903
  refreshPicker: function refreshPicker() {
@@ -2289,21 +2480,6 @@ var TextAreaInputView = Marionette.ItemView.extend({
2289
2480
  }
2290
2481
  });
2291
2482
 
2292
- function _defineProperty(obj, key, value) {
2293
- if (key in obj) {
2294
- Object.defineProperty(obj, key, {
2295
- value: value,
2296
- enumerable: true,
2297
- configurable: true,
2298
- writable: true
2299
- });
2300
- } else {
2301
- obj[key] = value;
2302
- }
2303
-
2304
- return obj;
2305
- }
2306
-
2307
2483
  function template$9(data) {
2308
2484
  var __p = '';
2309
2485
  __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';
@@ -2570,6 +2746,25 @@ return __p
2570
2746
  *
2571
2747
  * @param {Object} [options]
2572
2748
  *
2749
+ * @param {number} [options.defaultValue]
2750
+ * Defaults value to display if property is not set.
2751
+ *
2752
+ * @param {number} [options.minValue=0]
2753
+ * Value when dragging slider to the very left.
2754
+ *
2755
+ * @param {number} [options.maxValue=100]
2756
+ * Value when dragging slider to the very right.
2757
+ *
2758
+ * @param {string} [options.unit="%"]
2759
+ * Unit to display after value.
2760
+ *
2761
+ * @param {function} [options.displayText]
2762
+ * Function that receives value and returns custom text to display as value.
2763
+ *
2764
+ * @param {boolean} [options.saveOnSlide]
2765
+ * Already update the model while dragging the handle - not only after
2766
+ * handle has been released.
2767
+ *
2573
2768
  * @class
2574
2769
  */
2575
2770
 
@@ -2582,15 +2777,27 @@ var SliderInputView = Marionette.ItemView.extend({
2582
2777
  value: '.value'
2583
2778
  },
2584
2779
  events: {
2585
- 'slidechange': 'save'
2780
+ 'slidechange': 'save',
2781
+ 'slide': 'handleSlide'
2586
2782
  },
2587
2783
  onRender: function onRender() {
2784
+ var _this = this;
2785
+
2588
2786
  this.ui.widget.slider({
2589
- animate: 'fast',
2590
- min: 'minValue' in this.options ? this.options.minValue : 0,
2591
- max: 'maxValue' in this.options ? this.options.maxValue : 100
2787
+ animate: 'fast'
2788
+ });
2789
+ this.setupAttributeBinding('minValue', function (value) {
2790
+ return _this.updateSliderOption('min', value || 0);
2791
+ });
2792
+ this.setupAttributeBinding('maxValue', function (value) {
2793
+ return _this.updateSliderOption('max', value || 100);
2592
2794
  });
2593
2795
  this.load();
2796
+ this.listenTo(this.model, 'change:' + this.options.propertyName, this.load);
2797
+ },
2798
+ updateSliderOption: function updateSliderOption(name, value) {
2799
+ this.ui.widget.slider('option', name, value);
2800
+ this.updateText(this.ui.widget.slider('value'));
2594
2801
  },
2595
2802
  updateDisabled: function updateDisabled(disabled) {
2596
2803
  this.$el.toggleClass('disabled', !!disabled);
@@ -2601,11 +2808,15 @@ var SliderInputView = Marionette.ItemView.extend({
2601
2808
  this.ui.widget.slider('enable');
2602
2809
  }
2603
2810
  },
2604
- save: function save() {
2605
- var value = this.ui.widget.slider('option', 'value');
2606
- var unit = 'unit' in this.options ? this.options.unit : '%';
2607
- this.ui.value.text(value + unit);
2608
- this.model.set(this.options.propertyName, value);
2811
+ handleSlide: function handleSlide(event, ui) {
2812
+ this.updateText(ui.value);
2813
+
2814
+ if (this.options.saveOnSlide) {
2815
+ this.save(event, ui);
2816
+ }
2817
+ },
2818
+ save: function save(event, ui) {
2819
+ this.model.set(this.options.propertyName, ui.value);
2609
2820
  },
2610
2821
  load: function load() {
2611
2822
  var value;
@@ -2616,7 +2827,18 @@ var SliderInputView = Marionette.ItemView.extend({
2616
2827
  value = 'defaultValue' in this.options ? this.options.defaultValue : 0;
2617
2828
  }
2618
2829
 
2619
- this.ui.widget.slider('option', 'value', value);
2830
+ this.ui.widget.slider('option', 'value', this.clampValue(value));
2831
+ this.updateText(value);
2832
+ },
2833
+ clampValue: function clampValue(value) {
2834
+ var min = this.ui.widget.slider('option', 'min');
2835
+ var max = this.ui.widget.slider('option', 'max');
2836
+ return Math.min(max, Math.max(min, value));
2837
+ },
2838
+ updateText: function updateText(value) {
2839
+ var unit = 'unit' in this.options ? this.options.unit : '%';
2840
+ var text = 'displayText' in this.options ? this.options.displayText(value) : value + unit;
2841
+ this.ui.value.text(text);
2620
2842
  }
2621
2843
  });
2622
2844
 
@@ -3010,7 +3232,10 @@ var subviewContainer = {
3010
3232
  return view;
3011
3233
  },
3012
3234
  appendSubview: function appendSubview(view) {
3013
- return this.$el.append(this.subview(view).el);
3235
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
3236
+ to = _ref.to;
3237
+
3238
+ return (to || this.$el).append(this.subview(view).el);
3014
3239
  },
3015
3240
  onClose: function onClose() {
3016
3241
  if (this.subviews) {
@@ -3067,4 +3292,4 @@ var tooltipContainer = {
3067
3292
  }
3068
3293
  };
3069
3294
 
3070
- export { CheckBoxGroupInputView, CheckBoxInputView, CollectionView, ColorInputView, ConfigurationEditorTabView, ConfigurationEditorView, DeleteRowTableCellView, EnumTableCellView, ExtendedSelectInputView, IconTableCellView, JsonInputView, LabelOnlyView, BaseObject as Object, PresenceTableCellView, ProxyUrlInputView, SelectInputView, SeparatorView, SliderInputView, SortableCollectionView, TableCellView, TableHeaderCellView, TableRowView, TableView, TabsView, TextAreaInputView, TextInputView, TextTableCellView, TooltipView, UrlDisplayView, UrlInputView, cssModulesUtils, i18nUtils, inputView, inputWithPlaceholderText, serverSideValidation, subviewContainer, tooltipContainer, viewWithValidationErrorMessages };
3295
+ export { CheckBoxGroupInputView, CheckBoxInputView, CollectionView, ColorInputView, ConfigurationEditorTabView, ConfigurationEditorView, DeleteRowTableCellView, EnumTableCellView, ExtendedSelectInputView, IconTableCellView, JsonInputView, LabelOnlyView, NumberInputView, BaseObject as Object, PresenceTableCellView, ProxyUrlInputView, SelectInputView, SeparatorView, SliderInputView, SortableCollectionView, TableCellView, TableHeaderCellView, TableRowView, TableView, TabsView, TextAreaInputView, TextInputView, TextTableCellView, TooltipView, UrlDisplayView, UrlInputView, attributeBinding, cssModulesUtils, i18nUtils, inputView, inputWithPlaceholderText, serverSideValidation, subviewContainer, tooltipContainer, viewWithValidationErrorMessages };
@@ -2,8 +2,9 @@ FactoryBot.define do
2
2
  factory :account, class: Pageflow::Account do
3
3
  name { 'Account Name' }
4
4
 
5
- after(:build) do |account|
6
- account.default_theming ||= build(:theming, account: account)
5
+ after(:build) do |account, evaluator|
6
+ account.default_site ||=
7
+ build(:site, account: account, **evaluator.default_site_attributes)
7
8
  end
8
9
 
9
10
  trait(:with_first_paged_entry_template) do
@@ -21,6 +22,8 @@ FactoryBot.define do
21
22
 
22
23
  with_feature { nil }
23
24
  without_feature { nil }
25
+
26
+ default_site_attributes { {} }
24
27
  end
25
28
 
26
29
  after(:create) do |account, evaluator|
@@ -4,7 +4,7 @@ module Pageflow
4
4
  transient do
5
5
  title
6
6
  account
7
- theming
7
+ site
8
8
  type_name { 'paged' }
9
9
  revision_attributes { {} }
10
10
 
@@ -16,7 +16,7 @@ module Pageflow
16
16
  DraftEntry.new(create(:entry,
17
17
  title: title,
18
18
  account: account,
19
- theming: theming,
19
+ site: site,
20
20
  type_name: type_name,
21
21
  draft_attributes: revision_attributes,
22
22
  with_feature: with_feature,
@@ -10,7 +10,7 @@ module Pageflow
10
10
  account
11
11
 
12
12
  after(:build) do |entry|
13
- entry.theming ||= entry.account.default_theming
13
+ entry.site ||= entry.account.default_site
14
14
  end
15
15
 
16
16
  transient do
@@ -58,7 +58,7 @@ module Pageflow
58
58
  evaluator.permalink_attributes[:directory] ||
59
59
  build(
60
60
  :permalink_directory,
61
- theming: entry.theming,
61
+ site: entry.site,
62
62
  path: evaluator.permalink_attributes.fetch(:directory_path, '')
63
63
  )
64
64
 
@@ -70,18 +70,32 @@ module Pageflow
70
70
  end
71
71
 
72
72
  trait :published do
73
+ first_published_at { 1.month.ago }
74
+
73
75
  transient do
74
76
  published_revision_attributes { {} }
75
77
  end
76
78
 
77
79
  after(:create) do |entry, evaluator|
78
- create(:revision, :published, evaluator.published_revision_attributes.merge(entry: entry))
80
+ create(:revision, :published,
81
+ evaluator.published_revision_attributes.merge(entry: entry))
79
82
  end
80
83
  end
81
84
 
82
85
  trait :published_with_password do
83
- after(:create) do |entry, _evaluator|
84
- create(:revision, :published, entry: entry, password_protected: true)
86
+ first_published_at { 1.month.ago }
87
+
88
+ transient do
89
+ published_revision_attributes { {} }
90
+ end
91
+
92
+ after(:create) do |entry, evaluator|
93
+ create(:revision,
94
+ :published,
95
+ evaluator.published_revision_attributes.merge(
96
+ entry: entry,
97
+ password_protected: true
98
+ ))
85
99
  end
86
100
  end
87
101
 
@@ -1,7 +1,7 @@
1
1
  module Pageflow
2
2
  FactoryBot.define do
3
3
  factory :entry_template, class: Pageflow::EntryTemplate do
4
- account
4
+ site
5
5
  entry_type_name { 'paged' }
6
6
  theme_name { 'default' }
7
7
  end
@@ -1,6 +1,6 @@
1
1
  FactoryBot.define do
2
2
  factory :permalink_directory, class: Pageflow::PermalinkDirectory do
3
- theming
3
+ site
4
4
  path { '' }
5
5
  end
6
6
  end
@@ -4,7 +4,7 @@ module Pageflow
4
4
  transient do
5
5
  title
6
6
  account
7
- theming
7
+ site
8
8
  type_name { 'paged' }
9
9
  revision_attributes { {} }
10
10
  permalink_attributes { nil }
@@ -18,7 +18,7 @@ module Pageflow
18
18
  :published,
19
19
  title: title,
20
20
  account: account,
21
- theming: theming,
21
+ site: site,
22
22
  type_name: type_name,
23
23
  published_revision_attributes: revision_attributes,
24
24
  permalink_attributes: permalink_attributes,
@@ -0,0 +1,12 @@
1
+ module Pageflow
2
+ FactoryBot.define do
3
+ factory :site, class: Pageflow::Site do
4
+ feeds_enabled { true }
5
+ sitemap_enabled { true }
6
+
7
+ after(:build) do |site|
8
+ site.account ||= build(:account, default_site: site)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -101,7 +101,6 @@ var utils = (function () {
101
101
  me.extend(me, {
102
102
  hasTransform: _transform !== false,
103
103
  hasPerspective: _prefixStyle('perspective') in _elementStyle,
104
- hasTouch: 'ontouchstart' in window,
105
104
  hasPointer: navigator.msPointerEnabled,
106
105
  hasTransition: _prefixStyle('transition') in _elementStyle
107
106
  });
@@ -862,12 +861,10 @@ IScroll.prototype = {
862
861
  eventType(target, 'MSPointerUp', this);
863
862
  }
864
863
 
865
- if ( utils.hasTouch ) {
866
- eventType(startEventTarget, 'touchstart', this);
867
- eventType(target, 'touchmove', this);
868
- eventType(target, 'touchcancel', this);
869
- eventType(target, 'touchend', this);
870
- }
864
+ eventType(startEventTarget, 'touchstart', this);
865
+ eventType(target, 'touchmove', this);
866
+ eventType(target, 'touchcancel', this);
867
+ eventType(target, 'touchend', this);
871
868
 
872
869
  eventType(this.scroller, 'transitionend', this);
873
870
  eventType(this.scroller, 'webkitTransitionEnd', this);