pageflow 15.1.0.beta2 → 15.1.0.beta3

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 (162) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +141 -1
  3. data/README.md +3 -6
  4. data/admins/pageflow/entry.rb +1 -1
  5. data/app/assets/javascripts/pageflow/dist/editor.js +1241 -1281
  6. data/app/assets/javascripts/pageflow/dist/react-client.js +3 -3
  7. data/app/assets/javascripts/pageflow/dist/react-server.js +2 -2
  8. data/app/assets/javascripts/pageflow/dist/ui.js +241 -57
  9. data/app/assets/javascripts/pageflow/editor/base.js +0 -20
  10. data/app/assets/javascripts/pageflow/editor/vendor.js +16 -0
  11. data/app/assets/stylesheets/pageflow/admin/embedded_index_table.scss +5 -1
  12. data/app/controllers/concerns/pageflow/controller_delegation.rb +31 -0
  13. data/app/controllers/concerns/pageflow/entry_password_protection.rb +4 -4
  14. data/app/controllers/pageflow/editor/entries_controller.rb +35 -0
  15. data/app/controllers/pageflow/editor/file_import_controller.rb +1 -1
  16. data/app/controllers/pageflow/editor/files_controller.rb +1 -1
  17. data/app/controllers/pageflow/entries_controller.rb +29 -71
  18. data/app/controllers/pageflow/revisions_controller.rb +16 -5
  19. data/app/helpers/pageflow/common_entry_seed_helper.rb +9 -24
  20. data/app/helpers/pageflow/config_helper.rb +25 -3
  21. data/app/helpers/pageflow/editor/config_helper.rb +12 -0
  22. data/app/helpers/pageflow/editor/entries_helper.rb +10 -0
  23. data/app/helpers/pageflow/editor/files_helper.rb +24 -0
  24. data/app/helpers/pageflow/entries_helper.rb +5 -4
  25. data/app/helpers/pageflow/entry_json_seed_helper.rb +1 -0
  26. data/app/helpers/pageflow/files_helper.rb +14 -13
  27. data/app/helpers/pageflow/page_types_helper.rb +4 -1
  28. data/app/helpers/pageflow/render_json_helper.rb +30 -5
  29. data/app/models/concerns/pageflow/auto_generated_perma_id.rb +16 -0
  30. data/app/models/concerns/pageflow/feature_target.rb +3 -3
  31. data/app/models/pageflow/draft_entry.rb +3 -0
  32. data/app/models/pageflow/home_button.rb +3 -1
  33. data/app/models/pageflow/page.rb +1 -6
  34. data/app/models/pageflow/published_entry.rb +1 -0
  35. data/app/models/pageflow/revision.rb +3 -0
  36. data/app/models/pageflow/storyline.rb +0 -2
  37. data/app/views/admin/entries/_links.html.arb +1 -1
  38. data/app/views/admin/features/_form.html.erb +1 -1
  39. data/app/views/components/pageflow/admin/add_membership_button.rb +13 -1
  40. data/app/views/layouts/pageflow/application.html.erb +3 -19
  41. data/app/views/layouts/pageflow/editor.html.erb +18 -0
  42. data/app/views/pageflow/admin/accounts/_cannot_add_account.html.erb +0 -0
  43. data/app/views/pageflow/admin/entries/_cannot_add_user.html.erb +5 -0
  44. data/app/views/pageflow/admin/users/_cannot_add.html.erb +8 -0
  45. data/app/views/pageflow/admin/users/_cannot_add_account.html.erb +0 -0
  46. data/app/views/pageflow/admin/users/_cannot_add_entry.html +0 -0
  47. data/app/views/pageflow/{config/_editor_seeds.json.jbuilder → editor/config/_seeds.json.jbuilder} +3 -2
  48. data/app/views/pageflow/editor/entries/seed.json.erb +5 -4
  49. data/app/views/pageflow/{entries/edit.html.erb → editor/entries/show.html.erb} +5 -9
  50. data/app/views/pageflow/{entries → editor/entries}/show.json.jbuilder +0 -0
  51. data/app/views/pageflow/entries/{show.css.erb → stylesheet.css.erb} +0 -0
  52. data/app/views/pageflow/entry_json_seed/_entry.json.jbuilder +2 -8
  53. data/config/initializers/entry_types.rb +4 -0
  54. data/config/initializers/features.rb +0 -10
  55. data/config/initializers/help_entries.rb +0 -8
  56. data/config/locales/de.yml +4 -0
  57. data/config/locales/en.yml +4 -0
  58. data/config/routes.rb +10 -5
  59. data/db/migrate/20191202145757_create_pageflow_scrolled_sections.rb +21 -0
  60. data/db/migrate/20191202150657_create_pageflow_scrolled_chapters.rb +11 -0
  61. data/db/migrate/20191202154723_create_pageflow_scrolled_content_elements.rb +21 -0
  62. data/db/migrate/20191219143450_add_position_to_content_elements.rb +5 -0
  63. data/db/migrate/20191220100946_create_pageflow_scrolled_storylines.rb +24 -0
  64. data/entry_types/paged/app/assets/javascripts/pageflow_paged/dist/editor.js +9805 -114
  65. data/entry_types/paged/app/assets/javascripts/pageflow_paged/editor.js +7 -0
  66. data/entry_types/paged/app/assets/stylesheets/pageflow_paged/editor.scss +1 -0
  67. data/entry_types/paged/app/controllers/concerns/pageflow_paged/without_controller_namespace_partial_path_prefix.rb +21 -0
  68. data/entry_types/paged/app/controllers/pageflow_paged/application_controller.rb +25 -0
  69. data/entry_types/paged/app/controllers/pageflow_paged/editor/entries_controller.rb +17 -0
  70. data/entry_types/paged/app/controllers/pageflow_paged/entries_controller.rb +25 -0
  71. data/{app/views/layouts/pageflow → entry_types/paged/app/views/layouts/pageflow_paged}/_ie_include_tags.html.erb +0 -0
  72. data/{app/views/layouts/pageflow → entry_types/paged/app/views/layouts/pageflow_paged}/_loading_spinner_inline_script.html.erb +0 -0
  73. data/entry_types/paged/app/views/layouts/pageflow_paged/application.html.erb +33 -0
  74. data/entry_types/paged/app/views/pageflow_paged/chapters/_chapter.html.erb +7 -0
  75. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_body.html.erb +4 -0
  76. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_head.html.erb +12 -0
  77. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_indicators_seed.html.erb +3 -0
  78. data/entry_types/paged/app/views/pageflow_paged/editor/entries/_seed.json.jbuilder +0 -0
  79. data/entry_types/paged/app/views/pageflow_paged/editor/entries/partials.html.erb +3 -0
  80. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_entry.html.erb +7 -5
  81. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_header.html.erb +0 -0
  82. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_ie8_hint.html.erb +0 -0
  83. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_indicators.html.erb +0 -0
  84. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_multimedia_alert.html.erb +0 -0
  85. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_non_js_hint.html.erb +0 -0
  86. data/entry_types/paged/app/views/pageflow_paged/entries/_overview.html.erb +1 -0
  87. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/_skip_links.html.erb +0 -0
  88. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/overview/_chapter.html.erb +3 -1
  89. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/overview/_entry.html.erb +1 -1
  90. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/overview/_page.html.erb +0 -0
  91. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/entries/show.html.erb +3 -3
  92. data/{app/views/pageflow → entry_types/paged/app/views/pageflow_paged}/pages/_page.html.erb +1 -1
  93. data/entry_types/paged/config/initializers/features.rb +16 -0
  94. data/entry_types/paged/config/initializers/page_types.rb +16 -0
  95. data/entry_types/paged/config/routes.rb +3 -0
  96. data/entry_types/paged/lib/pageflow_paged.rb +19 -0
  97. data/entry_types/paged/lib/pageflow_paged/configuration.rb +16 -0
  98. data/entry_types/paged/lib/pageflow_paged/engine.rb +7 -0
  99. data/entry_types/paged/lib/pageflow_paged/plugin.rb +8 -0
  100. data/entry_types/scrolled/app/assets/stylesheets/pageflow_scrolled/editor.scss +1 -0
  101. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/chapters_controller.rb +56 -0
  102. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/content_elements_controller.rb +61 -0
  103. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/entries_controller.rb +8 -0
  104. data/entry_types/scrolled/app/controllers/pageflow_scrolled/editor/sections_controller.rb +59 -0
  105. data/entry_types/scrolled/app/controllers/pageflow_scrolled/entries_controller.rb +10 -0
  106. data/entry_types/scrolled/app/helpers/pageflow_scrolled/editor/seed_html_helper.rb +21 -0
  107. data/entry_types/scrolled/app/helpers/pageflow_scrolled/entry_json_seed_helper.rb +33 -0
  108. data/entry_types/scrolled/app/models/pageflow_scrolled/chapter.rb +40 -0
  109. data/entry_types/scrolled/app/models/pageflow_scrolled/content_element.rb +17 -0
  110. data/entry_types/scrolled/app/models/pageflow_scrolled/section.rb +26 -0
  111. data/entry_types/scrolled/app/models/pageflow_scrolled/storyline.rb +39 -0
  112. data/entry_types/scrolled/app/views/pageflow_scrolled/chapters/_chapter.json.jbuilder +8 -0
  113. data/entry_types/scrolled/app/views/pageflow_scrolled/content_elements/_content_element.json.jbuilder +9 -0
  114. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_body.html.erb +1 -0
  115. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_head.html.erb +12 -0
  116. data/entry_types/scrolled/app/views/pageflow_scrolled/editor/entries/_seed.json.jbuilder +1 -0
  117. data/entry_types/scrolled/app/views/pageflow_scrolled/entries/show.html.erb +22 -0
  118. data/entry_types/scrolled/app/views/pageflow_scrolled/entry_json_seed/_entry.json.jbuilder +35 -0
  119. data/entry_types/scrolled/app/views/pageflow_scrolled/sections/_section.json.jbuilder +8 -0
  120. data/entry_types/scrolled/config/routes.rb +23 -0
  121. data/entry_types/scrolled/lib/generators/pageflow_scrolled/install/install_generator.rb +34 -0
  122. data/entry_types/scrolled/lib/pageflow_scrolled.rb +19 -0
  123. data/entry_types/scrolled/lib/pageflow_scrolled/configuration.rb +6 -0
  124. data/entry_types/scrolled/lib/pageflow_scrolled/plugin.rb +16 -0
  125. data/entry_types/scrolled/lib/pageflow_scrolled/seeds.rb +133 -0
  126. data/entry_types/scrolled/spec/factories/chapters.rb +12 -0
  127. data/entry_types/scrolled/spec/factories/content_elements.rb +36 -0
  128. data/entry_types/scrolled/spec/factories/sections.rb +26 -0
  129. data/entry_types/scrolled/spec/factories/storylines.rb +12 -0
  130. data/entry_types/scrolled/spec/fixtures/image.jpg +0 -0
  131. data/lib/generators/pageflow/active_admin_initializer/active_admin_initializer_generator.rb +1 -1
  132. data/lib/generators/pageflow/assets/assets_generator.rb +2 -2
  133. data/lib/pageflow/built_in_page_types_plugin.rb +5 -3
  134. data/lib/pageflow/built_in_widget_types_plugin.rb +38 -12
  135. data/lib/pageflow/configuration.rb +76 -15
  136. data/lib/pageflow/editor_controller.rb +44 -0
  137. data/lib/pageflow/engine.rb +2 -3
  138. data/lib/pageflow/entries_controller_env_helper.rb +44 -0
  139. data/lib/pageflow/entry_type.rb +19 -2
  140. data/lib/pageflow/entry_type_configuration.rb +44 -0
  141. data/lib/pageflow/entry_types.rb +22 -0
  142. data/lib/pageflow/feature.rb +11 -5
  143. data/lib/pageflow/file_importers.rb +2 -2
  144. data/lib/pageflow/file_type.rb +3 -2
  145. data/lib/pageflow/file_types.rb +23 -3
  146. data/lib/pageflow/global_config_api.rb +11 -4
  147. data/lib/pageflow/page_types.rb +30 -0
  148. data/lib/pageflow/partial_editor_fragment_renderer.rb +37 -0
  149. data/lib/pageflow/revision_component.rb +2 -5
  150. data/lib/pageflow/revision_components.rb +18 -0
  151. data/lib/pageflow/version.rb +1 -1
  152. data/lib/pageflow/widget_type.rb +3 -0
  153. data/lib/pageflow/widget_types.rb +1 -1
  154. data/spec/factories/draft_entries.rb +11 -0
  155. data/spec/factories/published_entries.rb +17 -0
  156. data/vendor/assets/javascripts/dash.all.min.js +0 -1
  157. metadata +146 -29
  158. data/app/views/pageflow/chapters/_chapter.html.erb +0 -5
  159. data/app/views/pageflow/editor/entries/_indicators_seed.html.erb +0 -3
  160. data/app/views/pageflow/entries/_overview.html.erb +0 -1
  161. data/app/views/pageflow/entries/partials.html.erb +0 -3
  162. data/config/initializers/page_type_helpers.rb +0 -8
