pageflow 15.8.0 → 16.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -130
- data/admins/pageflow/accounts.rb +12 -16
- data/admins/pageflow/entry.rb +28 -25
- data/admins/pageflow/entry_templates.rb +5 -7
- data/admins/pageflow/sites.rb +50 -0
- data/app/assets/javascripts/pageflow/admin/entries.js +16 -7
- data/app/controllers/pageflow/entries_controller.rb +2 -2
- data/app/helpers/pageflow/admin/permalinks_helper.rb +2 -2
- data/app/helpers/pageflow/common_entry_seed_helper.rb +1 -1
- data/app/helpers/pageflow/embed_code_helper.rb +1 -1
- data/app/helpers/pageflow/entries_helper.rb +15 -15
- data/app/helpers/pageflow/sites_helper.rb +11 -0
- data/app/helpers/pageflow/social_share_helper.rb +2 -2
- data/app/models/pageflow/account.rb +7 -33
- data/app/models/pageflow/{cname_theming_request_scope.rb → cname_site_request_scope.rb} +3 -3
- data/app/models/pageflow/customized_theme.rb +1 -1
- data/app/models/pageflow/entry.rb +3 -4
- data/app/models/pageflow/entry_at_revision.rb +2 -2
- data/app/models/pageflow/entry_duplicate.rb +1 -1
- data/app/models/pageflow/entry_template.rb +4 -4
- data/app/models/pageflow/home_button.rb +7 -7
- data/app/models/pageflow/permalink.rb +3 -3
- data/app/models/pageflow/permalink_directory.rb +2 -2
- data/app/models/pageflow/published_entry.rb +2 -2
- data/app/models/pageflow/site.rb +59 -0
- data/app/models/pageflow/theme_customization.rb +1 -1
- data/app/policies/pageflow/account_policy.rb +2 -2
- data/app/policies/pageflow/entry_policy.rb +2 -2
- data/app/policies/pageflow/entry_template_policy.rb +1 -1
- data/app/policies/pageflow/{theming_policy.rb → site_policy.rb} +13 -11
- data/app/views/admin/accounts/_entry_template_details.html.arb +1 -1
- data/app/views/admin/accounts/_form.html.erb +4 -22
- data/app/views/admin/accounts/_site_defaults_inline_help.html.erb +5 -0
- data/app/views/admin/entries/_form.html.erb +4 -13
- data/app/views/admin/entries/_permalink_inputs.html.erb +2 -2
- data/app/views/admin/entries/_site_input.html.erb +15 -0
- data/app/views/admin/entries/{entry_type_name_input.html.erb → entry_site_and_type_name_input.html.erb} +3 -0
- data/app/views/admin/entry_templates/_form.html.erb +5 -5
- data/app/views/admin/sites/_attributes_table.html.arb +9 -0
- data/app/views/admin/sites/_fields.html.erb +17 -0
- data/app/views/admin/sites/_form.html.erb +5 -0
- data/app/views/components/pageflow/admin/entries_tab.rb +1 -2
- data/app/views/components/pageflow/admin/entry_templates_tab.rb +10 -11
- data/app/views/components/pageflow/admin/features_tab.rb +1 -1
- data/app/views/components/pageflow/admin/sites_tab.rb +32 -0
- data/app/views/components/pageflow/admin/users_tab.rb +1 -2
- data/app/views/pageflow/editor/entries/seed.json.erb +1 -1
- data/app/views/pageflow/editor/sites/_site.json.jbuilder +1 -0
- data/app/views/pageflow/entries/{_theming.css.erb → _site.css.erb} +0 -0
- data/app/views/pageflow/entries/stylesheet.css.erb +1 -1
- data/app/views/pageflow/social_share/_entry_meta_tags.html.erb +1 -1
- data/app/views/pageflow/social_share/_page_meta_tags.html.erb +1 -1
- data/config/initializers/admin_resource_tabs.rb +29 -12
- data/config/locales/de.yml +19 -17
- data/config/locales/en.yml +19 -17
- data/db/migrate/20221215101134_rename_theming_to_site.rb +9 -0
- data/db/migrate/20221215120856_associate_entry_templates_with_sites.rb +34 -0
- data/db/migrate/20221219203023_add_name_to_sites.rb +5 -0
- data/db/migrate/20230103155934_associate_theme_customizations_with_sites.rb +27 -0
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +10 -10
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +5 -5
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +1 -1
- data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +1 -1
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +5 -5
- data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +1 -1
- data/entry_types/scrolled/package/frontend/{EditableInlineText.module-c6672f27.js → EditableInlineText.module-14c7b097.js} +2 -2
- data/entry_types/scrolled/package/frontend/{PhonePlatformContext-22e65f92.js → PhonePlatformContext-f6093cc6.js} +47 -219
- data/entry_types/scrolled/package/frontend/{Viewer-6b05522f.js → Viewer-b6becc57.js} +2 -2
- data/entry_types/scrolled/package/frontend/{arrowRight-7e3d9dd5.js → arrowRight-78a7cee4.js} +1 -1
- data/entry_types/scrolled/package/frontend/{components-487daafa.js → components-b3160dd7.js} +2 -2
- data/entry_types/scrolled/package/frontend/index.css +1 -1
- data/entry_types/scrolled/package/frontend/index.js +195 -12
- data/entry_types/scrolled/package/widgets/defaultNavigation.css +2 -2
- data/entry_types/scrolled/package/widgets/defaultNavigation.js +16 -9
- data/lib/pageflow/ability_mixin.rb +16 -8
- data/lib/pageflow/admin/attributes_table_rows.rb +1 -1
- data/lib/pageflow/admin/form_inputs.rb +1 -1
- data/lib/pageflow/admin/tabs.rb +1 -1
- data/lib/pageflow/configuration/permissions.rb +3 -3
- data/lib/pageflow/configuration.rb +17 -17
- data/lib/pageflow/entry_export_import/entry_serialization.rb +1 -1
- data/lib/pageflow/primary_domain_entry_redirect.rb +7 -7
- data/lib/pageflow/seeds.rb +10 -10
- data/lib/pageflow/theme_customizations.rb +10 -10
- data/lib/pageflow/version.rb +1 -1
- data/package/editor.js +7 -7
- data/spec/factories/accounts.rb +5 -2
- data/spec/factories/draft_entries.rb +2 -2
- data/spec/factories/entries.rb +2 -2
- data/spec/factories/entry_templates.rb +1 -1
- data/spec/factories/permalink_directory.rb +1 -1
- data/spec/factories/published_entries.rb +2 -2
- data/spec/factories/sites.rb +9 -0
- metadata +27 -18
- data/app/helpers/pageflow/themings_helper.rb +0 -11
- data/app/models/pageflow/theming.rb +0 -30
- data/app/views/admin/accounts/_theming_defaults_inline_help.html.erb +0 -5
- data/app/views/admin/accounts/_theming_details.html.arb +0 -5
- data/app/views/pageflow/editor/themings/_theming.json.jbuilder +0 -1
- data/spec/factories/themings.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f961d4e469b058f29cbba131a2ab69068547a6215111a1e9dae04040b956ddcf
|
4
|
+
data.tar.gz: 91b70f55119f6c1b8f8b8f4d1b98555f9d58bf73160165d7e4d16f8026384d81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82ac9717c4501f56715a6afc1a855ea9ce82f8cf1d3b6c3627ca8785960753a2967ba5114f5c348aa95608160c70b59edf338b9ea21d94fe1aee98cd7704adba
|
7
|
+
data.tar.gz: 0abd22f0d5bf02e29f6ac4b9fb6bc03732eec4a5e3cbd596aed79498f218e333a915bbbe1eee3b923bfe14ce213767f380c433c22180e5cb6294e38aa2694ab8
|
data/CHANGELOG.md
CHANGED
@@ -1,152 +1,55 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
### Version
|
3
|
+
### Version 16.0.0
|
4
4
|
|
5
|
-
|
5
|
+
2023-01-11
|
6
6
|
|
7
|
-
[Compare changes](https://github.com/codevise/pageflow/compare/15-
|
7
|
+
[Compare changes](https://github.com/codevise/pageflow/compare/15-x-stable...v16.0.0)
|
8
8
|
|
9
9
|
#### Core
|
10
10
|
|
11
|
-
#####
|
11
|
+
##### Breaking Changes
|
12
12
|
|
13
|
-
-
|
14
|
-
([#
|
15
|
-
|
16
|
-
([#1859](https://github.com/codevise/pageflow/pull/1859))
|
17
|
-
- Allow adding id in data attribute when adding editor main menu item
|
18
|
-
([#1837](https://github.com/codevise/pageflow/pull/1837))
|
13
|
+
- The `Theming` model has been renamed to `Site`.
|
14
|
+
([#1903](https://github.com/codevise/pageflow/pull/1903),
|
15
|
+
[#1914](https://github.com/codevise/pageflow/pull/1914))
|
19
16
|
|
20
|
-
|
17
|
+
Related associations like `Entry#theming` or
|
18
|
+
`Account#default_theming` have been renamed to `Entry#site` and
|
19
|
+
`Account#default_site` accordingly.
|
21
20
|
|
22
|
-
-
|
23
|
-
|
21
|
+
- Entry templates and theme customizations now belong to sites instead
|
22
|
+
of accounts.
|
23
|
+
([#1904](https://github.com/codevise/pageflow/pull/1904),
|
24
|
+
[#1915](https://github.com/codevise/pageflow/pull/1915))
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
- Improve file import controller
|
28
|
-
([#1847](https://github.com/codevise/pageflow/pull/1847))
|
29
|
-
|
30
|
-
##### Published Entry
|
31
|
-
|
32
|
-
- Display opt-out vendors as accepted by default on privacy page
|
33
|
-
([#1899](https://github.com/codevise/pageflow/pull/1899))
|
34
|
-
|
35
|
-
##### JavaScript API
|
36
|
-
|
37
|
-
- Pass alt text in media events
|
38
|
-
([#1901](https://github.com/codevise/pageflow/pull/1901))
|
39
|
-
- Provide more tracking data
|
40
|
-
([#1885](https://github.com/codevise/pageflow/pull/1885))
|
26
|
+
Accounts can now contain multiple sites with their own set of
|
27
|
+
templates and customized theme.
|
41
28
|
|
42
29
|
##### Internal
|
43
30
|
|
44
|
-
-
|
45
|
-
([#
|
46
|
-
|
47
|
-
|
48
|
-
#### Paged Entry Type
|
49
|
-
|
50
|
-
##### Published Entry
|
51
|
-
|
52
|
-
- Add feature flag to enforce usage of FullHD videos
|
53
|
-
([#1879](https://github.com/codevise/pageflow/pull/1879))
|
54
|
-
- Allow enforcing best video quality in Paged entries
|
55
|
-
([#1863](https://github.com/codevise/pageflow/pull/1863))
|
56
|
-
- Ensure scroller content is accessible via OS X Spoken Content
|
57
|
-
([#1870](https://github.com/codevise/pageflow/pull/1870))
|
58
|
-
|
59
|
-
##### Internal
|
60
|
-
|
61
|
-
- Missing semicolon in themes/default/page.scss
|
62
|
-
([#1898](https://github.com/codevise/pageflow/pull/1898))
|
31
|
+
- Add reusable GitHub workflow to run RSpec tests
|
32
|
+
([#1905](https://github.com/codevise/pageflow/pull/1905))
|
63
33
|
|
64
34
|
#### Scrolled Entry Type
|
65
35
|
|
66
|
-
|
67
|
-
|
68
|
-
-
|
69
|
-
([#
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
-
|
77
|
-
([#
|
78
|
-
- Typography variants
|
79
|
-
([#1842](https://github.com/codevise/pageflow/pull/1842),
|
80
|
-
[#1845](https://github.com/codevise/pageflow/pull/1845))
|
81
|
-
- Improve backdrop hiding
|
82
|
-
([#1882](https://github.com/codevise/pageflow/pull/1881),
|
83
|
-
[#1881](https://github.com/codevise/pageflow/pull/1882))
|
84
|
-
- Backdrop effects
|
85
|
-
([#1841](https://github.com/codevise/pageflow/pull/1841),
|
86
|
-
[#1846](https://github.com/codevise/pageflow/pull/1846))
|
87
|
-
- Make border radius of cards appearance configurable
|
88
|
-
([#1838](https://github.com/codevise/pageflow/pull/1838))
|
89
|
-
- Allow using SVG images as backdrops and inline images
|
90
|
-
([#1860](https://github.com/codevise/pageflow/pull/1860))
|
91
|
-
- Improve scrolled favicons
|
92
|
-
([#1858](https://github.com/codevise/pageflow/pull/1858))
|
93
|
-
- Use public translations from pageflow-public-i18n in scrolled
|
94
|
-
([#1853](https://github.com/codevise/pageflow/pull/1853))
|
95
|
-
- Rewrite backdrop/motif area logic based on CSS as experimental feature
|
96
|
-
([#1854](https://github.com/codevise/pageflow/pull/1854),
|
97
|
-
[#1855](https://github.com/codevise/pageflow/pull/1855),
|
98
|
-
[#1856](https://github.com/codevise/pageflow/pull/1856))
|
99
|
-
- Bug: Prevent foreground shadow from overlaying next section
|
100
|
-
([#1900](https://github.com/codevise/pageflow/pull/1900))
|
101
|
-
- Bug: Ensure backdrop covers viewport in iOS in-app browers
|
102
|
-
([#1884](https://github.com/codevise/pageflow/pull/1884))
|
103
|
-
|
104
|
-
##### Content Elements
|
105
|
-
|
106
|
-
- Disable automatic hyphenation in text block headings
|
107
|
-
([#1875](https://github.com/codevise/pageflow/pull/1875))
|
108
|
-
- Disable top padding for new headings
|
109
|
-
([#1896](https://github.com/codevise/pageflow/pull/1896))
|
110
|
-
- Remove space before heading in cards appearance
|
111
|
-
([#1851](https://github.com/codevise/pageflow/pull/1851))
|
112
|
-
- Text block line breaks
|
113
|
-
([#1869](https://github.com/codevise/pageflow/pull/1869),
|
114
|
-
[#1871](https://github.com/codevise/pageflow/pull/1871))
|
115
|
-
- Improve mobile block quote size
|
116
|
-
([#1868](https://github.com/codevise/pageflow/pull/1868))
|
117
|
-
- Preserve Tweet hide when unloading
|
118
|
-
([#1864](https://github.com/codevise/pageflow/pull/1864))
|
119
|
-
- Question content element
|
120
|
-
([#1861](https://github.com/codevise/pageflow/pull/1861))
|
121
|
-
- Improve video embed content element
|
122
|
-
([#1848](https://github.com/codevise/pageflow/pull/1848),
|
123
|
-
[#1850](https://github.com/codevise/pageflow/pull/1850))
|
124
|
-
|
125
|
-
##### Widgets
|
126
|
-
|
127
|
-
- Fix info box position when all share providers are disabled
|
128
|
-
([#1877](https://github.com/codevise/pageflow/pull/1877))
|
129
|
-
- Add option to prevent collapsing default navigation on desktop
|
130
|
-
([#1891](https://github.com/codevise/pageflow/pull/1891))
|
131
|
-
- Options for scrolled default navigation
|
132
|
-
([#1866](https://github.com/codevise/pageflow/pull/1866))
|
133
|
-
|
134
|
-
##### Themes
|
135
|
-
|
136
|
-
- Let themes define external link list variants
|
137
|
-
([#1880](https://github.com/codevise/pageflow/pull/1880))
|
138
|
-
- Text block theme properties
|
139
|
-
([#1873](https://github.com/codevise/pageflow/pull/1873))
|
140
|
-
- Add theme properties for cards colors
|
141
|
-
([#1865](https://github.com/codevise/pageflow/pull/1865))
|
142
|
-
- Pass consistent arguments when transforming theme options
|
143
|
-
([#1844](https://github.com/codevise/pageflow/pull/1844))
|
36
|
+
- Simplify borders in default navigation mobile chapter menu
|
37
|
+
([#1913](https://github.com/codevise/pageflow/pull/1913))
|
38
|
+
- Add theme property for chapter link separator color
|
39
|
+
([#1912](https://github.com/codevise/pageflow/pull/1912))
|
40
|
+
- Add widget slot to default navigation
|
41
|
+
([#1911](https://github.com/codevise/pageflow/pull/1911))
|
42
|
+
- Improve theme property for default navigation progress bar height
|
43
|
+
([#1910](https://github.com/codevise/pageflow/pull/1910))
|
44
|
+
- Add theme option to use smaller menu icon variant
|
45
|
+
([#1909](https://github.com/codevise/pageflow/pull/1909))
|
46
|
+
- Allow using custom icons for share options
|
47
|
+
([#1907](https://github.com/codevise/pageflow/pull/1907))
|
144
48
|
|
145
|
-
|
49
|
+
[Compare changes](https://github.com/codevise/pageflow/compare/15-x-stable...master)
|
146
50
|
|
147
|
-
|
148
|
-
([#1874](https://github.com/codevise/pageflow/pull/1874))
|
51
|
+
None so far.
|
149
52
|
|
150
53
|
See
|
151
|
-
[15-
|
54
|
+
[15-x-stable branch](https://github.com/codevise/pageflow/blob/15-x-stable/CHANGELOG.md)
|
152
55
|
for previous changes.
|
data/admins/pageflow/accounts.rb
CHANGED
@@ -59,12 +59,11 @@ module Pageflow
|
|
59
59
|
|
60
60
|
show :title => :name do |account|
|
61
61
|
render 'account_details', :account => account
|
62
|
-
render 'theming_details', :account => account
|
63
62
|
|
64
|
-
tabs_view(Pageflow.config.admin_resource_tabs.find_by_resource(account
|
63
|
+
tabs_view(Pageflow.config.admin_resource_tabs.find_by_resource(account),
|
65
64
|
i18n: 'pageflow.admin.resource_tabs',
|
66
|
-
authorize: :
|
67
|
-
build_args: [account
|
65
|
+
authorize: :see_account_admin_tab,
|
66
|
+
build_args: [account])
|
68
67
|
end
|
69
68
|
|
70
69
|
controller do
|
@@ -76,14 +75,14 @@ module Pageflow
|
|
76
75
|
|
77
76
|
def new
|
78
77
|
@account = Account.new
|
79
|
-
@account.
|
78
|
+
@account.build_default_site
|
80
79
|
end
|
81
80
|
|
82
81
|
def create
|
83
82
|
account_params = permitted_params[:account] || {}
|
84
83
|
@account = Account.new(account_params)
|
85
|
-
@account.
|
86
|
-
:
|
84
|
+
@account.build_default_site(permitted_params.fetch(:account, {})[
|
85
|
+
:default_site_attributes])
|
87
86
|
super
|
88
87
|
end
|
89
88
|
|
@@ -100,7 +99,7 @@ module Pageflow
|
|
100
99
|
end
|
101
100
|
|
102
101
|
def scoped_collection
|
103
|
-
super.includes(:
|
102
|
+
super.includes(:default_site)
|
104
103
|
end
|
105
104
|
|
106
105
|
private
|
@@ -115,12 +114,12 @@ module Pageflow
|
|
115
114
|
[
|
116
115
|
:name,
|
117
116
|
:default_file_rights,
|
118
|
-
|
117
|
+
default_site_attributes: permitted_site_attributes
|
119
118
|
] +
|
120
119
|
permitted_attributes_for(:account)
|
121
120
|
end
|
122
121
|
|
123
|
-
def
|
122
|
+
def permitted_site_attributes
|
124
123
|
[
|
125
124
|
:cname,
|
126
125
|
:additional_cnames,
|
@@ -131,15 +130,12 @@ module Pageflow
|
|
131
130
|
:privacy_link_url,
|
132
131
|
:home_url
|
133
132
|
] +
|
134
|
-
permitted_attributes_for(:
|
133
|
+
permitted_attributes_for(:site)
|
135
134
|
end
|
136
135
|
|
137
136
|
def permitted_attributes_for(resource_name)
|
138
|
-
|
139
|
-
|
140
|
-
else
|
141
|
-
[]
|
142
|
-
end
|
137
|
+
config = params[:id] ? Pageflow.config_for(resource) : Pageflow.config
|
138
|
+
config.admin_form_inputs.permitted_attributes_for(resource_name)
|
143
139
|
end
|
144
140
|
|
145
141
|
def permit_feature_states(attributes)
|
data/admins/pageflow/entry.rb
CHANGED
@@ -99,13 +99,13 @@ module Pageflow
|
|
99
99
|
.order(:name)
|
100
100
|
end)
|
101
101
|
|
102
|
-
searchable_select_options(name: :
|
103
|
-
text_attribute: :
|
102
|
+
searchable_select_options(name: :eligible_sites,
|
103
|
+
text_attribute: :name_with_account_prefix,
|
104
104
|
scope: lambda do |params|
|
105
|
-
|
106
|
-
|
107
|
-
.new(current_user,
|
108
|
-
.
|
105
|
+
account = Account.find(params[:account_id])
|
106
|
+
SitePolicy::Scope
|
107
|
+
.new(current_user, Site)
|
108
|
+
.sites_allowed_for(account)
|
109
109
|
end,
|
110
110
|
filter: lambda do |term, scope|
|
111
111
|
scope.ransack(account_name_cont: term).result
|
@@ -139,11 +139,13 @@ module Pageflow
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
collection_action :
|
142
|
+
collection_action :entry_site_and_type_name_input do
|
143
143
|
account = Pageflow::Account.find(params[:account_id])
|
144
144
|
@entry = Pageflow::Entry.new(account: account,
|
145
145
|
type_name: params[:entry_type_name])
|
146
146
|
|
147
|
+
apply_entry_defaults(@entry)
|
148
|
+
|
147
149
|
if authorized?(:see_entry_types, account)
|
148
150
|
render(layout: false)
|
149
151
|
else
|
@@ -197,7 +199,7 @@ module Pageflow
|
|
197
199
|
helper FoldersHelper
|
198
200
|
helper EntriesHelper
|
199
201
|
helper EmbedCodeHelper
|
200
|
-
helper
|
202
|
+
helper SitesHelper
|
201
203
|
helper Admin::EntriesHelper
|
202
204
|
helper Admin::FeaturesHelper
|
203
205
|
helper Admin::FormHelper
|
@@ -206,6 +208,7 @@ module Pageflow
|
|
206
208
|
helper Admin::RevisionsHelper
|
207
209
|
|
208
210
|
helper_method :account_policy_scope
|
211
|
+
helper_method :site_policy_scope
|
209
212
|
|
210
213
|
after_build do |entry|
|
211
214
|
apply_entry_defaults(entry)
|
@@ -218,8 +221,8 @@ module Pageflow
|
|
218
221
|
end
|
219
222
|
|
220
223
|
before_update do |entry|
|
221
|
-
if entry.account_id_changed? && !authorized?(:
|
222
|
-
entry.
|
224
|
+
if entry.account_id_changed? && !authorized?(:update_site_on, resource)
|
225
|
+
entry.site = entry.account.default_site
|
223
226
|
end
|
224
227
|
end
|
225
228
|
|
@@ -232,7 +235,7 @@ module Pageflow
|
|
232
235
|
def scoped_collection
|
233
236
|
result =
|
234
237
|
super
|
235
|
-
.includes(:
|
238
|
+
.includes(:site,
|
236
239
|
{permalink: :directory},
|
237
240
|
:account,
|
238
241
|
{memberships: :user},
|
@@ -256,15 +259,15 @@ module Pageflow
|
|
256
259
|
|
257
260
|
def apply_entry_defaults(entry)
|
258
261
|
entry.account ||= account_policy_scope.entry_creatable.first || Account.first
|
259
|
-
entry.
|
262
|
+
entry.site ||= entry.account.default_site
|
260
263
|
end
|
261
264
|
|
262
265
|
def account_policy_scope
|
263
266
|
AccountPolicy::Scope.new(current_user, Account)
|
264
267
|
end
|
265
268
|
|
266
|
-
def
|
267
|
-
|
269
|
+
def site_policy_scope
|
270
|
+
SitePolicy::Scope.new(current_user, Site)
|
268
271
|
end
|
269
272
|
|
270
273
|
def permitted_attributes
|
@@ -286,10 +289,10 @@ module Pageflow
|
|
286
289
|
if params[:id]
|
287
290
|
accounts = resource.account
|
288
291
|
else
|
289
|
-
accounts = account_policy_scope.
|
292
|
+
accounts = account_policy_scope.sites_accessible
|
290
293
|
end
|
291
294
|
|
292
|
-
result +=
|
295
|
+
result += permitted_site_attributes(accounts)
|
293
296
|
|
294
297
|
result
|
295
298
|
end
|
@@ -301,26 +304,26 @@ module Pageflow
|
|
301
304
|
end
|
302
305
|
end
|
303
306
|
|
304
|
-
def
|
305
|
-
if (create_or_new_action? || authorized?(:
|
306
|
-
|
307
|
-
[:
|
307
|
+
def permitted_site_attributes(accounts)
|
308
|
+
if (create_or_new_action? || authorized?(:update_site_on, resource)) &&
|
309
|
+
site_params_present? && site_in_allowed_sites_for?(accounts)
|
310
|
+
[:site_id]
|
308
311
|
else
|
309
312
|
[]
|
310
313
|
end
|
311
314
|
end
|
312
315
|
|
313
|
-
def
|
314
|
-
params[:entry] && params[:entry][:
|
316
|
+
def site_params_present?
|
317
|
+
params[:entry] && params[:entry][:site_id]
|
315
318
|
end
|
316
319
|
|
317
320
|
def create_or_new_action?
|
318
321
|
[:create, :new, :permalink_inputs].include?(action_name.to_sym)
|
319
322
|
end
|
320
323
|
|
321
|
-
def
|
322
|
-
|
323
|
-
.include?(
|
324
|
+
def site_in_allowed_sites_for?(accounts)
|
325
|
+
site_policy_scope.sites_allowed_for(accounts)
|
326
|
+
.include?(Site.find(params[:entry][:site_id]))
|
324
327
|
end
|
325
328
|
|
326
329
|
def permitted_account_attributes
|
@@ -5,7 +5,7 @@ module Pageflow
|
|
5
5
|
actions :index, :new, :create, :edit, :update
|
6
6
|
form partial: 'form'
|
7
7
|
|
8
|
-
belongs_to :
|
8
|
+
belongs_to :site, parent_class: Pageflow::Site
|
9
9
|
|
10
10
|
breadcrumb do
|
11
11
|
breadcrumb_links.first 3
|
@@ -20,9 +20,7 @@ module Pageflow
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def new
|
23
|
-
|
24
|
-
@entry_template = EntryTemplate.new(
|
25
|
-
account: account,
|
23
|
+
@entry_template = parent.entry_templates.build(
|
26
24
|
entry_type_name: params[:entry_type_name]
|
27
25
|
)
|
28
26
|
|
@@ -32,8 +30,8 @@ module Pageflow
|
|
32
30
|
end
|
33
31
|
|
34
32
|
def create
|
35
|
-
@entry_template =
|
36
|
-
entry_template_params
|
33
|
+
@entry_template = parent.entry_templates.build(
|
34
|
+
entry_template_params
|
37
35
|
)
|
38
36
|
@page_title = page_title('new', @entry_template.entry_type_name)
|
39
37
|
authorize!(:create, @entry_template)
|
@@ -87,7 +85,7 @@ module Pageflow
|
|
87
85
|
end
|
88
86
|
|
89
87
|
def redirect_path
|
90
|
-
|
88
|
+
admin_account_site_path(parent.account, parent, tab: 'entry_templates')
|
91
89
|
end
|
92
90
|
|
93
91
|
def entry_template_params
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Pageflow
|
2
|
+
ActiveAdmin.register Site, as: 'Site' do
|
3
|
+
belongs_to :account
|
4
|
+
|
5
|
+
menu false
|
6
|
+
actions :index, :show, :new, :edit, :create, :update
|
7
|
+
|
8
|
+
show do
|
9
|
+
render 'attributes_table', site: site
|
10
|
+
|
11
|
+
tabs_view(Pageflow.config.admin_resource_tabs.find_by_resource(site),
|
12
|
+
i18n: 'pageflow.admin.resource_tabs',
|
13
|
+
authorize: :see_site_admin_tab,
|
14
|
+
build_args: [site])
|
15
|
+
end
|
16
|
+
|
17
|
+
form partial: 'form'
|
18
|
+
|
19
|
+
permit_params do
|
20
|
+
[
|
21
|
+
:name,
|
22
|
+
:cname,
|
23
|
+
:additional_cnames,
|
24
|
+
:imprint_link_url,
|
25
|
+
:imprint_link_label,
|
26
|
+
:copyright_link_url,
|
27
|
+
:copyright_link_label,
|
28
|
+
:privacy_link_url,
|
29
|
+
:home_url
|
30
|
+
] + permitted_admin_form_input_params
|
31
|
+
end
|
32
|
+
|
33
|
+
controller do
|
34
|
+
helper Pageflow::Admin::FormHelper
|
35
|
+
|
36
|
+
def index
|
37
|
+
redirect_to admin_account_path(parent, tab: 'sites')
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def permitted_admin_form_input_params
|
43
|
+
Pageflow
|
44
|
+
.config_for(parent)
|
45
|
+
.admin_form_inputs
|
46
|
+
.permitted_attributes_for(:site)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -88,17 +88,26 @@ jQuery(function($) {
|
|
88
88
|
|
89
89
|
$('.admin_entries form.pageflow_entry').each(function() {
|
90
90
|
var accountSelect = $('#entry_account_id', this);
|
91
|
-
var
|
91
|
+
var siteSelect = $('#entry_site_id', this);
|
92
92
|
var titleInput = $('#entry_title', this);
|
93
93
|
|
94
|
-
function
|
94
|
+
function updateSiteAndEntryTypeInput() {
|
95
95
|
var selectedAccountId = accountSelect.val();
|
96
96
|
|
97
|
-
$.get('/admin/entries/
|
97
|
+
$.get('/admin/entries/entry_site_and_type_name_input' +
|
98
98
|
'?account_id=' + selectedAccountId +
|
99
99
|
'&entry_type_name=' + $('[name="entry[type_name]"]').val())
|
100
100
|
.done(function(response) {
|
101
|
-
$('#entry_type_name_input').replaceWith(response);
|
101
|
+
$('#entry_type_name_input').replaceWith($(response).filter('#entry_type_name_input'));
|
102
|
+
$('#entry_site_input').replaceWith($(response).filter('#entry_site_input'));
|
103
|
+
|
104
|
+
// Set up searchable select
|
105
|
+
$(document).trigger('page:load');
|
106
|
+
|
107
|
+
siteSelect = $('#entry_site_id');
|
108
|
+
siteSelect.on('change', updatePermalinkInput);
|
109
|
+
|
110
|
+
updatePermalinkInput();
|
102
111
|
});
|
103
112
|
}
|
104
113
|
|
@@ -119,15 +128,15 @@ jQuery(function($) {
|
|
119
128
|
function fetchPermalinkInput(callback) {
|
120
129
|
$.get('/admin/entries/permalink_inputs' +
|
121
130
|
'?entry[account_id]=' + accountSelect.val() +
|
122
|
-
(
|
131
|
+
(siteSelect.val() ? '&entry[site_id]=' + siteSelect.val() : '') +
|
123
132
|
'&entry[title]=' + encodeURIComponent(titleInput.val()))
|
124
133
|
.done(callback);
|
125
134
|
}
|
126
135
|
|
127
|
-
accountSelect.on('change',
|
136
|
+
accountSelect.on('change', updateSiteAndEntryTypeInput);
|
128
137
|
|
129
138
|
accountSelect.on('change', updatePermalinkInput);
|
130
|
-
|
139
|
+
siteSelect.on('change', updatePermalinkInput);
|
131
140
|
|
132
141
|
titleInput.on('change keyup', debounce(updateSlugPlaceholder, 300));
|
133
142
|
});
|
@@ -6,9 +6,9 @@ module Pageflow
|
|
6
6
|
include EntryPasswordProtection
|
7
7
|
|
8
8
|
def index
|
9
|
-
|
9
|
+
site = Site.for_request(request).with_home_url.first!
|
10
10
|
|
11
|
-
redirect_to(
|
11
|
+
redirect_to(site.home_url)
|
12
12
|
end
|
13
13
|
|
14
14
|
def show
|
@@ -2,9 +2,9 @@ module Pageflow
|
|
2
2
|
module Admin
|
3
3
|
# @api private
|
4
4
|
module PermalinksHelper
|
5
|
-
def collection_for_permalink_directories(
|
5
|
+
def collection_for_permalink_directories(site, permalink)
|
6
6
|
options_from_collection_for_select(
|
7
|
-
|
7
|
+
site.permalink_directories,
|
8
8
|
'id',
|
9
9
|
'path',
|
10
10
|
permalink.directory_id
|
@@ -10,7 +10,7 @@ module Pageflow
|
|
10
10
|
config = Pageflow.config_for(entry)
|
11
11
|
|
12
12
|
json.locale entry.locale
|
13
|
-
json.
|
13
|
+
json.site entry.site.as_json(only: [:privacy_link_url])
|
14
14
|
json.enabled_feature_names entry.enabled_feature_names
|
15
15
|
json.page_types PageTypesSeed.new(config).as_json
|
16
16
|
|
@@ -24,7 +24,7 @@ module Pageflow
|
|
24
24
|
|
25
25
|
def entry_embed_url_options(entry)
|
26
26
|
options = Pageflow.config.entry_embed_url_options
|
27
|
-
options = options.call(entry.
|
27
|
+
options = options.call(entry.site) if options.respond_to?(:call)
|
28
28
|
options
|
29
29
|
end
|
30
30
|
end
|