pageflow 15.8.0 → 16.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -130
  3. data/admins/pageflow/accounts.rb +12 -16
  4. data/admins/pageflow/entry.rb +28 -25
  5. data/admins/pageflow/entry_templates.rb +5 -7
  6. data/admins/pageflow/sites.rb +50 -0
  7. data/app/assets/javascripts/pageflow/admin/entries.js +16 -7
  8. data/app/controllers/pageflow/entries_controller.rb +2 -2
  9. data/app/helpers/pageflow/admin/permalinks_helper.rb +2 -2
  10. data/app/helpers/pageflow/common_entry_seed_helper.rb +1 -1
  11. data/app/helpers/pageflow/embed_code_helper.rb +1 -1
  12. data/app/helpers/pageflow/entries_helper.rb +15 -15
  13. data/app/helpers/pageflow/sites_helper.rb +11 -0
  14. data/app/helpers/pageflow/social_share_helper.rb +2 -2
  15. data/app/models/pageflow/account.rb +7 -33
  16. data/app/models/pageflow/{cname_theming_request_scope.rb → cname_site_request_scope.rb} +3 -3
  17. data/app/models/pageflow/customized_theme.rb +1 -1
  18. data/app/models/pageflow/entry.rb +3 -4
  19. data/app/models/pageflow/entry_at_revision.rb +2 -2
  20. data/app/models/pageflow/entry_duplicate.rb +1 -1
  21. data/app/models/pageflow/entry_template.rb +4 -4
  22. data/app/models/pageflow/home_button.rb +7 -7
  23. data/app/models/pageflow/permalink.rb +3 -3
  24. data/app/models/pageflow/permalink_directory.rb +2 -2
  25. data/app/models/pageflow/published_entry.rb +2 -2
  26. data/app/models/pageflow/site.rb +59 -0
  27. data/app/models/pageflow/theme_customization.rb +1 -1
  28. data/app/policies/pageflow/account_policy.rb +2 -2
  29. data/app/policies/pageflow/entry_policy.rb +2 -2
  30. data/app/policies/pageflow/entry_template_policy.rb +1 -1
  31. data/app/policies/pageflow/{theming_policy.rb → site_policy.rb} +13 -11
  32. data/app/views/admin/accounts/_entry_template_details.html.arb +1 -1
  33. data/app/views/admin/accounts/_form.html.erb +4 -22
  34. data/app/views/admin/accounts/_site_defaults_inline_help.html.erb +5 -0
  35. data/app/views/admin/entries/_form.html.erb +4 -13
  36. data/app/views/admin/entries/_permalink_inputs.html.erb +2 -2
  37. data/app/views/admin/entries/_site_input.html.erb +15 -0
  38. data/app/views/admin/entries/{entry_type_name_input.html.erb → entry_site_and_type_name_input.html.erb} +3 -0
  39. data/app/views/admin/entry_templates/_form.html.erb +5 -5
  40. data/app/views/admin/sites/_attributes_table.html.arb +9 -0
  41. data/app/views/admin/sites/_fields.html.erb +17 -0
  42. data/app/views/admin/sites/_form.html.erb +5 -0
  43. data/app/views/components/pageflow/admin/entries_tab.rb +1 -2
  44. data/app/views/components/pageflow/admin/entry_templates_tab.rb +10 -11
  45. data/app/views/components/pageflow/admin/features_tab.rb +1 -1
  46. data/app/views/components/pageflow/admin/sites_tab.rb +32 -0
  47. data/app/views/components/pageflow/admin/users_tab.rb +1 -2
  48. data/app/views/pageflow/editor/entries/seed.json.erb +1 -1
  49. data/app/views/pageflow/editor/sites/_site.json.jbuilder +1 -0
  50. data/app/views/pageflow/entries/{_theming.css.erb → _site.css.erb} +0 -0
  51. data/app/views/pageflow/entries/stylesheet.css.erb +1 -1
  52. data/app/views/pageflow/social_share/_entry_meta_tags.html.erb +1 -1
  53. data/app/views/pageflow/social_share/_page_meta_tags.html.erb +1 -1
  54. data/config/initializers/admin_resource_tabs.rb +29 -12
  55. data/config/locales/de.yml +19 -17
  56. data/config/locales/en.yml +19 -17
  57. data/db/migrate/20221215101134_rename_theming_to_site.rb +9 -0
  58. data/db/migrate/20221215120856_associate_entry_templates_with_sites.rb +34 -0
  59. data/db/migrate/20221219203023_add_name_to_sites.rb +5 -0
  60. data/db/migrate/20230103155934_associate_theme_customizations_with_sites.rb +27 -0
  61. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +10 -10
  62. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/frontend.js +5 -5
  63. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-client.js +1 -1
  64. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/react-server.js +1 -1
  65. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +5 -5
  66. data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +1 -1
  67. data/entry_types/scrolled/package/frontend/{EditableInlineText.module-c6672f27.js → EditableInlineText.module-14c7b097.js} +2 -2
  68. data/entry_types/scrolled/package/frontend/{PhonePlatformContext-22e65f92.js → PhonePlatformContext-f6093cc6.js} +47 -219
  69. data/entry_types/scrolled/package/frontend/{Viewer-6b05522f.js → Viewer-b6becc57.js} +2 -2
  70. data/entry_types/scrolled/package/frontend/{arrowRight-7e3d9dd5.js → arrowRight-78a7cee4.js} +1 -1
  71. data/entry_types/scrolled/package/frontend/{components-487daafa.js → components-b3160dd7.js} +2 -2
  72. data/entry_types/scrolled/package/frontend/index.css +1 -1
  73. data/entry_types/scrolled/package/frontend/index.js +195 -12
  74. data/entry_types/scrolled/package/widgets/defaultNavigation.css +2 -2
  75. data/entry_types/scrolled/package/widgets/defaultNavigation.js +16 -9
  76. data/lib/pageflow/ability_mixin.rb +16 -8
  77. data/lib/pageflow/admin/attributes_table_rows.rb +1 -1
  78. data/lib/pageflow/admin/form_inputs.rb +1 -1
  79. data/lib/pageflow/admin/tabs.rb +1 -1
  80. data/lib/pageflow/configuration/permissions.rb +3 -3
  81. data/lib/pageflow/configuration.rb +17 -17
  82. data/lib/pageflow/entry_export_import/entry_serialization.rb +1 -1
  83. data/lib/pageflow/primary_domain_entry_redirect.rb +7 -7
  84. data/lib/pageflow/seeds.rb +10 -10
  85. data/lib/pageflow/theme_customizations.rb +10 -10
  86. data/lib/pageflow/version.rb +1 -1
  87. data/package/editor.js +7 -7
  88. data/spec/factories/accounts.rb +5 -2
  89. data/spec/factories/draft_entries.rb +2 -2
  90. data/spec/factories/entries.rb +2 -2
  91. data/spec/factories/entry_templates.rb +1 -1
  92. data/spec/factories/permalink_directory.rb +1 -1
  93. data/spec/factories/published_entries.rb +2 -2
  94. data/spec/factories/sites.rb +9 -0
  95. metadata +27 -18
  96. data/app/helpers/pageflow/themings_helper.rb +0 -11
  97. data/app/models/pageflow/theming.rb +0 -30
  98. data/app/views/admin/accounts/_theming_defaults_inline_help.html.erb +0 -5
  99. data/app/views/admin/accounts/_theming_details.html.arb +0 -5
  100. data/app/views/pageflow/editor/themings/_theming.json.jbuilder +0 -1
  101. data/spec/factories/themings.rb +0 -7
