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
@@ -1,7 +1,7 @@
|
|
1
1
|
module Pageflow
|
2
2
|
module EntriesHelper
|
3
3
|
def pretty_entry_title(entry)
|
4
|
-
[entry.title, entry.
|
4
|
+
[entry.title, entry.site.cname_domain.presence].compact.join(' - ')
|
5
5
|
end
|
6
6
|
|
7
7
|
def pretty_entry_url(entry, options = {})
|
@@ -20,21 +20,21 @@ module Pageflow
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def with_custom_canonical_url_prefix(entry)
|
23
|
-
return if entry.
|
23
|
+
return if entry.site.canonical_entry_url_prefix.blank?
|
24
24
|
entry = ensure_entry_with_revision(entry)
|
25
25
|
|
26
26
|
[
|
27
|
-
entry.
|
27
|
+
entry.site.canonical_entry_url_prefix.gsub(':locale', entry.locale),
|
28
28
|
entry.to_param,
|
29
|
-
entry.
|
29
|
+
entry.site.trailing_slash_in_canonical_urls ? '/' : ''
|
30
30
|
].join
|
31
31
|
end
|
32
32
|
|
33
33
|
def default(routes, entry, options)
|
34
34
|
params =
|
35
35
|
options
|
36
|
-
.reverse_merge(trailing_slash: entry.
|
37
|
-
.reverse_merge(Pageflow.config.
|
36
|
+
.reverse_merge(trailing_slash: entry.site.trailing_slash_in_canonical_urls)
|
37
|
+
.reverse_merge(Pageflow.config.site_url_options(entry.site) || {})
|
38
38
|
|
39
39
|
if entry.permalink.present?
|
40
40
|
routes.permalink_url(
|
@@ -57,8 +57,8 @@ module Pageflow
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def entry_privacy_link_url(entry)
|
60
|
-
return unless entry.
|
61
|
-
"#{entry.
|
60
|
+
return unless entry.site.privacy_link_url.present?
|
61
|
+
"#{entry.site.privacy_link_url}?lang=#{entry.locale}"
|
62
62
|
end
|
63
63
|
|
64
64
|
def entry_file_rights(entry)
|
@@ -80,23 +80,23 @@ module Pageflow
|
|
80
80
|
def entry_global_links(entry)
|
81
81
|
links = []
|
82
82
|
|
83
|
-
if entry.
|
84
|
-
links << link_to(raw(entry.
|
85
|
-
entry.
|
83
|
+
if entry.site.imprint_link_label.present? && entry.site.imprint_link_url.present?
|
84
|
+
links << link_to(raw(entry.site.imprint_link_label),
|
85
|
+
entry.site.imprint_link_url,
|
86
86
|
target: '_blank',
|
87
87
|
tabindex: 2,
|
88
88
|
class: 'legal')
|
89
89
|
end
|
90
90
|
|
91
|
-
if entry.
|
92
|
-
links << link_to(raw(entry.
|
93
|
-
entry.
|
91
|
+
if entry.site.copyright_link_label.present? && entry.site.copyright_link_url.present?
|
92
|
+
links << link_to(raw(entry.site.copyright_link_label),
|
93
|
+
entry.site.copyright_link_url,
|
94
94
|
target: '_blank',
|
95
95
|
tabindex: 2,
|
96
96
|
class: 'copy')
|
97
97
|
end
|
98
98
|
|
99
|
-
if entry.
|
99
|
+
if entry.site.privacy_link_url.present?
|
100
100
|
links << link_to(I18n.t('pageflow.public.privacy_notice'),
|
101
101
|
entry_privacy_link_url(entry),
|
102
102
|
target: '_blank',
|
@@ -32,8 +32,8 @@ module Pageflow
|
|
32
32
|
|
33
33
|
title = ["#{entry.title}:"]
|
34
34
|
title << page.title
|
35
|
-
title << '-' if entry.
|
36
|
-
title << entry.
|
35
|
+
title << '-' if entry.site.cname_domain.present?
|
36
|
+
title << entry.site.cname_domain
|
37
37
|
|
38
38
|
title.join(' ')
|
39
39
|
end
|
@@ -9,47 +9,21 @@ module Pageflow
|
|
9
9
|
has_many :users, through: :memberships, source: :user, class_name: '::User'
|
10
10
|
has_many :entry_memberships, through: :entries, source: :memberships
|
11
11
|
|
12
|
-
has_many :
|
13
|
-
|
14
|
-
belongs_to :default_theming, :class_name => 'Theming'
|
12
|
+
has_many :sites, dependent: :destroy
|
13
|
+
belongs_to :default_site, :class_name => 'Site'
|
15
14
|
|
16
|
-
validates :
|
17
|
-
validates_associated :entry_templates
|
15
|
+
validates :default_site, :presence => true
|
18
16
|
|
19
|
-
accepts_nested_attributes_for :
|
17
|
+
accepts_nested_attributes_for :default_site, :update_only => true
|
20
18
|
|
21
19
|
scope :with_landing_page, -> { where.not(:landing_page_name => '') }
|
22
20
|
|
23
|
-
def
|
24
|
-
super.tap do |
|
25
|
-
|
21
|
+
def build_default_site(*args)
|
22
|
+
super.tap do |site|
|
23
|
+
site.account = self
|
26
24
|
end
|
27
25
|
end
|
28
26
|
|
29
|
-
def first_paged_entry_template
|
30
|
-
EntryTemplate.find_or_initialize_by(account: self, entry_type_name: 'paged')
|
31
|
-
end
|
32
|
-
|
33
|
-
def existing_and_potential_entry_templates
|
34
|
-
entry_type_names = Pageflow.config_for(self).entry_types.map(&:name)
|
35
|
-
existing_entry_templates = EntryTemplate.where(account_id: id).load
|
36
|
-
allowed_existing_entry_templates =
|
37
|
-
existing_entry_templates.select do |template|
|
38
|
-
entry_type_names.include?(template.entry_type_name)
|
39
|
-
end
|
40
|
-
free_type_names =
|
41
|
-
entry_type_names - allowed_existing_entry_templates.map(&:entry_type_name)
|
42
|
-
|
43
|
-
potential_entry_templates = free_type_names.map do |type_name|
|
44
|
-
EntryTemplate.new(
|
45
|
-
account_id: id,
|
46
|
-
entry_type_name: type_name
|
47
|
-
)
|
48
|
-
end
|
49
|
-
|
50
|
-
allowed_existing_entry_templates + potential_entry_templates
|
51
|
-
end
|
52
|
-
|
53
27
|
def blacklist_for_serialization
|
54
28
|
[:features_configuration]
|
55
29
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Pageflow
|
2
|
-
class
|
3
|
-
def call(
|
4
|
-
|
2
|
+
class CnameSiteRequestScope
|
3
|
+
def call(sites, request)
|
4
|
+
sites.where(<<-SQL, host: request.host)
|
5
5
|
cname = :host OR
|
6
6
|
FIND_IN_SET(
|
7
7
|
:host,
|
@@ -13,7 +13,7 @@ module Pageflow
|
|
13
13
|
|
14
14
|
belongs_to :account, counter_cache: true
|
15
15
|
belongs_to :folder, optional: true
|
16
|
-
belongs_to :
|
16
|
+
belongs_to :site
|
17
17
|
|
18
18
|
has_many :revisions, -> { order('frozen_at DESC') }
|
19
19
|
|
@@ -36,7 +36,7 @@ module Pageflow
|
|
36
36
|
|
37
37
|
has_secure_password validations: false
|
38
38
|
|
39
|
-
validates :account, :
|
39
|
+
validates :account, :site, :presence => true
|
40
40
|
validates :title, presence: true
|
41
41
|
validate :entry_type_is_available_for_account
|
42
42
|
validate :folder_belongs_to_same_account
|
@@ -57,8 +57,7 @@ module Pageflow
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def entry_template
|
60
|
-
@entry_template ||=
|
61
|
-
account_id: account.id,
|
60
|
+
@entry_template ||= site.entry_templates.find_or_initialize_by(
|
62
61
|
entry_type_name: type_name
|
63
62
|
)
|
64
63
|
end
|
@@ -15,7 +15,7 @@ module Pageflow
|
|
15
15
|
|
16
16
|
delegate(:id, :slug,
|
17
17
|
:entry_type,
|
18
|
-
:account, :
|
18
|
+
:account, :site,
|
19
19
|
:permalink,
|
20
20
|
:feature_state, :enabled_feature_names,
|
21
21
|
:edit_lock,
|
@@ -47,7 +47,7 @@ module Pageflow
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def home_button
|
50
|
-
HomeButton.new(revision,
|
50
|
+
HomeButton.new(revision, site)
|
51
51
|
end
|
52
52
|
|
53
53
|
def overview_button
|
@@ -45,7 +45,7 @@ module Pageflow
|
|
45
45
|
type_name: original_entry.type_name,
|
46
46
|
title: new_title,
|
47
47
|
account: original_entry.account,
|
48
|
-
|
48
|
+
site: original_entry.site,
|
49
49
|
features_configuration: original_entry.features_configuration,
|
50
50
|
|
51
51
|
skip_draft_creation: true
|
@@ -3,15 +3,15 @@ module Pageflow
|
|
3
3
|
include ThemeReferencer
|
4
4
|
include SerializedConfiguration
|
5
5
|
serialize :default_share_providers, JSON
|
6
|
-
belongs_to :
|
7
|
-
delegate :enabled_feature_names, to: :
|
6
|
+
belongs_to :site
|
7
|
+
delegate :enabled_feature_names, to: :site
|
8
8
|
has_many :widgets, as: :subject, dependent: :destroy
|
9
9
|
|
10
|
-
validates :
|
10
|
+
validates :site, presence: true
|
11
11
|
validates :entry_type_name, presence: true
|
12
12
|
validates :entry_type_name,
|
13
13
|
uniqueness: {
|
14
|
-
scope: :
|
14
|
+
scope: :site
|
15
15
|
}
|
16
16
|
|
17
17
|
def entry_type
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Pageflow
|
2
2
|
class HomeButton
|
3
|
-
attr_reader :revision, :
|
3
|
+
attr_reader :revision, :site
|
4
4
|
|
5
|
-
def initialize(revision,
|
5
|
+
def initialize(revision, site)
|
6
6
|
@revision = revision
|
7
|
-
@
|
7
|
+
@site = site
|
8
8
|
end
|
9
9
|
|
10
10
|
def url
|
11
|
-
revision.configuration['home_url'].presence ||
|
11
|
+
revision.configuration['home_url'].presence || site_home_button_url
|
12
12
|
end
|
13
13
|
|
14
14
|
def enabled?
|
@@ -27,9 +27,9 @@ module Pageflow
|
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
|
-
def
|
31
|
-
if
|
32
|
-
options = Pageflow.config.
|
30
|
+
def site_home_button_url
|
31
|
+
if site.home_url.present?
|
32
|
+
options = Pageflow.config.site_url_options(site) || {}
|
33
33
|
Pageflow::Engine.routes.url_for(options.merge(controller: 'pageflow/entries',
|
34
34
|
action: 'index',
|
35
35
|
only_path: !options[:host]))
|
@@ -14,7 +14,7 @@ module Pageflow
|
|
14
14
|
format: /\A[0-9a-zA-Z_-]+\z/,
|
15
15
|
uniqueness: {scope: :directory})
|
16
16
|
|
17
|
-
validate :
|
17
|
+
validate :belongs_to_same_site_as_entry
|
18
18
|
|
19
19
|
private
|
20
20
|
|
@@ -30,8 +30,8 @@ module Pageflow
|
|
30
30
|
slug.nil?
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
return if !directory || !entry || entry.
|
33
|
+
def belongs_to_same_site_as_entry
|
34
|
+
return if !directory || !entry || entry.site_id == directory.site_id
|
35
35
|
|
36
36
|
errors.add(:directory, :invalid)
|
37
37
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Pageflow
|
2
2
|
# @api private
|
3
3
|
class PermalinkDirectory < ApplicationRecord
|
4
|
-
belongs_to :
|
4
|
+
belongs_to :site
|
5
5
|
|
6
6
|
validates(:path,
|
7
7
|
format: %r{\A([0-9a-zA-Z-]+/)*\z},
|
8
|
-
uniqueness: {scope: :
|
8
|
+
uniqueness: {scope: :site_id})
|
9
9
|
end
|
10
10
|
end
|
@@ -60,7 +60,7 @@ module Pageflow
|
|
60
60
|
self.class.model_name.cache_key,
|
61
61
|
entry.cache_key,
|
62
62
|
revision.cache_key,
|
63
|
-
|
63
|
+
site.cache_key
|
64
64
|
].compact.join('-')
|
65
65
|
end
|
66
66
|
|
@@ -68,7 +68,7 @@ module Pageflow
|
|
68
68
|
[
|
69
69
|
entry.cache_version,
|
70
70
|
revision.cache_version,
|
71
|
-
|
71
|
+
site.cache_version
|
72
72
|
].compact.join('-').presence
|
73
73
|
end
|
74
74
|
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Pageflow
|
2
|
+
class Site < ApplicationRecord
|
3
|
+
belongs_to :account
|
4
|
+
|
5
|
+
has_many :entry_templates, dependent: :destroy
|
6
|
+
has_many :entries
|
7
|
+
has_many :permalink_directories, -> { order('path ASC') }
|
8
|
+
|
9
|
+
scope :with_home_url, -> { where.not(home_url: '') }
|
10
|
+
scope :for_request, ->(request) { Pageflow.config.site_request_scope.call(all, request) }
|
11
|
+
|
12
|
+
validates :account, :presence => true
|
13
|
+
|
14
|
+
delegate :enabled_feature_names, to: :account
|
15
|
+
|
16
|
+
def display_name
|
17
|
+
name.presence || I18n.t('pageflow.admin.sites.default_name')
|
18
|
+
end
|
19
|
+
|
20
|
+
def name_with_account_prefix
|
21
|
+
[account.name, name].compact.join(' - ')
|
22
|
+
end
|
23
|
+
|
24
|
+
def host
|
25
|
+
Pageflow.config.site_url_options(self)&.dig(:host)
|
26
|
+
end
|
27
|
+
|
28
|
+
def cname_domain
|
29
|
+
cname.split('.').pop(2).join('.')
|
30
|
+
end
|
31
|
+
|
32
|
+
def first_paged_entry_template
|
33
|
+
entry_templates.find_or_initialize_by(entry_type_name: 'paged')
|
34
|
+
end
|
35
|
+
|
36
|
+
def existing_and_potential_entry_templates
|
37
|
+
entry_type_names = Pageflow.config_for(account).entry_types.map(&:name)
|
38
|
+
|
39
|
+
allowed_existing_entry_templates =
|
40
|
+
entry_templates.where(entry_type_name: entry_type_names)
|
41
|
+
|
42
|
+
free_type_names =
|
43
|
+
entry_type_names - allowed_existing_entry_templates.map(&:entry_type_name)
|
44
|
+
|
45
|
+
potential_entry_templates = free_type_names.map do |type_name|
|
46
|
+
entry_templates.build(entry_type_name: type_name)
|
47
|
+
end
|
48
|
+
|
49
|
+
allowed_existing_entry_templates + potential_entry_templates
|
50
|
+
end
|
51
|
+
|
52
|
+
# @deprecated Depending on what you need this for, consider
|
53
|
+
# scoping your code to an entry type or look at a specific entry's
|
54
|
+
# theme name.
|
55
|
+
def theme_name
|
56
|
+
first_paged_entry_template.theme_name
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -29,7 +29,7 @@ module Pageflow
|
|
29
29
|
entry_creatable
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def sites_accessible
|
33
33
|
entry_creatable
|
34
34
|
end
|
35
35
|
|
@@ -62,7 +62,7 @@ module Pageflow
|
|
62
62
|
publish?
|
63
63
|
end
|
64
64
|
|
65
|
-
def
|
65
|
+
def update_site_on_entry_of?
|
66
66
|
publish?
|
67
67
|
end
|
68
68
|
|
@@ -127,9 +127,9 @@ module Pageflow
|
|
127
127
|
publish_on_account_of?
|
128
128
|
end
|
129
129
|
|
130
|
-
def
|
130
|
+
def update_site_on?
|
131
131
|
user.admin? ||
|
132
|
-
(!permissions_config.
|
132
|
+
(!permissions_config.only_admins_may_update_site &&
|
133
133
|
publish_on_account_of?)
|
134
134
|
end
|
135
135
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Pageflow
|
2
|
-
class
|
2
|
+
class SitePolicy < ApplicationPolicy
|
3
3
|
class Scope < Scope
|
4
4
|
attr_reader :user, :scope
|
5
5
|
|
@@ -8,7 +8,7 @@ module Pageflow
|
|
8
8
|
@scope = scope
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def sites_allowed_for(accounts)
|
12
12
|
if user.admin?
|
13
13
|
scope.all
|
14
14
|
else
|
@@ -23,7 +23,7 @@ module Pageflow
|
|
23
23
|
def publisher_memberships_for_accounts(user, accounts_ids)
|
24
24
|
sanitize_sql_array(['LEFT OUTER JOIN pageflow_memberships ON ' \
|
25
25
|
'pageflow_memberships.user_id = :user_id AND ' \
|
26
|
-
'
|
26
|
+
'pageflow_sites.account_id IN (:accounts_ids) AND ' \
|
27
27
|
'pageflow_memberships.entity_id IN (:accounts_ids) AND ' \
|
28
28
|
'pageflow_memberships.entity_type = \'Pageflow::Account\' AND ' \
|
29
29
|
'pageflow_memberships.role IN (\'publisher\', \'manager\')',
|
@@ -35,19 +35,21 @@ module Pageflow
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
attr_reader :user
|
39
|
+
|
40
|
+
def initialize(user, site)
|
39
41
|
@user = user
|
40
|
-
@
|
42
|
+
@account_role_query = AccountRoleQuery.new(user, site.account)
|
41
43
|
end
|
42
44
|
|
43
|
-
def
|
44
|
-
|
45
|
+
def read?
|
46
|
+
@user.admin? ||
|
47
|
+
(@account_role_query.has_at_least_role?(:manager) &&
|
48
|
+
Pageflow.config.allow_multiaccount_users)
|
45
49
|
end
|
46
50
|
|
47
|
-
|
48
|
-
|
49
|
-
def allows?(roles)
|
50
|
-
@user.memberships.where(role: roles, entity: @theming.account).any?
|
51
|
+
def update?
|
52
|
+
read?
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
h5(entry_template.translated_entry_type_name)
|
2
2
|
|
3
3
|
extensible_attributes_table_for(entry_template,
|
4
|
-
Pageflow.config_for(entry_template.account)
|
4
|
+
Pageflow.config_for(entry_template.site.account)
|
5
5
|
.admin_attributes_table_rows.for(:entry_template)) do
|
6
6
|
row :theme, class: 'theme' do
|
7
7
|
entry_template.theme_name
|
@@ -10,29 +10,11 @@
|
|
10
10
|
<% end %>
|
11
11
|
<% end %>
|
12
12
|
|
13
|
-
|
14
|
-
<%= f.
|
15
|
-
<%=
|
16
|
-
<%= theming.input :additional_cnames, hint: t('pageflow.admin.themings.additional_cnames_hint') %>
|
17
|
-
<%= theming.input :home_url, hint: t('pageflow.admin.themings.home_url_hint') %>
|
13
|
+
<% if resource.new_record? %>
|
14
|
+
<%= f.semantic_fields_for :default_site do |site| %>
|
15
|
+
<%= render 'admin/sites/fields', f: site, account_config: account_config %>
|
18
16
|
<% end %>
|
19
|
-
|
20
|
-
<%= f.inputs do %>
|
21
|
-
<%= theming.input :imprint_link_label %>
|
22
|
-
<%= theming.input :imprint_link_url %>
|
23
|
-
<%= theming.input :copyright_link_label %>
|
24
|
-
<%= theming.input :copyright_link_url %>
|
25
|
-
<%= theming.input :privacy_link_url %>
|
26
|
-
|
27
|
-
<% account_config.admin_form_inputs.find_all_for(:theming).each do |form_input| %>
|
28
|
-
<%= form_input.build(theming) %>
|
29
|
-
<% end %>
|
30
|
-
<% end %>
|
31
|
-
<% end %>
|
32
|
-
|
33
|
-
<p>
|
34
|
-
<%= t('pageflow.admin.accounts.entry_template_hint') %>
|
35
|
-
</p>
|
17
|
+
<% end %>
|
36
18
|
|
37
19
|
<%= f.actions do %>
|
38
20
|
<%= f.action(:submit) %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= admin_form_for([:admin, resource]) do |f| %>
|
2
2
|
<%= f.inputs do %>
|
3
3
|
<%= f.input(:title,
|
4
|
-
hint: @entry.
|
4
|
+
hint: @entry.site.permalink_directories.blank? &&
|
5
5
|
I18n.t('pageflow.admin.entries.title_hint')) %>
|
6
6
|
|
7
7
|
<% if authorized?(:update_account_on, resource) &&
|
@@ -16,18 +16,9 @@
|
|
16
16
|
input_html: {class: 'entry_account_input'}) %>
|
17
17
|
<%end %>
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
ajax: {
|
23
|
-
resource: Pageflow::Entry,
|
24
|
-
collection_name: :eligible_themings,
|
25
|
-
params: {
|
26
|
-
entry_id: resource.id
|
27
|
-
}
|
28
|
-
},
|
29
|
-
include_blank: false) %>
|
30
|
-
<% end %>
|
19
|
+
<%= render('admin/entries/site_input',
|
20
|
+
entry: resource,
|
21
|
+
form: f) %>
|
31
22
|
|
32
23
|
<%= f.fields_for(:permalink, @entry.permalink || Pageflow::Permalink.new) do |permalink| %>
|
33
24
|
<%= render('admin/entries/permalink_inputs',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= form.input(:permalink,
|
2
2
|
as: :pageflow_permalink,
|
3
|
-
base_url:
|
4
|
-
directory_collection: collection_for_permalink_directories(entry.
|
3
|
+
base_url: pretty_site_url(entry.site),
|
4
|
+
directory_collection: collection_for_permalink_directories(entry.site,
|
5
5
|
form.object),
|
6
6
|
slug_placeholder: entry.default_permalink_slug) %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if authorized?(:update_site_on, entry) %>
|
2
|
+
<%= form.input(:site,
|
3
|
+
as: :searchable_select,
|
4
|
+
ajax: {
|
5
|
+
resource: Pageflow::Entry,
|
6
|
+
collection_name: :eligible_sites,
|
7
|
+
params: {
|
8
|
+
account_id: entry.account_id
|
9
|
+
}
|
10
|
+
},
|
11
|
+
include_blank: false,
|
12
|
+
wrapper_html: {
|
13
|
+
style: ('display: none' if site_policy_scope.sites_allowed_for(entry.account).one?)
|
14
|
+
}) %>
|
15
|
+
<% end %>
|
@@ -1,4 +1,7 @@
|
|
1
1
|
<%= fields_for(:entry, @entry, builder: ActiveAdmin::FormBuilder) do |form| %>
|
2
|
+
<%= render('admin/entries/site_input',
|
3
|
+
entry: @entry,
|
4
|
+
form: form) %>
|
2
5
|
<%= render('pageflow/admin/entries/entry_type_name_input',
|
3
6
|
form: form,
|
4
7
|
entry_types: Pageflow.config_for(@entry.account).entry_types) %>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
<%= f.inputs do %>
|
6
6
|
<%= f.semantic_errors :entry_type_name %>
|
7
|
-
<%= render('admin/accounts/
|
7
|
+
<%= render('admin/accounts/site_defaults_inline_help') %>
|
8
8
|
<%= f.hidden_field :entry_type_name, value: entry_type_name %>
|
9
9
|
<%= f.input :default_locale,
|
10
10
|
as: :select,
|
@@ -12,15 +12,15 @@
|
|
12
12
|
collection: Pageflow.config.available_public_locales.map{ |locale|
|
13
13
|
[t('pageflow.public._language', locale: locale), locale.to_s]
|
14
14
|
},
|
15
|
-
hint: t('pageflow.admin.
|
15
|
+
hint: t('pageflow.admin.sites.default_locale_hint') %>
|
16
16
|
<%= f.input :default_author,
|
17
|
-
hint: t('pageflow.admin.
|
17
|
+
hint: t('pageflow.admin.sites.default_author_hint'),
|
18
18
|
placeholder: Pageflow.config.default_author_meta_tag %>
|
19
19
|
<%= f.input :default_publisher,
|
20
|
-
hint: t('pageflow.admin.
|
20
|
+
hint: t('pageflow.admin.sites.default_publisher_hint'),
|
21
21
|
placeholder: Pageflow.config.default_publisher_meta_tag %>
|
22
22
|
<%= f.input :default_keywords,
|
23
|
-
hint: t('pageflow.admin.
|
23
|
+
hint: t('pageflow.admin.sites.default_keywords_hint'),
|
24
24
|
placeholder: Pageflow.config.default_keywords_meta_tag %>
|
25
25
|
<%= render('admin/accounts/share_providers_label') %>
|
26
26
|
<%= f.semantic_fields_for :share_providers,
|