@@ -0,0 +1,24 @@
1
+ module Pageflow
2
+ module Editor
3
+ # @api private
4
+ module FilesHelper
5
+ include Pageflow::FilesHelper
6
+ include AudioFilesHelper
7
+ include VideoFilesHelper
8
+ include RenderJsonHelper
9
+
10
+ def editor_files_json_seed(entry)
11
+ inner = Pageflow.config.file_types.map { |file_type|
12
+ json = render_json_partial(partial: 'pageflow/editor/files/file',
13
+ collection: entry.find_files(file_type.model),
14
+ locals: {file_type: file_type},
15
+ as: :file)
16
+
17
+ %("#{file_type.collection_name}": #{json})
18
+ }.join(',')
19
+
20
+ "{#{inner}}".html_safe
21
+ end
22
+ end
23
+ end
24
+ end
@@ -66,10 +66,11 @@ module Pageflow
66
66
  end
67
67
 
68
68
  def entry_stylesheet_link_tag(entry)
69
- url = polymorphic_path(entry.stylesheet_model,
70
- v: entry.stylesheet_cache_key,
71
- p: Pageflow::VERSION,
72
- format: 'css')
69
+ url = pageflow.polymorphic_path(entry.stylesheet_model,
70
+ action: :stylesheet,
71
+ v: entry.stylesheet_cache_key,
72
+ p: Pageflow::VERSION,
73
+ format: 'css')
73
74
 
74
75
  # We cannot use stylesheet_link_tag here since that always uses
75
76
  # the asset host. Entry stylesheet requests are subject to
@@ -5,6 +5,7 @@ module Pageflow
5
5
  module EntryJsonSeedHelper
6
6
  include RenderJsonHelper
7
7
  include CommonEntrySeedHelper
8
+ include FilesHelper
8
9
 
9
10
  def entry_json_seed(entry)
10
11
  sanitize_json(render_json_partial('pageflow/entry_json_seed/entry',
@@ -1,8 +1,7 @@
1
1
  module Pageflow
2
+ # Format and generate seed data for files
2
3
  module FilesHelper
3
4
  include RenderJsonHelper
4
- include VideoFilesHelper
5
- include AudioFilesHelper
6
5
 
7
6
  def file_format(file)
8
7
  file.format.presence || '-'
@@ -29,17 +28,19 @@ module Pageflow
29
28
  end
30
29
  end
31
30
 
32
- def files_json_seeds(entry)
33
- inner = Pageflow.config.file_types.map do |file_type|
34
- json = render_json_partial(partial: 'pageflow/editor/files/file',
35
- collection: entry.find_files(file_type.model),
36
- locals: {file_type: file_type},
37
- as: :file)
38
-
39
- %'"#{file_type.collection_name}": #{json}'
40
- end.join(',')
41
-
42
- "{#{inner}}".html_safe
31
+ # Render seed data for all files of the revision.
32
+ #
33
+ # @param [JBuilder] json
34
+ # @param [PublishedEntry] entry
35
+ # @since 15.1
36
+ def files_json_seed(json, entry)
37
+ Pageflow.config.file_types.each do |file_type|
38
+ json.set!(file_type.collection_name) do
39
+ json.array!(entry.find_files(file_type.model)) do |file|
40
+ json.partial!('pageflow/files/file', file: file, file_type: file_type)
41
+ end
42
+ end
43
+ end
43
44
  end
44
45
  end
45
46
  end
@@ -21,7 +21,10 @@ module Pageflow
21
21
  locals: {
22
22
  configuration: {},
23
23
  page: Page.new,
24
- entry: entry
24
+ entry: entry,
25
+
26
+ # Required by RevisionFileHelper#find_file_in_entry
27
+ :@entry => entry
25
28
  },
26
29
  layout: false).to_str,
27
30
  type: 'text/html', data: {template: "#{page_type.name}_page"})
@@ -1,4 +1,5 @@
1
1
  module Pageflow
2
+ # Helpers for rendering JSON seed data.
2
3
  module RenderJsonHelper
3
4
  # Renders `image_files/_image_file.json.jbuilder` when given a
4
5
  # collection of `ImageFile` records.
@@ -13,11 +14,25 @@ module Pageflow
13
14
  end
14
15
  end
15
16
 
17
+ # Render the given partial with format JSON, independent from
18
+ # currently rendered format. Can be used together with
19
+ # {sanitize_json} to render JSON to be included in an HTML script
20
+ # tag. Takes same parameters as JBuilder's partial! method.
16
21
  def render_json_partial(*args)
17
22
  render_with_format(:json) do
18
- JbuilderTemplate.encode(self) do |json|
23
+ render_json { |json|
19
24
  json.partial!(*args)
20
- end.html_safe
25
+ }.html_safe
26
+ end
27
+ end
28
+
29
+ # Yields to given block with JBuilder object and returns rendered
30
+ # JSON as string.
31
+ #
32
+ # @since 15.1
33
+ def render_json(&block)
34
+ render_with_format(:json) do
35
+ JbuilderTemplate.encode(self, &block)
21
36
  end
22
37
  end
23
38
 
@@ -25,23 +40,33 @@ module Pageflow
25
40
  "\u2028" => '\u2028',
26
41
  "\u2029" => '\u2029',
27
42
  '</' => '<\/'
28
- }
43
+ }.freeze
29
44
 