@@ -1,4 +1,4 @@
1
- import { useI18n, utils, Tooltip, useFileRights, useLegalInfo, useCredits, Widget, ThemeIcon, useShareUrl, useMediaMuted, useTheme, useOnUnmuteMedia, useChapters, useCurrentChapter, usePhonePlatform, useShareProviders, useScrollPosition, frontend } from 'pageflow-scrolled/frontend';
1
+ import { useTheme, useI18n, utils, Tooltip, useFileRights, useLegalInfo, useCredits, Widget, ThemeIcon, useShareUrl, useMediaMuted, useOnUnmuteMedia, useChapters, useCurrentChapter, usePhonePlatform, useShareProviders, useScrollPosition, frontend } from 'pageflow-scrolled/frontend';
2
2
  import React, { useRef, useEffect, useCallback, useState } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { media } from 'pageflow/frontend';
@@ -79,18 +79,20 @@ function _slicedToArray(arr, i) {
79
79
 
80
80
  var styles = {"breakpoint-below-md":"(max-width: 767px)","navigationBar":"DefaultNavigation-module_navigationBar__2RK0h scope-defaultNavigation","navigationBarExpanded":"DefaultNavigation-module_navigationBarExpanded__C3sLq","navigationBarContentWrapper":"DefaultNavigation-module_navigationBarContentWrapper__3narH","menuIcon":"DefaultNavigation-module_menuIcon__2bb8s","contextIcons":"DefaultNavigation-module_contextIcons__2e65s","contextIcon":"DefaultNavigation-module_contextIcon__ELsqa utils-module_unstyledButton__3rgne","logo":"DefaultNavigation-module_logo__3gUbx","chapterList":"DefaultNavigation-module_chapterList__3VoXX scope-defaultNavigationChapterList","chapterListItem":"DefaultNavigation-module_chapterListItem__1YF5e","navigationTooltip":"DefaultNavigation-module_navigationTooltip__26Fvn","progressBar":"DefaultNavigation-module_progressBar__1jvov","progressIndicator":"DefaultNavigation-module_progressIndicator__2d_e3","hasChapters":"DefaultNavigation-module_hasChapters__3ab-r","navigationChapters":"DefaultNavigation-module_navigationChapters__3M6zh","navigationChaptersHidden":"DefaultNavigation-module_navigationChaptersHidden__2TrUo"};
81
81
 
82
- var styles$1 = {"breakpoint-md":"(min-width: 768px)","burgerMenuIconContainer":"HamburgerIcon-module_burgerMenuIconContainer__3aBkk","burgerMenuIcon":"HamburgerIcon-module_burgerMenuIcon__1WUV0"};
82
+ var styles$1 = {"breakpoint-md":"(min-width: 768px)","burgerMenuIconContainer":"HamburgerIcon-module_burgerMenuIconContainer__3aBkk","burgerMenuIcon":"HamburgerIcon-module_burgerMenuIcon__1WUV0","small":"HamburgerIcon-module_small__asAkY"};
83
83
 
84
84
  var hamburgerIconStyles = {"hamburger":"HamburgerIcons-module_hamburger__SOreS","is-active":"HamburgerIcons-module_is-active__2jpzX","hamburger-inner":"HamburgerIcons-module_hamburger-inner__Wv7Dn","hamburger-box":"HamburgerIcons-module_hamburger-box__10MR1","hamburger--collapse":"HamburgerIcons-module_hamburger--collapse__1xOkf"};
85
85
 
86
86
  function HamburgerIcon(props) {
87
+ var theme = useTheme();
88
+
87
89
  var _useI18n = useI18n(),
88
90
  t = _useI18n.t;
89
91
 
90
92
  return /*#__PURE__*/React.createElement("div", {
91
93
  className: styles$1.burgerMenuIconContainer
92
94
  }, /*#__PURE__*/React.createElement("button", {
93
- className: classNames(styles.menuIcon, styles$1.burgerMenuIcon, hamburgerIconStyles.hamburger, hamburgerIconStyles['hamburger--collapse'], _defineProperty({}, hamburgerIconStyles['is-active'], !props.mobileNavHidden)),
95
+ className: classNames(styles.menuIcon, styles$1.burgerMenuIcon, hamburgerIconStyles.hamburger, hamburgerIconStyles['hamburger--collapse'], _defineProperty({}, styles$1.small, theme.options.defaultNavigationMenuIconVariant === 'small'), _defineProperty({}, hamburgerIconStyles['is-active'], !props.mobileNavHidden)),
94
96
  title: props.mobileNavHidden ? t('pageflow_scrolled.public.navigation.open_mobile_menu') : t('pageflow_scrolled.public.navigation.close_mobile_menu'),
95
97
  type: "button",
96
98
  onClick: props.onClick
@@ -189,7 +191,7 @@ function LegalInfoMenu(props) {
189
191
  })));
190
192
  }
191
193
 
192
- var styles$4 = {"shareIcon":"SharingMenu-module_shareIcon__2iW2l","sharingTooltip":"SharingMenu-module_sharingTooltip__2Tyev","shareLinkContainer":"SharingMenu-module_shareLinkContainer__3-3W6","shareLink":"SharingMenu-module_shareLink__3PdRE"};
194
+ var styles$4 = {"sharingTooltip":"SharingMenu-module_sharingTooltip__2Tyev","shareLinkContainer":"SharingMenu-module_shareLinkContainer__3-3W6","shareLink":"SharingMenu-module_shareLink__3PdRE"};
193
195
 
194
196
  function SharingMenu(_ref) {
195
197
  var shareProviders = _ref.shareProviders;
@@ -200,7 +202,6 @@ function SharingMenu(_ref) {
200
202
 
201
203
  function renderShareLinks(shareProviders) {
202
204
  return shareProviders.map(function (shareProvider) {
203
- var Icon = shareProvider.icon;
204
205
  return /*#__PURE__*/React.createElement("div", {
205
206
  key: shareProvider.name,
206
207
  className: styles$4.shareLinkContainer
@@ -209,8 +210,8 @@ function SharingMenu(_ref) {
209
210
  href: shareProvider.url.replace('%{url}', shareUrl),
210
211
  target: '_blank',
211
212
  rel: "noopener noreferrer"
212
- }, /*#__PURE__*/React.createElement(Icon, {
213
- className: styles$4.shareIcon
213
+ }, /*#__PURE__*/React.createElement(ThemeIcon, {
214
+ name: shareProvider.iconName
214
215
  }), shareProvider.name));
215
216
  });
216
217
  }
@@ -586,7 +587,7 @@ function DefaultNavigation(_ref) {
586
587
  }
587
588
 
588
589
  var hideSharingButton = configuration.hideSharingButton || !shareProviders.length;
589
- return /*#__PURE__*/React.createElement("header", {
590
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("header", {
590
591
  className: classNames(styles.navigationBar, (_classNames2 = {}, _defineProperty(_classNames2, styles.navigationBarExpanded, navExpanded || !isPhonePlatform && configuration.fixedOnDesktop || !mobileNavHidden), _defineProperty(_classNames2, styles.hasChapters, hasChapters), _classNames2))
591
592
  }, /*#__PURE__*/React.createElement("div", {
592
593
  className: styles.navigationBarContentWrapper
@@ -607,7 +608,13 @@ function DefaultNavigation(_ref) {
607
608
  style: {
608
609
  width: readingProgress + '%'
609
610
  }
610
- })));
611
+ }))), /*#__PURE__*/React.createElement(Widget, {
612
+ role: "defaultNavigationExtra",
613
+ props: {
614
+ navigationExpanded: navExpanded,
615
+ mobileNavigationVisible: !mobileNavHidden
616
+ }
617
+ }));
611
618
  }
