pageflow 16.0.0 → 16.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +86 -33
  3. data/README.md +6 -6
  4. data/Rakefile +1 -1
  5. data/admins/pageflow/entry.rb +0 -1
  6. data/admins/pageflow/sites.rb +3 -0
  7. data/app/assets/images/pageflow/admin/icons/published_with_noindex.svg +4 -0
  8. data/app/assets/javascripts/pageflow/dist/ui.js +299 -72
  9. data/app/assets/stylesheets/pageflow/admin/active_admin_patches.scss +1 -1
  10. data/app/assets/stylesheets/pageflow/admin/entries.scss +4 -0
  11. data/app/assets/stylesheets/pageflow/admin/permalink_input.scss +10 -0
  12. data/app/assets/stylesheets/pageflow/admin/publication_state_indicator.scss +4 -0
  13. data/app/assets/stylesheets/pageflow/editor/base.scss +0 -1
  14. data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +61 -7
  15. data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +12 -1
  16. data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -0
  17. data/app/assets/stylesheets/pageflow/editor/help.scss +3 -3
  18. data/app/assets/stylesheets/pageflow/editor/info_box.scss +7 -0
  19. data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +0 -5
  20. data/app/assets/stylesheets/pageflow/ui/forms.scss +4 -4
  21. data/app/assets/stylesheets/pageflow/{editor/wysihtml5.scss → ui/input/text_area_input.scss} +13 -1
  22. data/app/assets/stylesheets/pageflow/ui.scss +1 -0
  23. data/app/controllers/pageflow/chapters_controller.rb +2 -2
  24. data/app/controllers/pageflow/editor/entry_publications_controller.rb +5 -1
  25. data/app/controllers/pageflow/editor/file_import_controller.rb +1 -1
  26. data/app/controllers/pageflow/editor/files_controller.rb +1 -1
  27. data/app/controllers/pageflow/entries_controller.rb +12 -2
  28. data/app/controllers/pageflow/feeds_controller.rb +18 -0
  29. data/app/controllers/pageflow/pages_controller.rb +2 -2
  30. data/app/controllers/pageflow/sitemaps_controller.rb +15 -0
  31. data/app/controllers/pageflow/storylines_controller.rb +2 -2
  32. data/app/helpers/pageflow/entries_helper.rb +4 -1
  33. data/app/helpers/pageflow/feeds_helper.rb +66 -0
  34. data/app/helpers/pageflow/meta_tags_helper.rb +2 -1
  35. data/app/helpers/pageflow/page_types_helper.rb +10 -10
  36. data/app/helpers/pageflow/revision_file_helper.rb +3 -3
  37. data/app/helpers/pageflow/social_share_helper.rb +2 -2
  38. data/app/inputs/pageflow_permalink_input.rb +15 -3
  39. data/app/models/concerns/pageflow/entry_publication_states.rb +9 -0
  40. data/app/models/concerns/pageflow/reusable_file.rb +3 -3
  41. data/app/models/concerns/pageflow/uploadable_file.rb +5 -0
  42. data/app/models/pageflow/account.rb +8 -0
  43. data/app/models/pageflow/audio_file_url_templates.rb +2 -1
  44. data/app/models/pageflow/draft_entry.rb +1 -1
  45. data/app/models/pageflow/entries_feed.rb +32 -0
  46. data/app/models/pageflow/entry.rb +7 -5
  47. data/app/models/pageflow/entry_at_revision.rb +2 -0
  48. data/app/models/pageflow/image_file.rb +34 -8
  49. data/app/models/pageflow/image_file_url_templates.rb +7 -1
  50. data/app/models/pageflow/membership.rb +3 -2
  51. data/app/models/pageflow/other_file.rb +5 -0
  52. data/app/models/pageflow/other_file_url_templates.rb +16 -0
  53. data/app/models/pageflow/published_entry.rb +6 -0
  54. data/app/models/pageflow/revision.rb +6 -0
  55. data/app/models/pageflow/site.rb +8 -0
  56. data/app/models/pageflow/sitemaps.rb +14 -0
  57. data/app/models/pageflow/used_file.rb +10 -2
  58. data/app/models/pageflow/video_file_url_templates.rb +3 -1
  59. data/app/models/pageflow/widget.rb +9 -1
  60. data/app/views/admin/entries/_permalink_inputs.html.erb +1 -2
  61. data/app/views/admin/sites/_attributes_table.html.arb +3 -0
  62. data/app/views/admin/sites/_fields.html.erb +6 -0
  63. data/app/views/components/pageflow/admin/extensible_attributes_table.rb +2 -2
  64. data/app/views/components/pageflow/admin/revisions_tab.rb +8 -0
  65. data/app/views/components/pageflow/admin/sites_tab.rb +3 -0
  66. data/app/views/pageflow/editor/config/_seeds.json.jbuilder +2 -0
  67. data/app/views/pageflow/editor/entries/_entry.json.jbuilder +1 -0
  68. data/app/views/pageflow/editor/entry_publications/check.json.jbuilder +1 -0
  69. data/app/views/pageflow/feeds/index.atom.builder +20 -0
  70. data/app/views/pageflow/image_files/_image_file.json.jbuilder +1 -0
  71. data/app/views/pageflow/meta_tags/_entry.html.erb +1 -0
  72. data/app/views/pageflow/sitemaps/index.xml.builder +9 -0
  73. data/config/initializers/features.rb +3 -0
  74. data/config/initializers/paperclip.rb +8 -0
  75. data/config/locales/de.yml +77 -6
  76. data/config/locales/en.yml +79 -4
  77. data/config/routes.rb +3 -0
  78. data/config/spring.rb +1 -1
  79. data/db/migrate/20230120092923_create_other_files.rb +23 -0
  80. data/db/migrate/20230323115745_add_feeds_enabled_to_sites.rb +5 -0
  81. data/db/migrate/20230323154323_add_sitemap_enabled_to_sites.rb +5 -0
  82. data/db/migrate/20230331103823_add_title_to_sites.rb +5 -0
  83. data/db/migrate/20230405103612_add_custom_feed_url_to_sites.rb +5 -0
  84. data/db/migrate/20231024062501_add_output_presences_to_image_files.rb +5 -0
  85. data/db/migrate/20231128124523_add_noindex_to_revisions.rb +5 -0
  86. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +710 -259
  87. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +34 -5
  88. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +1 -1
  89. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +1 -1
  90. data/entry_types/paged/app/controllers/pageflow_paged/editor/entries_controller.rb +0 -2
  91. data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +2 -1
  92. data/entry_types/paged/app/views/pageflow_paged/entries/show.html.erb +1 -0
  93. data/entry_types/paged/config/initializers/features.rb +0 -1
  94. data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -1
  95. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
  96. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +3 -4
  97. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +13 -6
  98. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +11 -3
  99. data/entry_types/scrolled/app/helpers/pageflow_scrolled/cache_helper.rb +11 -0
  100. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/entry_json_seed_helper.rb +42 -0
  101. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +8 -5
  102. data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +17 -12
  103. data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +9 -1
  104. data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +1 -1
  105. data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +23 -0
  106. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -1
  107. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -5
  108. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/sections/_section_with_content_elements.json.jbuilder +10 -0
  109. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +44 -41
  110. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_consent_vendors.json.jbuilder +16 -0
  111. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +7 -0
  112. data/entry_types/scrolled/config/initializers/features.rb +5 -0
  113. data/entry_types/scrolled/config/locales/consent_widget.de.yml +4 -0
  114. data/entry_types/scrolled/config/locales/consent_widget.en.yml +4 -0
  115. data/entry_types/scrolled/config/locales/de.yml +225 -8
  116. data/entry_types/scrolled/config/locales/en.yml +239 -2
  117. data/entry_types/scrolled/config/routes.rb +4 -0
  118. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +69 -44
  119. data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +2 -1
  120. data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +1 -1
  121. data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +96 -0
  122. data/entry_types/scrolled/lib/pageflow_scrolled/content_element_consent_vendors.rb +38 -0
  123. data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +13 -1
  124. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +30 -0
  125. data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +6 -1
  126. data/entry_types/scrolled/lib/pageflow_scrolled/web_app_manifest.rb +1 -1
  127. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/dummy.rake +1 -1
  128. data/entry_types/scrolled/lib/tasks/pageflow_scrolled/storybook.rake +1 -2
  129. data/entry_types/scrolled/package/config/webpack.js +26 -0
  130. data/entry_types/scrolled/package/contentElements-editor.js +330 -32
  131. data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
  132. data/entry_types/scrolled/package/contentElements-frontend.js +920 -145
  133. data/entry_types/scrolled/package/editor.js +819 -239
  134. data/entry_types/scrolled/package/frontend/{EditableInlineText.module-14c7b097.js → EditableInlineText.module-6ee0e024.js} +1975 -1792
  135. data/entry_types/scrolled/package/frontend/PhonePlatformContext-b28d991a.js +32 -0
  136. data/entry_types/scrolled/package/frontend/ToggleFullscreenCornerButton-8242f213.js +107 -0
  137. data/entry_types/scrolled/package/frontend/Viewer-32cd1ac1.js +154 -0
  138. data/entry_types/scrolled/package/frontend/{Viewer-b6becc57.js → Viewer-6e4d14ed.js} +32 -161
  139. data/entry_types/scrolled/package/frontend/arrowRight-e42e6011.js +77 -0
  140. data/entry_types/scrolled/package/frontend/{components-b3160dd7.js → components-24363f97.js} +188 -47
  141. data/entry_types/scrolled/package/frontend/{PhonePlatformContext-f6093cc6.js → i18n-71c39823.js} +191 -111
  142. data/entry_types/scrolled/package/frontend/index-fc4b13e6.js +118 -0
  143. data/entry_types/scrolled/package/frontend/index.css +1 -1
  144. data/entry_types/scrolled/package/frontend/index.js +252 -76
  145. data/entry_types/scrolled/package/frontend/useContentElementEditorState-245f1986.js +52 -0
  146. data/entry_types/scrolled/package/package.json +6 -4
  147. data/entry_types/scrolled/package/testHelpers.js +11 -2
  148. data/entry_types/scrolled/package/values/colors.module.css +15 -0
  149. data/entry_types/scrolled/package/widgets/consentBar.css +1 -0
  150. data/entry_types/scrolled/package/widgets/consentBar.js +426 -0
  151. data/entry_types/scrolled/package/widgets/defaultNavigation.css +2 -2
  152. data/entry_types/scrolled/package/widgets/defaultNavigation.js +39 -4
  153. data/entry_types/scrolled/package/widgets/iconInlineFileRights.css +1 -0
  154. data/entry_types/scrolled/package/widgets/iconInlineFileRights.js +49 -0
  155. data/entry_types/scrolled/package/widgets/textInlineFileRights.css +1 -0
  156. data/entry_types/scrolled/package/widgets/textInlineFileRights.js +37 -0
  157. data/lib/generators/pageflow/resque/resque_generator.rb +1 -1
  158. data/lib/generators/pageflow/resque/templates/resque.rake +1 -1
  159. data/lib/generators/pageflow/resque/templates/resque.rb +1 -1
  160. data/lib/generators/pageflow/routes/routes_generator.rb +1 -1
  161. data/lib/pageflow/ability_mixin.rb +5 -5
  162. data/lib/pageflow/active_admin_can_can_fix.rb +2 -2
  163. data/lib/pageflow/built_in_file_type.rb +7 -0
  164. data/lib/pageflow/configuration.rb +29 -1
  165. data/lib/pageflow/engine.rb +18 -40
  166. data/lib/pageflow/entry_export_import/revision_serialization.rb +1 -1
  167. data/lib/pageflow/file_type.rb +2 -2
  168. data/lib/pageflow/global_config_api.rb +2 -2
  169. data/lib/pageflow/nested_revision_component.rb +23 -5
  170. data/lib/pageflow/page_type.rb +1 -1
  171. data/lib/pageflow/paperclip_processors/webp.rb +63 -0
  172. data/lib/pageflow/rails_version.rb +19 -0
  173. data/lib/pageflow/seeds.rb +10 -7
  174. data/lib/pageflow/user_mixin.rb +1 -1
  175. data/lib/pageflow/version.rb +1 -1
  176. data/lib/pageflow/widget_types.rb +4 -0
  177. data/package/config/jest/index.js +3 -1
  178. data/package/config/webpack5.js +14 -0
  179. data/package/editor.js +410 -181
  180. data/package/frontend.js +34 -4
  181. data/package/testHelpers.js +1 -1
  182. data/package/ui.js +297 -71
  183. data/spec/factories/entries.rb +34 -3
  184. data/spec/factories/sites.rb +3 -0
  185. data/vendor/assets/javascripts/iscroll.js +4 -7
  186. metadata +118 -80
  187. data/app/helpers/pageflow/admin/permalinks_helper.rb +0 -15
  188. data/entry_types/scrolled/package/frontend/arrowRight-78a7cee4.js +0 -42