30
45
  ESCAPED_CHARS_REGEX = %r{</|[\u2028\u2029]}u
31
46
 
47
+ # Make JSON string safe for embedding in HTML script tag. Escape
48
+ # whitespace characters that are allowed in JSON but not allowed
49
+ # in HTML. Make sure closing script tag in JSON text is not
50
+ # interpreted as closing tag of the surrounding script tag.
32
51
  def sanitize_json(json)
33
52
  json.gsub(ESCAPED_CHARS_REGEX, ESCAPED_CHARS)
34
53
  end
35
54
 
55
+ # Render the given partial with format HTML, independent from
56
+ # currently rendered format. Can be used to render HTML to be
57
+ # included in a JSON response. Takes same parameters as Rails
58
+ # normal render method.
36
59
  def render_html_partial(*args)
37
60
  render_with_format(:html) do
38
61
  render(*args)
39
62
  end
40
63
  end
41
64
 
42
- def render_with_format(format, &block)
65
+ private
66
+
67
+ def render_with_format(format)
43
68
  old_formats = formats
44
- self.formats = [format] # hack so partials resolve with json not html format
69
+ self.formats = [format] # HACK: so partials resolve with json not html format
45
70
  yield
46
71
  ensure
47
72
  self.formats = old_formats
@@ -0,0 +1,16 @@
1
+ module Pageflow
2
+ # Add a +perma_id+ attribute of type integer.
3
+ # The perma_id is automatically generated on create
4
+ # and remains unchanged throughout the models lifecycle.
5
+ module AutoGeneratedPermaId
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ before_save :ensure_perma_id
10
+ end
11
+
12
+ def ensure_perma_id
13
+ self.perma_id ||= (self.class.maximum(:perma_id) || 0) + 1
14
+ end
15
+ end
16
+ end
@@ -13,10 +13,10 @@ module Pageflow
13
13
  serialize :features_configuration, JSON
