pageflow 15.1.0 → 15.2.2

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.

Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +92 -161
  3. data/README.md +1 -2
  4. data/admins/pageflow/accounts.rb +94 -19
  5. data/app/assets/javascripts/pageflow/admin/accounts.js +3 -3
  6. data/app/assets/javascripts/pageflow/dist/frontend.js +2 -0
  7. data/app/assets/javascripts/pageflow/dist/ui.js +9 -0
  8. data/app/assets/stylesheets/pageflow/themes/default/logo/variant/background_image.scss +4 -0
  9. data/app/assets/stylesheets/pageflow/themes/default/logo/variant/watermark.scss +5 -0
  10. data/app/controllers/pageflow/editor/widgets_controller.rb +1 -1
  11. data/app/helpers/pageflow/pages_helper.rb +1 -0
  12. data/app/models/pageflow/account.rb +6 -0
  13. data/app/models/pageflow/draft_entry.rb +13 -3
  14. data/app/models/pageflow/entry.rb +8 -1
  15. data/app/models/pageflow/entry_template.rb +55 -0
  16. data/app/models/pageflow/published_entry.rb +13 -3
  17. data/app/models/pageflow/revision.rb +1 -1
  18. data/app/models/pageflow/theming.rb +8 -47
  19. data/app/policies/pageflow/entry_template_policy.rb +18 -0
  20. data/app/policies/pageflow/theming_policy.rb +0 -4
  21. data/app/views/admin/accounts/_configuration_label.html.erb +5 -0
  22. data/app/views/admin/accounts/_entry_template_details.html.arb +17 -0
  23. data/app/views/admin/accounts/_form.html.erb +43 -23
  24. data/app/views/admin/accounts/_share_providers_label.html.erb +5 -0
  25. data/app/views/admin/accounts/_theming_details.html.arb +0 -12
  26. data/app/views/pageflow/themes/_theme.json.jbuilder +1 -0
  27. data/config/locales/de.yml +12 -7
  28. data/config/locales/en.yml +12 -7
  29. data/db/migrate/20200122115400_create_pageflow_entry_templates.rb +75 -0
  30. data/db/migrate/20200206134400_convert_legacy_scrolled_content_element_types.rb +48 -0
  31. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +42 -4
  32. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +1 -0
  33. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +4 -1
  34. data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +2 -1
  35. data/entry_types/scrolled/app/helpers/pageflow_scrolled/i18n_helper.rb +35 -0
  36. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -1
  37. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +14 -2
  38. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +10 -1
  39. data/entry_types/scrolled/config/locales/new/de.yml +231 -8
  40. data/entry_types/scrolled/config/locales/new/en.yml +228 -10
  41. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +3 -0
  42. data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +9 -4
  43. data/entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake +96 -0
  44. data/entry_types/scrolled/package/contentElements-editor.js +410 -0
  45. data/entry_types/scrolled/package/contentElements-frontend.js +533 -0
  46. data/entry_types/scrolled/package/editor.js +498 -2561
  47. data/entry_types/scrolled/package/frontend.js +713 -1238
  48. data/entry_types/scrolled/package/package.json +12 -2
  49. data/lib/pageflow/ability_mixin.rb +3 -2
  50. data/lib/pageflow/seeds.rb +0 -2
  51. data/lib/pageflow/theme.rb +4 -0
  52. data/lib/pageflow/themes.rb +5 -1
  53. data/lib/pageflow/version.rb +1 -1
  54. data/packages/pageflow/config/jest/index.js +0 -1
  55. data/packages/pageflow/config/jest/transformers/jst.js +1 -1
  56. data/packages/pageflow/config/webpack.js +0 -1
  57. data/packages/pageflow/editor.js +33 -4
  58. data/packages/pageflow/package.json +2 -1
  59. data/packages/pageflow/testHelpers.js +367 -4
  60. data/packages/pageflow/ui.js +9 -0
  61. data/spec/factories/accounts.rb +6 -0
  62. data/spec/factories/entry_templates.rb +8 -0
  63. data/spec/factories/published_entries.rb +3 -1
  64. data/spec/factories/themings.rb +0 -1
  65. metadata +14 -4
  66. data/app/assets/javascripts/pageflow/dist/editor.js +0 -11881
  67. data/app/assets/javascripts/pageflow/dist/index.js +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14b74c67c4c51cb8e8b753f5ba3b9a285fade60db4af15a81189a4986ab695cf