@@ -143,7 +143,7 @@ function ChapterLink(props) {
143
143
  }, item);
144
144
  }
145
145
 
146
- var styles$3 = {"legalInfoTooltip":"LegalInfoMenu-module_legalInfoTooltip__Qmf8u","scroller":"LegalInfoMenu-module_scroller__3NPW_","links":"LegalInfoMenu-module_links__1kpsd","legalInfoLink":"LegalInfoMenu-module_legalInfoLink__gkXaF"};
146
+ var styles$3 = {"legalInfoTooltip":"LegalInfoMenu-module_legalInfoTooltip__Qmf8u","scroller":"LegalInfoMenu-module_scroller__3NPW_","links":"LegalInfoMenu-module_links__1kpsd","separator":"LegalInfoMenu-module_separator__3mmjA","section":"LegalInfoMenu-module_section__1bLWD","legalInfoLink":"LegalInfoMenu-module_legalInfoLink__gkXaF","rights":"LegalInfoMenu-module_rights__-XGYO"};
147
147
 
148
148
  function LegalInfoLink(props) {
149
149
  return /*#__PURE__*/React.createElement("div", null, props.label && props.url && /*#__PURE__*/React.createElement("a", {
@@ -170,11 +170,14 @@ function LegalInfoMenu(props) {
170
170
  }, /*#__PURE__*/React.createElement("div", {
171
171
  className: styles$3.scroller
172
172
  }, credits && /*#__PURE__*/React.createElement("p", {
173
+ className: styles$3.section,
173
174
  dangerouslySetInnerHTML: {
174
175
  __html: credits
175
176
  }
176
- }), fileRights && /*#__PURE__*/React.createElement("p", null, t('pageflow_scrolled.public.image_rights'), ": ", fileRights)), /*#__PURE__*/React.createElement("div", {
177
- className: styles$3.links
177
+ }), fileRights.length > 0 && /*#__PURE__*/React.createElement("div", {
178
+ className: styles$3.section
179
+ }, /*#__PURE__*/React.createElement("strong", null, t('pageflow_scrolled.public.media')), " ", renderFileRights(fileRights))), /*#__PURE__*/React.createElement("div", {
180
+ className: classNames(styles$3.links, _defineProperty({}, styles$3.separator, credits || fileRights.length > 0))
178
181
  }, /*#__PURE__*/React.createElement(LegalInfoLink, legalInfo.imprint), /*#__PURE__*/React.createElement(LegalInfoLink, legalInfo.copyright), /*#__PURE__*/React.createElement(LegalInfoLink, legalInfo.privacy)), /*#__PURE__*/React.createElement(Widget, {
179
182
  role: "creditsBoxFooter"
180
183
  }));
@@ -191,6 +194,37 @@ function LegalInfoMenu(props) {
191
194
  })));