14
14
  end
15
15
 
16
- def enabled_feature_names
17
- Pageflow.config.features.select do |feature|
16
+ def enabled_feature_names(config = Pageflow.config_for(self))
17
+ config.features.select { |feature|
18
18
  feature_state(feature.name) == true
19
- end.map(&:name)
19
+ }.map(&:name)
20
20
  end
21
21
 
22
22
  def feature_state(name)
@@ -14,6 +14,7 @@ module Pageflow
14
14
  :password_digest,
15
15
  :to_model, :to_key, :persisted?, :to_json,
16
16
  :first_published_at,
17
+ :type_name,
17
18
  :to => :entry)
18
19
 
19
20
  delegate(:title, :summary, :credits, :manual_start,
@@ -36,6 +37,8 @@ module Pageflow
36
37
  @draft = draft || entry.draft
37
38
  end
38
39
 
40
+ alias revision draft
41
+
39
42
  # So we can always get to the original Entry title.
40
43
  def entry_title
41
44
  entry.title
@@ -30,7 +30,9 @@ module Pageflow
30
30
  def theming_home_button_url
31
31
  if theming.home_url.present?
32
32
  options = Pageflow.config.theming_url_options(theming) || {}
33
- options.merge(controller: 'entries', action: 'index')
33
+ Pageflow::Engine.routes.url_for(options.merge(controller: 'pageflow/entries',
34
+ action: 'index',
35
+ only_path: !options[:host]))
34
36
  end
35
37
  end
36
38
  end
@@ -1,6 +1,7 @@
1
1
  module Pageflow
2
2
  class Page < ApplicationRecord
3
3
  include SerializedConfiguration
4
+ include AutoGeneratedPermaId
4
5
 
5
6
  belongs_to :chapter, touch: true
6
7
 
@@ -10,8 +11,6 @@ module Pageflow
10
11
 
11
12
  scope :displayed_in_navigation, -> { where(:display_in_navigation => true) }
12
13
 
13
- before_save :ensure_perma_id
14
-
15
14
  def title
16
15
  configuration['title'].presence || configuration['additional_title']
17
16
  end
@@ -28,9 +27,5 @@ module Pageflow
28
27
  def copy_to(chapter)
29
28
  chapter.pages << dup
30
29
  end
31
-
32
- def ensure_perma_id
33
- self.perma_id ||= (Page.maximum(:perma_id) || 0) + 1
34
- end
35
30
  end
36
31
  end
@@ -13,6 +13,7 @@ module Pageflow
13
13
  :to_model, :to_key, :persisted?,
14
14
  :authenticate,
15
15
  :first_published_at,
16
+ :type_name,
16
17
  :to => :entry)
