pageflow 15.1.2 → 15.4.0
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 +5 -5
- data/CHANGELOG.md +160 -190
- data/README.md +3 -5
- data/admins/pageflow/accounts.rb +13 -35
- data/admins/pageflow/entry.rb +21 -1
- data/admins/pageflow/entry_templates.rb +140 -0
- data/admins/pageflow/membership.rb +12 -0
- data/admins/pageflow/user.rb +5 -3
- data/app/assets/javascripts/pageflow/admin/accounts.js +3 -3
- data/app/assets/javascripts/pageflow/admin/entries.js +65 -0
- data/app/assets/javascripts/pageflow/admin/users.js +1 -1
- data/app/assets/javascripts/pageflow/asset_urls.js.erb +1 -0
- data/app/assets/javascripts/pageflow/base.js +0 -12
- data/app/assets/javascripts/pageflow/components.js +2 -6
- data/app/assets/javascripts/pageflow/dist/ui.js +155 -46
- data/app/assets/javascripts/pageflow/vendor.js +12 -10
- data/app/assets/stylesheets/pageflow/base.scss +0 -7
- data/app/assets/stylesheets/pageflow/editor/base.scss +5 -2
- data/app/assets/stylesheets/pageflow/editor/composables.scss +5 -1
- data/app/assets/stylesheets/pageflow/editor/drop_down_button.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/emulation_mode_button.scss +44 -55
- data/app/assets/stylesheets/pageflow/editor/help.scss +2 -2
- data/app/assets/stylesheets/pageflow/editor/select_button.scss +1 -1
- data/app/assets/stylesheets/pageflow/editor/sidebar_footer.scss +1 -1
- data/app/assets/stylesheets/pageflow/entries.scss +1 -1
- data/app/assets/stylesheets/pageflow/loading_spinner.scss +4 -1
- data/app/assets/stylesheets/pageflow/navigation_mobile.scss +4 -4
- data/app/assets/stylesheets/pageflow/themes/default/anchors.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/logo/variant/background_image.scss +4 -0
- data/app/assets/stylesheets/pageflow/themes/default/logo/variant/watermark.scss +6 -1
- data/app/assets/stylesheets/pageflow/themes/default/page/anchors.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/control_bar.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/classic/info_box.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/shared/menu_bar.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/control_bar.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/info_box.scss +1 -1
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/slim/quality_menu.scss +2 -2
- data/app/assets/stylesheets/pageflow/themes/default/player_controls/waveform/wave.scss +1 -1
- data/app/assets/stylesheets/pageflow/ui/forms.scss +9 -2
- data/app/assets/stylesheets/pageflow/ui/input/extended_select_input.scss +2 -2
- data/app/assets/stylesheets/pageflow/ui/tooltip.scss +17 -3
- data/app/controllers/pageflow/editor/widgets_controller.rb +1 -1
- data/app/helpers/pageflow/admin/entries_helper.rb +16 -0
- data/app/helpers/pageflow/pages_helper.rb +1 -0
- data/app/helpers/pageflow/structured_data_helper.rb +0 -2
- data/app/models/pageflow/account.rb +26 -0
- data/app/models/pageflow/account_role_query.rb +1 -1
- data/app/models/pageflow/entry.rb +16 -2
- data/app/models/pageflow/entry_duplicate.rb +1 -0
- data/app/models/pageflow/entry_template.rb +69 -0
- data/app/models/pageflow/managed_user_query.rb +1 -1
- data/app/models/pageflow/revision.rb +1 -1
- data/app/models/pageflow/theming.rb +8 -47
- data/app/policies/pageflow/account_policy.rb +10 -0
- data/app/policies/pageflow/entry_template_policy.rb +22 -0
- data/app/policies/pageflow/folder_policy.rb +2 -2
- data/app/policies/pageflow/membership_policy.rb +2 -2
- data/app/policies/pageflow/theming_policy.rb +2 -6
- data/app/policies/pageflow/user_policy.rb +1 -1
- data/app/views/admin/accounts/_configuration_label.html.erb +5 -0
- data/app/views/admin/accounts/_entry_template_details.html.arb +19 -0
- data/app/views/admin/accounts/_form.html.erb +5 -31
- data/app/views/admin/accounts/_share_providers_label.html.erb +5 -0
- data/app/views/admin/accounts/_theming_details.html.arb +0 -12
- data/app/views/admin/entries/_attributes_table.html.arb +5 -0
- data/app/views/admin/entries/_not_allowed_to_see_entry_types.json.jbuilder +2 -0
- data/app/views/admin/entries/entry_types.json.jbuilder +4 -0
- data/app/views/admin/entry_templates/_form.html.erb +58 -0
- data/app/views/admin/users/_not_allowed_to_see_user_quota.html.erb +3 -0
- data/app/views/components/pageflow/admin/entry_templates_tab.rb +48 -0
- data/app/views/pageflow/admin/users/_quota_exhausted.html.erb +1 -1
- data/app/views/pageflow/themes/_theme.json.jbuilder +1 -0
- data/app/views/pageflow/video_files/_video_file.json.jbuilder +8 -1
- data/config/initializers/admin_resource_tabs.rb +5 -0
- data/config/initializers/help_entries.rb +1 -5
- data/config/locales/de.yml +100 -162
- data/config/locales/en.yml +91 -150
- data/db/migrate/20200122115400_create_pageflow_entry_templates.rb +75 -0
- data/db/migrate/20200206134400_convert_legacy_scrolled_content_element_types.rb +48 -0
- data/db/migrate/20200515112500_add_constraints_to_entry_templates.rb +21 -0
- data/db/migrate/20200807135200_rename_pageflow_entry_template_entry_type_to_entry_type_name.rb +7 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/components.js +7 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +1541 -1357
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +9245 -0
- data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-client.js +1 -1
- data/{app/assets/javascripts/pageflow → entry_types/paged/app/assets/javascripts/pageflow_paged}/dist/react-server.js +3 -3
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/frontend.js +6 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/server_rendering.js +9 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/vendor.js +9 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/videojs.js +6 -0
- data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +2 -2
- data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/page_background_asset_helper.rb +4 -3
- data/{app/helpers/pageflow → entry_types/paged/app/helpers/pageflow_paged}/react_server_side_rendering_helper.rb +23 -2
- data/entry_types/paged/app/views/layouts/pageflow_paged/_loading_spinner_inline_script.html.erb +1 -0
- data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +3 -3
- data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +4 -2
- data/entry_types/paged/app/views/pageflow_paged/entries/_entry.html.erb +1 -1
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/page_background_asset/_element.html.erb +0 -0
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/_widget.html.erb +0 -0
- data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/react/page.html.erb +0 -0
- data/entry_types/paged/config/initializers/features.rb +1 -1
- data/entry_types/paged/config/initializers/help_entries.rb +17 -0
- data/entry_types/paged/config/locales/new/help.de.yml +162 -0
- data/entry_types/paged/config/locales/new/help.en.yml +153 -0
- data/entry_types/paged/lib/pageflow_paged/engine.rb +13 -0
- data/entry_types/paged/lib/pageflow_paged/plugin.rb +5 -1
- data/entry_types/paged/lib/pageflow_paged/react.rb +12 -0
- data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/page_type.rb +2 -2
- data/{lib/pageflow → entry_types/paged/lib/pageflow_paged}/react/widget_type.rb +2 -2
- data/entry_types/paged/lib/tasks/pageflow_paged_tasks.rake +7 -0
- data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react-server.js +20613 -0
- data/entry_types/paged/vendor/assets/javascripts/development/pageflow_paged/vendor/react.js +21495 -0
- data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/dash.all.min.js +0 -0
- data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs-dash.js +0 -0
- data/{vendor/assets/javascripts → entry_types/paged/vendor/assets/javascripts/pageflow_paged/vendor}/videojs.js +0 -0
- data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react-server.js +24 -0
- data/entry_types/paged/vendor/assets/javascripts/production/pageflow_paged/vendor/react.js +24 -0
- data/entry_types/scrolled/app/assets/javascripts/pageflow_scrolled/legacy.js +0 -0
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +15 -4
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +2 -2
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +10 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +11 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +4 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/favicon_helper.rb +21 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/i18n_helper.rb +35 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/react_server_side_rendering_helper.rb +40 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/themes_helper.rb +8 -0
- data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +38 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/content_elements/batch.json.jbuilder +2 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +1 -7
- data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +36 -10
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +13 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_theme.json.jbuilder +8 -0
- data/entry_types/scrolled/app/views/pageflow_scrolled/favicons/_entry.html.erb +10 -0
- data/entry_types/scrolled/config/initializers/help_entries.rb +16 -0
- data/entry_types/scrolled/config/locales/de.yml +655 -0
- data/entry_types/scrolled/config/locales/en.yml +522 -0
- data/entry_types/scrolled/config/routes.rb +1 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +36 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-192x192.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/android-chrome-512x512.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/apple-touch-icon.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/browserconfig.xml +9 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-16x16.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon-32x32.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/favicon.ico +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/mstile-150x150.png +0 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/safari-pinned-tab.svg +46 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/favicons/site.webmanifest +19 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoDesktop.svg +56 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/logoMobile.svg +22 -0
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/templates/theme/unmute.mp3 +0 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/engine.rb +4 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +3 -1
- data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +93 -28
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +134 -0
- data/entry_types/scrolled/package/contentElements-editor.js +482 -0
- data/entry_types/scrolled/package/contentElements-frontend.css +1 -0
- data/entry_types/scrolled/package/contentElements-frontend.js +1112 -0
- data/entry_types/scrolled/package/editor.js +3066 -2579
- data/entry_types/scrolled/package/frontend-server.js +228 -0
- data/entry_types/scrolled/package/frontend/EditableText-43c50894.js +2161 -0
- data/entry_types/scrolled/package/frontend/Wavesurfer-b88b02e0.js +375 -0
- data/entry_types/scrolled/package/frontend/components-3ead1b4a.js +2533 -0
- data/entry_types/scrolled/package/frontend/getPrototypeOf-63c7c8e8.js +86 -0
- data/entry_types/scrolled/package/frontend/index.css +9 -0
- data/entry_types/scrolled/package/frontend/index.js +5507 -0
- data/entry_types/scrolled/package/package.json +40 -7
- data/entry_types/scrolled/spec/fixtures/audio.m4a +0 -0
- data/entry_types/scrolled/spec/fixtures/video.mp4 +0 -0
- data/lib/generators/pageflow/initializer/templates/pageflow.rb +21 -9
- data/lib/pageflow/ability_mixin.rb +15 -2
- data/lib/pageflow/configuration.rb +6 -5
- data/lib/pageflow/entry_type_configuration.rb +1 -0
- data/lib/pageflow/global_config_api.rb +5 -4
- data/lib/pageflow/react.rb +4 -2
- data/lib/pageflow/seeds.rb +0 -2
- data/lib/pageflow/theme.rb +4 -0
- data/lib/pageflow/themes.rb +9 -1
- data/lib/pageflow/version.rb +1 -1
- data/{packages/pageflow → package}/config/jest/index.js +8 -3
- data/{packages/pageflow → package}/config/jest/transformers/jst.js +1 -1
- data/{packages/pageflow → package}/config/jest/transformers/upwardBabel.js +0 -0
- data/{packages/pageflow → package}/config/webpack.js +7 -1
- data/{packages/pageflow → package}/editor.js +493 -1122
- data/package/frontend.js +2542 -0
- data/{packages/pageflow → package}/package.json +5 -1
- data/package/testHelpers.js +732 -0
- data/{packages/pageflow → package}/ui.js +155 -46
- data/spec/factories/accounts.rb +9 -1
- data/spec/factories/entry_templates.rb +9 -0
- data/spec/factories/published_entries.rb +8 -1
- data/spec/factories/themings.rb +0 -1
- metadata +94 -33
- data/app/assets/javascripts/pageflow/dist/editor.js +0 -11890
- data/app/assets/javascripts/pageflow/dist/frontend.js +0 -5798
- data/app/assets/javascripts/pageflow/videojs.js +0 -6
- data/config/initializers/entry_types.rb +0 -4
- data/entry_types/scrolled/config/locales/new/de.yml +0 -46
- data/entry_types/scrolled/config/locales/new/en.yml +0 -46
- data/entry_types/scrolled/package/frontend.js +0 -3404
- data/packages/pageflow/config/jest/transformers/cssModules.js +0 -1
- data/packages/pageflow/testHelpers.js +0 -268
@@ -24,7 +24,8 @@ label:hover span.name {
|
|
24
24
|
select,
|
25
25
|
textarea,
|
26
26
|
input {
|
27
|
-
font-family: Helvetica, "Sans-Serif";
|
27
|
+
font-family: Helvetica, Arial, "Sans-Serif";
|
28
|
+
font-size: 13px;
|
28
29
|
display: block;
|
29
30
|
width: 100%;
|
30
31
|
border: solid 1px #888;
|
@@ -158,6 +159,12 @@ textarea.short {
|
|
158
159
|
margin: 7px 0;
|
159
160
|
float: left;
|
160
161
|
}
|
162
|
+
|
163
|
+
&.disabled .slider,
|
164
|
+
&.disabled .value {
|
165
|
+
opacity: 0.5;
|
166
|
+
pointer-events: none;
|
167
|
+
}
|
161
168
|
}
|
162
169
|
|
163
170
|
.validation {
|
@@ -189,7 +196,7 @@ textarea.short {
|
|
189
196
|
width: 20px;
|
190
197
|
height: 17px;
|
191
198
|
text-align: center;
|
192
|
-
pointer-events:
|
199
|
+
pointer-events: auto;
|
193
200
|
}
|
194
201
|
|
195
202
|
position: absolute;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
.extended_select_input {
|
2
2
|
.ui-selectmenu-button span.ui-selectmenu-text {
|
3
|
-
font-family: Helvetica, Sans-Serif;
|
3
|
+
font-family: Helvetica, Arial, Sans-Serif;
|
4
4
|
font-size: 13px;
|
5
5
|
}
|
6
6
|
}
|
@@ -91,7 +91,7 @@
|
|
91
91
|
}
|
92
92
|
|
93
93
|
.ui-widget {
|
94
|
-
font-family: Helvetica, Sans-Serif;
|
94
|
+
font-family: Helvetica, Arial, Sans-Serif;
|
95
95
|
font-size: 13px;
|
96
96
|
|
97
97
|
.item-description {
|
@@ -1,10 +1,9 @@
|
|
1
1
|
.tooltip {
|
2
|
-
$background-color: rgba(0, 0, 0, 0.
|
2
|
+
$background-color: rgba(0, 0, 0, 0.9);
|
3
3
|
|
4
4
|
position: absolute;
|
5
5
|
z-index: 10001;
|
6
6
|
top: 40px;
|
7
|
-
left: 400px;
|
8
7
|
max-width: 70%;
|
9
8
|
padding: 10px 15px;
|
10
9
|
color: #fff;
|
@@ -46,6 +45,21 @@
|
|
46
45
|
}
|
47
46
|
}
|
48
47
|
|
48
|
+
&.align_top_center {
|
49
|
+
transform: translate(-50%, -100%);
|
50
|
+
|
51
|
+
&:after {
|
52
|
+
border-top: solid 10px $background-color;
|
53
|
+
border-right: solid 10px transparent;
|
54
|
+
border-bottom: solid 10px transparent;
|
55
|
+
border-left: solid 10px transparent;
|
56
|
+
|
57
|
+
top: 100%;
|
58
|
+
left: 50%;
|
59
|
+
transform: translateX(-50%);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
49
63
|
&.align_bottom_right {
|
50
64
|
@include transform(translateX(-100%));
|
51
65
|
|
@@ -54,4 +68,4 @@
|
|
54
68
|
left: auto;
|
55
69
|
}
|
56
70
|
}
|
57
|
-
}
|
71
|
+
}
|
@@ -18,6 +18,22 @@ module Pageflow
|
|
18
18
|
I18n.t(state, scope: 'activerecord.values.pageflow/entry.publication_states')
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
def entry_type_collection
|
23
|
+
entry_type_collection_for_config(Pageflow.config)
|
24
|
+
end
|
25
|
+
|
26
|
+
def entry_type_collection_for_account(target)
|
27
|
+
entry_type_collection_for_config(Pageflow.config_for(target))
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def entry_type_collection_for_config(config)
|
33
|
+
config.entry_types.map(&:name).index_by do |type|
|
34
|
+
I18n.t(type, scope: 'activerecord.values.pageflow/entry.type_names')
|
35
|
+
end
|
36
|
+
end
|
21
37
|
end
|
22
38
|
end
|
23
39
|
end
|
@@ -19,6 +19,7 @@ module Pageflow
|
|
19
19
|
classes << 'chapter_beginning' if page.position == 0
|
20
20
|
classes << 'first_page' if page.is_first
|
21
21
|
classes << 'no_text_content' if !page_has_content(page)
|
22
|
+
classes << 'hide_logo' if page.configuration['hide_logo']
|
22
23
|
classes.join(' ')
|
23
24
|
end
|
24
25
|
|
@@ -6,8 +6,6 @@ module Pageflow
|
|
6
6
|
include MetaTagsHelper
|
7
7
|
|
8
8
|
def structured_data_for_entry(entry)
|
9
|
-
return '' unless Pageflow.config_for(entry).features.enabled?('structured_data')
|
10
|
-
|
11
9
|
content_tag(:script, type: 'application/ld+json') do
|
12
10
|
render_json_partial('pageflow/structured_data/entry',
|
13
11
|
entry: entry,
|
@@ -10,9 +10,11 @@ module Pageflow
|
|
10
10
|
has_many :entry_memberships, through: :entries, source: :memberships
|
11
11
|
|
12
12
|
has_many :themings, dependent: :destroy
|
13
|
+
has_many :entry_templates, dependent: :destroy
|
13
14
|
belongs_to :default_theming, :class_name => 'Theming'
|
14
15
|
|
15
16
|
validates :default_theming, :presence => true
|
17
|
+
validates_associated :entry_templates
|
16
18
|
|
17
19
|
accepts_nested_attributes_for :default_theming, :update_only => true
|
18
20
|
|
@@ -24,6 +26,30 @@ module Pageflow
|
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
29
|
+
def first_paged_entry_template
|
30
|
+
EntryTemplate.find_or_initialize_by(account: self, entry_type_name: 'paged')
|
31
|
+
end
|
32
|
+
|
33
|
+
def existing_and_potential_entry_templates
|
34
|
+
entry_type_names = Pageflow.config_for(self).entry_types.map(&:name)
|
35
|
+
existing_entry_templates = EntryTemplate.where(account_id: id).load
|
36
|
+
allowed_existing_entry_templates =
|
37
|
+
existing_entry_templates.select do |template|
|
38
|
+
entry_type_names.include?(template.entry_type_name)
|
39
|
+
end
|
40
|
+
free_type_names =
|
41
|
+
entry_type_names - allowed_existing_entry_templates.map(&:entry_type_name)
|
42
|
+
|
43
|
+
potential_entry_templates = free_type_names.map do |type_name|
|
44
|
+
EntryTemplate.new(
|
45
|
+
account_id: id,
|
46
|
+
entry_type_name: type_name
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
allowed_existing_entry_templates + potential_entry_templates
|
51
|
+
end
|
52
|
+
|
27
53
|
def blacklist_for_serialization
|
28
54
|
[:features_configuration]
|
29
55
|
end
|
@@ -32,7 +32,7 @@ module Pageflow
|
|
32
32
|
INNER JOIN pageflow_memberships ON
|
33
33
|
pageflow_memberships.user_id = :user_id AND
|
34
34
|
pageflow_memberships.entity_id = pageflow_accounts.id AND
|
35
|
-
pageflow_memberships.entity_type =
|
35
|
+
pageflow_memberships.entity_type = 'Pageflow::Account' AND
|
36
36
|
pageflow_memberships.role IN (:roles)
|
37
37
|
SQL
|
38
38
|
end
|
@@ -37,6 +37,7 @@ module Pageflow
|
|
37
37
|
|
38
38
|
validates :account, :theming, :presence => true
|
39
39
|
validates :title, presence: true
|
40
|
+
validate :entry_type_is_available_for_account
|
40
41
|
validate :folder_belongs_to_same_account
|
41
42
|
|
42
43
|
scope :editing, -> { joins(:edit_lock).merge(Pageflow::EditLock.active) }
|
@@ -51,11 +52,18 @@ module Pageflow
|
|
51
52
|
after_create unless: :skip_draft_creation do
|
52
53
|
create_draft!
|
53
54
|
draft.storylines.create!(configuration: {main: true})
|
54
|
-
|
55
|
+
entry_template.copy_defaults_to(draft)
|
56
|
+
end
|
57
|
+
|
58
|
+
def entry_template
|
59
|
+
@entry_template ||= EntryTemplate.find_or_initialize_by(
|
60
|
+
account_id: account.id,
|
61
|
+
entry_type_name: type_name
|
62
|
+
)
|
55
63
|
end
|
56
64
|
|
57
65
|
def entry_type
|
58
|
-
Pageflow.
|
66
|
+
Pageflow.config.entry_types.find_by_name!(type_name)
|
59
67
|
end
|
60
68
|
|
61
69
|
def edit_lock
|
@@ -132,6 +140,12 @@ module Pageflow
|
|
132
140
|
errors.add(:folder, :must_be_same_account) if folder.present? && folder.account_id != account_id
|
133
141
|
end
|
134
142
|
|
143
|
+
def entry_type_is_available_for_account
|
144
|
+
return if Pageflow.config_for(account).entry_types.map(&:name).include?(type_name)
|
145
|
+
|
146
|
+
errors.add(:type_name, :must_be_available_for_account, type_name: type_name)
|
147
|
+
end
|
148
|
+
|
135
149
|
def update_password!(options)
|
136
150
|
if options[:password].present?
|
137
151
|
self.password = options[:password]
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Pageflow
|
2
|
+
class EntryTemplate < ApplicationRecord
|
3
|
+
include ThemeReferencer
|
4
|
+
include SerializedConfiguration
|
5
|
+
serialize :default_share_providers, JSON
|
6
|
+
belongs_to :account
|
7
|
+
delegate :enabled_feature_names, to: :account
|
8
|
+
has_many :widgets, as: :subject, dependent: :destroy
|
9
|
+
|
10
|
+
validates :account, presence: true
|
11
|
+
validates :entry_type_name, presence: true
|
12
|
+
validates :entry_type_name,
|
13
|
+
uniqueness: {
|
14
|
+
scope: :account
|
15
|
+
}
|
16
|
+
|
17
|
+
def entry_type
|
18
|
+
Pageflow.config.entry_types.find_by_name!(entry_type_name)
|
19
|
+
end
|
20
|
+
|
21
|
+
def translated_entry_type_name
|
22
|
+
I18n.t("activerecord.values.pageflow/entry.type_names.#{entry_type_name}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def resolve_widgets(options = {})
|
26
|
+
widgets.resolve(Pageflow.config_for(self), options)
|
27
|
+
end
|
28
|
+
|
29
|
+
def copy_defaults_to(revision)
|
30
|
+
widgets.copy_all_to(revision)
|
31
|
+
copy_attributes_to(revision)
|
32
|
+
end
|
33
|
+
|
34
|
+
def share_providers=(share_providers)
|
35
|
+
self.default_share_providers = share_providers
|
36
|
+
end
|
37
|
+
|
38
|
+
def share_providers
|
39
|
+
default_share_providers
|
40
|
+
end
|
41
|
+
|
42
|
+
def default_share_providers
|
43
|
+
self[:default_share_providers].presence ||
|
44
|
+
hashify_provider_array(Pageflow.config.default_share_providers)
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def copy_attributes_to(revision)
|
50
|
+
revision.update(
|
51
|
+
author: default_author.presence || Pageflow.config.default_author_meta_tag,
|
52
|
+
publisher: default_publisher.presence || Pageflow.config.default_publisher_meta_tag,
|
53
|
+
keywords: default_keywords.presence || Pageflow.config.default_keywords_meta_tag,
|
54
|
+
share_providers: default_share_providers,
|
55
|
+
theme_name: theme_name,
|
56
|
+
configuration: configuration,
|
57
|
+
locale: default_locale
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
def available_themes
|
62
|
+
Pageflow.config_for(self).themes
|
63
|
+
end
|
64
|
+
|
65
|
+
def hashify_provider_array(arr)
|
66
|
+
Hash[arr.reject(&:blank?).map { |v| [v.to_s, true] }]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -26,7 +26,7 @@ module Pageflow
|
|
26
26
|
<<-SQL
|
27
27
|
INNER JOIN pageflow_memberships account_memberships ON
|
28
28
|
account_memberships.user_id = users.id AND
|
29
|
-
account_memberships.entity_type =
|
29
|
+
account_memberships.entity_type = 'Pageflow::Account'
|
30
30
|
SQL
|
31
31
|
end
|
32
32
|
|
@@ -1,11 +1,6 @@
|
|
1
1
|
module Pageflow
|
2
2
|
class Theming < ApplicationRecord
|
3
|
-
include ThemeReferencer
|
4
|
-
|
5
|
-
serialize :default_share_providers, JSON
|
6
|
-
|
7
3
|
belongs_to :account
|
8
|
-
has_many :widgets, as: :subject, dependent: :destroy
|
9
4
|
|
10
5
|
has_many :entries
|
11
6
|
|
@@ -14,55 +9,21 @@ module Pageflow
|
|
14
9
|
|
15
10
|
validates :account, :presence => true
|
16
11
|
|
17
|
-
def resolve_widgets(options = {})
|
18
|
-
widgets.resolve(Pageflow.config_for(account), options)
|
19
|
-
end
|
20
|
-
|
21
12
|
def cname_domain
|
22
13
|
cname.split('.').pop(2).join('.')
|
23
14
|
end
|
24
15
|
|
25
16
|
def name
|
26
|
-
I18n.t('pageflow.admin.themings.name',
|
27
|
-
|
28
|
-
|
29
|
-
def copy_defaults_to(revision)
|
30
|
-
widgets.copy_all_to(revision)
|
31
|
-
copy_attributes_to(revision)
|
32
|
-
end
|
33
|
-
|
34
|
-
def share_providers=(share_providers_array)
|
35
|
-
self.default_share_providers = hashify_provider_array(share_providers_array)
|
36
|
-
end
|
37
|
-
|
38
|
-
def share_providers
|
39
|
-
default_share_providers.to_a
|
40
|
-
end
|
41
|
-
|
42
|
-
def default_share_providers
|
43
|
-
self[:default_share_providers].presence || hashify_provider_array(Pageflow.config.default_share_providers)
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
def copy_attributes_to(revision)
|
49
|
-
revision.update(
|
50
|
-
author: default_author.presence || Pageflow.config.default_author_meta_tag,
|
51
|
-
publisher: default_publisher.presence || Pageflow.config.default_publisher_meta_tag,
|
52
|
-
keywords: default_keywords.presence || Pageflow.config.default_keywords_meta_tag,
|
53
|
-
share_providers: default_share_providers,
|
54
|
-
theme_name: theme_name,
|
55
|
-
home_button_enabled: home_button_enabled_by_default,
|
56
|
-
locale: default_locale
|
57
|
-
)
|
58
|
-
end
|
59
|
-
|
60
|
-
def available_themes
|
61
|
-
Pageflow.config_for(account).themes
|
17
|
+
I18n.t('pageflow.admin.themings.name',
|
18
|
+
account_name: account.name,
|
19
|
+
theme_name: 'default')
|
62
20
|
end
|
63
21
|
|
64
|
-
|
65
|
-
|
22
|
+
# @deprecated Depending on what you need this for, consider
|
23
|
+
# scoping your code to an entry type or look at a specific entry's
|
24
|
+
# theme name.
|
25
|
+
def theme_name
|
26
|
+
account.first_paged_entry_template.theme_name
|
66
27
|
end
|
67
28
|
end
|
68
29
|
end
|
@@ -88,6 +88,16 @@ module Pageflow
|
|
88
88
|
query.has_at_least_role?(:manager))
|
89
89
|
end
|
90
90
|
|
91
|
+
def see_user_quota?
|
92
|
+
user.admin? ||
|
93
|
+
query.has_at_least_role?(:manager)
|
94
|
+
end
|
95
|
+
|
96
|
+
def see_entry_types?
|
97
|
+
user.admin? ||
|
98
|
+
query.has_at_least_role?(:publisher)
|
99
|
+
end
|
100
|
+
|
91
101
|
def edit_role_on?
|
92
102
|
user.admin? || query.has_at_least_role?(:manager)
|
93
103
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Pageflow
|
2
|
+
class EntryTemplatePolicy < ApplicationPolicy
|
3
|
+
def initialize(user, entry_template)
|
4
|
+
@user = user
|
5
|
+
@entry_template = entry_template
|
6
|
+
end
|
7
|
+
|
8
|
+
def create?
|
9
|
+
update?
|
10
|
+
end
|
11
|
+
|
12
|
+
def update?
|
13
|
+
allows?(%w(publisher manager))
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def allows?(roles)
|
19
|
+
@user.memberships.where(role: roles, entity: @entry_template.account).any?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|