4
- data.tar.gz: ac8d1c183d0e9d0d13c621523f117a060e18cbad35feb47cf4796ff6e55d44eb
3
+ metadata.gz: 96f84a19d2aa50c2afc00d37aa82fc7c80ac4a8670667ac5823494cf8af4d221
4
+ data.tar.gz: b50cf792f81b8b7e61df6d22876dca72eaa1b0728549bb378f9641bbba4763fd
5
5
  SHA512:
6
- metadata.gz: b3f281f75b9c458be05082c8bdc5e23773e9662c23efddaa55e1c783dafde77484e94a67386e6e7743950cf3411ee0024f542077ebfafb8e64ef7154aaeb95a8
7
- data.tar.gz: bf6bae79a9eee4cecd0c9d69dce4fb67be8c7fcd0357f5f2a02cfae80e9238ff29c639e9ef25c5ec8f465e0c433b301932d76426b2c9e4a8d44230bb2bf438bf
6
+ metadata.gz: 21d633f0e23d4c1e97739acbee71d940a934221d7c72f1e2293ac00a758f96c8f624090dd1970b2690b04da8df6fb70a0330fe930e9b7365faf848b68b54abfc
7
+ data.tar.gz: 69776aa736a02178d13001e8ac627a42b4db1ebf1a4386d2a337d9adcdf6035b6da78fb88f9db26094cd4b14c35acf8d12fb5df01427130af155c8ce9eeff900
@@ -1,199 +1,130 @@
1
1
  # CHANGELOG
2
2
 
3
- ### Version 15.1.0
3
+ ### Version 15.2.2
4
4
 
5
- 2020-02-05
5
+ 2020-07-15
6
6
 