17
18
 
18
19
  delegate(:widgets,
@@ -156,6 +156,9 @@ module Pageflow
156
156
  end
157
157
  end
158
158
 
159
+ # Public interface for copying a revision
160
+ #
161
+ # @since 15.1
159
162
  def copy(&block)
160
163
  revision = dup
161
164
 
@@ -3,8 +3,6 @@ module Pageflow
3
3
  include SerializedConfiguration
4
4
  include RevisionComponent
5
5
 
6
- belongs_to :revision, touch: true
7
-
8
6
  has_many(:chapters,
9
7
  -> { order('pageflow_chapters.position ASC') },
10
8
  dependent: :destroy,
@@ -1,7 +1,7 @@
1
1
  para do
2
2
  if authorized?(:edit, entry)
3
3
  span(link_to(I18n.t('pageflow.admin.entries.editor'),
4
- pageflow.edit_entry_path(entry),
4
+ pageflow.editor_entry_path(entry),
5
5
  class: 'editor icon_button button'))
6
6
  end
7
7
 
@@ -2,7 +2,7 @@
2
2
  <%= hidden_field_tag('tab', params[:tab]) %>
3
3
 
4
4
  <%= f.inputs do %>
5
- <% Pageflow.config.features.each do |feature| %>
5
+ <% Pageflow.config_for(resource).features.each do |feature| %>
6
6
  <li>
7
7
  <%= label_tag(feature_state_input_name(resource, feature.name),
8
8
  t(feature.name_translation_key)) %>
@@ -16,6 +16,7 @@ module Pageflow
16
16
  path = new_admin_entry_membership_path(
17
17
  parent, entity_type: to_class_name(entity_type)
18
18
  )
19
+ quota = Pageflow.config.quotas.get(:users, parent.account)
19
20
  else
20
21
  path = new_admin_account_membership_path(
21
22
  parent, entity_type: to_class_name(entity_type)
@@ -28,7 +29,13 @@ module Pageflow
28
29
  rel = 'add_member'
29
30
  end
30
31
 
31
- if membership_possible_for(user, parent, entity_type)
32
+ if parent.is_a?(Entry) && parent.account.users.length < 2
33
+ render 'pageflow/admin/entries/cannot_add_user',
34
+ user: user,
35
+ parent: parent,
36
+ entity_type: entity_type,
37
+ quota: quota
38
+ elsif membership_possible_for(user, parent, entity_type)
32
39
  para do
33
40
  link_to(button_label, path, class: 'button', data: {rel: rel})
34
41
  end
@@ -38,6 +45,11 @@ module Pageflow
38
45
  class: 'button disabled',
39
46
  data: {rel: rel}),
40
47
  'data-tooltip' => data_tooltip)
48
+ render 'pageflow/admin/users/cannot_add',
49
+ user: user,
50
+ parent: parent,
51
+ entity_type: entity_type,
52
+ quota: quota
41
53
  end
42
54
  end
43
55
 
@@ -1,33 +1,17 @@
1
1
  <!DOCTYPE html>
2
- <%= content_tag(:html, lang: I18n.locale, dir: @page_text_direction) do %>
2
+ <%= content_tag(:html, lang: I18n.locale) do %>
3
3
  <head>
4
4
  <title><%= @page_title.presence || 'Pageflow' %></title>
5
5
 
6
- <script>
7
- window.PAGEFLOW_EDITOR = <%= @editor_scope ? 'true' : 'false' %>;
8
- </script>
9
-
10
- <%= javascript_include_tag 'pageflow/vendor', 'data-turbolinks-track' => true %>
11
- <%= javascript_include_tag 'pageflow/application', 'data-turbolinks-track' => true %>
12
-
13
6
  <%= csrf_meta_tags %>
7
+
14
8
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, minimum-scale=1, maximum-scale=1" />
15
9
  <meta name="apple-mobile-web-app-capable" content="yes" />
16
10
 
17
11
  <%= yield :head %>
18
-
19
- <%= stylesheet_link_tag 'pageflow/print_view', media: 'print', 'data-turbolinks-track' => true %>
20
- <%= render 'layouts/pageflow/loading_spinner_inline_script' %>
21
-
22
- <%= render 'layouts/pageflow/ie_include_tags' %>
23
12
  </head>
24
13
 
25
- <body class="load_all_images has_no_mobile_platform non_js">
26
- <script>
27
- jQuery('body').removeClass('load_all_images');
28
- jQuery("body").removeClass('non_js').addClass('js');
29
- </script>
14
+ <body>
30
15
  <%= yield %>
31
- <%= render 'layouts/pageflow/theme_probes' %>
32
16
  </body>
33
17
  <% end %>
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <%= content_tag(:html, lang: I18n.locale) do %>
3
+ <head>
4
+ <title><%= @page_title.presence || 'Pageflow' %></title>
5
+
6
+ <%= csrf_meta_tags %>
7
+
8
+ <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, minimum-scale=1, maximum-scale=1" />
9
+ <meta name="apple-mobile-web-app-capable" content="yes" />
10
+
11
+ <%= yield :head %>
12
+ </head>
13
+
14
+ <body class="js">
15
+ <%= yield %>
16
+ <%= render 'layouts/pageflow/theme_probes' %>
17
+ </body>
18
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if quota.exhausted? %>
2
+ <%= t("pageflow.admin.entry.user_quota_exhausted") %>
3
+ <% else %>
4
+ <%= t("pageflow.admin.entry.entry_membership_hint") %>
5
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <% if parent.is_a?(Pageflow::Entry) %>
2
+ <%= render 'pageflow/admin/entries/cannot_add_user', user: user, parent: parent, entity_type: entity_type, quota: quota %>
3
+ <% elsif parent.is_a?(User) %>
4
+ <%= render "pageflow/admin/users/cannot_add_#{entity_type}", user: user, parent: parent, entity_type: entity_type %>
5
+ <% elsif parent.is_a?(Pageflow::Account) %>
6
+ <%= t("pageflow.admin.account.cannot_add") %>
7
+ <%= render "pageflow/admin/accounts/cannot_add_#{entity_type}", user: user, parent: parent, entity_type: entity_type %>
8
+ <%end%>
@@ -5,7 +5,7 @@ json.call(Pageflow.config,
5
5
  :available_public_locales,
6
6
  :available_text_track_kinds,
7
7
  :available_share_providers)
8
- json.file_types Pageflow.config.file_types do |file_type|
8
+ json.file_types Pageflow.config_for(entry).file_types do |file_type|
9
9
  json.collection_name file_type.collection_name
10
10
  json.top_level_type file_type.top_level_type
11
11
  json.type_name file_type.type_name
@@ -15,7 +15,8 @@ json.file_types Pageflow.config.file_types do |file_type|
15
15
  json.collection_name nested_file_type.collection_name
16
16
  end
17
17
  end
18
- json.file_importers Pageflow.config.file_importers do |file_importer|
18
+
19
+ json.file_importers Pageflow.config_for(entry).file_importers do |file_importer|
19
20
  json.importer_name file_importer.name
20
21
  json.logo_source file_importer.logo_source
21
22
  json.authentication_provider file_importer.authentication_provider