612
619
 
613
620
  frontend.widgetTypes.register('defaultNavigation', {
@@ -95,7 +95,11 @@ module Pageflow
95
95
  Admin::EntryTabPolicy.new(user, tab).see?
96
96
  end
97
97
 
98
- can :see_theming_admin_tab, Admin::Tab do |tab|
98
+ can :see_site_admin_tab, Admin::Tab do |tab|
99
+ Admin::AdminOnlyTabPolicy.new(user, tab).see?
100
+ end
101
+
102
+ can :see_account_admin_tab, Admin::Tab do |tab|
99
103
  Admin::AdminOnlyTabPolicy.new(user, tab).see?
100
104
  end
101
105
 
@@ -112,8 +116,8 @@ module Pageflow
112
116
  AccountPolicy.new(user, account).configure_folder_on?
113
117
  end
114
118
 
115
- can :update_theming_on_entry_of, Account do |account|
116
- AccountPolicy.new(user, account).update_theming_on_entry_of?
119
+ can :update_site_on_entry_of, Account do |account|
120
+ AccountPolicy.new(user, account).update_site_on_entry_of?
117
121
  end
118
122
 
119
123
  can :create, Entry do |entry|
@@ -180,8 +184,8 @@ module Pageflow
180
184
  EntryPolicy.new(user, entry).update_feature_configuration_on?
181
185
  end
182
186
 
183
- can :update_theming_on, Entry do |entry|
184
- EntryPolicy.new(user, entry).update_theming_on?
187
+ can :update_site_on, Entry do |entry|
188
+ EntryPolicy.new(user, entry).update_site_on?
185
189
  end
186
190
 
187
191
  can :use_files, Entry, EntryPolicy::Scope.new(user, Entry).resolve do |entry|
@@ -222,8 +226,12 @@ module Pageflow
222
226
  EntryPolicy.new(user, storyline.revision.entry).edit?
223
227
  end
224
228
 
225
- can :edit, Theming do |theming|
226
- ThemingPolicy.new(user, theming).edit?
229
+ can :read, Site do |site|
230
+ SitePolicy.new(user, site).read?
231
+ end
232
+
233
+ can :update, Site do |site|
234
+ SitePolicy.new(user, site).update?
227
235
  end
228
236
 
229
237
  can :create, EntryTemplate do |entry_template|
@@ -275,7 +283,7 @@ module Pageflow
275
283
  can :manage, [Entry, Revision]
276
284
  can :manage, Pageflow.config.file_types.map(&:model)
277
285
  can :manage, Folder
278
- can :manage, Theming
286
+ can :manage, Site
279
287
  can :manage, EntryTemplate
280
288
  can :manage, ::User
281
289
  end
@@ -12,7 +12,7 @@ module Pageflow
12
12
 
13
13
  # Insert an additional row into an attribute table.
14
14
  #
15
- # @param resource_name [Symbol] Either :entry, :account or :theming.
15
+ # @param resource_name [Symbol] Either :entry, :account or :site.
16
16
  #
17
17
  # @param name [Symbol] Name of the attribute to display.
18
18
  #
@@ -11,7 +11,7 @@ module Pageflow
11
11
  # Register a proc which adds additional inputs to admin forms.
12
12
  #
13
13
  # @param resource_name [Symbol] A resource name like `:entry`,
14
- # `:account` or `:theming`
14
+ # `:account` or `:site`
15
15
  # @param attribute_name [Symbol] The name of the additional
16
16
  # attribute
17
17
  # @param options [Hash] Formtastic options
@@ -9,7 +9,7 @@ module Pageflow
9
9
  # Display additional tabs on admin resource pages.
10
10
  #
11
11
  # @param [Symbol] resource_name A resource name like `:entry`,
12
- # `:user` or `:account`
12
+ # `:user`, `:account` or `:site`.
13
13
  # @param [Hash] options
14
14
  # @option options [Symbol] :name Unique identifier.
15
15
  # @option options [Arbre::Component] :component Component to
@@ -6,7 +6,7 @@ module Pageflow
6
6
  def initialize
7
7
  @only_admins_may_update_features = false
8
8
  @only_admins_may_see_admin_boolean = false
9
- @only_admins_may_update_theming = false
9
+ @only_admins_may_update_site = false
10
10
  end
11
11
 
12
12
  # Restrict access to features tabs to admins. Defaults to false.
@@ -18,10 +18,10 @@ module Pageflow
18
18
  # @since 12.1
19
19
  attr_accessor :only_admins_may_see_admin_boolean
20
20
 
21
- # Restrict access to theming drop down on entry edit admin page
21
+ # Restrict access to site drop down on entry edit admin page
22
22
  # to admins. Defaults to false.
23
23
  # @since 12.1
24
- attr_accessor :only_admins_may_update_theming
24
+ attr_accessor :only_admins_may_update_site
25
25
  end
26
26
  end
27
27
  end
@@ -151,21 +151,21 @@ module Pageflow
151
151
  attr_accessor :editor_routing_constraint
152
152
 
153
153
  # Either a lambda or an object with a `call` method taking two
154
- # parameters: An `ActiveRecord` scope of {Pageflow::Theming} records
154
+ # parameters: An `ActiveRecord` scope of {Pageflow::Site} records
155
155
  # and an {ActionDispatch::Request} object. Has to return the scope
156
- # in which to find themings.
156
+ # in which to find sites.
157
157
  #
158
- # Defaults to {CnameThemingRequestScope} which finds themings
158
+ # Defaults to {CnameSiteRequestScope} which finds sites
159
159
  # based on the request subdomain. Can be used to alter the logic
160
- # of finding a theming whose home_url to redirect to when visiting
160
+ # of finding a site whose home_url to redirect to when visiting
161
161
  # the public root path.
162
162
  #
163
163
  # Example:
164
164
  #
165
- # config.theming_request_scope = lambda do |themings, request|
166
- # themings.where(id: Pageflow::Account.find_by_name!(request.subdomain).default_theming_id)
165
+ # config.site_request_scope = lambda do |sites, request|
166
+ # sites.where(id: Pageflow::Account.find_by_name!(request.subdomain).default_site_id)
167
167
  # end
168
- attr_accessor :theming_request_scope
168
+ attr_accessor :site_request_scope
169
169
 
170
170
  # Either a lambda or an object with a `call` method taking two
171
171
  # parameters: An `ActiveRecord` scope of `Pageflow::Entry` records
@@ -196,7 +196,7 @@ module Pageflow
196
196
  attr_accessor :public_entry_redirect
197
197
 
198
198
  # Either a lambda or an object with a `call` method taking a
199
- # {Theming} as paramater and returing a hash of options used to
199
+ # {Site} as paramater and returing a hash of options used to
200
200
  # construct the url of a published entry.
201
201
  #
202
202
  # Can be used to change the host of the url under which entries
@@ -204,13 +204,13 @@ module Pageflow
204
204
  #
205
205
  # Example:
206
206
  #
207
- # config.public_entry_url_options = lambda do |theming|
208
- # {host: "#{theming.account.name}.example.com"}
207
+ # config.public_entry_url_options = lambda do |site|
208
+ # {host: "#{site.account.name}.example.com"}
209
209
  # end
210
210
  attr_accessor :public_entry_url_options
211
211
 
212
212
  # Either a lambda or an object with a `call` method taking a
213
- # {Theming} as paramater and returing a hash of options used to
213
+ # {Site} as paramater and returing a hash of options used to
214
214
  # construct the embed url of a published entry.
215
215
  attr_accessor :entry_embed_url_options
216
216
 
@@ -281,7 +281,7 @@ module Pageflow
281
281
  # @since 0.10
282
282
  attr_accessor :available_public_locales
283
283
 
284
- # Array of sharing providers which can be configured on theming level.
284
+ # Array of sharing providers which can be configured on site level.
285
285
  # Defaults to `[:facebook, :twitter, :linked_in, :whats_app, :telegram, :email]`.
286
286
  # @since 14.1
287
287
  attr_accessor :available_share_providers
@@ -310,7 +310,7 @@ module Pageflow
310
310
 
311
311
  # Share provider defaults.
312
312
  #
313
- # Default share providers for new themings.
313
+ # Default share providers for new sites.
314
314
  # Must be a subset or equal to `available_share_providers`
315
315
  # @since 14.1
316
316
  attr_accessor :default_share_providers
@@ -402,10 +402,10 @@ module Pageflow
402
402
  @thumbnail_styles = Defaults::THUMBNAIL_STYLES.dup
403
403
  @css_rendered_thumbnail_styles = Defaults::CSS_RENDERED_THUMBNAIL_STYLES.dup
404
404
 
405
- @theming_request_scope = CnameThemingRequestScope.new
405
+ @site_request_scope = CnameSiteRequestScope.new
406
406
  @public_entry_request_scope = lambda { |entries, request| entries }
407
407
  @public_entry_redirect = ->(_entry, _request) { nil }
408
- @public_entry_url_options = Pageflow::ThemingsHelper::DEFAULT_PUBLIC_ENTRY_OPTIONS
408
+ @public_entry_url_options = Pageflow::SitesHelper::DEFAULT_PUBLIC_ENTRY_OPTIONS
409
409
  @entry_embed_url_options = {protocol: 'https'}
410
410
 
411
411
  @transform_theme_customization_overrides = ->(overrides, _entry) { overrides }
@@ -515,9 +515,9 @@ module Pageflow
515
515
  end
516
516
 
517
517
  # @api private
518
- def theming_url_options(theming)
518
+ def site_url_options(site)
519
519
  options = public_entry_url_options
520
- options.respond_to?(:call) ? options.call(theming) : options
520
+ options.respond_to?(:call) ? options.call(site) : options
521
521
  end
522
522
 
523
523
  # @api private
@@ -44,7 +44,7 @@ module Pageflow
44
44
  def create_entry(data, options)
45
45
  entry_data = data.except(*DEFAULT_REMOVAL_COLUMNS)
46
46
  entry_data['account_id'] = options[:account].id
47
- entry_data['theming_id'] = options[:account].default_theming.id
47
+ entry_data['site_id'] = options[:account].default_site.id
48
48
  Entry.create!(entry_data.merge(skip_draft_creation: true))
49
49
  end
50
50
 
@@ -5,20 +5,20 @@ module Pageflow
5
5
  # @since 12.4
6
6
  class PrimaryDomainEntryRedirect
7
7
  def call(entry, request)
8
- theming = entry.theming
8
+ site = entry.site
9
9
 
10
- if theming.cname.present? &&
11
- !known_domains(theming).include?(request.host)
12
- [request.protocol, theming.cname, request.fullpath].join
10
+ if site.cname.present? &&
11
+ !known_domains(site).include?(request.host)
12
+ [request.protocol, site.cname, request.fullpath].join
13
13
  end
14
14
  end
15
15
 
16
16
  private
17
17
 
18
- def known_domains(theming)
18
+ def known_domains(site)
19
19
  [
20
- theming.cname,
21
- (theming.additional_cnames || '').split(',').map(&:strip)
20
+ site.cname,
21
+ (site.additional_cnames || '').split(',').map(&:strip)
22
22
  ].flatten
23
23
  end
24
24
  end
@@ -19,7 +19,7 @@ module Pageflow
19
19
  module Seeds
20
20
  DEFAULT_USER_PASSWORD = '!Pass123'
21
21
 
22
- # Create an {Account} with a default {Theming} if no account by
22
+ # Create an {Account} with a default {Site} if no account by
23
23
  # that name exists.
24
24
  #
25
25
  # @param [Hash] attributes attributes to override defaults
@@ -30,29 +30,29 @@ module Pageflow
30
30
  Account.find_or_create_by!(attributes.slice(:name)) do |account|
31
31
  account.attributes = attributes.reverse_merge(name: 'Pageflow')
32
32
 
33
- build_default_theming_for(account)
33
+ build_default_site_for(account)
34
34
 
35
35
  say_creating_account(account)
36
36
  yield(account) if block_given?
37
37
  end
38
38
  end
39
39
 
40
- # Build a default {Theming} for an {Account}. To be used inside a
40
+ # Build a default {Site} for an {Account}. To be used inside a
41
41
  # block passed to {#account}.
42
42
  #
43
43
  # @example
44
44
  #
45
45
  # account(name: 'example') do |account|
46
- # build_default_theming_for(account) do |theming|
47
- # theming.theme_name = 'mdr'
46
+ # build_default_site_for(account) do |site|
47
+ # site.theme_name = 'mdr'
48
48
  # end
49
49
  # end
50
50
  #
51
51
  # @param [Account] account the account to build a default themeing for
52
52
  # @param [Hash] attributes further attributes to override defaults
53
- # @yield [theming] a block which is passed the newly built theming
54
- # @return [Theming] newly built theming
55
- def build_default_theming_for(account, attributes = {}, &block)
53
+ # @yield [site] a block which is passed the newly built site
54
+ # @return [Site] newly built site
55
+ def build_default_site_for(account, attributes = {}, &block)
56
56
  default_attributes = {
57
57
  imprint_link_label: 'Impressum',
58
58
  imprint_link_url: 'http://example.com/impressum.html',
@@ -60,7 +60,7 @@ module Pageflow
60
60
  copyright_link_url: 'http://www.example.com/copyright.html'
61
61
  }
62
62
 
63
- account.build_default_theming(default_attributes.merge(attributes), &block)
63
+ account.build_default_site(default_attributes.merge(attributes), &block)
64
64
  end
65
65
 
66
66
  # Create a {User} if none with the given email exists yet.
@@ -110,7 +110,7 @@ module Pageflow
110
110
 
111
111
  if entry.nil?
112
112
  entry = Entry.create!(attributes) do |created_entry|
113
- created_entry.theming = attributes.fetch(:account).default_theming
113
+ created_entry.site = attributes.fetch(:account).default_site
114
114
 
115
115
  say_creating_entry(created_entry)
116
116
  yield(created_entry) if block_given?
@@ -5,10 +5,10 @@ module Pageflow
5
5
  # @since 15.7
6
6
  class ThemeCustomizations
7
7
  # Override theme options and files for entries of an entry type in
8
- # a specific account.
9
- def update(account:, entry_type_name:, overrides: {}, file_ids: {})
8
+ # a specific site.
9
+ def update(site:, entry_type_name:, overrides: {}, file_ids: {})
10
10
  ThemeCustomization
11
- .find_or_initialize_by(account: account, entry_type_name: entry_type_name)
11
+ .find_or_initialize_by(site: site, entry_type_name: entry_type_name)
12
12
  .update!(overrides: overrides, selected_file_ids: file_ids)
13
13
  end
14
14
 
@@ -16,10 +16,10 @@ module Pageflow
16
16
  # its theme without actually updating the theme customization.
17
17
  #
18
18
  # @return [PublishedEntry]
19
- def preview(account:, entry:, overrides: {}, file_ids: {})
19
+ def preview(site:, entry:, overrides: {}, file_ids: {})
20
20
  theme_customization =
21
21
  ThemeCustomization
22
- .find_or_initialize_by(account: account, entry_type_name: entry.type_name)
22
+ .find_or_initialize_by(site: site, entry_type_name: entry.type_name)
23
23
 
24
24
  theme_customization.assign_attributes(overrides: overrides, selected_file_ids: file_ids)
25
25
 
@@ -30,12 +30,12 @@ module Pageflow
30
30
  PublishedEntry.new(entry, entry.draft, theme: theme)
31
31
  end
32
32
 
33
- # Get customization for entry type and account.
33
+ # Get customization for entry type and site.
34
34
  #
35
35
  # @return [ThemeCustomization]
36
- def get(account:, entry_type_name:)
36
+ def get(site:, entry_type_name:)
37
37
  ThemeCustomization
38
- .find_or_initialize_by(account: account, entry_type_name: entry_type_name)
38
+ .find_or_initialize_by(site: site, entry_type_name: entry_type_name)
39
39
  end
40
40
 
41
41
  # Upload a file that shall be used to customize a theme. Uploading
@@ -43,10 +43,10 @@ module Pageflow
43
43
  # assign a role via the `file_ids` parameter.
44
44
  #
45
45
  # @return [ThemeCustomizationFile]
46
- def upload_file(account:, entry_type_name:, type_name:, attachment:)
46
+ def upload_file(site:, entry_type_name:, type_name:, attachment:)
47
47
  theme_customization_file =
48
48
  ThemeCustomization
49
- .find_or_create_by(account: account, entry_type_name: entry_type_name)
49
+ .find_or_create_by(site: site, entry_type_name: entry_type_name)
50
50
  .uploaded_files
51
51
  .build(type_name: type_name)
52
52
 
@@ -1,3 +1,3 @@
1
1
  module Pageflow
2
- VERSION = '15.8.0'.freeze
2
+ VERSION = '16.0.0'.freeze
3
3
  end
data/package/editor.js CHANGED
@@ -2684,10 +2684,10 @@ var EditLockContainer = Backbone.Model.extend({
2684
2684
  handleError: function handleError() {}
2685
2685
  });
2686
2686
 
2687
- var Theming = Backbone.Model.extend({
2688
- modelName: 'theming',
2689
- i18nKey: 'pageflow/theming',
2690
- collectionName: 'themings'
2687
+ var Site = Backbone.Model.extend({
2688
+ modelName: 'site',
2689
+ i18nKey: 'pageflow/site',
2690
+ collectionName: 'sites'
2691
2691
  });
2692
2692
 
2693
2693
  var ChapterConfiguration = Configuration.extend({
@@ -5272,7 +5272,7 @@ var EditMetaDataView = Marionette.Layout.extend({
5272
5272
  configurationEditor.tab('widgets', function () {
5273
5273
  editor.entryType.appearanceInputs && editor.entryType.appearanceInputs(this, {
5274
5274
  entry: entry,
5275
- theming: state.theming
5275
+ site: state.site
5276
5276
  });
5277
5277
  entry.widgets && this.view(EditWidgetsView, {
5278
5278
  model: entry,
@@ -8141,7 +8141,7 @@ app.addInitializer(function (options) {
8141
8141
  state.entry = editor.createEntryModel(options, {
8142
8142
  widgets: widgets
8143
8143
  });
8144
- state.theming = new Theming(options.theming);
8144
+ state.site = new Site(options.site);
8145
8145
  state.account = new Backbone.Model(options.account);
8146
8146
  widgets.subject = state.entry;
8147
8147
  state.storylineOrdering = new StorylineOrdering(state.storylines, state.pages);
@@ -8257,4 +8257,4 @@ app.addRegions({
8257
8257
  sidebarFooterRegion: 'sidebar .sidebar_footer_container'
8258
8258
  });
8259
8259
 
8260
- export { AudioFile, BackButtonDecoratorView, BackgroundImageEmbeddedView, BackgroundPositioningPreviewView, BackgroundPositioningSlidersView, BackgroundPositioningView, ChangeThemeDialogView, Chapter, ChapterConfiguration, ChapterPagesCollection, ChapterScaffold, ChaptersCollection, ChooseImporterView, Configuration, ConfirmEncodingView, ConfirmFileImportUploadView, ConfirmUploadView, ConfirmableFileItemView, DropDownButtonItemListView, DropDownButtonItemView, DropDownButtonView, EditConfigurationView, EditEntryView, EditFileView, EditLock, EditLockContainer, EditMetaDataView, EditWidgetView, EditWidgetsView, EditorApi, EditorView, EmulationModeButtonView, EncodedFile, EncodingConfirmation, Entry, EntryMetadata, EntryMetadataFileSelectionHandler, EntryPublication, EntryPublicationQuotaDecoratorView, ExplorerFileItemView, Failure, FileConfiguration, FileImport, FileInputView, FileItemView, FileMetaDataItemValueView, FileMetaDataItemView, FileProcessingStateDisplayView, FileReuse, FileSettingsDialogView, FileStage, FileStageItemView, FileThumbnailView, FileTypes, FileTypesCollection, FileUploader, FilesCollection, FilesExplorerView, FilesImporterView, FilesView, FilteredFilesView, ForeignKeySubsetCollection, HelpButtonView, HelpImageView, HelpView, ImageFile, InfoBoxView, InvalidNestedTypeError, LazyVideoEmbeddedView, ListItemView, ListView, LoadingView, LockedView, ModelThumbnailView, NestedFilesCollection, NestedFilesView, NestedTypeError, NotificationsView, OrderedPageLinksCollection, OtherEntriesCollection, OtherEntriesCollectionView, OtherEntry, OtherEntryItemView, Page, PageConfigurationFileSelectionHandler, PageLink, PageLinkConfigurationEditorView, PageLinkFileSelectionHandler, PageLinkItemView, PageLinksCollection, PageLinksView, PageThumbnailView, PagesCollection, PublishEntryView, ReferenceInputView, ReusableFile, Scaffold, ScrollingView, SelectButtonView, SidebarController, SidebarFooterView, SidebarRouter, StaticThumbnailView, Storyline, StorylineChaptersCollection, StorylineConfiguration, StorylineOrdering, StorylineScaffold, StorylineTransitiveChildPages, StorylinesCollection, SubsetCollection, TextFileMetaDataItemValueView, TextTrackFile, TextTracksFileMetaDataItemValueView, TextTracksView, Theme, ThemeInputView, ThemeItemView, ThemesCollection, Theming, UnmatchedUploadError, UploadError, UploadableFile, UploadableFilesView, UploaderView, VideoFile, Widget, WidgetConfiguration, WidgetConfigurationFileSelectionHandler, WidgetItemView, WidgetTypes, WidgetsCollection, addAndReturnModel, app, authenticationProvider, configurationContainer, delayedDestroying, dialogView, editor, entryTypeEditorControllerUrls, failureIndicatingView, failureTracking, fileWithType, filesCountWatcher, formDataUtils, loadable, modelLifecycleTrackingView, orderedCollection, persistedPromise, polling, retryable, selectableView, stageProvider, startEditor, state, stylesheet, transientReferences, validFileTypeTranslationList };
8260
+ export { AudioFile, BackButtonDecoratorView, BackgroundImageEmbeddedView, BackgroundPositioningPreviewView, BackgroundPositioningSlidersView, BackgroundPositioningView, ChangeThemeDialogView, Chapter, ChapterConfiguration, ChapterPagesCollection, ChapterScaffold, ChaptersCollection, ChooseImporterView, Configuration, ConfirmEncodingView, ConfirmFileImportUploadView, ConfirmUploadView, ConfirmableFileItemView, DropDownButtonItemListView, DropDownButtonItemView, DropDownButtonView, EditConfigurationView, EditEntryView, EditFileView, EditLock, EditLockContainer, EditMetaDataView, EditWidgetView, EditWidgetsView, EditorApi, EditorView, EmulationModeButtonView, EncodedFile, EncodingConfirmation, Entry, EntryMetadata, EntryMetadataFileSelectionHandler, EntryPublication, EntryPublicationQuotaDecoratorView, ExplorerFileItemView, Failure, FileConfiguration, FileImport, FileInputView, FileItemView, FileMetaDataItemValueView, FileMetaDataItemView, FileProcessingStateDisplayView, FileReuse, FileSettingsDialogView, FileStage, FileStageItemView, FileThumbnailView, FileTypes, FileTypesCollection, FileUploader, FilesCollection, FilesExplorerView, FilesImporterView, FilesView, FilteredFilesView, ForeignKeySubsetCollection, HelpButtonView, HelpImageView, HelpView, ImageFile, InfoBoxView, InvalidNestedTypeError, LazyVideoEmbeddedView, ListItemView, ListView, LoadingView, LockedView, ModelThumbnailView, NestedFilesCollection, NestedFilesView, NestedTypeError, NotificationsView, OrderedPageLinksCollection, OtherEntriesCollection, OtherEntriesCollectionView, OtherEntry, OtherEntryItemView, Page, PageConfigurationFileSelectionHandler, PageLink, PageLinkConfigurationEditorView, PageLinkFileSelectionHandler, PageLinkItemView, PageLinksCollection, PageLinksView, PageThumbnailView, PagesCollection, PublishEntryView, ReferenceInputView, ReusableFile, Scaffold, ScrollingView, SelectButtonView, SidebarController, SidebarFooterView, SidebarRouter, Site, StaticThumbnailView, Storyline, StorylineChaptersCollection, StorylineConfiguration, StorylineOrdering, StorylineScaffold, StorylineTransitiveChildPages, StorylinesCollection, SubsetCollection, TextFileMetaDataItemValueView, TextTrackFile, TextTracksFileMetaDataItemValueView, TextTracksView, Theme, ThemeInputView, ThemeItemView, ThemesCollection, UnmatchedUploadError, UploadError, UploadableFile, UploadableFilesView, UploaderView, VideoFile, Widget, WidgetConfiguration, WidgetConfigurationFileSelectionHandler, WidgetItemView, WidgetTypes, WidgetsCollection, addAndReturnModel, app, authenticationProvider, configurationContainer, delayedDestroying, dialogView, editor, entryTypeEditorControllerUrls, failureIndicatingView, failureTracking, fileWithType, filesCountWatcher, formDataUtils, loadable, modelLifecycleTrackingView, orderedCollection, persistedPromise, polling, retryable, selectableView, stageProvider, startEditor, state, stylesheet, transientReferences, validFileTypeTranslationList };
@@ -2,8 +2,9 @@ FactoryBot.define do
2
2
  factory :account, class: Pageflow::Account do
3
3
  name { 'Account Name' }
4
4
 
5
- after(:build) do |account|
6
- account.default_theming ||= build(:theming, account: account)
5
+ after(:build) do |account, evaluator|
6
+ account.default_site ||=
7
+ build(:site, account: account, **evaluator.default_site_attributes)
7
8
  end
8
9
 
9
10
  trait(:with_first_paged_entry_template) do
@@ -21,6 +22,8 @@ FactoryBot.define do
21
22
 
22
23
  with_feature { nil }
23
24
  without_feature { nil }
25
+
26
+ default_site_attributes { {} }
24
27
  end
25
28
 
26
29
  after(:create) do |account, evaluator|
@@ -4,7 +4,7 @@ module Pageflow
4
4
  transient do
5
5
  title
6
6
  account
7
- theming
7
+ site
8
8
  type_name { 'paged' }
9
9
  revision_attributes { {} }
10
10
 
@@ -16,7 +16,7 @@ module Pageflow
16
16
  DraftEntry.new(create(:entry,
17
17
  title: title,
18
18
  account: account,
19
- theming: theming,
19
+ site: site,
20
20
  type_name: type_name,
21
21
  draft_attributes: revision_attributes,
22
22
  with_feature: with_feature,
@@ -10,7 +10,7 @@ module Pageflow
10
10
  account
11
11
 
12
12
  after(:build) do |entry|
13
- entry.theming ||= entry.account.default_theming
13
+ entry.site ||= entry.account.default_site
14
14
  end
15
15
 
16
16
  transient do
@@ -58,7 +58,7 @@ module Pageflow
58
58
  evaluator.permalink_attributes[:directory] ||
59
59
  build(
60
60
  :permalink_directory,
61
- theming: entry.theming,
61
+ site: entry.site,
62
62
  path: evaluator.permalink_attributes.fetch(:directory_path, '')
63
63
  )
64
64
 
@@ -1,7 +1,7 @@
1
1
  module Pageflow
2
2
  FactoryBot.define do
3
3
  factory :entry_template, class: Pageflow::EntryTemplate do
4
- account
4
+ site
5
5
  entry_type_name { 'paged' }
6
6
  theme_name { 'default' }
7
7
  end
@@ -1,6 +1,6 @@
1
1
  FactoryBot.define do
2
2
  factory :permalink_directory, class: Pageflow::PermalinkDirectory do
3
- theming
3
+ site
4
4
  path { '' }
5
5
  end
6
6
  end
@@ -4,7 +4,7 @@ module Pageflow
4
4
  transient do
5
5
  title
6
6
  account
7
- theming
7
+ site
8
8
  type_name { 'paged' }
9
9
  revision_attributes { {} }
10
10
  permalink_attributes { nil }
@@ -18,7 +18,7 @@ module Pageflow
18
18
  :published,
19
19
  title: title,
20
20
  account: account,
21
- theming: theming,
21
+ site: site,
22
22
  type_name: type_name,
23
23
  published_revision_attributes: revision_attributes,
24
24
  permalink_attributes: permalink_attributes,
@@ -0,0 +1,9 @@
1
+ module Pageflow
2
+ FactoryBot.define do
3
+ factory :site, class: Pageflow::Site do
4
+ after(:build) do |site|
5
+ site.account ||= build(:account, default_site: site)
6
+ end
7
+ end
8
+ end
9
+ end