192
195
  }
193
196
 
197
+ function renderFileRights(items) {
198
+ return /*#__PURE__*/React.createElement("ul", {
199
+ className: styles$3.rights
200
+ }, items.map(function (item, index) {
201
+ return /*#__PURE__*/React.createElement("li", {
202
+ key: index
203
+ }, index > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, "\xA0| "), renderFileRightsText(item));
204
+ }));
205
+ }
206
+
207
+ function renderFileRightsText(item) {
208
+ if (item.urls.length > 1) {
209
+ return /*#__PURE__*/React.createElement(React.Fragment, null, item.text, " (", item.urls.flatMap(function (url, index) {
210
+ return [index > 0 && ', ', /*#__PURE__*/React.createElement("a", {
211
+ href: url,
212
+ target: "_blank",
213
+ rel: "noopener noreferrer",
214
+ key: index
215
+ }, index + 1)];
216
+ }), ")");
217
+ } else if (item.urls.length === 1) {
218
+ return /*#__PURE__*/React.createElement("a", {
219
+ href: item.urls[0],
220
+ target: "_blank",
221
+ rel: "noopener noreferrer"
222
+ }, item.text);
223
+ } else {
224
+ return item.text;
225
+ }
226
+ }
227
+
194
228
  var styles$4 = {"sharingTooltip":"SharingMenu-module_sharingTooltip__2Tyev","shareLinkContainer":"SharingMenu-module_shareLinkContainer__3-3W6","shareLink":"SharingMenu-module_shareLink__3PdRE"};
