pageflow 15.1.2 → 15.2.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 +4 -4
- data/CHANGELOG.md +77 -185
- data/README.md +1 -2
- data/admins/pageflow/accounts.rb +94 -19
- data/app/assets/javascripts/pageflow/admin/accounts.js +2 -2
- data/app/assets/javascripts/pageflow/dist/frontend.js +2 -0
- data/app/assets/javascripts/pageflow/dist/ui.js +9 -0
- 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 +5 -0
- data/app/controllers/pageflow/editor/widgets_controller.rb +1 -1
- data/app/helpers/pageflow/pages_helper.rb +1 -0
- data/app/models/pageflow/account.rb +6 -0
- data/app/models/pageflow/entry.rb +8 -1
- data/app/models/pageflow/entry_template.rb +55 -0
- data/app/models/pageflow/revision.rb +1 -1
- data/app/models/pageflow/theming.rb +8 -47
- data/app/policies/pageflow/entry_template_policy.rb +18 -0
- data/app/policies/pageflow/theming_policy.rb +0 -4
- data/app/views/admin/accounts/_configuration_label.html.erb +5 -0
- data/app/views/admin/accounts/_entry_template_details.html.arb +17 -0
- data/app/views/admin/accounts/_form.html.erb +43 -23
- 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/pageflow/themes/_theme.json.jbuilder +1 -0
- data/config/locales/de.yml +12 -7
- data/config/locales/en.yml +12 -7
- 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/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +32 -3
- data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +1 -0
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +4 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +2 -1
- data/entry_types/scrolled/app/helpers/pageflow_scrolled/i18n_helper.rb +35 -0
- 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 +14 -2
- data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +10 -1
- data/entry_types/scrolled/config/locales/new/de.yml +231 -8
- data/entry_types/scrolled/config/locales/new/en.yml +228 -10
- data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +3 -0
- data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +9 -4
- data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +96 -0
- data/entry_types/scrolled/package/editor.js +498 -2561
- data/entry_types/scrolled/package/frontend.js +713 -1238
- data/entry_types/scrolled/package/package.json +12 -2
- data/lib/pageflow/ability_mixin.rb +3 -2
- data/lib/pageflow/seeds.rb +0 -2
- data/lib/pageflow/theme.rb +4 -0
- data/lib/pageflow/themes.rb +5 -1
- data/lib/pageflow/version.rb +1 -1
- data/packages/pageflow/config/jest/index.js +0 -1
- data/packages/pageflow/config/jest/transformers/jst.js +1 -1
- data/packages/pageflow/config/webpack.js +0 -1
- data/packages/pageflow/editor.js +23 -3
- data/packages/pageflow/package.json +2 -1
- data/packages/pageflow/testHelpers.js +367 -4
- data/packages/pageflow/ui.js +9 -0
- data/spec/factories/accounts.rb +6 -0
- data/spec/factories/entry_templates.rb +8 -0
- data/spec/factories/published_entries.rb +3 -1
- data/spec/factories/themings.rb +0 -1
- metadata +11 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f634bdc5700407153c1e555eb991eac53f2572d
|
4
|
+
data.tar.gz: 47766062e1a5fedffcce3c969fae1fa52ba10ed3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a87e52617931eeff9d0bce5bf8b09ef2673e4543173d9cd00edd88d2e2fab165222a6216785560fb099635e2a8fc7e7df9f1c69d3c8c79d94cde602aedcf5a2
|
7
|
+
data.tar.gz: ebcb2edecf5aca9a2dbbd2037a4e07120cdf3fcc3c578de36ba5a19d08507298a493e3ef15b21714829061dd0a43d777e4d882a2303a3beed8f0942506e2adf5
|
data/CHANGELOG.md
CHANGED
@@ -1,218 +1,110 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
### Version 15.
|
3
|
+
### Version 15.2.0
|
4
4
|
|
5
5
|
2020-04-01
|
6
6
|
|
7
|
-
[Compare changes](https://github.com/codevise/pageflow/compare/
|
8
|
-
|
9
|
-
- Bug fix: Make multimedia alert and new pages box display again for
|
10
|
-
new paged entries
|
11
|
-
([#1368](https://github.com/codevise/pageflow/pull/1368))
|
12
|
-
|
13
|
-
### Version 15.1.1
|
14
|
-
|
15
|
-
2020-02-12
|
16
|
-
|
17
|
-
[Compare changes](https://github.com/codevise/pageflow/compare/v15.1.0...v15.1.1)
|
18
|
-
|
19
|
-
- Re-add entry.configuration in editor for backwards compatibility
|
20
|
-
([#1332](https://github.com/codevise/pageflow/pull/1332))
|
21
|
-
|
22
|
-
### Version 15.1.0
|
23
|
-
|
24
|
-
2020-02-05
|
25
|
-
|
26
|
-
[Compare changes](https://github.com/codevise/pageflow/compare/15-0-stable...v15.1.0)
|
27
|
-
|
28
|
-
See
|
29
|
-
[changes grouped by pre releases](https://github.com/codevise/pageflow/blob/v15.1.0.rc0/CHANGELOG.md).
|
7
|
+
[Compare changes](https://github.com/codevise/pageflow/compare/15-1-stable...v15.2.0)
|
30
8
|
|
31
9
|
#### Core
|
32
10
|
|
33
|
-
#####
|
34
|
-
|
35
|
-
- Updated Active Admin to 2.5.0
|
36
|
-
([#1280](https://github.com/codevise/pageflow/pull/1280))
|
37
|
-
|
38
|
-
Starting with Active Admin 2.0, using `unshift` (or any other
|
39
|
-
mutating method) to add load paths no longer work reliably (see
|
40
|
-
[activeadmin/activeadmin#5995](https://github.com/activeadmin/activeadmin/issues/5995).
|
41
|
-
Apply the following change to your host application's
|
42
|
-
`active_admin.rb` initializer:
|
43
|
-
|
44
|
-
```diff
|
45
|
-
- ActiveAdmin.application.unshift(Pageflow.active_admin_load_path)
|
46
|
-
+ ActiveAdmin.application.load_paths += [Pageflow.active_admin_load_path]
|
47
|
-
```
|
48
|
-
|
49
|
-
- Improve support for Webpack setup in host appplication
|
50
|
-
([#1276](https://github.com/codevise/pageflow/pull/1276),
|
51
|
-
[#1279](https://github.com/codevise/pageflow/pull/1279))
|
11
|
+
##### Editor
|
52
12
|
|
53
|
-
|
13
|
+
- Bug fix: Re-add entry.configuration in editor for backwards compatibility
|
14
|
+
([#1331](https://github.com/codevise/pageflow/pull/1331))
|
15
|
+
- Bug fix: Fix help link in editor page type drop down
|
16
|
+
([#1372](https://github.com/codevise/pageflow/pull/1372))
|
54
17
|
|
55
|
-
|
56
|
-
([#1195](https://github.com/codevise/pageflow/pull/1195))
|
18
|
+
##### Documentation
|
57
19
|
|
58
|
-
|
59
|
-
|
60
|
-
-
|
61
|
-
([#
|
62
|
-
|
63
|
-
##### Engine Config
|
64
|
-
|
65
|
-
- Add entry type concept
|
66
|
-
([#1249](https://github.com/codevise/pageflow/pull/1249))
|
67
|
-
- Render entry type specific editor seed data
|
68
|
-
([#1265](https://github.com/codevise/pageflow/pull/1265))
|
69
|
-
- Entry type specific editor views
|
70
|
-
([#1262](https://github.com/codevise/pageflow/pull/1262))
|
71
|
-
- Entry type specific editor assets
|
72
|
-
([#1257](https://github.com/codevise/pageflow/pull/1257))
|
73
|
-
- Let entry types provide frontend apps to render entries
|
74
|
-
([#1254](https://github.com/codevise/pageflow/pull/1254),
|
75
|
-
[#1255](https://github.com/codevise/pageflow/pull/1255))
|
76
|
-
- Extend config DSL for entry types
|
77
|
-
([#1267](https://github.com/codevise/pageflow/pull/1267))
|
78
|
-
- Allow scoping file types and widget types by entry types
|
79
|
-
([#1283](https://github.com/codevise/pageflow/pull/1283))
|
80
|
-
- Decouple revision components and file types from page types
|
81
|
-
([#1256](https://github.com/codevise/pageflow/pull/1256),
|
82
|
-
[#1259](https://github.com/codevise/pageflow/pull/1259))
|
83
|
-
- Consider feature flags for file types available in editor
|
84
|
-
([#1275](https://github.com/codevise/pageflow/pull/1275))
|
85
|
-
- Extract part of appearance options into paged entry type
|
86
|
-
([#1304](https://github.com/codevise/pageflow/pull/1304),
|
87
|
-
[#1321](https://github.com/codevise/pageflow/pull/1321))
|
88
|
-
- Scope existing built ins to paged entry type
|
89
|
-
([#1296](https://github.com/codevise/pageflow/pull/1296))
|
90
|
-
- Integrate entry type specific config with feature flags
|
91
|
-
([#1295](https://github.com/codevise/pageflow/pull/1295))
|
92
|
-
- Decouple editor layout
|
93
|
-
([#1284](https://github.com/codevise/pageflow/pull/1284))
|
94
|
-
- Let entry types define editor controllers
|
95
|
-
([#1271](https://github.com/codevise/pageflow/pull/1271))
|
96
|
-
- Add authentication provider
|
97
|
-
([#1236](https://github.com/codevise/pageflow/pull/1236))
|
98
|
-
- Bug fix: Change revision#locale to always return string
|
99
|
-
([#1239](https://github.com/codevise/pageflow/pull/1239))
|
100
|
-
|
101
|
-
##### File Importers
|
102
|
-
|
103
|
-
- Introduce file importer API
|
104
|
-
([#1250](https://github.com/codevise/pageflow/pull/1250),
|
105
|
-
[#1266](https://github.com/codevise/pageflow/pull/1266),
|
106
|
-
[#1258](https://github.com/codevise/pageflow/pull/1258),
|
107
|
-
[#1269](https://github.com/codevise/pageflow/pull/1269),
|
108
|
-
[#1323](https://github.com/codevise/pageflow/pull/1323))
|
20
|
+
- Remind developers to configure their editor with ESLint before starting to contribute
|
21
|
+
([#1369](https://github.com/codevise/pageflow/pull/1369))
|
22
|
+
- Move troubleshooting to docs
|
23
|
+
([#1327](https://github.com/codevise/pageflow/pull/1327))
|
109
24
|
|
110
25
|
##### Internal
|
111
26
|
|
112
|
-
-
|
113
|
-
([#
|
114
|
-
-
|
115
|
-
([#
|
116
|
-
-
|
117
|
-
([#
|
118
|
-
- Update pageflow-react build stack
|
119
|
-
([#1240](https://github.com/codevise/pageflow/pull/1240))
|
120
|
-
- Modernize editor JavaScript build stack
|
121
|
-
([#1238](https://github.com/codevise/pageflow/pull/1238))
|
122
|
-
- Replace chromedriver-helper by webdrivers
|
123
|
-
([#1251](https://github.com/codevise/pageflow/pull/1251))
|
27
|
+
- Extract entry template from theming
|
28
|
+
([#1315](https://github.com/codevise/pageflow/pull/1315))
|
29
|
+
- Use Ruby 2.6.5 in Travis
|
30
|
+
([#1334](https://github.com/codevise/pageflow/pull/1334))
|
31
|
+
- Remove pageflow-react from yarn workspace list
|
32
|
+
([#1329](https://github.com/codevise/pageflow/pull/1329))
|
124
33
|
|
125
34
|
#### Paged Entry Type
|
126
35
|
|
127
|
-
##### Editor
|
128
|
-
|
129
|
-
- Bug fix: Fix page selection view
|
130
|
-
([#1281](https://github.com/codevise/pageflow/pull/1281))
|
131
|
-
|
132
36
|
##### Published Entry
|
133
37
|
|
134
|
-
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
([#
|
139
|
-
- Add meta charset tag in application layout of paged entries
|
140
|
-
([#1322](https://github.com/codevise/pageflow/pull/1322))
|
141
|
-
- Bug fix: Invalidate page partial cache on locale change
|
142
|
-
([#1311](https://github.com/codevise/pageflow/pull/1311))
|
143
|
-
- Bug fix: Do not prefix partial paths with pageflow_paged
|
144
|
-
([#1320](https://github.com/codevise/pageflow/pull/1320))
|
145
|
-
- Bug fix: Fix `link_to home_button` raises URLGenerationError
|
146
|
-
([#1310](https://github.com/codevise/pageflow/pull/1310))
|
38
|
+
- Allow hiding the logo on page level
|
39
|
+
([#1356](https://github.com/codevise/pageflow/pull/1356))
|
40
|
+
- Bug fix: Make multimedia alert and new pages box display again for
|
41
|
+
new entries
|
42
|
+
([#1366](https://github.com/codevise/pageflow/pull/1366))
|
147
43
|
|
148
|
-
|
44
|
+
#### Scrolled Entry Type
|
149
45
|
|
150
|
-
|
151
|
-
([#1285](https://github.com/codevise/pageflow/pull/1285))
|
152
|
-
- Move editor actions into editor controller
|
153
|
-
([#1282](https://github.com/codevise/pageflow/pull/1282))
|
46
|
+
##### Content Elements
|
154
47
|
|
155
|
-
|
48
|
+
- Add before/after content element
|
49
|
+
([#1351](https://github.com/codevise/pageflow/pull/1351))
|
50
|
+
- dataWrapperChart content element
|
51
|
+
([#1349](https://github.com/codevise/pageflow/pull/1349),
|
52
|
+
[#1355](https://github.com/codevise/pageflow/pull/1355))
|
53
|
+
- External link content element
|
54
|
+
([#1346](https://github.com/codevise/pageflow/pull/1346))
|
55
|
+
- Add videoEmbed content element
|
56
|
+
([#1336](https://github.com/codevise/pageflow/pull/1336))
|
156
57
|
|
157
|
-
#####
|
58
|
+
##### Widgets
|
158
59
|
|
159
|
-
-
|
160
|
-
([#
|
161
|
-
- Use seed data in scrolled entries
|
162
|
-
([#1248](https://github.com/codevise/pageflow/pull/1248),
|
163
|
-
[#1270](https://github.com/codevise/pageflow/pull/1270),
|
164
|
-
[#1278](https://github.com/codevise/pageflow/pull/1278),
|
165
|
-
[#1286](https://github.com/codevise/pageflow/pull/1286),
|
166
|
-
[#1314](https://github.com/codevise/pageflow/pull/1314),
|
167
|
-
[#1242](https://github.com/codevise/pageflow/pull/1242))
|
168
|
-
- Fix section index and references to adjacent chapters
|
169
|
-
([#1316](https://github.com/codevise/pageflow/pull/1316))
|
170
|
-
- Render uploaded images in scrolled entries
|
171
|
-
([#1299](https://github.com/codevise/pageflow/pull/1299),
|
172
|
-
[#1303](https://github.com/codevise/pageflow/pull/1303))
|
173
|
-
- Use chapters from db in navigaition bar
|
174
|
-
([#1298](https://github.com/codevise/pageflow/pull/1298),
|
175
|
-
[#1300](https://github.com/codevise/pageflow/pull/1300),
|
176
|
-
[#1308](https://github.com/codevise/pageflow/pull/1308))
|
177
|
-
- Sharing, imprint, privacy in navigation
|
178
|
-
([#1319](https://github.com/codevise/pageflow/pull/1319))
|
60
|
+
- Improve navigation
|
61
|
+
([#1347](https://github.com/codevise/pageflow/pull/1347))
|
179
62
|
|
180
63
|
##### Editor
|
181
64
|
|
182
|
-
-
|
183
|
-
([#
|
184
|
-
-
|
185
|
-
([#
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
65
|
+
- Adding content elements
|
66
|
+
([#1337](https://github.com/codevise/pageflow/pull/1337))
|
67
|
+
- Edit content elements in the editor
|
68
|
+
([#1335](https://github.com/codevise/pageflow/pull/1335))
|
69
|
+
- Add inline help texts for scrolled editor
|
70
|
+
([#1353](https://github.com/codevise/pageflow/pull/1353))
|
71
|
+
- Add section editing options in editor sidebar
|
72
|
+
([#1363](https://github.com/codevise/pageflow/pull/1363))
|
73
|
+
|
74
|
+
##### JavaScript API
|
75
|
+
|
76
|
+
- Export useFile hook from scrolled frontend
|
77
|
+
([#1371](https://github.com/codevise/pageflow/pull/1371))
|
78
|
+
- Fix useFileRights hook
|
79
|
+
([#1357](https://github.com/codevise/pageflow/pull/1357))
|
80
|
+
- I18n for scrolled frontend
|
81
|
+
([#1342](https://github.com/codevise/pageflow/pull/1342))
|
82
|
+
- Content element frontend api
|
83
|
+
([#1324](https://github.com/codevise/pageflow/pull/1324))
|
84
|
+
- Enable registering content elements with default config
|
85
|
+
([#1354](https://github.com/codevise/pageflow/pull/1354),
|
86
|
+
[#1360](https://github.com/codevise/pageflow/pull/1360))
|
87
|
+
- Introduce configuration editor groups in scrolled editor
|
88
|
+
([#1352](https://github.com/codevise/pageflow/pull/1352),
|
89
|
+
[#1365](https://github.com/codevise/pageflow/pull/1365))
|
90
|
+
- Improve guides
|
91
|
+
([#1362](https://github.com/codevise/pageflow/pull/1362),
|
92
|
+
[#1348](https://github.com/codevise/pageflow/pull/1348),
|
93
|
+
[#1344](https://github.com/codevise/pageflow/pull/1344))
|
192
94
|
|
193
95
|
##### Internal
|
194
96
|
|
195
|
-
-
|
196
|
-
([#
|
197
|
-
-
|
198
|
-
([#
|
199
|
-
-
|
200
|
-
([#
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
([#1274](https://github.com/codevise/pageflow/pull/1274),
|
206
|
-
[#1302](https://github.com/codevise/pageflow/pull/1302))
|
207
|
-
- Split Travis run into multiple jobs
|
208
|
-
([#1261](https://github.com/codevise/pageflow/pull/1261))
|
209
|
-
- Generate JSDoc and SassDoc in GitHub workflow
|
210
|
-
([#1307](https://github.com/codevise/pageflow/pull/1307))
|
211
|
-
- Add needed command to node package development docs
|
212
|
-
([#1290](https://github.com/codevise/pageflow/pull/1290))
|
213
|
-
- Improve Capybara Chrome setup
|
214
|
-
([#1291](https://github.com/codevise/pageflow/pull/1291))
|
97
|
+
- Make package imports external by default in Rollup config
|
98
|
+
([#1341](https://github.com/codevise/pageflow/pull/1341))
|
99
|
+
- Make pageflow-scrolled Capybara specs less flaky
|
100
|
+
([#1339](https://github.com/codevise/pageflow/pull/1339))
|
101
|
+
- Prevent Percy from reporting different video loading progress
|
102
|
+
([#1343](https://github.com/codevise/pageflow/pull/1343))
|
103
|
+
- Enable React devtools in editor iframe
|
104
|
+
([#1338](https://github.com/codevise/pageflow/pull/1338))
|
105
|
+
- Setup Storybook for content element development
|
106
|
+
([#1326](https://github.com/codevise/pageflow/pull/1326))
|
215
107
|
|
216
108
|
See
|
217
|
-
[15-
|
109
|
+
[15-1-stable branch](https://github.com/codevise/pageflow/blob/15-1-stable/CHANGELOG.md)
|
218
110
|
for previous changes.
|
data/README.md
CHANGED
@@ -168,8 +168,7 @@ is only available for admins.
|
|
168
168
|
|
169
169
|
## Troubleshooting
|
170
170
|
|
171
|
-
If you run into problems during the installation of Pageflow, please refer to the [Troubleshooting](https://github.com/codevise/pageflow/
|
172
|
-
page. If that doesn't help, consider [filing an issue](https://github.com/codevise/pageflow/issues?state=open).
|
171
|
+
If you run into problems during the installation of Pageflow, please refer to the [Troubleshooting](doc/troubleshooting.md) docs. If that doesn't help, consider [filing an issue](https://github.com/codevise/pageflow/issues?state=open).
|
173
172
|
|
174
173
|
## Security Policy
|
175
174
|
|
data/admins/pageflow/accounts.rb
CHANGED
@@ -31,7 +31,7 @@ module Pageflow
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
column :default_theming do |account|
|
34
|
-
account.
|
34
|
+
account.first_paged_entry_template.theme_name if authorized?(:read, account)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -63,6 +63,7 @@ module Pageflow
|
|
63
63
|
show :title => :name do |account|
|
64
64
|
render 'account_details', :account => account
|
65
65
|
render 'theming_details', :account => account
|
66
|
+
render 'entry_template_details', account: account
|
66
67
|
|
67
68
|
tabs_view(Pageflow.config.admin_resource_tabs.find_by_resource(account.default_theming),
|
68
69
|
i18n: 'pageflow.admin.resource_tabs',
|
@@ -80,28 +81,65 @@ module Pageflow
|
|
80
81
|
|
81
82
|
def new
|
82
83
|
@account = Account.new
|
83
|
-
@account.build_default_theming
|
84
|
+
@account.build_default_theming
|
85
|
+
@entry_template = @account.entry_templates.build(
|
84
86
|
default_locale: current_user.locale,
|
85
|
-
share_providers: Pageflow.config.default_share_providers
|
87
|
+
share_providers: Pageflow.config.default_share_providers,
|
88
|
+
entry_type: 'paged'
|
86
89
|
)
|
87
90
|
end
|
88
91
|
|
89
92
|
def create
|
90
|
-
|
91
|
-
|
93
|
+
account_params = (permitted_params[:account] || {})
|
94
|
+
.except(:paged_entry_template_attributes)
|
95
|
+
@account = Account.new(account_params)
|
96
|
+
@account.build_default_theming(permitted_params.fetch(:account, {})[
|
97
|
+
:default_theming_attributes])
|
98
|
+
@entry_template = @account.entry_templates.build({entry_type: 'paged'}
|
99
|
+
.merge(entry_template_params))
|
100
|
+
|
101
|
+
super
|
102
|
+
update_widgets('paged')
|
103
|
+
end
|
104
|
+
|
105
|
+
def edit
|
106
|
+
@entry_template = resource.first_paged_entry_template
|
92
107
|
super
|
93
|
-
update_widgets
|
94
108
|
end
|
95
109
|
|
96
110
|
def update
|
111
|
+
@entry_template = resource.entry_templates.find_or_initialize_by(
|
112
|
+
entry_type: 'paged'
|
113
|
+
)
|
114
|
+
@entry_template.assign_attributes(entry_template_params)
|
115
|
+
@entry_template.save
|
97
116
|
update! do |success, failure|
|
98
117
|
success.html { redirect_to(admin_account_path(resource, params.permit(:tab))) }
|
99
118
|
end
|
100
|
-
update_widgets
|
119
|
+
update_widgets('paged')
|
120
|
+
end
|
121
|
+
|
122
|
+
def entry_template_params
|
123
|
+
current_params = permitted_params_with_entry_template_attributes.fetch(:account, {})[
|
124
|
+
:paged_entry_template_attributes]&.to_hash
|
125
|
+
if current_params
|
126
|
+
config = true_false_strings_to_booleans_or_numbers(
|
127
|
+
current_params['configuration']
|
128
|
+
)
|
129
|
+
share_providers = true_false_strings_to_booleans_or_numbers(
|
130
|
+
current_params['share_providers']
|
131
|
+
)
|
132
|
+
current_params.merge('configuration' => config, 'share_providers' => share_providers)
|
133
|
+
else
|
134
|
+
{}
|
135
|
+
end
|
101
136
|
end
|
102
137
|
|
103
|
-
def update_widgets
|
104
|
-
|
138
|
+
def update_widgets(entry_type)
|
139
|
+
if @account.valid?
|
140
|
+
EntryTemplate.find_by(account_id: @account.id, entry_type: entry_type)
|
141
|
+
&.widgets&.batch_update!(widgets_params)
|
142
|
+
end
|
105
143
|
end
|
106
144
|
|
107
145
|
def widgets_params
|
@@ -113,11 +151,13 @@ module Pageflow
|
|
113
151
|
def permitted_params
|
114
152
|
result = params.permit(account: permitted_account_attributes)
|
115
153
|
|
116
|
-
|
117
|
-
|
118
|
-
end
|
154
|
+
with_permitted_feature_states(result)
|
155
|
+
end
|
119
156
|
|
120
|
-
|
157
|
+
def permitted_params_with_entry_template_attributes
|
158
|
+
result = params.permit(account: permitted_account_attributes_plus_entry_template)
|
159
|
+
|
160
|
+
with_permitted_feature_states(result)
|
121
161
|
end
|
122
162
|
|
123
163
|
def scoped_collection
|
@@ -126,6 +166,31 @@ module Pageflow
|
|
126
166
|
|
127
167
|
private
|
128
168
|
|
169
|
+
def with_permitted_feature_states(result)
|
170
|
+
result[:account] && permit_feature_states(result[:account])
|
171
|
+
|
172
|
+
result
|
173
|
+
end
|
174
|
+
|
175
|
+
def true_false_strings_to_booleans_or_numbers(hash)
|
176
|
+
hash&.map { |k, v| [k, to_boolean_or_number(v)] }&.to_h
|
177
|
+
end
|
178
|
+
|
179
|
+
def to_boolean_or_number(value)
|
180
|
+
case value
|
181
|
+
when 'false'
|
182
|
+
false
|
183
|
+
when 'true'
|
184
|
+
true
|
185
|
+
when '0'
|
186
|
+
0
|
187
|
+
when '1'
|
188
|
+
1
|
189
|
+
else
|
190
|
+
value
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
129
194
|
def permitted_account_attributes
|
130
195
|
[
|
131
196
|
:name,
|
@@ -135,25 +200,35 @@ module Pageflow
|
|
135
200
|
permitted_attributes_for(:account)
|
136
201
|
end
|
137
202
|
|
203
|
+
def permitted_account_attributes_plus_entry_template
|
204
|
+
permitted_account_attributes +
|
205
|
+
[paged_entry_template_attributes: permitted_entry_template_attributes]
|
206
|
+
end
|
207
|
+
|
138
208
|
def permitted_theming_attributes
|
139
209
|
[
|
140
210
|
:cname,
|
141
211
|
:additional_cnames,
|
142
|
-
:theme_name,
|
143
212
|
:imprint_link_url,
|
144
213
|
:imprint_link_label,
|
145
214
|
:copyright_link_url,
|
146
215
|
:copyright_link_label,
|
147
216
|
:privacy_link_url,
|
148
|
-
:home_url
|
149
|
-
|
217
|
+
:home_url
|
218
|
+
] +
|
219
|
+
permitted_attributes_for(:theming)
|
220
|
+
end
|
221
|
+
|
222
|
+
def permitted_entry_template_attributes
|
223
|
+
[
|
224
|
+
:theme_name,
|
150
225
|
:default_author,
|
151
226
|
:default_publisher,
|
152
227
|
:default_keywords,
|
153
228
|
:default_locale,
|
154
|
-
share_providers:
|
155
|
-
|
156
|
-
|
229
|
+
share_providers: {},
|
230
|
+
configuration: {}
|
231
|
+
]
|
157
232
|
end
|
158
233
|
|
159
234
|
def permitted_attributes_for(resource_name)
|