pageflow 0.11.4 → 12.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pageflow might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +224 -1207
- data/README.md +7 -3
- data/Rakefile +2 -0
- data/admins/pageflow/accounts.rb +27 -8
- data/admins/pageflow/entry.rb +130 -47
- data/admins/pageflow/folder.rb +28 -17
- data/admins/pageflow/membership.rb +58 -6
- data/admins/pageflow/user.rb +105 -98
- data/app/assets/fonts/pageflow/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/pageflow/fontawesome-webfont.svg +644 -463
- data/app/assets/fonts/pageflow/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/pageflow/fontawesome-webfont.woff +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.eot +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.svg +2864 -696
- data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.ttf +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-bold-webfont.woff +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.eot +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.svg +2572 -613
- data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.ttf +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-light-webfont.woff +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.eot +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.svg +2977 -779
- data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.ttf +0 -0
- data/app/assets/fonts/pageflow/sourcesanspro-regular-webfont.woff +0 -0
- data/app/assets/javascripts/pageflow/admin/entries.js +21 -3
- data/app/assets/javascripts/pageflow/audio.js +30 -15
- data/app/assets/javascripts/pageflow/audio/multi_player.js +12 -1
- data/app/assets/javascripts/pageflow/audio_player.js +15 -1
- data/app/assets/javascripts/pageflow/audio_player/rewind_method.js +3 -1
- data/app/assets/javascripts/pageflow/base.js +4 -1
- data/app/assets/javascripts/pageflow/browser.js +3 -0
- data/app/assets/javascripts/pageflow/browser/autoplay_support.js +3 -0
- data/app/assets/javascripts/pageflow/browser/facebook.js +1 -2
- data/app/assets/javascripts/pageflow/browser/ios_platform.js +5 -0
- data/app/assets/javascripts/pageflow/browser/video.js +4 -0
- data/app/assets/javascripts/pageflow/components.js +7 -0
- data/app/assets/javascripts/pageflow/cookies.js +1 -4
- data/app/assets/javascripts/pageflow/dist/react.js +4724 -5808
- data/app/assets/javascripts/pageflow/editor/api.js +201 -161
- data/app/assets/javascripts/pageflow/editor/api/errors.js +80 -0
- data/app/assets/javascripts/pageflow/editor/api/failure.js +9 -0
- data/app/assets/javascripts/pageflow/editor/api/failures.js +25 -2
- data/app/assets/javascripts/pageflow/editor/api/file_type.js +42 -3
- data/app/assets/javascripts/pageflow/editor/api/file_types.js +75 -46
- data/app/assets/javascripts/pageflow/editor/base.js +8 -0
- data/app/assets/javascripts/pageflow/editor/collections/file_types_collection.js +37 -0
- data/app/assets/javascripts/pageflow/editor/collections/files_collection.js +32 -1
- data/app/assets/javascripts/pageflow/editor/collections/mixins/ordered_collection.js +1 -1
- data/app/assets/javascripts/pageflow/editor/collections/multi_collection.js +4 -6
- data/app/assets/javascripts/pageflow/editor/collections/nested_files_collection.js +27 -0
- data/app/assets/javascripts/pageflow/editor/collections/pages_collection.js +21 -1
- data/app/assets/javascripts/pageflow/editor/collections/subset_collection.js +8 -2
- data/app/assets/javascripts/pageflow/editor/controllers/sidebar_controller.js +3 -2
- data/app/assets/javascripts/pageflow/editor/initializers/error_listener.js +10 -5
- data/app/assets/javascripts/pageflow/editor/initializers/routing.js +3 -1
- data/app/assets/javascripts/pageflow/editor/initializers/setup_collections.js +3 -0
- data/app/assets/javascripts/pageflow/editor/initializers/setup_file_types.js +136 -6
- data/app/assets/javascripts/pageflow/editor/initializers/setup_file_uploader.js +10 -0
- data/app/assets/javascripts/pageflow/editor/initializers/setup_hotkeys.js +5 -7
- data/app/assets/javascripts/pageflow/editor/initializers/stylesheet_reloading.js +1 -1
- data/app/assets/javascripts/pageflow/editor/models/configuration.js +1 -0
- data/app/assets/javascripts/pageflow/editor/models/entry.js +34 -26
- data/app/assets/javascripts/pageflow/editor/models/file_configuration.js +10 -0
- data/app/assets/javascripts/pageflow/editor/models/file_reuse.js +23 -0
- data/app/assets/javascripts/pageflow/editor/models/file_uploader.js +69 -0
- data/app/assets/javascripts/pageflow/editor/models/mixins/retryable.js +1 -1
- data/app/assets/javascripts/pageflow/editor/models/page.js +13 -0
- data/app/assets/javascripts/pageflow/editor/models/text_track_file.js +48 -0
- data/app/assets/javascripts/pageflow/editor/models/uploaded_file.js +62 -11
- data/app/assets/javascripts/pageflow/editor/routers/sidebar_router.js +1 -0
- data/app/assets/javascripts/pageflow/editor/templates/confirm_upload.jst.ejs +18 -0
- data/app/assets/javascripts/pageflow/editor/templates/delete_row_table_cell.jst.ejs +1 -0
- data/app/assets/javascripts/pageflow/editor/templates/drop_down_button.jst.ejs +0 -2
- data/app/assets/javascripts/pageflow/editor/templates/drop_down_button_item.jst.ejs +1 -0
- data/app/assets/javascripts/pageflow/editor/templates/edit_entry.jst.ejs +3 -1
- data/app/assets/javascripts/pageflow/editor/templates/edit_file.jst.ejs +0 -0
- data/app/assets/javascripts/pageflow/editor/templates/file_item.jst.ejs +1 -6
- data/app/assets/javascripts/pageflow/editor/templates/file_meta_data_item_value_view.jst.ejs +3 -0
- data/app/assets/javascripts/pageflow/editor/templates/file_settings_dialog.jst.ejs +10 -0
- data/app/assets/javascripts/pageflow/editor/templates/files_blank_slate.jst.ejs +1 -1
- data/app/assets/javascripts/pageflow/editor/templates/filtered_files.jst.ejs +10 -0
- data/app/assets/javascripts/pageflow/{ui → editor}/templates/inputs/file_input.jst.ejs +1 -1
- data/app/assets/javascripts/pageflow/editor/templates/inputs/reference.jst.ejs +2 -2
- data/app/assets/javascripts/pageflow/editor/templates/nested_files.jst.ejs +1 -0
- data/app/assets/javascripts/pageflow/editor/templates/table_cell.jst.ejs +0 -0
- data/app/assets/javascripts/pageflow/editor/templates/text_tracks.jst.ejs +13 -0
- data/app/assets/javascripts/pageflow/editor/templates/uploadable_files.jst.ejs +1 -0
- data/app/assets/javascripts/pageflow/editor/utils/form_data_utils.js +19 -0
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/audio.js +5 -2
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/background_image.js +3 -2
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/background.js +35 -0
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/groups/options.js +7 -9
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/video.js +6 -5
- data/app/assets/javascripts/pageflow/editor/views/confirm_upload_view.js +69 -0
- data/app/assets/javascripts/pageflow/editor/views/confirmable_file_item_view.js +1 -1
- data/app/assets/javascripts/pageflow/editor/views/drop_down_button_item_list_view.js +9 -0
- data/app/assets/javascripts/pageflow/editor/views/drop_down_button_item_view.js +14 -1
- data/app/assets/javascripts/pageflow/editor/views/drop_down_button_view.js +51 -20
- data/app/assets/javascripts/pageflow/editor/views/edit_entry_view.js +21 -2
- data/app/assets/javascripts/pageflow/editor/views/edit_file_view.js +52 -0
- data/app/assets/javascripts/pageflow/editor/views/edit_storyline_view.js +1 -1
- data/app/assets/javascripts/pageflow/editor/views/entry_preview_view.js +15 -7
- data/app/assets/javascripts/pageflow/editor/views/file_item_view.js +33 -22
- data/app/assets/javascripts/pageflow/editor/views/file_meta_data_item_value_view.js +49 -0
- data/app/assets/javascripts/pageflow/editor/views/file_meta_data_item_view.js +16 -5
- data/app/assets/javascripts/pageflow/editor/views/file_settings_dialog_view.js +31 -0
- data/app/assets/javascripts/pageflow/editor/views/files_explorer_view.js +6 -7
- data/app/assets/javascripts/pageflow/editor/views/files_view.js +13 -14
- data/app/assets/javascripts/pageflow/editor/views/filtered_files_view.js +75 -0
- data/app/assets/javascripts/pageflow/editor/views/help_view.js +3 -0
- data/app/assets/javascripts/pageflow/editor/views/inputs/file_input_view.js +217 -0
- data/app/assets/javascripts/pageflow/editor/views/inputs/page_link_input_view.js +6 -0
- data/app/assets/javascripts/pageflow/editor/views/inputs/reference_input_view.js +13 -2
- data/app/assets/javascripts/pageflow/editor/views/list_view.js +24 -14
- data/app/assets/javascripts/pageflow/editor/views/model_thumbnail_view.js +4 -1
- data/app/assets/javascripts/pageflow/editor/views/nested_files_view.js +94 -0
- data/app/assets/javascripts/pageflow/editor/views/page_preview_view.js +7 -2
- data/app/assets/javascripts/pageflow/editor/views/text_file_meta_data_item_value_view.js +25 -0
- data/app/assets/javascripts/pageflow/editor/views/text_tracks_file_meta_data_item_value_view.js +12 -0
- data/app/assets/javascripts/pageflow/editor/views/text_tracks_view.js +65 -0
- data/app/assets/javascripts/pageflow/editor/views/uploadable_files_view.js +56 -0
- data/app/assets/javascripts/pageflow/editor/views/uploader_view.js +13 -10
- data/app/assets/javascripts/pageflow/features.js +8 -12
- data/app/assets/javascripts/pageflow/focus_outline.js +2 -0
- data/app/assets/javascripts/pageflow/media_player/volume_binding.js +2 -0
- data/app/assets/javascripts/pageflow/media_player/volume_fading.js +6 -0
- data/app/assets/javascripts/pageflow/page_type.js +0 -1
- data/app/assets/javascripts/pageflow/phone_landscape_fullscreen.js +34 -0
- data/app/assets/javascripts/pageflow/react.js +4 -0
- data/app/assets/javascripts/pageflow/ready.js +3 -0
- data/app/assets/javascripts/pageflow/seed_entry_data.js +4 -1
- data/app/assets/javascripts/pageflow/slideshow.js +1 -0
- data/app/assets/javascripts/pageflow/slideshow/adjacent_preparer.js +7 -5
- data/app/assets/javascripts/pageflow/slideshow/atmo.js +3 -3
- data/app/assets/javascripts/pageflow/slideshow/hidden_text_indicator_widget.js +4 -2
- data/app/assets/javascripts/pageflow/slideshow/hide_text.js +8 -4
- data/app/assets/javascripts/pageflow/slideshow/lazy_page_widget.js +5 -0
- data/app/assets/javascripts/pageflow/slideshow/scroller_widget.js +11 -18
- data/app/assets/javascripts/pageflow/ui.js +6 -0
- data/app/assets/javascripts/pageflow/ui/templates/inputs/url_display.jst.ejs +7 -0
- data/app/assets/javascripts/pageflow/ui/templates/table.jst.ejs +7 -0
- data/app/assets/javascripts/pageflow/ui/templates/table_blank_slate.jst.ejs +3 -0
- data/app/assets/javascripts/pageflow/ui/utils/i18n_utils.js +97 -2
- data/app/assets/javascripts/pageflow/ui/views/collection_view.js +8 -1
- data/app/assets/javascripts/pageflow/ui/views/inputs/check_box_input_view.js +12 -1
- data/app/assets/javascripts/pageflow/ui/views/inputs/proxy_url_input_view.js +51 -5
- data/app/assets/javascripts/pageflow/ui/views/inputs/select_input_view.js +80 -2
- data/app/assets/javascripts/pageflow/ui/views/inputs/slider_input_view.js +8 -1
- data/app/assets/javascripts/pageflow/ui/views/inputs/text_area_input_view.js +17 -1
- data/app/assets/javascripts/pageflow/ui/views/inputs/text_input_view.js +47 -4
- data/app/assets/javascripts/pageflow/ui/views/inputs/url_display_view.js +42 -0
- data/app/assets/javascripts/pageflow/ui/views/inputs/url_input_view.js +20 -2
- data/app/assets/javascripts/pageflow/ui/views/mixins/input_view.js +74 -46
- data/app/assets/javascripts/pageflow/ui/views/table_cells/delete_row_table_cell_view.js +63 -0
- data/app/assets/javascripts/pageflow/ui/views/table_cells/enum_table_cell_view.js +26 -0
- data/app/assets/javascripts/pageflow/ui/views/table_cells/icon_table_cell_view.js +40 -0
- data/app/assets/javascripts/pageflow/ui/views/table_cells/presence_table_cell_view.js +31 -0
- data/app/assets/javascripts/pageflow/ui/views/table_cells/table_cell_view.js +101 -0
- data/app/assets/javascripts/pageflow/ui/views/table_cells/table_header_cell_view.js +10 -0
- data/app/assets/javascripts/pageflow/ui/views/table_cells/text_table_cell_view.js +46 -0
- data/app/assets/javascripts/pageflow/ui/views/table_row_view.js +47 -0
- data/app/assets/javascripts/pageflow/ui/views/table_view.js +47 -0
- data/app/assets/javascripts/pageflow/video_player.js +9 -5
- data/app/assets/javascripts/pageflow/video_player/buffer_underrun_waiting.js +15 -13
- data/app/assets/javascripts/pageflow/video_player/cue_settings_methods.js +33 -0
- data/app/assets/javascripts/pageflow/video_player/dash.js +3 -0
- data/app/assets/javascripts/pageflow/video_player/filter_sources.js +1 -1
- data/app/assets/javascripts/pageflow/video_player/lazy.js +3 -9
- data/app/assets/javascripts/pageflow/video_player/prebuffering.js +11 -2
- data/app/assets/javascripts/pageflow/video_player/use_slim_controls_during_phone_playback.js +16 -0
- data/app/assets/javascripts/pageflow/videojs.js +6 -0
- data/app/assets/javascripts/pageflow/widgets.js +41 -7
- data/app/assets/stylesheets/pageflow/admin.scss +7 -4
- data/app/assets/stylesheets/pageflow/admin/{entries/user_badge_list.scss → badge_list.scss} +6 -9
- data/app/assets/stylesheets/pageflow/admin/embed_code.scss +13 -0
- data/app/assets/stylesheets/pageflow/admin/entries.scss +1 -2
- data/app/assets/stylesheets/pageflow/admin/hint.scss +20 -0
- data/app/assets/stylesheets/pageflow/admin/tooltip_bubble.scss +34 -0
- data/app/assets/stylesheets/pageflow/editor/base.scss +4 -4
- data/app/assets/stylesheets/pageflow/editor/confirm_upload.scss +66 -0
- data/app/assets/stylesheets/pageflow/editor/dialogs.scss +9 -1
- data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +56 -20
- data/app/assets/stylesheets/pageflow/editor/file_meta_data.scss +26 -6
- data/app/assets/stylesheets/pageflow/editor/file_settings_dialog.scss +32 -0
- data/app/assets/stylesheets/pageflow/editor/files.scss +5 -0
- data/app/assets/stylesheets/pageflow/editor/filtered_files.scss +25 -0
- data/app/assets/stylesheets/pageflow/editor/inputs.scss +2 -1
- data/app/assets/stylesheets/pageflow/editor/inputs/file_input.scss +65 -0
- data/app/assets/stylesheets/pageflow/editor/inputs/reference.scss +2 -2
- data/app/assets/stylesheets/pageflow/editor/text_tracks.scss +39 -0
- data/app/assets/stylesheets/pageflow/entries.scss +1 -0
- data/app/assets/stylesheets/pageflow/mixins/buttons.scss +77 -5
- data/app/assets/stylesheets/pageflow/mixins/icons/fontawesome.scss +3 -1
- data/app/assets/stylesheets/pageflow/page_types.scss +0 -4
- data/app/assets/stylesheets/pageflow/page_types/video.scss +5 -1
- data/app/assets/stylesheets/pageflow/page_types/video/content_hiding.scss +1 -0
- data/app/assets/stylesheets/pageflow/themes/default/base.scss +1 -0
- data/app/assets/stylesheets/pageflow/themes/default/built_in_page_types.scss +0 -2
- data/app/assets/stylesheets/pageflow/themes/default/definitions.scss +1 -0
- data/app/assets/stylesheets/pageflow/themes/default/loading_spinner.scss +31 -12
- data/app/assets/stylesheets/pageflow/themes/default/logo.scss +9 -1
- data/app/assets/stylesheets/pageflow/themes/default/logo/variant/background_image.scss +8 -2
- data/app/assets/stylesheets/pageflow/themes/default/logo/variant/watermark.scss +21 -0
- data/app/assets/stylesheets/pageflow/themes/default/mixins/cue_margins.scss +43 -0
- data/app/assets/stylesheets/pageflow/themes/default/mixins/indicator_typography.scss +7 -3
- data/app/assets/stylesheets/pageflow/themes/default/page.scss +20 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls.scss +4 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic.scss +4 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/container.scss +8 -6
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/control_bar.scss +18 -3
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/cue_margins.scss +1 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/icons/custom.scss +14 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/icons/icon_font.scss +4 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/icons/sprite.scss +4 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/info_box.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/menu_bar.scss +5 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/shared/menu_bar.scss +121 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim.scss +2 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/container.scss +2 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/control_bar.scss +74 -12
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/cue_margins.scss +3 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/info_box.scss +31 -5
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/menu_bar.scss +13 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/quality_menu.scss +116 -0
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/vjs_mapping.scss +13 -3
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/widget_margins.scss +8 -3
- data/app/assets/stylesheets/pageflow/themes/default/text_track_cues.scss +25 -0
- data/app/assets/stylesheets/pageflow/themes/default/variables/widgets.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/video_player/vjs_base.scss +122 -79
- data/app/assets/stylesheets/pageflow/themes/default/video_wrapper.scss +16 -7
- data/app/assets/stylesheets/pageflow/ui.scss +5 -1
- data/app/assets/stylesheets/pageflow/ui/forms.scss +5 -58
- data/app/assets/stylesheets/pageflow/ui/table_cells/delete_row_table_cell.scss +7 -0
- data/app/assets/stylesheets/pageflow/ui/table_cells/icon_table_cell.scss +16 -0
- data/app/assets/stylesheets/pageflow/ui/table_cells/presence_table_cell.scss +8 -0
- data/app/assets/stylesheets/pageflow/ui/table_view.scss +33 -0
- data/app/assets/stylesheets/pageflow/ui/tooltip.scss +1 -1
- data/app/controllers/pageflow/editor/encoding_confirmations_controller.rb +3 -3
- data/app/controllers/pageflow/editor/entry_publications_controller.rb +3 -3
- data/app/controllers/pageflow/editor/files_controller.rb +72 -14
- data/app/controllers/pageflow/editor/widgets_controller.rb +1 -1
- data/app/controllers/pageflow/entries_controller.rb +12 -2
- data/app/controllers/pageflow/files_controller.rb +1 -1
- data/app/helpers/pageflow/admin/entries_helper.rb +17 -0
- data/app/helpers/pageflow/admin/form_helper.rb +1 -1
- data/app/helpers/pageflow/admin/memberships_helper.rb +117 -13
- data/app/helpers/pageflow/common_entry_seed_helper.rb +36 -5
- data/app/helpers/pageflow/embed_code_helper.rb +32 -0
- data/app/helpers/pageflow/entries_helper.rb +1 -1
- data/app/helpers/pageflow/entry_json_seed_helper.rb +6 -16
- data/app/helpers/pageflow/files_helper.rb +5 -2
- data/app/helpers/pageflow/folders_helper.rb +26 -2
- data/app/helpers/pageflow/page_background_asset_helper.rb +8 -0
- data/app/helpers/pageflow/quota_helper.rb +1 -1
- data/app/helpers/pageflow/video_files_helper.rb +0 -5
- data/app/jobs/pageflow/poll_zencoder_job.rb +1 -1
- data/app/jobs/pageflow/process_file_job.rb +18 -0
- data/app/mailers/pageflow/user_mailer.rb +4 -2
- data/app/models/concerns/pageflow/hosted_file.rb +9 -0
- data/app/models/concerns/pageflow/output_source.rb +60 -0
- data/app/models/concerns/pageflow/uploaded_file.rb +33 -5
- data/app/models/pageflow/account.rb +3 -1
- data/app/models/pageflow/audio_file_url_templates.rb +21 -0
- data/app/models/pageflow/draft_entry.rb +19 -9
- data/app/models/pageflow/entry.rb +2 -1
- data/app/models/pageflow/entry_duplicate.rb +2 -2
- data/app/models/pageflow/entry_role_query.rb +81 -0
- data/app/models/pageflow/file_reuse.rb +25 -0
- data/app/models/pageflow/file_usage.rb +7 -1
- data/app/models/pageflow/image_file.rb +7 -1
- data/app/models/pageflow/image_file_url_templates.rb +19 -0
- data/app/models/pageflow/invited_user.rb +2 -0
- data/app/models/pageflow/membership.rb +46 -3
- data/app/models/pageflow/published_entry.rb +2 -2
- data/app/models/pageflow/revision.rb +16 -5
- data/app/models/pageflow/roles.rb +36 -0
- data/app/models/pageflow/text_track_file.rb +45 -0
- data/app/models/pageflow/text_track_file_url_templates.rb +16 -0
- data/app/models/pageflow/thumbnail_file_resolver.rb +22 -2
- data/app/models/pageflow/url_template.rb +13 -0
- data/app/models/pageflow/used_file.rb +21 -0
- data/app/models/pageflow/video_file.rb +72 -27
- data/app/models/pageflow/video_file_url_templates.rb +34 -0
- data/app/policies/pageflow/account_policy.rb +145 -0
- data/app/policies/pageflow/admin/admin_only_tab_policy.rb +16 -0
- data/app/policies/pageflow/admin/entry_tab_policy.rb +25 -0
- data/app/policies/pageflow/application_policy.rb +11 -0
- data/app/policies/pageflow/entry_policy.rb +138 -0
- data/app/policies/pageflow/file_policy.rb +42 -0
- data/app/policies/pageflow/folder_policy.rb +54 -0
- data/app/policies/pageflow/membership_policy.rb +105 -0
- data/app/policies/pageflow/theming_policy.rb +57 -0
- data/app/policies/pageflow/user_policy.rb +69 -0
- data/app/state_machines/pageflow/encoded_file_state_machine.rb +4 -0
- data/app/state_machines/pageflow/image_file_state_machine.rb +5 -1
- data/app/views/admin/entries/_attributes_table.html.arb +21 -2
- data/app/views/admin/entries/_links.html.arb +1 -1
- data/app/views/admin/memberships/_entity_account_input.html.erb +5 -0
- data/app/views/admin/memberships/_entity_entry_input.html.erb +5 -0
- data/app/views/admin/memberships/_form.html.erb +16 -5
- data/app/views/admin/memberships/_role_hint.html.arb +2 -0
- data/app/views/admin/users/_form.html.erb +29 -20
- data/app/views/components/pageflow/admin/add_membership_button_if_needed.rb +62 -0
- data/app/views/components/pageflow/admin/embed_code_field.rb +15 -0
- data/app/views/components/pageflow/admin/entry_user_badge_list.rb +15 -7
- data/app/views/components/pageflow/admin/grouped_folder_list.rb +20 -16
- data/app/views/components/pageflow/admin/members_tab.rb +22 -11
- data/app/views/components/pageflow/admin/membership_role_with_tooltip.rb +21 -0
- data/app/views/components/pageflow/admin/tabs_view.rb +13 -13
- data/app/views/components/pageflow/admin/user_account_badge_list.rb +43 -0
- data/app/views/components/pageflow/admin/user_accounts_tab.rb +46 -0
- data/app/views/components/pageflow/admin/user_entries_tab.rb +50 -0
- data/app/views/components/pageflow/admin/users_tab.rb +32 -4
- data/app/views/layouts/pageflow/application.html.erb +3 -2
- data/app/views/pageflow/config/_editor_seeds.json.jbuilder +15 -2
- data/app/views/pageflow/editor/entries/_entry.json.jbuilder +1 -0
- data/app/views/pageflow/editor/files/_file.json.jbuilder +10 -2
- data/app/views/pageflow/entries/show.css.erb +4 -11
- data/app/views/pageflow/entries/show.json.jbuilder +1 -1
- data/app/views/pageflow/entry_json_seed/_entry.json.jbuilder +19 -0
- data/app/views/pageflow/file_types/_thumbnails.css.erb +1 -1
- data/app/views/pageflow/files/_file.json.jbuilder +12 -0
- data/app/views/pageflow/page_background_asset/_element.html.erb +3 -0
- data/app/views/pageflow/page_types/_page_type.json.jbuilder +7 -0
- data/app/views/pageflow/react/_widget.html.erb +1 -0
- data/app/views/pageflow/react/page.html.erb +6 -0
- data/app/views/pageflow/video_files/_video_file.json.jbuilder +2 -0
- data/config/initializers/admin_resource_tabs.rb +8 -1
- data/config/initializers/features.rb +1 -4
- data/config/initializers/help_entries.rb +2 -1
- data/config/initializers/paperclip.rb +4 -0
- data/config/initializers/zencoder.rb +5 -2
- data/config/locales/de.yml +370 -108
- data/config/locales/en.yml +333 -83
- data/config/routes.rb +18 -10
- data/db/migrate/20150825133449_update_audio_loop_pages_to_use_atmo.rb +24 -0
- data/db/migrate/20160304072911_rename_membership_entry_and_make_polymorphic.rb +19 -0
- data/db/migrate/20160304151327_add_role_to_membership.rb +19 -0
- data/db/migrate/20160504093145_replace_role_and_account_on_user.rb +42 -0
- data/db/migrate/20160531152500_update_users_count.rb +27 -0
- data/db/migrate/20160707125400_add_output_presences_to_video_files.rb +5 -0
- data/db/migrate/20160824115000_add_parent_file_to_video_files.rb +8 -0
- data/db/migrate/20160824115100_add_parent_file_to_audio_files.rb +8 -0
- data/db/migrate/20160824115200_add_parent_file_to_image_files.rb +8 -0
- data/db/migrate/20160929102700_add_configuration_to_files.rb +7 -0
- data/db/migrate/20161007144500_add_text_track_files.rb +31 -0
- data/db/migrate/20161216175734_move_configuration_from_file_to_file_usage.rb +27 -0
- data/db/migrate/20161230144429_add_processed_attachment_to_text_track_files.rb +8 -0
- data/db/migrate/20170222124848_update_video_file_output_presences.rb +12 -0
- data/db/migrate/20170421112300_turn_background_video_pages_into_background_image_pages.rb +22 -0
- data/lib/generators/pageflow/assets/assets_generator.rb +2 -0
- data/lib/generators/pageflow/assets/templates/components.js +4 -0
- data/lib/generators/pageflow/initializer/templates/pageflow.rb +23 -20
- data/lib/generators/pageflow/seeds/templates/seeds.rb +81 -15
- data/lib/pageflow.rb +8 -0
- data/lib/pageflow/ability_mixin.rb +196 -62
- data/lib/pageflow/admin/tab.rb +21 -0
- data/lib/pageflow/admin/tabs.rb +31 -6
- data/lib/pageflow/built_in_file_type.rb +39 -0
- data/lib/pageflow/built_in_page_types_plugin.rb +80 -0
- data/lib/pageflow/configuration.rb +13 -1
- data/lib/pageflow/engine.rb +6 -1
- data/lib/pageflow/file_type.rb +60 -15
- data/lib/pageflow/file_types.rb +20 -2
- data/lib/pageflow/page_type.rb +53 -4
- data/lib/pageflow/page_types.rb +4 -0
- data/lib/pageflow/paperclip_processors/vtt.rb +35 -0
- data/lib/pageflow/react.rb +11 -0
- data/lib/pageflow/react/page_type.rb +26 -0
- data/lib/pageflow/react/widget_type.rb +20 -0
- data/lib/pageflow/seeds.rb +59 -15
- data/lib/pageflow/user_mixin.rb +18 -25
- data/lib/pageflow/version.rb +1 -1
- data/lib/pageflow/zencoder_api.rb +18 -4
- data/lib/pageflow/zencoder_video_output_definition.rb +375 -127
- data/lib/tasks/pageflow_tasks.rake +7 -0
- data/spec/factories/accounts.rb +36 -3
- data/spec/factories/entries.rb +22 -4
- data/spec/factories/invited_user.rb +3 -4
- data/spec/factories/memberships.rb +34 -2
- data/spec/factories/text_track_files.rb +40 -0
- data/spec/factories/users.rb +32 -7
- data/spec/factories/video_files.rb +7 -1
- data/spec/fixtures/sample.srt +12 -0
- data/spec/fixtures/sample.vtt +40 -0
- data/vendor/assets/javascripts/dash.all.min.js +14 -0
- data/vendor/assets/javascripts/polyfills/bind.js +17 -11
- data/vendor/assets/javascripts/videojs-dash.js +302 -0
- data/vendor/assets/javascripts/videojs.js +26804 -0
- metadata +187 -49
- data/app/assets/images/pageflow/themes/default/page_type_pictograms/audio_loop/sprite.png +0 -0
- data/app/assets/images/pageflow/themes/default/page_type_pictograms/audio_loop/wide.png +0 -0
- data/app/assets/javascripts/pageflow/editor/collections/file_usages_collection.js +0 -21
- data/app/assets/javascripts/pageflow/editor/models/file_usage.js +0 -8
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/audio_loop.js +0 -20
- data/app/assets/javascripts/pageflow/editor/views/configuration_editors/background_video.js +0 -24
- data/app/assets/javascripts/pageflow/page_types/audio.js +0 -135
- data/app/assets/javascripts/pageflow/page_types/audio_loop.js +0 -102
- data/app/assets/javascripts/pageflow/page_types/background_image.js +0 -44
- data/app/assets/javascripts/pageflow/page_types/background_video.js +0 -137
- data/app/assets/javascripts/pageflow/page_types/video.js +0 -277
- data/app/assets/javascripts/pageflow/ui/views/inputs/file_input_view.js +0 -79
- data/app/assets/javascripts/pageflow/video_player/play_button_patch.js +0 -39
- data/app/assets/javascripts/pageflow/video_player/player_buffered_patch.js +0 -47
- data/app/assets/javascripts/pageflow/video_player/src_from_options_method.js +0 -31
- data/app/assets/stylesheets/pageflow/page_types/audio_loop.scss +0 -18
- data/app/assets/stylesheets/pageflow/page_types/background-video.scss +0 -50
- data/app/controllers/pageflow/editor/file_usages_controller.rb +0 -37
- data/app/jobs/pageflow/process_image_file_job.rb +0 -18
- data/app/views/pageflow/pages/templates/_audio.html.erb +0 -69
- data/app/views/pageflow/pages/templates/_audio_loop.html.erb +0 -34
- data/app/views/pageflow/pages/templates/_background_image.html.erb +0 -24
- data/app/views/pageflow/pages/templates/_background_video.html.erb +0 -32
- data/app/views/pageflow/pages/templates/_video.html.erb +0 -42
- data/lib/pageflow/built_in_page_type.rb +0 -79
data/README.md
CHANGED
@@ -12,7 +12,9 @@ For a high level introduction and example Pageflow stories see
|
|
12
12
|
|
13
13
|
* [Getting Started](https://github.com/codevise/pageflow/wiki/Getting-Started)
|
14
14
|
* [Guides](https://github.com/codevise/pageflow/blob/master/doc/index.md)
|
15
|
-
* [
|
15
|
+
* [JavaScript API Reference](https://doclets.io/codevise/pageflow/master)
|
16
|
+
* [Theme API Reference](http://codevise.github.io/pageflow/theme/master/)
|
17
|
+
* [List of Plugins](https://github.com/codevise/pageflow/wiki/List-of-Plugins)
|
16
18
|
|
17
19
|
## Updating
|
18
20
|
|
@@ -41,13 +43,15 @@ Pageflow assumes the following choice of libraries:
|
|
41
43
|
* [Resque](https://github.com/resque/resque) for background jobs
|
42
44
|
* [FriendlyId](https://github.com/norman/friendly_id) for pretty URLs
|
43
45
|
* [Paperclip](https://github.com/thoughtbot/paperclip) for attachment handling
|
44
|
-
* [Backbone](http://backbonejs.org/) [Marionette](http://marionettejs.com/) for
|
46
|
+
* [Backbone](http://backbonejs.org/) [Marionette](http://marionettejs.com/) for the editor
|
47
|
+
* [React](https://facebook.github.io/react/)/[Redux](http://redux.js.org/) for the frontend
|
45
48
|
|
46
49
|
## Requirements
|
47
50
|
|
48
51
|
Pageflow runs in environments with:
|
49
52
|
|
50
53
|
* Ruby >= 2.1
|
54
|
+
* Node >= 6.9.5
|
51
55
|
* Rails 4.2
|
52
56
|
* Redis server (for Resque)
|
53
57
|
* A database server supported by Active Record (tested with MySQL)
|
@@ -83,7 +87,7 @@ Add this line to your application's Gemfile:
|
|
83
87
|
# Gemfile
|
84
88
|
gem 'pageflow'
|
85
89
|
|
86
|
-
# Required for Rails 4.
|
90
|
+
# Required for Rails 4.2 compatibility
|
87
91
|
gem 'state_machine', git: 'https://github.com/codevise/state_machine.git'
|
88
92
|
|
89
93
|
Run bundler to install dependencies:
|
data/Rakefile
CHANGED
data/admins/pageflow/accounts.rb
CHANGED
@@ -1,21 +1,38 @@
|
|
1
1
|
module Pageflow
|
2
2
|
ActiveAdmin.register Account, :as => 'Account' do
|
3
|
-
menu :
|
3
|
+
menu priority: 3,
|
4
|
+
if: proc { authorized?(:index, :accounts) }
|
4
5
|
|
5
6
|
config.batch_actions = false
|
6
7
|
|
7
8
|
index do
|
8
9
|
column :name do |account|
|
9
|
-
|
10
|
+
if authorized?(:read, account)
|
11
|
+
link_to(account.name,
|
12
|
+
admin_account_path(account),
|
13
|
+
data: {id: account.id})
|
14
|
+
else
|
15
|
+
account.name
|
16
|
+
end
|
10
17
|
end
|
11
18
|
column :entries_count do |account|
|
12
|
-
account.entries_count
|
19
|
+
account.entries_count if authorized?(:read, account)
|
13
20
|
end
|
14
21
|
column :users_count do |account|
|
15
|
-
account.
|
22
|
+
account.memberships.size if authorized?(:read, account)
|
23
|
+
end
|
24
|
+
account_memberships = current_user.memberships.on_accounts
|
25
|
+
account_roles = account_memberships.each_with_object({}) do |membership, roles|
|
26
|
+
roles[membership.entity_id] = membership.role
|
27
|
+
end
|
28
|
+
if authorized?(:see_own_role_on, :accounts)
|
29
|
+
column :own_role do |account|
|
30
|
+
own_role = account_roles[account.id]
|
31
|
+
membership_role_with_tooltip(own_role, scope: 'own_account_role')
|
32
|
+
end
|
16
33
|
end
|
17
34
|
column :default_theming do |account|
|
18
|
-
account.default_theming.theme_name
|
35
|
+
account.default_theming.theme_name if authorized?(:read, account)
|
19
36
|
end
|
20
37
|
end
|
21
38
|
|
@@ -27,15 +44,17 @@ module Pageflow
|
|
27
44
|
render 'account_details', :account => account
|
28
45
|
render 'theming_details', :account => account
|
29
46
|
|
30
|
-
tabs_view(Pageflow.config.admin_resource_tabs.find_by_resource(
|
31
|
-
:
|
32
|
-
:
|
47
|
+
tabs_view(Pageflow.config.admin_resource_tabs.find_by_resource(account.default_theming),
|
48
|
+
i18n: 'pageflow.admin.resource_tabs',
|
49
|
+
authorize: :see_theming_admin_tab,
|
50
|
+
build_args: [account.default_theming])
|
33
51
|
end
|
34
52
|
|
35
53
|
controller do
|
36
54
|
helper Pageflow::Admin::FeaturesHelper
|
37
55
|
helper Pageflow::Admin::WidgetsHelper
|
38
56
|
helper Pageflow::Admin::FormHelper
|
57
|
+
helper Pageflow::Admin::MembershipsHelper
|
39
58
|
helper ThemesHelper
|
40
59
|
|
41
60
|
def new
|
data/admins/pageflow/entry.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Pageflow
|
2
|
-
ActiveAdmin.register Entry, :
|
3
|
-
menu :
|
2
|
+
ActiveAdmin.register Entry, as: 'Entry' do
|
3
|
+
menu priority: 1
|
4
4
|
|
5
5
|
config.batch_actions = false
|
6
6
|
|
@@ -14,11 +14,15 @@ module Pageflow
|
|
14
14
|
column I18n.t('pageflow.admin.entries.members'), class: 'members' do |entry|
|
15
15
|
entry_user_badge_list(entry)
|
16
16
|
end
|
17
|
-
if authorized?(:
|
17
|
+
if authorized?(:see, :accounts)
|
18
18
|
column :account, sortable: 'account_id' do |entry|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
if authorized?(:read, entry.account)
|
20
|
+
link_to(entry.account.name,
|
21
|
+
admin_account_path(entry.account),
|
22
|
+
data: {id: entry.account.id})
|
23
|
+
else
|
24
|
+
entry.account.name
|
25
|
+
end
|
22
26
|
end
|
23
27
|
end
|
24
28
|
column :created_at
|
@@ -26,7 +30,7 @@ module Pageflow
|
|
26
30
|
column :published_at, sortable: 'pageflow_revisions.published_at'
|
27
31
|
|
28
32
|
column class: 'buttons' do |entry|
|
29
|
-
if authorized?(:edit,
|
33
|
+
if authorized?(:edit, entry)
|
30
34
|
icon_link_to(pageflow.edit_entry_path(entry),
|
31
35
|
tooltip: I18n.t('pageflow.admin.entries.editor_hint'),
|
32
36
|
class: 'editor')
|
@@ -45,33 +49,46 @@ module Pageflow
|
|
45
49
|
end
|
46
50
|
|
47
51
|
filter :title
|
48
|
-
filter :account,
|
52
|
+
filter :account,
|
53
|
+
if: ->(_) { authorized?(:index, :accounts) },
|
54
|
+
collection: -> { Account.accessible_by(current_ability, :read) }
|
49
55
|
filter :created_at
|
50
56
|
filter :edited_at
|
51
57
|
filter :first_published_at
|
52
58
|
filter :published_revision_published_at, as: :date_range
|
53
|
-
filter :with_publication_state,
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
filter :with_publication_state,
|
60
|
+
as: :select,
|
61
|
+
collection: -> { collection_for_entry_publication_states }
|
62
|
+
|
63
|
+
sidebar :folders, only: :index do
|
64
|
+
text_node(link_to(I18n.t('pageflow.admin.entries.add_folder'),
|
65
|
+
new_admin_folder_path,
|
66
|
+
class: 'new'))
|
67
|
+
grouped_folder_list(Folder.accessible_by(current_ability, :read).includes(:account),
|
68
|
+
active_id: params[:folder_id],
|
69
|
+
grouped_by_accounts: authorized?(:see, :accounts))
|
61
70
|
end
|
62
71
|
|
63
72
|
form do |f|
|
64
73
|
f.inputs do
|
65
|
-
f.input :title, :
|
66
|
-
if authorized?(:read, Account)
|
67
|
-
f.input :account, :include_blank => false
|
74
|
+
f.input :title, hint: I18n.t('pageflow.admin.entries.title_hint')
|
68
75
|
|
69
|
-
|
70
|
-
|
71
|
-
|
76
|
+
if authorized?(:update_account_on, resource)
|
77
|
+
f.input :account,
|
78
|
+
collection: eligible_accounts,
|
79
|
+
include_blank: false,
|
80
|
+
input_html: {class: 'entry_account_input'}
|
81
|
+
end
|
82
|
+
|
83
|
+
if authorized?(:update_theming_on, resource) && !f.object.new_record?
|
84
|
+
f.input :theming, collection: eligible_themings, include_blank: false
|
72
85
|
end
|
73
|
-
|
74
|
-
|
86
|
+
|
87
|
+
if authorized?(:configure_folder_for, resource)
|
88
|
+
folder_collection = collection_for_folders(resource.account, resource.folder)
|
89
|
+
f.input(:folder,
|
90
|
+
collection: folder_collection,
|
91
|
+
include_blank: true) unless folder_collection.empty?
|
75
92
|
end
|
76
93
|
|
77
94
|
Pageflow.config_for(f.object).admin_form_inputs.build(:entry, f)
|
@@ -80,7 +97,7 @@ module Pageflow
|
|
80
97
|
end
|
81
98
|
|
82
99
|
action_item(:depublish, only: :show) do
|
83
|
-
if authorized?(:publish,
|
100
|
+
if authorized?(:publish, entry) && entry.published?
|
84
101
|
button_to(I18n.t('pageflow.admin.entries.depublish'),
|
85
102
|
pageflow.current_entry_revisions_path(entry),
|
86
103
|
method: :delete,
|
@@ -105,46 +122,48 @@ module Pageflow
|
|
105
122
|
end
|
106
123
|
end
|
107
124
|
|
108
|
-
member_action :duplicate, :
|
125
|
+
member_action :duplicate, method: :post do
|
109
126
|
entry = Entry.find(params[:id])
|
110
127
|
authorize!(:duplicate, entry)
|
111
128
|
new_entry = entry.duplicate
|
112
129
|
redirect_to(edit_admin_entry_path(new_entry))
|
113
130
|
end
|
114
131
|
|
115
|
-
member_action :snapshot, :
|
132
|
+
member_action :snapshot, method: :post do
|
116
133
|
entry = Entry.find(params[:id])
|
117
134
|
authorize!(:snapshot, entry)
|
118
|
-
entry.snapshot(:
|
135
|
+
entry.snapshot(creator: current_user, type: 'user')
|
119
136
|
redirect_to(admin_entry_path(entry))
|
120
137
|
end
|
121
138
|
|
122
139
|
member_action :preview do
|
123
140
|
entry = Entry.find(params[:id])
|
124
|
-
authorize!(:
|
141
|
+
authorize!(:read, entry.draft)
|
125
142
|
redirect_to(pageflow.revision_path(entry.draft))
|
126
143
|
end
|
127
144
|
|
128
|
-
show :
|
129
|
-
render 'attributes_table', :
|
130
|
-
render 'links', :
|
145
|
+
show title: :title do |entry|
|
146
|
+
render 'attributes_table', entry: entry
|
147
|
+
render 'links', entry: entry
|
131
148
|
|
132
|
-
tabs_view(Pageflow.config.admin_resource_tabs.find_by_resource(
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
149
|
+
tabs_view(Pageflow.config.admin_resource_tabs.find_by_resource(entry),
|
150
|
+
i18n: 'pageflow.admin.resource_tabs',
|
151
|
+
authorize: :see_entry_admin_tab,
|
152
|
+
build_args: [entry])
|
136
153
|
end
|
137
154
|
|
138
155
|
controller do
|
139
156
|
helper FoldersHelper
|
140
157
|
helper EntriesHelper
|
141
|
-
helper
|
142
|
-
helper
|
143
|
-
helper
|
144
|
-
helper
|
158
|
+
helper EmbedCodeHelper
|
159
|
+
helper Admin::EntriesHelper
|
160
|
+
helper Admin::FeaturesHelper
|
161
|
+
helper Admin::FormHelper
|
162
|
+
helper Admin::MembershipsHelper
|
163
|
+
helper Admin::RevisionsHelper
|
145
164
|
|
146
165
|
after_build do |entry|
|
147
|
-
entry.account ||=
|
166
|
+
entry.account ||= account_policy_scope.entry_creatable.first || Account.first
|
148
167
|
entry.theming ||= entry.account.default_theming
|
149
168
|
end
|
150
169
|
|
@@ -155,7 +174,7 @@ module Pageflow
|
|
155
174
|
end
|
156
175
|
|
157
176
|
def scoped_collection
|
158
|
-
result = super.includes(:theming, :account, :
|
177
|
+
result = super.includes(:theming, :account, {memberships: :user}, :published_revision).references(:published_revision)
|
159
178
|
params.key?(:folder_id) ? result.where(folder_id: params[:folder_id]) : result
|
160
179
|
end
|
161
180
|
|
@@ -171,23 +190,87 @@ module Pageflow
|
|
171
190
|
|
172
191
|
private
|
173
192
|
|
193
|
+
def account_policy_scope
|
194
|
+
AccountPolicy::Scope.new(current_user, Account)
|
195
|
+
end
|
196
|
+
|
197
|
+
def theming_policy_scope
|
198
|
+
ThemingPolicy::Scope.new(current_user, Theming)
|
199
|
+
end
|
200
|
+
|
174
201
|
def permitted_attributes
|
175
202
|
result = [:title]
|
176
|
-
|
177
|
-
|
203
|
+
target = if !params[:id] && current_user.admin?
|
204
|
+
Account.first
|
205
|
+
elsif params[:id]
|
206
|
+
resource
|
207
|
+
else
|
208
|
+
current_user.accounts.first
|
209
|
+
end
|
178
210
|
result += Pageflow.config_for(target).admin_form_inputs.permitted_attributes_for(:entry)
|
211
|
+
result += permitted_account_attributes
|
212
|
+
|
213
|
+
if params[:id]
|
214
|
+
result << :folder_id if authorized?(:configure_folder_for, resource)
|
215
|
+
end
|
216
|
+
|
217
|
+
if params[:id]
|
218
|
+
accounts = resource.account
|
219
|
+
else
|
220
|
+
accounts = account_policy_scope.themings_accessible
|
221
|
+
end
|
222
|
+
|
223
|
+
result += permitted_theming_attributes(accounts)
|
179
224
|
|
180
|
-
result += [:account_id, :theming_id] if authorized?(:read, Account)
|
181
|
-
result << :folder_id if authorized?(:manage, Folder)
|
182
225
|
result
|
183
226
|
end
|
184
227
|
|
185
228
|
def permit_feature_states(attributes)
|
186
|
-
if authorized?(:
|
229
|
+
if params[:id] && authorized?(:update_feature_configuration_on, resource)
|
187
230
|
feature_states = params[:entry][:feature_states].try(:permit!)
|
188
231
|
attributes.merge!(feature_states: feature_states || {})
|
189
232
|
end
|
190
233
|
end
|
234
|
+
|
235
|
+
def permitted_theming_attributes(accounts)
|
236
|
+
if (create_or_new_action? || authorized?(:update_theming_on, resource)) &&
|
237
|
+
theming_params_present? && theming_in_allowed_themings_for?(accounts)
|
238
|
+
[:theming_id]
|
239
|
+
else
|
240
|
+
[]
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def theming_params_present?
|
245
|
+
params[:entry] && params[:entry][:theming_id]
|
246
|
+
end
|
247
|
+
|
248
|
+
def create_or_new_action?
|
249
|
+
[:create, :new].include?(action_name.to_sym)
|
250
|
+
end
|
251
|
+
|
252
|
+
def theming_in_allowed_themings_for?(accounts)
|
253
|
+
theming_policy_scope.themings_allowed_for(accounts)
|
254
|
+
.include?(Theming.find(params[:entry][:theming_id]))
|
255
|
+
end
|
256
|
+
|
257
|
+
def permitted_account_attributes
|
258
|
+
if account_params_present? &&
|
259
|
+
(action_name.to_sym == :create || legally_moving_entry_to_other_account)
|
260
|
+
[:account_id]
|
261
|
+
else
|
262
|
+
[]
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
def legally_moving_entry_to_other_account
|
267
|
+
action_name.to_sym == :update && authorized?(:update_account_on, resource) &&
|
268
|
+
account_policy_scope.entry_movable.include?(Account.find(params[:entry][:account_id]))
|
269
|
+
end
|
270
|
+
|
271
|
+
def account_params_present?
|
272
|
+
params[:entry] && params[:entry][:account_id]
|
273
|
+
end
|
191
274
|
end
|
192
275
|
end
|
193
276
|
end
|
data/admins/pageflow/folder.rb
CHANGED
@@ -1,58 +1,69 @@
|
|
1
1
|
module Pageflow
|
2
|
-
ActiveAdmin.register Folder, :
|
2
|
+
ActiveAdmin.register Folder, as: 'Folder' do
|
3
3
|
menu false
|
4
4
|
|
5
|
-
# TODO
|
6
5
|
actions :new, :create, :edit, :update, :destroy
|
7
6
|
|
8
7
|
form do |f|
|
9
8
|
f.inputs do
|
10
|
-
if authorized?(:
|
11
|
-
f.input :account,
|
9
|
+
if authorized?(:show_account_selection_on, resource) && f.object.new_record?
|
10
|
+
f.input :account,
|
11
|
+
collection: AccountPolicy::Scope.new(current_user, Account).folder_addable,
|
12
|
+
include_blank: false
|
12
13
|
end
|
13
14
|
f.input :name
|
14
15
|
end
|
15
16
|
f.actions do
|
16
17
|
f.action(:submit)
|
17
|
-
f.action(:cancel, :
|
18
|
+
f.action(:cancel, wrapper_html: {class: 'cancel'})
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
22
|
controller do
|
22
|
-
|
23
|
-
|
24
|
-
folder.account ||= current_user.account
|
25
|
-
end
|
23
|
+
after_build do |folder|
|
24
|
+
folder.account ||= account_policy_scope.folder_addable.first || Account.first
|
26
25
|
end
|
27
26
|
|
28
27
|
def create
|
29
|
-
super do |success
|
28
|
+
super do |success|
|
30
29
|
success.html { redirect_to(admin_entries_path) }
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
33
|
def update
|
35
|
-
super do |success,
|
36
|
-
success.html { redirect_to(admin_entries_path(:
|
34
|
+
super do |success, _failure|
|
35
|
+
success.html { redirect_to(admin_entries_path(folder_id: resource.id)) }
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
39
|
def destroy
|
41
|
-
super do |success,
|
40
|
+
super do |success, _failure|
|
42
41
|
success.html { redirect_to(admin_entries_path) }
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
46
45
|
def permitted_params
|
47
|
-
result = params.permit(:
|
48
|
-
restrict_attributes(
|
46
|
+
result = params.permit(folder: [:name, :account_id])
|
47
|
+
restrict_attributes(result[:folder]) if result[:folder]
|
49
48
|
result
|
50
49
|
end
|
51
50
|
|
52
51
|
private
|
53
52
|
|
54
|
-
def
|
55
|
-
|
53
|
+
def account_policy_scope
|
54
|
+
AccountPolicy::Scope.new(current_user, Account)
|
55
|
+
end
|
56
|
+
|
57
|
+
def restrict_attributes(attributes)
|
58
|
+
if params[:folder] && params[:folder][:account_id] &&
|
59
|
+
AccountPolicy::Scope.new(current_user, Account)
|
60
|
+
.folder_addable.exists?(params[:folder][:account_id]) &&
|
61
|
+
action_name.to_sym == :create
|
62
|
+
|
63
|
+
attributes
|
64
|
+
else
|
65
|
+
attributes.except!(:account_id)
|
66
|
+
end
|
56
67
|
end
|
57
68
|
end
|
58
69
|
end
|