195
229
 
196
230
  function SharingMenu(_ref) {
@@ -521,6 +555,7 @@ function DefaultNavigation(_ref) {
521
555
  var shareProviders = useShareProviders({
522
556
  isPhonePlatform: isPhonePlatform
523
557
  });
558
+ var theme = useTheme();
524
559
  useScrollPosition(function (_ref2) {
525
560
  var prevPos = _ref2.prevPos,
526
561
  currPos = _ref2.currPos;
@@ -596,7 +631,7 @@ function DefaultNavigation(_ref) {
596
631
  mobileNavHidden: mobileNavHidden
597
632
  }), /*#__PURE__*/React.createElement(SkipLinks, null), /*#__PURE__*/React.createElement(Logo, null), renderNav(), /*#__PURE__*/React.createElement("div", {
598
633
  className: classNames(styles.contextIcons)
599
- }, !configuration.hideToggleMuteButton && /*#__PURE__*/React.createElement(ToggleMuteButton, null), /*#__PURE__*/React.createElement(LegalInfoMenu, {
634
+ }, !configuration.hideToggleMuteButton && /*#__PURE__*/React.createElement(ToggleMuteButton, null), !theme.options.hideLegalInfoButton && /*#__PURE__*/React.createElement(LegalInfoMenu, {
600
635
  tooltipOffset: hideSharingButton ? -40 : 0
601
636
  }), !hideSharingButton && /*#__PURE__*/React.createElement(SharingMenu, {
602
637
  shareProviders: shareProviders
@@ -0,0 +1 @@
1
+ .IconInlineFileRights-module_standAlone__15788{color:#fff;position:absolute;right:0;bottom:0;left:0;display:flex;justify-content:flex-end;pointer-events:none}.IconInlineFileRights-module_standAlone__15788>*{pointer-events:auto}.IconInlineFileRights-module_button__o5ZmR{border:0;padding:0;background-color:transparent;width:44px;height:40px;margin:0;display:flex;align-items:center;justify-content:center;color:currentColor;cursor:pointer;position:relative}.IconInlineFileRights-module_button__o5ZmR,.IconInlineFileRights-module_tooltip__2e1u8{transition:opacity .2s,visibility .2s}.IconInlineFileRights-module_transparent__2dVaA .IconInlineFileRights-module_button__o5ZmR{opacity:.6}.IconInlineFileRights-module_wrapper__2kQK_:active .IconInlineFileRights-module_button__o5ZmR,.IconInlineFileRights-module_wrapper__2kQK_:focus .IconInlineFileRights-module_button__o5ZmR,.IconInlineFileRights-module_wrapper__2kQK_:hover .IconInlineFileRights-module_button__o5ZmR{opacity:1}.IconInlineFileRights-module_button__o5ZmR svg{width:23px;height:23px}.IconInlineFileRights-module_standAlone__15788 .IconInlineFileRights-module_button__o5ZmR svg{filter:drop-shadow(0 1px 4px #000)}.IconInlineFileRights-module_tooltip__2e1u8{font-size:13.5555px;font-family:sans-serif;line-height:1.4;position:absolute;bottom:38px;right:5px;background-color:rgba(17,17,17,.9);border-radius:3px;color:#fff;padding:8px;visibility:hidden;opacity:0;text-align:right;margin-left:10px;box-sizing:border-box;max-width:95%;z-index:1}.IconInlineFileRights-module_tooltip__2e1u8:after{content:"";display:block;border:5px solid transparent;border-top-color:rgba(17,17,17,.9);position:absolute;right:11px;top:100%}.IconInlineFileRights-module_tooltip__2e1u8 a{color:#fff;-webkit-text-decoration-color:hsla(0,0%,100%,.3);text-decoration-color:hsla(0,0%,100%,.3)}.IconInlineFileRights-module_tooltip__2e1u8 span{color:hsla(0,0%,100%,.7)}.IconInlineFileRights-module_wrapper__2kQK_:focus-within .IconInlineFileRights-module_tooltip__2e1u8,.IconInlineFileRights-module_wrapper__2kQK_:hover .IconInlineFileRights-module_tooltip__2e1u8{visibility:visible;opacity:1}.IconInlineFileRights-module_scroller__1hT8t{overflow:auto;overflow-y:hidden;scrollbar-width:thin}.IconInlineFileRights-module_scroller__1hT8t::-webkit-scrollbar{height:12px}.IconInlineFileRights-module_scroller__1hT8t::-webkit-scrollbar-thumb{background-color:hsla(0,0%,100%,.9);border-radius:20px;border:3px solid rgba(17,17,17,.9)}
@@ -0,0 +1,49 @@
1
+ import { ThemeIcon, frontend } from 'pageflow-scrolled/frontend';
2
+ import React from 'react';
3
+ import classNames from 'classnames';
4
+
5
+ function _defineProperty(obj, key, value) {
6
+ if (key in obj) {
7
+ Object.defineProperty(obj, key, {
8
+ value: value,
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true
12
+ });
13
+ } else {
14
+ obj[key] = value;
15
+ }
16
+
17
+ return obj;
18
+ }
19
+
20
+ var styles = {"standAlone":"IconInlineFileRights-module_standAlone__15788","button":"IconInlineFileRights-module_button__o5ZmR","tooltip":"IconInlineFileRights-module_tooltip__2e1u8","transparent":"IconInlineFileRights-module_transparent__2dVaA","wrapper":"IconInlineFileRights-module_wrapper__2kQK_","scroller":"IconInlineFileRights-module_scroller__1hT8t"};
21
+
22
+ function IconInlineFileRights(_ref) {
23
+ var _classNames;
24
+
25
+ var context = _ref.context,
26
+ playerControlsStandAlone = _ref.playerControlsStandAlone,
27
+ playerControlsTransparent = _ref.playerControlsTransparent,
28
+ children = _ref.children;
29
+
30
+ if (context === 'afterElement') {
31
+ return null;
32
+ }
33
+
34
+ return /*#__PURE__*/React.createElement("div", {
35
+ className: classNames(styles.wrapper, (_classNames = {}, _defineProperty(_classNames, styles.transparent, context !== 'playerControls' || playerControlsTransparent), _defineProperty(_classNames, styles.standAlone, context !== 'playerControls'), _classNames))
36
+ }, /*#__PURE__*/React.createElement("button", {
37
+ className: styles.button
38
+ }, /*#__PURE__*/React.createElement(ThemeIcon, {
39
+ name: "copyright"
40
+ })), /*#__PURE__*/React.createElement("div", {
41
+ className: styles.tooltip
42
+ }, /*#__PURE__*/React.createElement("div", {
43
+ className: styles.scroller
44
+ }, children)));
45
+ }
46
+
47
+ frontend.widgetTypes.register('iconInlineFileRights', {
48
+ component: IconInlineFileRights
49
+ });
@@ -0,0 +1 @@
1
+ .TextInlineFileRights-module_text__1tT0W{font-size:14px;position:relative;z-index:1;color:var(--content-text-color)}.TextInlineFileRights-module_text__1tT0W li{text-align:right;padding-top:.2em}.TextInlineFileRights-module_forSection__22xHD{position:absolute;bottom:0;right:0}.TextInlineFileRights-module_forSection__22xHD li{padding:0 .4em .2em 0}.TextInlineFileRights-module_text__1tT0W a{color:inherit;-webkit-text-decoration-color:color-mix(in srgb,currentColor,transparent);text-decoration-color:color-mix(in srgb,currentColor,transparent)}.TextInlineFileRights-module_text__1tT0W span{opacity:.7}
@@ -0,0 +1,37 @@
1
+ import { frontend } from 'pageflow-scrolled/frontend';
2
+ import React from 'react';
3
+ import classNames from 'classnames';
4
+
5
+ function _defineProperty(obj, key, value) {
6
+ if (key in obj) {
7
+ Object.defineProperty(obj, key, {
8
+ value: value,
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true
12
+ });
13
+ } else {
14
+ obj[key] = value;
15
+ }
16
+
17
+ return obj;
18
+ }
19
+
20
+ var styles = {"text":"TextInlineFileRights-module_text__1tT0W","forSection":"TextInlineFileRights-module_forSection__22xHD"};
21
+
22
+ function TextInlineFileRights(_ref) {
23
+ var context = _ref.context,
24
+ children = _ref.children;
25
+
26
+ if (context === 'insideElement' || context === 'playerControls') {
27
+ return null;
28
+ }
29
+
30
+ return /*#__PURE__*/React.createElement("div", {
31
+ className: classNames(styles.text, _defineProperty({}, styles.forSection, context === 'section'))
32
+ }, /*#__PURE__*/React.createElement("div", null, children));
33
+ }
34
+
35
+ frontend.widgetTypes.register('textInlineFileRights', {
36
+ component: TextInlineFileRights
37
+ });
@@ -12,7 +12,7 @@ module Pageflow
12
12
  template 'resque_enqueue_after_commit_patch.rb', 'config/initializers/resque_enqueue_after_commit_patch.rb'
13
13
  template 'resque.rake', 'lib/tasks/resque.rake'
14
14
 
15
- inject_into_file 'config/application.rb', after: "config.load_defaults 5.2\n" do
15
+ inject_into_file 'config/application.rb', after: /config.load_defaults .*\n/ do
16
16
  <<-RUBY
17
17
  config.active_job.queue_adapter = :resque
18
18
  RUBY
@@ -1,5 +1,5 @@
1
1
  require 'resque/tasks'
2
- require 'resque_scheduler/tasks'
2
+ require 'resque/scheduler/tasks'
3
3
 
4
4
  namespace :resque do
5
5
  # Tell resque to initialize the rails app in worker processes
@@ -1,5 +1,5 @@
1
1
  require 'resque'
2
- require 'resque_scheduler'
2
+ require 'resque-scheduler'
3
3
 
4
4
  # Change to use your favorite method of configuration. Consider the
5
5
  # dotenv gem to setup your environment with a .env file.
@@ -18,7 +18,7 @@ module Pageflow
18
18
  end
19
19
 
20
20
  def require_resque_server
21
- prepend_to_file 'config/routes.rb', "require 'resque/server'\nrequire 'resque_scheduler/server'\n\n"
21
+ prepend_to_file 'config/routes.rb', "require 'resque/server'\nrequire 'resque/scheduler/server'\n\n"
22
22
  end
23
23
  end
24
24
  end
@@ -31,7 +31,7 @@ module Pageflow
31
31
  AccountPolicy.new(user, account).see_badge_belonging_to?
32
32
  end
33
33
 
34
- can :create, Membership do |membership|
34
+ can :create, Membership, Membership.all do |membership|
35
35
  membership.entity.nil? ||
36
36
  membership.user.nil? ||
37
37
  (!(membership.user.entries.include?(membership.entity) ||
@@ -120,7 +120,7 @@ module Pageflow
120
120
  AccountPolicy.new(user, account).update_site_on_entry_of?
121
121
  end
122
122
 
123
- can :create, Entry do |entry|
123
+ can :create, Entry, Entry.all do |entry|
124
124
  EntryPolicy.new(user, entry).create?
125
125
  end
126
126
 
@@ -204,7 +204,7 @@ module Pageflow
204
204
  FilePolicy.new(user, record).use?
205
205
  end
206
206
 
207
- can [:create, :update, :destroy], Folder do |folder|
207
+ can [:create, :update, :destroy], Folder, Folder.all do |folder|
208
208
  FolderPolicy.new(user, folder).manage?
209
209
  end
210
210
 
@@ -234,7 +234,7 @@ module Pageflow
234
234
  SitePolicy.new(user, site).update?
235
235
  end
236
236
 
237
- can :create, EntryTemplate do |entry_template|
237
+ can :create, EntryTemplate, EntryTemplate.all do |entry_template|
238
238
  EntryTemplatePolicy.new(user, entry_template).create?
239
239
  end
240
240
 
@@ -242,7 +242,7 @@ module Pageflow
242
242
  EntryTemplatePolicy.new(user, entry_template).update?
243
243
  end
244
244
 
245
- can :create, ::User do |managed_user|
245
+ can :create, ::User, ::User.all do |managed_user|
246
246
  UserPolicy.new(user, managed_user).create?
247
247
  end
248
248
 
@@ -17,13 +17,13 @@ module Pageflow
17
17
  # :create, User -> :create_any, :users
18
18
  module ActiveAdminCanCanFix
19
19
  def can?(action, subject)
20
- if [:read, :create].include?(action) &&
20
+ if [:read, :new, :create].include?(action) &&
21
21
  [Entry, Account, User].include?(subject)
22
22
  collection_name = subject.name.demodulize.underscore.pluralize.to_sym
23
23
 
24
24
  if action == :read
25
25
  super(:index, collection_name)
26
- elsif action == :create
26
+ else
27
27
  super(:create_any, collection_name)
28
28
  end
29
29
  else
@@ -41,5 +41,12 @@ module Pageflow
41
41
  collection_name: 'text_track_files',
42
42
  url_templates: TextTrackFileUrlTemplates.new)
43
43
  end
44
+
45
+ def self.other
46
+ FileType.new(model: 'Pageflow::OtherFile',
47
+ collection_name: 'other_files',
48
+ url_templates: OtherFileUrlTemplates.new,
49
+ top_level_type: true)
50
+ end
44
51
  end
45
52
  end
@@ -195,6 +195,19 @@ module Pageflow
195
195
  # @since 12.4
196
196
  attr_accessor :public_entry_redirect
197
197
 
198
+ # Cache-Control header to set for published entries that have been
199
+ # published without a password. For password protected entries,
200
+ # cache control is always set to private to prevent caching
201
+ # authenticated responses in public caches like CDNs and serving
202
+ # them to unauthenticated users.
203
+ #
204
+ # Can be wrapped in a `features.register` block to use different
205
+ # caching strategies for different entries or accounts.
206
+ #
207
+ # @since 16.1
208
+ # @return [String]
209
+ attr_accessor :public_entry_cache_control_header
210
+
198
211
  # Either a lambda or an object with a `call` method taking a
199
212
  # {Site} as paramater and returing a hash of options used to
200
213
  # construct the url of a published entry.
@@ -232,6 +245,12 @@ module Pageflow
232
245
  # boolean. Defaults to false.
233
246
  attr_accessor :confirm_encoding_jobs
234
247
 
248
+ # Controls default value of "published until" date field in editor
249
+ # publish entry view.
250
+ #
251
+ # @since 16.1
252
+ attr_accessor :default_published_until_duration_in_months
253
+
235
254
  # Used by Pageflow extensions to provide new tabs to be displayed
236
255
  # in the admin.
237
256
  #
@@ -330,9 +349,12 @@ module Pageflow
330
349
  # @since 0.11
331
350
  attr_accessor :authorize_user_deletion
332
351
 
352
+ # Array of values that the `license` attribute on files can take.
353
+ attr_accessor :available_file_licenses
354
+
333
355
  # Array of values that the `kind` attribute on text tracks can
334
356
  # take. Defaults to `[:captions, :subtitles, :descriptions]`.
335
- attr_reader :available_text_track_kinds
357
+ attr_accessor :available_text_track_kinds
336
358
 
337
359
  # Allow one user to be member of multiple accounts. Defaults to
338
360
  # true.
@@ -412,6 +434,7 @@ module Pageflow
412
434
  @transform_theme_customization_files = ->(files, _entry) { files }
413
435
 
414
436
  @confirm_encoding_jobs = false
437
+ @default_published_until_duration_in_months = 12
415
438
 
416
439
  @admin_resource_tabs = Pageflow::Admin::Tabs.new
417
440
  @admin_form_inputs = Pageflow::Admin::FormInputs.new
@@ -431,6 +454,10 @@ module Pageflow
431
454
 
432
455
  @authorize_user_deletion = lambda { |_user| true }
433
456
 
457
+ @available_file_licenses = [
458
+ :cc_by_4, :cc_by_sa_4, :cc_by_nc_4, :cc_by_nc_sa_4, :cc_by_nd_4, :cc_by_nc_nd_4
459
+ ]
460
+
434
461
  @available_text_track_kinds = [:captions, :subtitles, :descriptions]
435
462
 
436
463
  @allow_multiaccount_users = true
@@ -541,6 +568,7 @@ module Pageflow
541
568
  delegate :page_types, to: :config
542
569
  delegate :themes, to: :config
543
570
  delegate :widget_types, to: :config
571
+ delegate :public_entry_cache_control_header=, to: :config
544
572
 
545
573
  delegate :for_entry_type, to: :config
546
574
  end
@@ -31,6 +31,8 @@ require 'pageflow_paged'
31
31
  require 'pageflow_scrolled'
32
32
  require 'symmetric-encryption'
33
33
 
34
+ require 'pageflow/rails_version'
35
+
34
36
  if Gem::Specification.find_all_by_name('pageflow-react', '>= 0.0').any?
35
37
  fail('The pageflow-react gem has been merged into the pageflow gem. ' \
36
38
  'See the pageflow changelog for update instructions.')
@@ -41,45 +43,21 @@ module Pageflow
41
43
  class Engine < ::Rails::Engine
42
44
  isolate_namespace Pageflow
43
45
 
44
- config.paths.add('app/views/components', autoload: true)
45
- config.paths.add('lib', autoload: true)
46
-
47
- def eager_load!
48
- # Manually eager load `lib/pageflow` as the least bad option:
49
- #
50
- # - Autoload paths are not eager loaded in production.
51
- #
52
- # - `lib` cannot be an eager load path since otherwise templates
53
- # in `lib/generators` are also executed.
54
- #
55
- # - `lib/pageflow` cannot be an eager load path since eager load
56
- # paths are automatically used as autoload paths. That way
57
- # `lib/pageflow/admin/something.rb` could be autoloaded via
58
- # `Admin::Something`.
59
- #
60
- # - Using `require` in `lib/pageflow.rb` disables code
61
- # reloading.
62
- #
63
- # - Using `require_dependency` in `lib/pageflow.rb` does not
64
- # activate code reloading either since it requires the
65
- # autoload path to be set up correctly, which only happens
66
- # during initialization.
67
- super
68
-
69
- lib_path = config.root.join('lib')
70
- matcher = %r{\A#{Regexp.escape(lib_path.to_s)}/(.*)\.rb\Z}
71
-
72
- already_required_files = [
73
- 'pageflow/engine',
74
- 'pageflow/global_config_api',
75
- 'pageflow/news_item_api',
76
- 'pageflow/version'
77
- ]
78
-
79
- Dir.glob("#{lib_path}/pageflow/**/*.rb").sort.each do |file|
80
- logical_path = file.sub(matcher, '\1')
81
- require_dependency(logical_path) unless already_required_files.include?(logical_path)
82
- end
46
+ config.autoload_paths << root.join('app/views/components')
47
+ config.eager_load_paths << root.join('app/views/components')
48
+
49
+ lib = root.join('lib')
50
+
51
+ config.autoload_paths << lib
52
+ config.eager_load_paths << lib
53
+
54
+ initializer 'pageflow.autoloading' do
55
+ Rails.autoloaders.main.ignore(
56
+ lib.join('generators'),
57
+ lib.join('tasks'),
58
+ lib.join('pageflow/paperclip_processors'),
59
+ lib.join('pageflow/version.rb')
60
+ )
83
61
  end
84
62
 
85
63
  config.i18n.load_path += Dir[config.root.join('config', 'locales', '**', '*.yml').to_s]
@@ -106,7 +84,7 @@ module Pageflow
106
84
  end
107
85
 
108
86
  initializer 'pageflow.factories', after: 'factory_bot.set_factory_paths' do
109
- if Pageflow.configured? && defined?(FactoryBot)
87
+ if defined?(FactoryBot)
110
88
  FactoryBot.definition_file_paths.unshift(Engine.root.join('spec', 'factories'))
111
89
  end
112
90
  end
@@ -28,7 +28,7 @@ module Pageflow
28
28
  end
29
29
 
30
30
  def import(data, options)
31
- Import.new(options).perform(data)
31
+ Import.new(**options).perform(data)
32
32
  end
33
33
 
34
34
  private
@@ -123,11 +123,11 @@ module Pageflow
123
123
  @css_background_image_class_prefix || model.model_name.singular
124
124
  end
125
125
 
126
- def css_background_image_urls_for(file, options)
126
+ def css_background_image_urls_for(file, **options)
127
127
  if call_arity(css_background_image_urls) == 1
128
128
  css_background_image_urls.call(file)
129
129
  else
130
- css_background_image_urls.call(file, options)
130
+ css_background_image_urls.call(file, **options)
131
131
  end
132
132
  end
133
133
 
@@ -87,8 +87,6 @@ module Pageflow
87
87
  # coniguration is now complete.
88
88
  def finalize!
89
89
  @finalized = true
90
- configure!
91
- @config.lint!
92
90
  end
93
91
 
94
92
  # @api private
@@ -103,6 +101,8 @@ module Pageflow
103
101
  @after_global_configure_blocks.each do |block|
104
102
  block.call(@config)
105
103
  end
104
+
105
+ @config.lint!
106
106
  end
107
107
 
108
108
  private
@@ -14,10 +14,10 @@ module Pageflow
14
14
  end
15
15
 
16
16
  # @api private
17
- def copy_nested_revision_component_to(record)
17
+ def copy_nested_revision_component_to(record, reset_perma_ids: false)
18
18
  nested_revision_component_collection_names.each do |collection_name|
19
19
  send(collection_name).each do |nested|
20
- nested.copy_to(record.send(collection_name))
20
+ nested.copy_to(record.send(collection_name), reset_perma_ids: reset_perma_ids)
21
21
  end
22
22
  end
23
23
  end
@@ -38,12 +38,30 @@ module Pageflow
38
38
  extend ActiveSupport::Concern
39
39
  include Container
40
40
 
41
+ def duplicate
42
+ copy_with(reset_perma_ids: true) do |record|
43
+ yield record if block_given?
44
+ record.save!
45
+ end
46
+ end
47
+
41
48
  # @api private
42
- def copy_to(collection)
49
+ def copy_to(collection, reset_perma_ids: false)
50
+ copy_with(reset_perma_ids: reset_perma_ids) do |record|
51
+ collection << record
52
+ end
53
+ end
54
+
55
+ private
56
+
57
+ def copy_with(reset_perma_ids:)
43
58
  record = dup
44
- collection << record
59
+ record.perma_id = nil if reset_perma_ids && record.respond_to?(:perma_id=)
60
+
61
+ yield record
62
+ copy_nested_revision_component_to(record, reset_perma_ids: reset_perma_ids)
45
63
 
46
- copy_nested_revision_component_to(record)
64
+ record
47
65
  end
48
66
  end
49
67
  end
@@ -202,7 +202,7 @@ module Pageflow
202
202
  # name 'rainbow'
203
203
  #
204
204
  # def json_seed_template
205
- # 'pageflow/rainbow/page_type.json.jbuilder'
205
+ # 'pageflow/rainbow/page_type'
206
206
  # end
207
207
  # end
208
208
  #
@@ -0,0 +1,63 @@
1
+ require 'vips'
2
+
3
+ module Pageflow
4
+ module PaperclipProcessors
5
+ # @api private
6
+ class Webp < Paperclip::Processor
7
+ ANIMATED_FORMATS = %w[.gif].freeze
8
+
9
+ def initialize(file, options = {}, attachment = nil)
10
+ super
11
+
12
+ geometry = options[:geometry].to_s
13
+ @should_crop = geometry[-1, 1] == '#'
14
+
15
+ @target_geometry = Paperclip::Geometry.parse(geometry)
16
+ @whiny = options.fetch(:whiny, true)
17
+
18
+ @current_format = File.extname(file.path)
19
+ @basename = File.basename(@file.path, @current_format)
20
+ end
21
+
22
+ def make
23
+ source = @file
24
+ filename = [@basename, '.webp'].join
25
+ destination = Paperclip::TempfileFactory.new.generate(filename)
26
+
27
+ begin
28
+ thumbnail = Vips::Image.thumbnail(
29
+ ANIMATED_FORMATS.include?(@current_format) ? "#{source.path}[n=-1]" : source.path,
30
+ width,
31
+ size: @should_crop ? :both : :down,
32
+ height: height,
33
+ crop: crop
34
+ )
35
+ thumbnail.webpsave(destination.path)
36
+ rescue Vips::Error => e
37
+ if @whiny
38
+ message = "There was an error processing the thumbnail for #{@basename}:\n" + e.message
39
+ raise Paperclip::Error, message
40
+ end
41
+ end
42
+
43
+ destination
44
+ end
45
+
46
+ private
47
+
48
+ def crop
49
+ return unless @should_crop
50
+
51
+ @options[:crop] || :centre
52
+ end
53
+
54
+ def width
55
+ @target_geometry.width
56
+ end
57
+
58
+ def height
59
+ @target_geometry.height
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,19 @@
1
+ module Pageflow
2
+ module RailsVersion
3
+ extend self
4
+
5
+ def detect
6
+ from_env || '~> 6.1.0'
7
+ end
8
+
9
+ def experimental?
10
+ detect != '~> 6.1.0'
11
+ end
12
+
13
+ private
14
+
15
+ def from_env
16
+ ENV['PAGEFLOW_RAILS_VERSION'] if ENV['PAGEFLOW_RAILS_VERSION'] != ''
17
+ end
18
+ end
19
+ end