7
- [Compare changes](https://github.com/codevise/pageflow/compare/15-0-stable...v15.1.0)
7
+ [Compare changes](https://github.com/codevise/pageflow/compare/v15.2.1.0...v15.2.2)
8
8
 
9
- See
10
- [changes grouped by pre releases](https://github.com/codevise/pageflow/blob/v15.1.0.rc0/CHANGELOG.md).
9
+ - Fix dummy app generation with Thor 1.0
10
+ ([#1526](https://github.com/codevise/pageflow/pull/1526))
11
11
 
12
- #### Core
12
+ ### Version 15.2.1
13
13
 
14
- ##### Host Application
14
+ 2020-04-02
15
15
 
16
- - Updated Active Admin to 2.5.0
17
- ([#1280](https://github.com/codevise/pageflow/pull/1280))
16
+ [Compare changes](https://github.com/codevise/pageflow/compare/v15.2.0...v15.2.1)
18
17
 
19
- Starting with Active Admin 2.0, using `unshift` (or any other
20
- mutating method) to add load paths no longer work reliably (see
21
- [activeadmin/activeadmin#5995](https://github.com/activeadmin/activeadmin/issues/5995).
22
- Apply the following change to your host application's
23
- `active_admin.rb` initializer:
18
+ - Fix disabling home button input in account form based on theme (15.2 Backport)
19
+ ([#1376](https://github.com/codevise/pageflow/pull/1376))
20
+ - Include scrolled content element js files in gem (15.2 Backport)
21
+ ([#1374](https://github.com/codevise/pageflow/pull/1374))
24
22
 
25
- ```diff
26
- - ActiveAdmin.application.unshift(Pageflow.active_admin_load_path)
27
- + ActiveAdmin.application.load_paths += [Pageflow.active_admin_load_path]
28
- ```
23
+ ### Version 15.2.0
29
24
 
30
- - Improve support for Webpack setup in host appplication
31
- ([#1276](https://github.com/codevise/pageflow/pull/1276),
32
- [#1279](https://github.com/codevise/pageflow/pull/1279))
25
+ 2020-04-01
33
26
 
34
- ##### Admin
27
+ [Compare changes](https://github.com/codevise/pageflow/compare/15-1-stable...v15.2.0)
35
28
 
36
- - Improve add member button
37
- ([#1195](https://github.com/codevise/pageflow/pull/1195))
29
+ #### Core
38
30
 
39
31
  ##### Editor
40
32
 
41
- - Bug fix: Prevent including pageflow/ui in pageflow/editor
42
- ([#1309](https://github.com/codevise/pageflow/pull/1309))
43
-
44
- ##### Engine Config
45
-
46
- - Add entry type concept
47
- ([#1249](https://github.com/codevise/pageflow/pull/1249))
48
- - Render entry type specific editor seed data
49
- ([#1265](https://github.com/codevise/pageflow/pull/1265))
50
- - Entry type specific editor views
51
- ([#1262](https://github.com/codevise/pageflow/pull/1262))
52
- - Entry type specific editor assets
53
- ([#1257](https://github.com/codevise/pageflow/pull/1257))
54
- - Let entry types provide frontend apps to render entries
55
- ([#1254](https://github.com/codevise/pageflow/pull/1254),
56
- [#1255](https://github.com/codevise/pageflow/pull/1255))
57
- - Extend config DSL for entry types
58
- ([#1267](https://github.com/codevise/pageflow/pull/1267))
59
- - Allow scoping file types and widget types by entry types
60
- ([#1283](https://github.com/codevise/pageflow/pull/1283))
61
- - Decouple revision components and file types from page types
62
- ([#1256](https://github.com/codevise/pageflow/pull/1256),
63
- [#1259](https://github.com/codevise/pageflow/pull/1259))
64
- - Consider feature flags for file types available in editor
65
- ([#1275](https://github.com/codevise/pageflow/pull/1275))
66
- - Extract part of appearance options into paged entry type
67
- ([#1304](https://github.com/codevise/pageflow/pull/1304),
68
- [#1321](https://github.com/codevise/pageflow/pull/1321))
69
- - Scope existing built ins to paged entry type
70
- ([#1296](https://github.com/codevise/pageflow/pull/1296))
71
- - Integrate entry type specific config with feature flags
72
- ([#1295](https://github.com/codevise/pageflow/pull/1295))
73
- - Decouple editor layout
74
- ([#1284](https://github.com/codevise/pageflow/pull/1284))
75
- - Let entry types define editor controllers
76
- ([#1271](https://github.com/codevise/pageflow/pull/1271))
77
- - Add authentication provider
78
- ([#1236](https://github.com/codevise/pageflow/pull/1236))
79
- - Bug fix: Change revision#locale to always return string
80
- ([#1239](https://github.com/codevise/pageflow/pull/1239))
81
-
82
- ##### File Importers
83
-
84
- - Introduce file importer API
85
- ([#1250](https://github.com/codevise/pageflow/pull/1250),
86
- [#1266](https://github.com/codevise/pageflow/pull/1266),
87
- [#1258](https://github.com/codevise/pageflow/pull/1258),
88
- [#1269](https://github.com/codevise/pageflow/pull/1269),
89
- [#1323](https://github.com/codevise/pageflow/pull/1323))
33
+ - Bug fix: Re-add entry.configuration in editor for backwards compatibility
34
+ ([#1331](https://github.com/codevise/pageflow/pull/1331))
35
+ - Bug fix: Fix help link in editor page type drop down
36
+ ([#1372](https://github.com/codevise/pageflow/pull/1372))
90
37
 
91
- ##### Internal
38
+ ##### Documentation
92
39
 
93
- - Add configuration to revisions
94
- ([#1306](https://github.com/codevise/pageflow/pull/1306))
95
- - Add entry type engines
96
- ([#1247](https://github.com/codevise/pageflow/pull/1247))
97
- - Migrate legacy JavaScript to Rollup/Jest
98
- ([#1241](https://github.com/codevise/pageflow/pull/1241))
99
- - Update pageflow-react build stack
100
- ([#1240](https://github.com/codevise/pageflow/pull/1240))
101
- - Modernize editor JavaScript build stack
102
- ([#1238](https://github.com/codevise/pageflow/pull/1238))
103
- - Replace chromedriver-helper by webdrivers
104
- ([#1251](https://github.com/codevise/pageflow/pull/1251))
40
+ - Remind developers to configure their editor with ESLint before starting to contribute
41
+ ([#1369](https://github.com/codevise/pageflow/pull/1369))
42
+ - Move troubleshooting to docs
43
+ ([#1327](https://github.com/codevise/pageflow/pull/1327))
105
44
 
106
- #### Paged Entry Type
45
+ ##### Internal
107
46
 
108
- ##### Editor
47
+ - Extract entry template from theming
48
+ ([#1315](https://github.com/codevise/pageflow/pull/1315))
49
+ - Use Ruby 2.6.5 in Travis
50
+ ([#1334](https://github.com/codevise/pageflow/pull/1334))
51
+ - Remove pageflow-react from yarn workspace list
52
+ ([#1329](https://github.com/codevise/pageflow/pull/1329))
109
53
 
110
- - Bug fix: Fix page selection view
111
- ([#1281](https://github.com/codevise/pageflow/pull/1281))
54
+ #### Paged Entry Type
112
55
 
113
56
  ##### Published Entry
114
57
 
115
- - Add width/height to social share images to make Facebook display
116
- them faster.
117
- ([#1223](https://github.com/codevise/pageflow/pull/1223))
118
- - Add translations for some text track languages
119
- ([#1237](https://github.com/codevise/pageflow/pull/1237))
120
- - Add meta charset tag in application layout of paged entries
121
- ([#1322](https://github.com/codevise/pageflow/pull/1322))
122
- - Bug fix: Invalidate page partial cache on locale change
123
- ([#1311](https://github.com/codevise/pageflow/pull/1311))
124
- - Bug fix: Do not prefix partial paths with pageflow_paged
125
- ([#1320](https://github.com/codevise/pageflow/pull/1320))
126
- - Bug fix: Fix `link_to home_button` raises URLGenerationError
127
- ([#1310](https://github.com/codevise/pageflow/pull/1310))
58
+ - Allow hiding the logo on page level
59
+ ([#1356](https://github.com/codevise/pageflow/pull/1356))
60
+ - Bug fix: Make multimedia alert and new pages box display again for
61
+ new entries
62
+ ([#1366](https://github.com/codevise/pageflow/pull/1366))
128
63
 
129
- ##### Internal
64
+ #### Scrolled Entry Type
130
65
 
131
- - Move PagedEntriesController to paged entry type engine
132
- ([#1285](https://github.com/codevise/pageflow/pull/1285))
133
- - Move editor actions into editor controller
134
- ([#1282](https://github.com/codevise/pageflow/pull/1282))
66
+ ##### Content Elements
135
67
 
136
- #### Scrolled Entry Type
68
+ - Add before/after content element
69
+ ([#1351](https://github.com/codevise/pageflow/pull/1351))
70
+ - dataWrapperChart content element
71
+ ([#1349](https://github.com/codevise/pageflow/pull/1349),
72
+ [#1355](https://github.com/codevise/pageflow/pull/1355))
73
+ - External link content element
74
+ ([#1346](https://github.com/codevise/pageflow/pull/1346))
75
+ - Add videoEmbed content element
76
+ ([#1336](https://github.com/codevise/pageflow/pull/1336))
137
77
 
138
- ##### Published Entry
78
+ ##### Widgets
139
79
 
140
- - Import scrolled entry type React app
141
- ([#1264](https://github.com/codevise/pageflow/pull/1264))
142
- - Use seed data in scrolled entries
143
- ([#1248](https://github.com/codevise/pageflow/pull/1248),
144
- [#1270](https://github.com/codevise/pageflow/pull/1270),
145
- [#1278](https://github.com/codevise/pageflow/pull/1278),
146
- [#1286](https://github.com/codevise/pageflow/pull/1286),
147
- [#1314](https://github.com/codevise/pageflow/pull/1314),
148
- [#1242](https://github.com/codevise/pageflow/pull/1242))
149
- - Fix section index and references to adjacent chapters
150
- ([#1316](https://github.com/codevise/pageflow/pull/1316))
151
- - Render uploaded images in scrolled entries
152
- ([#1299](https://github.com/codevise/pageflow/pull/1299),
153
- [#1303](https://github.com/codevise/pageflow/pull/1303))
154
- - Use chapters from db in navigaition bar
155
- ([#1298](https://github.com/codevise/pageflow/pull/1298),
156
- [#1300](https://github.com/codevise/pageflow/pull/1300),
157
- [#1308](https://github.com/codevise/pageflow/pull/1308))
158
- - Sharing, imprint, privacy in navigation
159
- ([#1319](https://github.com/codevise/pageflow/pull/1319))
80
+ - Improve navigation
81
+ ([#1347](https://github.com/codevise/pageflow/pull/1347))
160
82
 
161
83
  ##### Editor
162
84
 
163
- - Render demo in editor
164
- ([#1268](https://github.com/codevise/pageflow/pull/1268))
165
- - Use data from Backbone collections in scrolled editor preview
166
- ([#1288](https://github.com/codevise/pageflow/pull/1288),
167
- [#1293](https://github.com/codevise/pageflow/pull/1293),
168
- [#1292](https://github.com/codevise/pageflow/pull/1292),
169
- [#1294](https://github.com/codevise/pageflow/pull/1294),
170
- [#1305](https://github.com/codevise/pageflow/pull/1305))
171
- - Outline editing for scrolled entries
172
- ([#1318](https://github.com/codevise/pageflow/pull/1318))
85
+ - Adding content elements
86
+ ([#1337](https://github.com/codevise/pageflow/pull/1337))
87
+ - Edit content elements in the editor
88
+ ([#1335](https://github.com/codevise/pageflow/pull/1335))
89
+ - Add inline help texts for scrolled editor
90
+ ([#1353](https://github.com/codevise/pageflow/pull/1353))
91
+ - Add section editing options in editor sidebar
92
+ ([#1363](https://github.com/codevise/pageflow/pull/1363))
93
+
94
+ ##### JavaScript API
95
+
96
+ - Export useFile hook from scrolled frontend
97
+ ([#1371](https://github.com/codevise/pageflow/pull/1371))
98
+ - Fix useFileRights hook
99
+ ([#1357](https://github.com/codevise/pageflow/pull/1357))
100
+ - I18n for scrolled frontend
101
+ ([#1342](https://github.com/codevise/pageflow/pull/1342))
102
+ - Content element frontend api
103
+ ([#1324](https://github.com/codevise/pageflow/pull/1324))
104
+ - Enable registering content elements with default config
105
+ ([#1354](https://github.com/codevise/pageflow/pull/1354),
106
+ [#1360](https://github.com/codevise/pageflow/pull/1360))
107
+ - Introduce configuration editor groups in scrolled editor
108
+ ([#1352](https://github.com/codevise/pageflow/pull/1352),
109
+ [#1365](https://github.com/codevise/pageflow/pull/1365))
110
+ - Improve guides
111
+ ([#1362](https://github.com/codevise/pageflow/pull/1362),
112
+ [#1348](https://github.com/codevise/pageflow/pull/1348),
113
+ [#1344](https://github.com/codevise/pageflow/pull/1344))
173
114
 
174
115
  ##### Internal
175
116
 
176
- - Pass scrolled entry to watchCollections in tests
177
- ([#1317](https://github.com/codevise/pageflow/pull/1317))
178
- - Setup Capybara for scrolled engine
179
- ([#1289](https://github.com/codevise/pageflow/pull/1289))
180
- - Set PAGEFLOW_EDITOR global in scrolled editor
181
- ([#1287](https://github.com/codevise/pageflow/pull/1287))
182
-
183
- #### Development Setup
184
-
185
- - DB seed data for scrolled entries
186
- ([#1274](https://github.com/codevise/pageflow/pull/1274),
187
- [#1302](https://github.com/codevise/pageflow/pull/1302))
188
- - Split Travis run into multiple jobs
189
- ([#1261](https://github.com/codevise/pageflow/pull/1261))
190
- - Generate JSDoc and SassDoc in GitHub workflow
191
- ([#1307](https://github.com/codevise/pageflow/pull/1307))
192
- - Add needed command to node package development docs
193
- ([#1290](https://github.com/codevise/pageflow/pull/1290))
194
- - Improve Capybara Chrome setup
195
- ([#1291](https://github.com/codevise/pageflow/pull/1291))
117
+ - Make package imports external by default in Rollup config
118
+ ([#1341](https://github.com/codevise/pageflow/pull/1341))
119
+ - Make pageflow-scrolled Capybara specs less flaky
120
+ ([#1339](https://github.com/codevise/pageflow/pull/1339))
121
+ - Prevent Percy from reporting different video loading progress
122
+ ([#1343](https://github.com/codevise/pageflow/pull/1343))
123
+ - Enable React devtools in editor iframe
124
+ ([#1338](https://github.com/codevise/pageflow/pull/1338))
125
+ - Setup Storybook for content element development
126
+ ([#1326](https://github.com/codevise/pageflow/pull/1326))
196
127
 
197
128
  See
198
- [15-0-stable branch](https://github.com/codevise/pageflow/blob/15-0-stable/CHANGELOG.md)
129
+ [15-1-stable branch](https://github.com/codevise/pageflow/blob/15-1-stable/CHANGELOG.md)
199
130
  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/wiki/Troubleshooting) wiki
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
 
@@ -31,7 +31,7 @@ module Pageflow
31
31
  end
32
32
  end
33
33
  column :default_theming do |account|
34
- account.default_theming.theme_name if authorized?(:read, 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
- @account = Account.new(permitted_params[:account])
91
- @account.build_default_theming(permitted_params.fetch(:account, {})[:default_theming_attributes])
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
- @account.default_theming.widgets.batch_update!(widgets_params) if @account.valid?
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
- if result[:account]
117
- permit_feature_states(result[:account])
118
- end
154
+ with_permitted_feature_states(result)
155
+ end
119
156
 
120
- result
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
- :home_button_enabled_by_default,
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
- permitted_attributes_for(:theming)
229
+ share_providers: {},
230
+ configuration: {}
231
+ ]
157
232
  end
158
233
 
159
234
  def permitted_attributes_for(resource_name)