pageflow 15.6.1 → 15.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +253 -11
- data/README.md +1 -2
- data/admins/pageflow/entry.rb +28 -57
- data/admins/pageflow/membership.rb +5 -1
- data/admins/pageflow/user.rb +1 -3
- data/app/assets/images/pageflow/admin/icons/buttons/editor.svg +2 -0
- data/app/assets/images/pageflow/admin/icons/buttons/preview.svg +2 -0
- data/app/assets/images/pageflow/admin/icons/buttons/show_public.svg +2 -0
- data/app/assets/images/pageflow/admin/icons/delete.svg +9 -0
- data/app/assets/images/pageflow/admin/icons/done.svg +6 -0
- data/app/assets/images/pageflow/admin/icons/edit.svg +7 -0
- data/app/assets/images/pageflow/admin/icons/editor.svg +2 -0
- data/app/assets/images/pageflow/admin/icons/folder.svg +8 -0
- data/app/assets/images/pageflow/admin/icons/folder_active.svg +8 -0
- data/app/assets/images/pageflow/admin/icons/info.svg +3 -0
- data/app/assets/images/pageflow/admin/icons/new.svg +5 -0
- data/app/assets/images/pageflow/admin/icons/preview.svg +2 -0
- data/app/assets/images/pageflow/admin/icons/published.svg +2 -0
- data/app/assets/images/pageflow/admin/icons/published_with_password.svg +2 -0
- data/app/assets/images/pageflow/admin/icons/show_public.svg +2 -0
- data/app/assets/images/pageflow/editor/blank_entry/logo.png +0 -0
- data/app/assets/images/pageflow/themes/default/embed_opt_in.svg +3 -0
- data/app/assets/images/pageflow/themes/default/embed_opt_out_info.svg +16 -0
- data/app/assets/javascripts/pageflow/admin/entries.js +9 -57
- data/app/assets/javascripts/pageflow/dist/editor.js +11890 -0
- data/app/assets/javascripts/pageflow/dist/frontend.js +5800 -0
- data/app/assets/javascripts/pageflow/dist/react-client.js +22 -0
- data/app/assets/javascripts/pageflow/dist/react-server.js +19 -0
- data/app/assets/javascripts/pageflow/dist/ui.js +127 -10
- data/app/assets/stylesheets/pageflow/admin/active_admin_patches.scss +18 -16
- data/app/assets/stylesheets/pageflow/admin/badge_list.scss +25 -35
- data/app/assets/stylesheets/pageflow/admin/columns.scss +13 -11
- data/app/assets/stylesheets/pageflow/admin/embed_code.scss +1 -4
- data/app/assets/stylesheets/pageflow/admin/entries/folders.scss +44 -19
- data/app/assets/stylesheets/pageflow/admin/entries.scss +15 -31
- data/app/assets/stylesheets/pageflow/admin/features.scss +3 -1
- data/app/assets/stylesheets/pageflow/admin/forms.scss +14 -12
- data/app/assets/stylesheets/pageflow/admin/hint.scss +8 -14
- data/app/assets/stylesheets/pageflow/admin/icon_button.scss +25 -14
- data/app/assets/stylesheets/pageflow/admin/icon_link.scss +31 -15
- data/app/assets/stylesheets/pageflow/admin/publication_state_indicator.scss +14 -7
- data/app/assets/stylesheets/pageflow/admin/status_tags.scss +5 -4
- data/app/assets/stylesheets/pageflow/admin/tabs_view.scss +36 -34
- data/app/assets/stylesheets/pageflow/admin/tooltip_bubble.scss +15 -11
- data/app/assets/stylesheets/pageflow/admin.scss +12 -0
- data/app/assets/stylesheets/pageflow/editor/background_positioning.scss +15 -61
- data/app/assets/stylesheets/pageflow/editor/base.scss +28 -13
- data/app/assets/stylesheets/pageflow/editor/blank_entry.scss +6 -6
- data/app/assets/stylesheets/pageflow/editor/change_theme.scss +28 -71
- data/app/assets/stylesheets/pageflow/editor/composables.scss +2 -2
- data/app/assets/stylesheets/pageflow/editor/confirm_encoding.scss +18 -36
- data/app/assets/stylesheets/pageflow/editor/confirm_upload.scss +12 -39
- data/app/assets/stylesheets/pageflow/editor/dialogs.scss +39 -12
- data/app/assets/stylesheets/pageflow/editor/disabled_atmo_indicator.scss +3 -3
- data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +7 -10
- data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +3 -8
- data/app/assets/stylesheets/pageflow/editor/failures.scss +3 -3
- data/app/assets/stylesheets/pageflow/editor/file_import.scss +22 -38
- data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +3 -7
- data/app/assets/stylesheets/pageflow/editor/file_settings_dialog.scss +4 -24
- data/app/assets/stylesheets/pageflow/editor/file_stages.scss +10 -11
- data/app/assets/stylesheets/pageflow/editor/file_thumbnails.scss +4 -8
- data/app/assets/stylesheets/pageflow/editor/files.scss +7 -6
- data/app/assets/stylesheets/pageflow/editor/files_explorer.scss +13 -30
- data/app/assets/stylesheets/pageflow/editor/files_gallery.scss +15 -11
- data/app/assets/stylesheets/pageflow/editor/filtered_files.scss +6 -7
- data/app/assets/stylesheets/pageflow/editor/help.scss +19 -14
- data/app/assets/stylesheets/pageflow/editor/help_image.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/info_box.scss +19 -0
- data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +7 -11
- data/app/assets/stylesheets/pageflow/editor/inputs/file_processing_state_display.scss +0 -2
- data/app/assets/stylesheets/pageflow/editor/inputs/reference.scss +7 -11
- data/app/assets/stylesheets/pageflow/editor/list.scss +13 -10
- data/app/assets/stylesheets/pageflow/editor/loading.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/locked.scss +9 -5
- data/app/assets/stylesheets/pageflow/editor/menu.scss +5 -5
- data/app/assets/stylesheets/pageflow/editor/notifications.scss +15 -14
- data/app/assets/stylesheets/pageflow/editor/other_entry_item.scss +7 -3
- data/app/assets/stylesheets/pageflow/editor/outline.scss +57 -19
- data/app/assets/stylesheets/pageflow/editor/page_links.scss +10 -8
- data/app/assets/stylesheets/pageflow/editor/page_selection.scss +2 -29
- data/app/assets/stylesheets/pageflow/editor/publish_entry.scss +5 -6
- data/app/assets/stylesheets/pageflow/editor/quotas.scss +2 -3
- data/app/assets/stylesheets/pageflow/editor/select_button.scss +12 -6
- data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +1 -5
- data/app/assets/stylesheets/pageflow/editor/storyline_picker.scss +6 -2
- data/app/assets/stylesheets/pageflow/editor/text_tracks.scss +6 -22
- data/app/assets/stylesheets/pageflow/editor/widgets.scss +2 -2
- data/app/assets/stylesheets/pageflow/editor/wysihtml5.scss +35 -29
- data/app/assets/stylesheets/pageflow/mixins/background_icons.scss +3 -3
- data/app/assets/stylesheets/pageflow/mixins/buttons.scss +50 -68
- data/app/assets/stylesheets/pageflow/themes/default/base.scss +2 -0
- data/app/assets/stylesheets/pageflow/themes/default/consent/bar.scss +156 -0
- data/app/assets/stylesheets/pageflow/themes/default/consent/vendor_list.scss +62 -0
- data/app/assets/stylesheets/pageflow/themes/default/consent.scss +2 -0
- data/app/assets/stylesheets/pageflow/themes/default/logo/alignment.scss +7 -0
- data/app/assets/stylesheets/pageflow/themes/default/page/shadow.scss +44 -0
- data/app/assets/stylesheets/pageflow/themes/default/third_party_embed_consent.scss +103 -0
- data/app/assets/stylesheets/pageflow/ui/forms.scss +79 -84
- data/app/assets/stylesheets/pageflow/ui/functions.scss +56 -0
- data/app/assets/stylesheets/pageflow/ui/input/check_box_group_input.scss +2 -3
- data/app/assets/stylesheets/pageflow/ui/input/color_input.scss +6 -6
- data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.scss +63 -50
- data/app/assets/stylesheets/pageflow/ui/normalize/forms.scss +153 -0
- data/app/assets/stylesheets/pageflow/ui/normalize.scss +278 -0
- data/app/assets/stylesheets/pageflow/ui/properties.scss +44 -0
- data/app/assets/stylesheets/pageflow/ui/table_cells/delete_row_table_cell.scss +1 -1
- data/app/assets/stylesheets/pageflow/ui/table_view.scss +14 -18
- data/app/assets/stylesheets/pageflow/ui/tabs_view.scss +8 -11
- data/app/assets/stylesheets/pageflow/ui/tooltip.scss +6 -8
- data/app/assets/stylesheets/pageflow/ui/validation_error_messages.scss +6 -0
- data/app/assets/stylesheets/pageflow/ui.scss +4 -0
- data/app/controllers/pageflow/edit_locks_controller.rb +3 -1
- data/app/helpers/pageflow/admin/entries_helper.rb +2 -12
- data/app/helpers/pageflow/embed_code_helper.rb +1 -1
- data/app/helpers/pageflow/entries_helper.rb +41 -2
- data/app/helpers/pageflow/file_background_images_helper.rb +1 -1
- data/app/helpers/pageflow/page_types_helper.rb +1 -1
- data/app/helpers/pageflow/themes_helper.rb +1 -1
- data/app/jobs/pageflow/poll_meta_data_from_zencoder_job.rb +1 -1
- data/app/jobs/pageflow/poll_zencoder_job.rb +1 -9
- data/app/models/pageflow/audio_file.rb +17 -0
- data/app/models/pageflow/audio_file_url_templates.rb +4 -1
- data/app/models/pageflow/customized_theme.rb +37 -0
- data/app/models/pageflow/draft_entry.rb +6 -59
- data/app/models/pageflow/entry.rb +8 -0
- data/app/models/pageflow/entry_at_revision.rb +68 -0
- data/app/models/pageflow/entry_role_query.rb +44 -24
- data/app/models/pageflow/image_file_css_background_image_urls.rb +8 -2
- data/app/models/pageflow/published_entry.rb +9 -56
- data/app/models/pageflow/theme_customization.rb +46 -0
- data/app/models/pageflow/theme_customization_file.rb +58 -0
- data/app/models/pageflow/video_file.rb +11 -1
- data/app/models/pageflow/video_file_url_templates.rb +1 -0
- data/app/policies/pageflow/entry_policy.rb +4 -0
- data/app/state_machines/pageflow/media_encoding_state_machine.rb +23 -4
- data/app/views/admin/entries/_form.html.erb +50 -0
- data/app/views/admin/entries/entry_type_name_input.html.erb +5 -0
- data/app/views/admin/features/_form.html.erb +1 -1
- data/app/views/admin/memberships/_form.html.erb +2 -3
- data/app/views/admin/users/_form.html.erb +1 -1
- data/app/views/admin/users/invitation.html.erb +2 -2
- data/app/views/components/pageflow/admin/entry_user_badge_list.rb +10 -9
- data/app/views/components/pageflow/admin/members_tab.rb +5 -1
- data/app/views/components/pageflow/admin/revisions_tab.rb +13 -3
- data/app/views/components/pageflow/admin/timestamp.rb +20 -0
- data/app/views/components/pageflow/admin/user_account_badge_list.rb +5 -6
- data/app/views/pageflow/admin/entries/_cannot_add_user.html.erb +9 -5
- data/app/views/pageflow/admin/entries/_entry_type_name_input.html.erb +7 -0
- data/app/views/pageflow/audio_files/_audio_file.json.jbuilder +13 -0
- data/app/views/pageflow/editor/encoding_confirmations/_intro.html.erb +0 -0
- data/app/views/pageflow/editor/encoding_confirmations/check.json.jbuilder +14 -2
- data/config/initializers/paperclip.rb +16 -1
- data/config/locales/de.yml +24 -28
- data/config/locales/en.yml +19 -10
- data/db/migrate/20210528073122_create_pageflow_theme_customizations.rb +11 -0
- data/db/migrate/20210531090654_create_pageflow_theme_customization_files.rb +15 -0
- data/db/migrate/20210531102228_add_selected_file_ids_to_theme_customizations.rb +5 -0
- data/db/migrate/20211020085902_add_canonical_entry_url_prefix_to_themings.rb +5 -0
- data/db/migrate/20220503150010_add_peak_data_to_audio_files.rb +5 -0
- data/db/migrate/20220705084830_add_trailing_slash_in_canonical_urls_to_themings.rb +5 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +256 -124
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +566 -167
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +5 -5
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +4 -4
- data/entry_types/paged/app/helpers/pageflow_paged/third_party_embed_consent_helper.rb +38 -0
- data/entry_types/paged/app/views/pageflow_paged/third_party_embed_consent/_opt_in.html.erb +12 -0
- data/entry_types/paged/app/views/pageflow_paged/third_party_embed_consent/_opt_out_info.html.erb +10 -0
- data/entry_types/paged/config/initializers/features.rb +2 -0
- data/entry_types/paged/config/locales/new/video_contain.de.yml +7 -0
- data/entry_types/paged/config/locales/new/video_contain.en.yml +7 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +3 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +1 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/packs_helper.rb +58 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +37 -3
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +92 -6
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/webpack_public_path_helper.rb +20 -0
- data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +7 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +5 -2
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +5 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +5 -4
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +16 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +13 -2
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_widget.json.jbuilder +2 -0
- data/entry_types/scrolled/config/locales/de.yml +1 -8
- data/entry_types/scrolled/config/locales/en.yml +1 -9
- data/entry_types/scrolled/config/locales/new/before_after_slider.de.yml +8 -0
- data/entry_types/scrolled/config/locales/new/before_after_slider.en.yml +8 -0
- data/entry_types/scrolled/config/locales/new/center_ragged.de.yml +8 -0
- data/entry_types/scrolled/config/locales/new/center_ragged.en.yml +9 -0
- data/entry_types/scrolled/config/locales/new/consent.de.yml +25 -0
- data/entry_types/scrolled/config/locales/new/consent.en.yml +24 -0
- data/entry_types/scrolled/config/locales/new/content_element_categories.de.yml +39 -0
- data/entry_types/scrolled/config/locales/new/content_element_categories.en.yml +39 -0
- data/entry_types/scrolled/config/locales/new/default_transition.de.yml +14 -0
- data/entry_types/scrolled/config/locales/new/default_transition.en.yml +14 -0
- data/entry_types/scrolled/config/locales/new/header_line_breaks.de.yml +28 -0
- data/entry_types/scrolled/config/locales/new/header_line_breaks.en.yml +27 -0
- data/entry_types/scrolled/config/locales/new/header_size.de.yml +17 -0
- data/entry_types/scrolled/config/locales/new/header_size.en.yml +17 -0
- data/entry_types/scrolled/config/locales/new/iframe_embed.de.yml +39 -0
- data/entry_types/scrolled/config/locales/new/iframe_embed.en.yml +39 -0
- data/entry_types/scrolled/config/locales/new/inline_loops.de.yml +26 -0
- data/entry_types/scrolled/config/locales/new/inline_loops.en.yml +26 -0
- data/entry_types/scrolled/config/locales/new/portrait_inline_image.de.yml +9 -0
- data/entry_types/scrolled/config/locales/new/portrait_inline_image.en.yml +9 -0
- data/entry_types/scrolled/config/locales/new/section_width.de.yml +10 -0
- data/entry_types/scrolled/config/locales/new/section_width.en.yml +10 -0
- data/entry_types/scrolled/config/locales/new/typography_variants.de.yml +7 -0
- data/entry_types/scrolled/config/locales/new/typography_variants.en.yml +7 -0
- data/entry_types/scrolled/config/locales/new/video_embed_poster.de.yml +8 -0
- data/entry_types/scrolled/config/locales/new/video_embed_poster.en.yml +8 -0
- data/entry_types/scrolled/config/locales/new/waveform_styles.de.yml +11 -0
- data/entry_types/scrolled/config/locales/new/waveform_styles.en.yml +12 -0
- data/entry_types/scrolled/config/locales/new/widgets.de.yml +6 -0
- data/entry_types/scrolled/config/locales/new/widgets.en.yml +6 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +29 -5
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/themes_plugin.rb.tt +8 -6
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_packs.rb +37 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/additional_seed_data.rb +57 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +49 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +8 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/react_widget_type.rb +42 -0
- data/entry_types/scrolled/lib/pageflow_scrolled.rb +17 -1
- data/entry_types/scrolled/package/contentElements-editor.js +323 -89
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -1
- data/entry_types/scrolled/package/contentElements-frontend.js +719 -529
- data/entry_types/scrolled/package/editor.js +459 -261
- data/entry_types/scrolled/package/frontend/{EditableText-7093fd0e.js → EditableInlineText.module-b9923660.js} +284 -362
- data/entry_types/scrolled/package/frontend/{i18n-4dc6c377.js → PhonePlatformContext-9fb97827.js} +199 -106
- data/entry_types/scrolled/package/frontend/{Viewer-e49e7807.js → Viewer-e2290ea0.js} +196 -79
- data/entry_types/scrolled/package/frontend/{Wavesurfer-0adf5667.js → Wavesurfer-7d9cf1b7.js} +16 -58
- data/entry_types/scrolled/package/frontend/{components-6a6793ca.js → components-6ab26015.js} +664 -671
- data/entry_types/scrolled/package/frontend/{getPrototypeOf-63c7c8e8.js → createSuper-d0f30da3.js} +34 -5
- data/entry_types/scrolled/package/frontend/index.css +1 -9
- data/entry_types/scrolled/package/frontend/index.js +1919 -2386
- data/entry_types/scrolled/package/frontend/{useBrowserFeature-91a4c29d.js → usePhonePlatform-2857c22b.js} +9 -8
- data/entry_types/scrolled/package/frontend-server.js +3 -6
- data/entry_types/scrolled/package/package.json +16 -8
- data/entry_types/scrolled/package/testHelpers.js +456 -0
- data/entry_types/scrolled/package/values/breakpoints.module.css +9 -0
- data/entry_types/scrolled/package/values/colors.module.css +5 -0
- data/entry_types/scrolled/package/widgets/defaultNavigation.css +9 -0
- data/entry_types/scrolled/package/widgets/defaultNavigation.js +612 -0
- data/entry_types/scrolled/spec/fixtures/image.svg +1 -0
- data/lib/pageflow/ability_mixin.rb +4 -0
- data/lib/pageflow/built_in_widget_type.rb +4 -0
- data/lib/pageflow/built_in_widget_types_plugin.rb +7 -0
- data/lib/pageflow/configuration.rb +34 -1
- data/lib/pageflow/entry_type.rb +11 -2
- data/lib/pageflow/entry_type_configuration.rb +2 -0
- data/lib/pageflow/file_type.rb +24 -0
- data/lib/pageflow/paperclip_processors/audio_waveform.rb +42 -0
- data/lib/pageflow/paperclip_processors/noop.rb +10 -0
- data/lib/pageflow/theme_customizations.rb +61 -0
- data/lib/pageflow/user_mixin.rb +6 -0
- data/lib/pageflow/version.rb +1 -1
- data/lib/pageflow.rb +9 -0
- data/package/config/jest/index.js +2 -1
- data/package/config/postcss/scaleFunctions.js +71 -0
- data/package/editor.js +95 -85
- data/package/frontend.js +521 -161
- data/package/package.json +5 -3
- data/package/testHelpers.js +26 -5
- data/package/ui.js +124 -11
- data/spec/factories/draft_entries.rb +19 -1
- data/spec/factories/entries.rb +4 -0
- data/spec/factories/published_entries.rb +6 -0
- data/spec/fixtures/audio.ogg +0 -0
- metadata +123 -15
- data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +0 -2
- data/app/views/admin/entries/entry_types.json.jbuilder +0 -4
- data/package/config/jest/transformers/upwardBabel.js +0 -5
@@ -95,6 +95,13 @@ module Pageflow
|
|
95
95
|
# @since 15.1
|
96
96
|
attr_reader :entry_types
|
97
97
|
|
98
|
+
# Either a lambda or an object with a `call` method taking an
|
99
|
+
# {Account} as paramater and returing the entry type that shall be
|
100
|
+
# selected by default when creating a new entry.
|
101
|
+
# @return [#call]
|
102
|
+
# @since 15.7
|
103
|
+
attr_accessor :default_entry_type
|
104
|
+
|
98
105
|
# List of {FileType} instances.
|
99
106
|
# Can be registered globally or provided by page types.
|
100
107
|
# @return [FileTypes]
|
@@ -207,8 +214,22 @@ module Pageflow
|
|
207
214
|
# construct the embed url of a published entry.
|
208
215
|
attr_accessor :entry_embed_url_options
|
209
216
|
|
217
|
+
# Either a lambda or an object with a `call` method taking a hash
|
218
|
+
# of theme option overrides and an {EntryAtRevision} and returning
|
219
|
+
# a transformed hash of overrides. Can be used to filter overrides
|
220
|
+
# based on feature flags and other entry or account traits.
|
221
|
+
attr_accessor :transform_theme_customization_overrides
|
222
|
+
|
223
|
+
# Either a lambda or an object with a `call` method taking a hash
|
224
|
+
# of theme customization files and an {EntryAtRevision} and
|
225
|
+
# returning a transformed hash of files. Can be used to filter
|
226
|
+
# files based on feature flags and other entry or account traits.
|
227
|
+
attr_accessor :transform_theme_customization_files
|
228
|
+
|
210
229
|
# Submit video/audio encoding jobs only after the user has
|
211
|
-
# explicitly confirmed in the editor.
|
230
|
+
# explicitly confirmed in the editor. Can either be set to a
|
231
|
+
# boolean or a lambda that is passed the file and returns a
|
232
|
+
# boolean. Defaults to false.
|
212
233
|
attr_accessor :confirm_encoding_jobs
|
213
234
|
|
214
235
|
# Used by Pageflow extensions to provide new tabs to be displayed
|
@@ -387,6 +408,9 @@ module Pageflow
|
|
387
408
|
@public_entry_url_options = Pageflow::ThemingsHelper::DEFAULT_PUBLIC_ENTRY_OPTIONS
|
388
409
|
@entry_embed_url_options = {protocol: 'https'}
|
389
410
|
|
411
|
+
@transform_theme_customization_overrides = ->(overrides, _entry) { overrides }
|
412
|
+
@transform_theme_customization_files = ->(files, _entry) { files }
|
413
|
+
|
390
414
|
@confirm_encoding_jobs = false
|
391
415
|
|
392
416
|
@admin_resource_tabs = Pageflow::Admin::Tabs.new
|
@@ -481,6 +505,15 @@ module Pageflow
|
|
481
505
|
@features.lint!
|
482
506
|
end
|
483
507
|
|
508
|
+
# @api private
|
509
|
+
def confirm_encoding_jobs?(file)
|
510
|
+
if confirm_encoding_jobs.respond_to?(:call)
|
511
|
+
confirm_encoding_jobs.call(file)
|
512
|
+
else
|
513
|
+
confirm_encoding_jobs
|
514
|
+
end
|
515
|
+
end
|
516
|
+
|
484
517
|
# @api private
|
485
518
|
def theming_url_options(theming)
|
486
519
|
options = public_entry_url_options
|
data/lib/pageflow/entry_type.rb
CHANGED
@@ -4,7 +4,8 @@ module Pageflow
|
|
4
4
|
# @since 15.1
|
5
5
|
class EntryType
|
6
6
|
# @api private
|
7
|
-
attr_reader :name, :frontend_app, :editor_fragment_renderer, :configuration, :editor_app
|
7
|
+
attr_reader :name, :frontend_app, :editor_fragment_renderer, :configuration, :editor_app,
|
8
|
+
:theme_files
|
8
9
|
|
9
10
|
# @param name [String] A unique name.
|
10
11
|
#
|
@@ -20,12 +21,20 @@ module Pageflow
|
|
20
21
|
# @param editor_app [#call] A rack app that extends the REST
|
21
22
|
# interface used by editor Backbone collections. Mounted at
|
22
23
|
# `/editor/entries/:id/<entry_type_name>/`
|
23
|
-
|
24
|
+
#
|
25
|
+
# @param theme_files [Hash] A hash of the following form defining
|
26
|
+
# what files can be uploaded when customizing themes of the
|
27
|
+
# entry type and which Paperclip styles shall be processed:
|
28
|
+
# `{logo: {content_type: %r{^image/}, styles: {small:
|
29
|
+
# '300x300>'}}`.
|
30
|
+
def initialize(name:, frontend_app:, editor_fragment_renderer:, configuration:, editor_app: nil,
|
31
|
+
theme_files: {})
|
24
32
|
@name = name
|
25
33
|
@frontend_app = frontend_app
|
26
34
|
@editor_fragment_renderer = editor_fragment_renderer
|
27
35
|
@configuration = configuration
|
28
36
|
@editor_app = editor_app
|
37
|
+
@theme_files = theme_files
|
29
38
|
end
|
30
39
|
end
|
31
40
|
end
|
@@ -18,6 +18,8 @@ module Pageflow
|
|
18
18
|
delegate :revision_components, to: :@config
|
19
19
|
delegate :themes, to: :@config
|
20
20
|
delegate :widget_types, to: :@config
|
21
|
+
delegate :transform_theme_customization_overrides=, to: :@config
|
22
|
+
delegate :transform_theme_customization_files=, to: :@config
|
21
23
|
|
22
24
|
def plugin(plugin)
|
23
25
|
plugin.configure(self)
|
data/lib/pageflow/file_type.rb
CHANGED
@@ -123,6 +123,14 @@ 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)
|
127
|
+
if call_arity(css_background_image_urls) == 1
|
128
|
+
css_background_image_urls.call(file)
|
129
|
+
else
|
130
|
+
css_background_image_urls.call(file, options)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
126
134
|
# @api private
|
127
135
|
def param_key
|
128
136
|
model.model_name.param_key.to_sym
|
@@ -154,5 +162,21 @@ module Pageflow
|
|
154
162
|
{}
|
155
163
|
end
|
156
164
|
end
|
165
|
+
|
166
|
+
def call_arity(callable)
|
167
|
+
# lambda's #call method always claims to have no required
|
168
|
+
# parameters:
|
169
|
+
#
|
170
|
+
# lambda { |file| }.method(:call).arity # => -1
|
171
|
+
# lambda { |file, entry:| }.method(:call).arity # => -1
|
172
|
+
#
|
173
|
+
# Use arity of lambda itself instead:
|
174
|
+
#
|
175
|
+
# lambda { |file| }.arity # => 1
|
176
|
+
# lambda { |file, entry:| }.arity # => 1
|
177
|
+
return callable.arity if callable.respond_to?(:arity)
|
178
|
+
|
179
|
+
callable.method(:call).arity
|
180
|
+
end
|
157
181
|
end
|
158
182
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
module Pageflow
|
4
|
+
module PaperclipProcessors
|
5
|
+
# @api private
|
6
|
+
class AudioWaveform < Paperclip::Processor
|
7
|
+
def make
|
8
|
+
destination = make_tempfile_for(file.path)
|
9
|
+
|
10
|
+
generate_peak_data(input: file.path,
|
11
|
+
output: destination.path)
|
12
|
+
|
13
|
+
destination
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def generate_peak_data(input:, output:)
|
19
|
+
_stdout, stderr, status = Open3.capture3('audiowaveform',
|
20
|
+
'-i',
|
21
|
+
input,
|
22
|
+
'-o',
|
23
|
+
output,
|
24
|
+
'--pixels-per-second',
|
25
|
+
'10',
|
26
|
+
'--bits',
|
27
|
+
'8')
|
28
|
+
|
29
|
+
raise "audiowaveform failed: #{stderr}" unless status.success?
|
30
|
+
end
|
31
|
+
|
32
|
+
def make_tempfile_for(path)
|
33
|
+
basename = File.basename(path, File.extname(path))
|
34
|
+
|
35
|
+
tempfile = Tempfile.new([basename, '.json'])
|
36
|
+
tempfile.binmode
|
37
|
+
|
38
|
+
tempfile
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Pageflow
|
2
|
+
# Apply account wide customizations to themes of a specific entry
|
3
|
+
# type.
|
4
|
+
#
|
5
|
+
# @since 15.7
|
6
|
+
class ThemeCustomizations
|
7
|
+
# Override theme options and files for entries of an entry type in
|
8
|
+
# a specific account.
|
9
|
+
def update(account:, entry_type_name:, overrides: {}, file_ids: {})
|
10
|
+
ThemeCustomization
|
11
|
+
.find_or_initialize_by(account: account, entry_type_name: entry_type_name)
|
12
|
+
.update!(overrides: overrides, selected_file_ids: file_ids)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Construct an entry that uses the given overrides and files in
|
16
|
+
# its theme without actually updating the theme customization.
|
17
|
+
#
|
18
|
+
# @return [PublishedEntry]
|
19
|
+
def preview(account:, entry:, overrides: {}, file_ids: {})
|
20
|
+
theme_customization =
|
21
|
+
ThemeCustomization
|
22
|
+
.find_or_initialize_by(account: account, entry_type_name: entry.type_name)
|
23
|
+
|
24
|
+
theme_customization.assign_attributes(overrides: overrides, selected_file_ids: file_ids)
|
25
|
+
|
26
|
+
theme = CustomizedTheme.build(entry: entry,
|
27
|
+
theme: entry.draft.theme,
|
28
|
+
theme_customization: theme_customization)
|
29
|
+
|
30
|
+
PublishedEntry.new(entry, entry.draft, theme: theme)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get customization for entry type and account.
|
34
|
+
#
|
35
|
+
# @return [ThemeCustomization]
|
36
|
+
def get(account:, entry_type_name:)
|
37
|
+
ThemeCustomization
|
38
|
+
.find_or_initialize_by(account: account, entry_type_name: entry_type_name)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Upload a file that shall be used to customize a theme. Uploading
|
42
|
+
# the file does not result in visible changes. Call [#update] and
|
43
|
+
# assign a role via the `file_ids` parameter.
|
44
|
+
#
|
45
|
+
# @return [ThemeCustomizationFile]
|
46
|
+
def upload_file(account:, entry_type_name:, type_name:, attachment:)
|
47
|
+
theme_customization_file =
|
48
|
+
ThemeCustomization
|
49
|
+
.find_or_create_by(account: account, entry_type_name: entry_type_name)
|
50
|
+
.uploaded_files
|
51
|
+
.build(type_name: type_name)
|
52
|
+
|
53
|
+
# Assign attachment in separate step to make sure theme
|
54
|
+
# customization association (which is used to look up Paperclip
|
55
|
+
# styles and validation content type) has already been set when Paperclip runs.
|
56
|
+
theme_customization_file.attachment = attachment
|
57
|
+
theme_customization_file.save!
|
58
|
+
theme_customization_file
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/pageflow/user_mixin.rb
CHANGED
@@ -70,6 +70,12 @@ module Pageflow
|
|
70
70
|
devise_mailer.send(notification, self, *args).deliver_later
|
71
71
|
end
|
72
72
|
|
73
|
+
module ClassMethods
|
74
|
+
def ransackable_attributes(_auth_object)
|
75
|
+
%w[first_name last_name email]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
73
79
|
private
|
74
80
|
|
75
81
|
def needs_password?(attributes)
|
data/lib/pageflow/version.rb
CHANGED
data/lib/pageflow.rb
CHANGED
@@ -44,4 +44,13 @@ module Pageflow
|
|
44
44
|
def self.built_in_widget_types_plugin
|
45
45
|
BuiltInWidgetTypesPlugin.new
|
46
46
|
end
|
47
|
+
|
48
|
+
# Apply account wide customizations to themes of a specific entry
|
49
|
+
# type.
|
50
|
+
#
|
51
|
+
# @return [ThemeCustomizations]
|
52
|
+
# @since 15.7
|
53
|
+
def self.theme_customizations
|
54
|
+
ThemeCustomizations.new
|
55
|
+
end
|
47
56
|
end
|
@@ -2,6 +2,7 @@ const path = require('path');
|
|
2
2
|
|
3
3
|
module.exports = {
|
4
4
|
globals: {
|
5
|
+
__webpack_public_path__: '',
|
5
6
|
pageflow: {
|
6
7
|
config: {}
|
7
8
|
}
|
@@ -22,7 +23,7 @@ module.exports = {
|
|
22
23
|
|
23
24
|
transform: {
|
24
25
|
'^.+\\.jst$': resolve('./transformers/jst'),
|
25
|
-
'^.+\\.jsx?$':
|
26
|
+
'^.+\\.jsx?$': ['babel-jest', {rootMode: "upward"}],
|
26
27
|
'^.+\\.module.css$': 'jest-css-modules-processor'
|
27
28
|
}
|
28
29
|
}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
const scale = Object.entries({
|
2
|
+
'0.5': '0.125rem',
|
3
|
+
'1': '0.25rem',
|
4
|
+
'1.5': '0.375rem',
|
5
|
+
'2': '0.5rem',
|
6
|
+
'2.5': '0.625rem',
|
7
|
+
'3': '0.75rem',
|
8
|
+
'3.5': '0.875rem',
|
9
|
+
'4': '1rem',
|
10
|
+
'5': '1.25rem',
|
11
|
+
'6': '1.5rem',
|
12
|
+
'7': '1.75rem',
|
13
|
+
'8': '2rem',
|
14
|
+
'9': '2.25rem',
|
15
|
+
'10': '2.5rem',
|
16
|
+
'11': '2.75rem',
|
17
|
+
'12': '3rem',
|
18
|
+
'14': '3.5rem',
|
19
|
+
'16': '4rem',
|
20
|
+
'20': '5rem',
|
21
|
+
'24': '6rem',
|
22
|
+
'28': '7rem',
|
23
|
+
'32': '8rem',
|
24
|
+
'36': '9rem',
|
25
|
+
'40': '10rem',
|
26
|
+
'44': '11rem',
|
27
|
+
'48': '12rem',
|
28
|
+
'52': '13rem',
|
29
|
+
'56': '14rem',
|
30
|
+
'60': '15rem',
|
31
|
+
'64': '16rem',
|
32
|
+
'72': '18rem',
|
33
|
+
'80': '20rem',
|
34
|
+
'96': '24rem'
|
35
|
+
}).reduce((result, e) => {
|
36
|
+
const [key, value] = e;
|
37
|
+
return {
|
38
|
+
...result,
|
39
|
+
[key]: value,
|
40
|
+
[`-${key}`]: `-${value}`
|
41
|
+
};
|
42
|
+
}, {});
|
43
|
+
|
44
|
+
const rounded = {
|
45
|
+
'sm': '0.125rem',
|
46
|
+
'base': '0.25rem',
|
47
|
+
'md': '0.375rem',
|
48
|
+
'lg': '0.5rem',
|
49
|
+
'xl': '0.75rem',
|
50
|
+
'2xl': '1em',
|
51
|
+
'3xl': '1.5rem',
|
52
|
+
'full': '9999px'
|
53
|
+
};
|
54
|
+
|
55
|
+
module.exports = require('postcss-functions')({
|
56
|
+
functions: {
|
57
|
+
rounded: loopUpFunction(rounded, 'rounded'),
|
58
|
+
size: loopUpFunction(scale, 'size'),
|
59
|
+
space: loopUpFunction(scale, 'space')
|
60
|
+
}
|
61
|
+
});
|
62
|
+
|
63
|
+
function loopUpFunction(map, name) {
|
64
|
+
return function(key = 'base') {
|
65
|
+
if (!map[key]) {
|
66
|
+
throw new Error(`Unknown ${name} ${key}`);
|
67
|
+
}
|
68
|
+
|
69
|
+
return map[key];
|
70
|
+
}
|
71
|
+
}
|