pages_core 3.15.3 → 3.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/app/assets/builds/pages_core/admin-dist.js +1 -1
  4. data/app/assets/builds/pages_core/admin-dist.js.map +4 -4
  5. data/app/assets/builds/pages_core/admin.css +378 -253
  6. data/app/assets/builds/pages_core/mailer.css +41 -6
  7. data/app/assets/builds/pages_core_fonts/121b837e.woff2 +0 -0
  8. data/app/assets/builds/pages_core_fonts/216e5c23.woff2 +0 -0
  9. data/app/assets/builds/pages_core_fonts/3017b52f.woff2 +0 -0
  10. data/app/assets/builds/pages_core_fonts/489746b9.woff2 +0 -0
  11. data/app/assets/builds/pages_core_fonts/49775483.woff2 +0 -0
  12. data/app/assets/builds/pages_core_fonts/49c9e472.woff2 +0 -0
  13. data/app/assets/builds/pages_core_fonts/4a119645.woff2 +0 -0
  14. data/app/assets/builds/pages_core_fonts/5d56d7a8.woff2 +0 -0
  15. data/app/assets/builds/pages_core_fonts/61ea75a6.woff2 +0 -0
  16. data/app/assets/builds/pages_core_fonts/62cbb778.woff2 +0 -0
  17. data/app/assets/builds/pages_core_fonts/647d26c.woff2 +0 -0
  18. data/app/assets/builds/pages_core_fonts/67764053.woff2 +0 -0
  19. data/app/assets/builds/pages_core_fonts/6bb0fd00.woff2 +0 -0
  20. data/app/assets/builds/pages_core_fonts/6c0194a2.woff2 +0 -0
  21. data/app/assets/builds/pages_core_fonts/71423409.woff2 +0 -0
  22. data/app/assets/builds/pages_core_fonts/7584e61d.woff2 +0 -0
  23. data/app/assets/builds/pages_core_fonts/77bcfa1c.woff2 +0 -0
  24. data/app/assets/builds/pages_core_fonts/7aca0cc5.woff2 +0 -0
  25. data/app/assets/builds/pages_core_fonts/9a09533f.woff2 +0 -0
  26. data/app/assets/builds/pages_core_fonts/a51f5bc8.woff2 +0 -0
  27. data/app/assets/builds/pages_core_fonts/a80b2975.woff2 +0 -0
  28. data/app/assets/builds/pages_core_fonts/a891f617.woff2 +0 -0
  29. data/app/assets/builds/pages_core_fonts/ad6083f3.woff2 +0 -0
  30. data/app/assets/builds/pages_core_fonts/b29a61ff.woff2 +0 -0
  31. data/app/assets/builds/{fonts/6569749d.ttf → pages_core_fonts/b30b0656.ttf} +0 -0
  32. data/app/assets/builds/pages_core_fonts/b3a5f48c.woff2 +0 -0
  33. data/app/assets/builds/pages_core_fonts/bc73ee06.woff2 +0 -0
  34. data/app/assets/builds/pages_core_fonts/c38c6d45.woff2 +0 -0
  35. data/app/assets/builds/pages_core_fonts/c5ce0b1f.woff2 +0 -0
  36. data/app/assets/builds/pages_core_fonts/c8d53904.woff2 +0 -0
  37. data/app/assets/builds/pages_core_fonts/ce13c169.woff2 +0 -0
  38. data/app/assets/builds/pages_core_fonts/d43bd0d5.woff2 +0 -0
  39. data/app/assets/builds/pages_core_fonts/e1c7d368.woff2 +0 -0
  40. data/app/assets/builds/pages_core_fonts/e1e8175d.woff2 +0 -0
  41. data/app/assets/builds/pages_core_fonts/e318f796.woff2 +0 -0
  42. data/app/assets/builds/{fonts/ee32bc60.ttf → pages_core_fonts/e7acb7d9.ttf} +0 -0
  43. data/app/assets/builds/pages_core_fonts/ee5514c6.woff2 +0 -0
  44. data/app/assets/builds/pages_core_fonts/f4e495e2.woff2 +0 -0
  45. data/app/assets/builds/pages_core_fonts/f736ec65.woff2 +0 -0
  46. data/app/assets/builds/pages_core_fonts/f741c7ba.woff2 +0 -0
  47. data/app/assets/builds/pages_core_fonts/f7767345.woff2 +0 -0
  48. data/app/assets/builds/pages_core_fonts/fe9eb751.woff2 +0 -0
  49. data/app/assets/stylesheets/pages_core/admin/components/forms.css +2 -2
  50. data/app/assets/stylesheets/pages_core/admin/components/header.css +1 -1
  51. data/app/assets/stylesheets/pages_core/admin/controllers/pages.css +1 -1
  52. data/app/assets/stylesheets/pages_core/admin/global/fonts.css +38 -38
  53. data/app/controllers/{pages_core → admin}/admin_controller.rb +1 -3
  54. data/app/controllers/attachments_controller.rb +40 -0
  55. data/app/controllers/concerns/pages_core/document_title_controller.rb +16 -0
  56. data/app/controllers/concerns/pages_core/page_parameters.rb +1 -1
  57. data/app/controllers/concerns/pages_core/pages/preview_controller.rb +49 -0
  58. data/app/controllers/concerns/pages_core/pages/rss_controller.rb +43 -0
  59. data/app/controllers/errors_controller.rb +2 -0
  60. data/app/controllers/images_controller.rb +13 -0
  61. data/app/controllers/pages_core/frontend/pages_controller.rb +3 -4
  62. data/app/controllers/pages_core/frontend_controller.rb +6 -1
  63. data/app/controllers/pages_core/sitemaps_controller.rb +21 -52
  64. data/app/helpers/pages_core/admin/image_uploads_helper.rb +1 -1
  65. data/app/helpers/pages_core/application_helper.rb +0 -3
  66. data/app/helpers/pages_core/attachments_helper.rb +0 -10
  67. data/app/helpers/pages_core/feed_tags_helper.rb +31 -0
  68. data/app/helpers/pages_core/frontend_helper.rb +3 -0
  69. data/app/helpers/pages_core/head_tags_helper.rb +80 -70
  70. data/app/helpers/pages_core/page_path_helper.rb +1 -12
  71. data/app/javascript/components/Attachments/Attachment.tsx +3 -3
  72. data/app/javascript/components/Attachments/AttachmentEditor.tsx +5 -5
  73. data/app/javascript/components/Attachments/Deleted.tsx +28 -0
  74. data/app/javascript/components/Attachments/List.tsx +11 -24
  75. data/app/javascript/components/Attachments/Placeholder.tsx +0 -2
  76. data/app/javascript/components/Attachments.tsx +2 -3
  77. data/app/javascript/components/DateRangeSelect.tsx +13 -10
  78. data/app/javascript/components/DateTimeSelect.tsx +11 -11
  79. data/app/javascript/components/EditableImage.tsx +3 -3
  80. data/app/javascript/components/FileUploadButton.tsx +3 -3
  81. data/app/javascript/components/ImageCropper/FocalPoint.tsx +10 -14
  82. data/app/javascript/components/ImageCropper/Image.tsx +19 -25
  83. data/app/javascript/components/ImageCropper/Toolbar.tsx +27 -26
  84. data/app/javascript/components/ImageCropper/useContainerSize.ts +25 -0
  85. data/app/javascript/components/ImageCropper/useCrop.ts +28 -13
  86. data/app/javascript/components/ImageCropper/useImageCropperContext.ts +13 -0
  87. data/app/javascript/components/ImageCropper.tsx +24 -83
  88. data/app/javascript/components/ImageEditor/Form.tsx +25 -28
  89. data/app/javascript/components/ImageEditor/useImageEditor.ts +63 -0
  90. data/app/javascript/components/ImageEditor/useImageEditorContext.ts +14 -0
  91. data/app/javascript/components/ImageEditor.tsx +28 -42
  92. data/app/javascript/components/ImageGrid/Deleted.tsx +28 -0
  93. data/app/javascript/components/ImageGrid/DragElement.tsx +5 -5
  94. data/app/javascript/components/ImageGrid/FilePlaceholder.tsx +0 -2
  95. data/app/javascript/components/ImageGrid/Grid.tsx +15 -24
  96. data/app/javascript/components/ImageGrid/GridImage.tsx +4 -4
  97. data/app/javascript/components/ImageGrid/Placeholder.tsx +2 -4
  98. data/app/javascript/components/ImageGrid.tsx +2 -4
  99. data/app/javascript/components/ImageUploader.tsx +5 -5
  100. data/app/javascript/components/LabelledField.tsx +6 -6
  101. data/app/javascript/components/Modal.tsx +16 -13
  102. data/app/javascript/components/PageForm/Block.tsx +3 -3
  103. data/app/javascript/components/PageForm/Content.tsx +11 -15
  104. data/app/javascript/components/PageForm/Dates.tsx +3 -11
  105. data/app/javascript/components/PageForm/Files.tsx +2 -4
  106. data/app/javascript/components/PageForm/Form.tsx +3 -9
  107. data/app/javascript/components/PageForm/Images.tsx +2 -4
  108. data/app/javascript/components/PageForm/LocaleLinks.tsx +4 -11
  109. data/app/javascript/components/PageForm/Metadata.tsx +8 -13
  110. data/app/javascript/components/PageForm/Options.tsx +28 -11
  111. data/app/javascript/components/PageForm/PageDescription.tsx +7 -14
  112. data/app/javascript/components/PageForm/PathSegment.tsx +5 -10
  113. data/app/javascript/components/PageForm/TabPanel.tsx +3 -6
  114. data/app/javascript/components/PageForm/Tabs.tsx +2 -4
  115. data/app/javascript/components/PageForm/UnconfiguredContent.tsx +7 -12
  116. data/app/javascript/components/PageForm/pageParams.ts +3 -2
  117. data/app/javascript/components/PageForm/usePage.ts +1 -46
  118. data/app/javascript/components/PageForm/usePageFormContext.ts +8 -0
  119. data/app/javascript/components/PageForm/useTabs.ts +1 -1
  120. data/app/javascript/components/PageForm/utils.ts +49 -0
  121. data/app/javascript/components/PageForm.tsx +52 -48
  122. data/app/javascript/components/PageImages.tsx +1 -3
  123. data/app/javascript/components/PageTree/Button.tsx +25 -0
  124. data/app/javascript/components/PageTree/CollapseArrow.tsx +34 -0
  125. data/app/javascript/components/PageTree/CollapsedLabel.tsx +21 -0
  126. data/app/javascript/components/PageTree/EditPageName.tsx +68 -0
  127. data/app/javascript/components/PageTree/Node.tsx +143 -413
  128. data/app/javascript/components/PageTree/PageName.tsx +6 -4
  129. data/app/javascript/components/PageTree/StatusLabel.tsx +10 -0
  130. data/app/javascript/components/PageTree/tree.ts +268 -0
  131. data/app/javascript/components/PageTree/usePageTree.ts +268 -0
  132. data/app/javascript/components/PageTree/usePageTreeContext.ts +13 -0
  133. data/app/javascript/components/PageTree.tsx +194 -214
  134. data/app/javascript/components/{RichTextToolbarButton.tsx → RichTextArea/ToolbarButton.tsx} +3 -5
  135. data/app/javascript/components/RichTextArea/actions.ts +106 -0
  136. data/app/javascript/components/RichTextArea/useMaybeControlledValue.ts +14 -0
  137. data/app/javascript/components/RichTextArea.tsx +91 -209
  138. data/app/javascript/components/TagEditor/AddTagForm.tsx +2 -2
  139. data/app/javascript/components/TagEditor/Editor.tsx +3 -5
  140. data/app/javascript/components/TagEditor/Tag.tsx +3 -5
  141. data/app/javascript/components/TagEditor/useTags.ts +7 -4
  142. data/app/javascript/components/TagEditor.tsx +2 -4
  143. data/app/javascript/components/Toast.tsx +5 -5
  144. data/app/javascript/components/drag/draggedOrder.ts +6 -6
  145. data/app/javascript/components/drag/useDragCollection.ts +21 -25
  146. data/app/javascript/components/drag/useDragUploader.ts +20 -18
  147. data/app/javascript/components/drag/useDraggable.ts +3 -3
  148. data/app/javascript/features/RichText.tsx +0 -1
  149. data/app/javascript/features/contentTabs.ts +2 -2
  150. data/app/javascript/stores/useModalStore.ts +1 -1
  151. data/app/javascript/stores/useToastStore.ts +2 -2
  152. data/app/javascript/types/Attachments.ts +11 -11
  153. data/app/javascript/types/Crop.ts +16 -12
  154. data/app/javascript/types/Drag.ts +21 -23
  155. data/app/javascript/types/Images.ts +8 -8
  156. data/app/javascript/types/PageEditor.ts +11 -4
  157. data/app/javascript/types/Pages.ts +22 -27
  158. data/app/javascript/types/Tags.ts +5 -6
  159. data/app/javascript/types/Template.ts +4 -4
  160. data/app/javascript/types.ts +2 -2
  161. data/app/models/attachment.rb +5 -9
  162. data/app/models/autopublisher.rb +1 -1
  163. data/app/models/concerns/pages_core/page_model/redirectable.rb +1 -2
  164. data/app/models/concerns/pages_core/page_model/searchable.rb +1 -1
  165. data/app/models/concerns/pages_core/page_model/status.rb +2 -4
  166. data/app/models/concerns/pages_core/searchable_document.rb +2 -4
  167. data/app/models/image.rb +0 -15
  168. data/app/models/page_builder.rb +4 -6
  169. data/app/resources/admin/page_resource.rb +2 -2
  170. data/app/resources/export/page_resource.rb +1 -1
  171. data/app/services/pages_core/invite_service.rb +1 -2
  172. data/app/views/layouts/admin.html.erb +1 -0
  173. data/app/views/pages_core/sitemaps/index.xml.builder +10 -0
  174. data/config/routes.rb +4 -3
  175. data/db/migrate/20240917142300_add_skip_index_to_pages.rb +7 -0
  176. data/lib/pages_core/engine.rb +15 -17
  177. data/lib/pages_core/sitemap.rb +58 -0
  178. data/lib/pages_core/templates/configuration_proxy.rb +3 -3
  179. data/lib/pages_core.rb +7 -4
  180. data/lib/rails/generators/pages_core/frontend/frontend_generator.rb +2 -2
  181. data/lib/rails/generators/pages_core/frontend/templates/application.html.erb +13 -5
  182. data/lib/rails/generators/pages_core/frontend/templates/postcss.config.js +2 -6
  183. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/components/base.css +3 -1
  184. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/config.css +2 -3
  185. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/animation.css +1 -1
  186. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/colors.css +6 -5
  187. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/fonts.css +1 -1
  188. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/grid.css +9 -6
  189. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/typography.css +42 -26
  190. data/lib/rails/generators/pages_core/install/templates/application_controller.rb +0 -6
  191. data/lib/rails/generators/pages_core/rspec/templates/rails_helper.rb +1 -1
  192. metadata +81 -49
  193. data/app/assets/builds/fonts/7b7db107.woff2 +0 -0
  194. data/app/assets/builds/fonts/921961e9.woff2 +0 -0
  195. data/app/controller_dummies/admin/admin_controller.rb +0 -6
  196. data/app/controller_dummies/application_controller.rb +0 -6
  197. data/app/controller_dummies/attachments_controller.rb +0 -4
  198. data/app/controller_dummies/frontend_controller.rb +0 -4
  199. data/app/controller_dummies/images_controller.rb +0 -4
  200. data/app/controller_dummies/page_files_controller.rb +0 -4
  201. data/app/controller_dummies/pages_controller.rb +0 -4
  202. data/app/controller_dummies/sitemaps_controller.rb +0 -4
  203. data/app/controllers/concerns/pages_core/preview_pages_controller.rb +0 -47
  204. data/app/controllers/concerns/pages_core/rss_controller.rb +0 -41
  205. data/app/controllers/pages_core/attachments_controller.rb +0 -42
  206. data/app/controllers/pages_core/frontend/page_files_controller.rb +0 -25
  207. data/app/controllers/pages_core/images_controller.rb +0 -15
  208. data/app/helpers/pages_core/meta_tags_helper.rb +0 -96
  209. data/app/helpers/pages_core/open_graph_tags_helper.rb +0 -49
  210. data/app/javascript/components/PageTree/Draggable.tsx +0 -338
  211. data/app/javascript/lib/Tree.ts +0 -305
  212. data/app/javascript/types/Trees.ts +0 -19
  213. data/app/views/sitemaps/show.xml.builder +0 -11
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddSkipIndexToPages < ActiveRecord::Migration[7.2]
4
+ def change
5
+ add_column :pages, :skip_index, :boolean, null: false, default: false
6
+ end
7
+ end
@@ -2,11 +2,7 @@
2
2
 
3
3
  module PagesCore
4
4
  class Engine < Rails::Engine
5
- # config.autoload_paths += Dir["#{config.root}/lib/"]
6
- # config.autoload_paths += Dir["#{config.root}/lib/pages_core/**/"]
7
- # config.eager_load_paths += Dir["#{config.root}/lib/pages_core/**/"]
8
-
9
- initializer :factory_bot_definitions do |app|
5
+ initializer "pages_core.factory_bot" do |app|
10
6
  path = File.expand_path("../../spec/factories", __dir__)
11
7
 
12
8
  if defined?(FactoryBotRails)
@@ -16,7 +12,7 @@ module PagesCore
16
12
  end
17
13
  end
18
14
 
19
- initializer :append_migrations do |app|
15
+ initializer "pages_core.migrations" do |app|
20
16
  unless app.root.to_s.match root.to_s
21
17
  config.paths["db/migrate"].expanded.each do |expanded_path|
22
18
  app.config.paths["db/migrate"] << expanded_path
@@ -24,9 +20,10 @@ module PagesCore
24
20
  end
25
21
  end
26
22
 
27
- # Enable asset precompilation
28
- initializer :assets do |_config|
29
- Rails.application.config.assets.precompile += %w[
23
+ initializer "pages_core.sprockets" do |app|
24
+ next unless Object.const_defined?("Sprockets::Railtie")
25
+
26
+ app.config.assets.precompile += %w[
30
27
  pages_core/admin-dist.js
31
28
  pages_core/admin.css
32
29
  pages_core/mailer.css
@@ -40,14 +37,14 @@ module PagesCore
40
37
  ]
41
38
  end
42
39
 
43
- initializer :handle_exceptions do |app|
40
+ initializer "pages_core.rescue_response" do |app|
44
41
  app.config.exceptions_app = app.routes
45
42
  ActionDispatch::ExceptionWrapper.rescue_responses.merge!(
46
43
  "PagesCore::NotAuthorized" => :forbidden
47
44
  )
48
45
  end
49
46
 
50
- initializer :healthcheck do |_app|
47
+ initializer "pages_core.healthcheck" do |_app|
51
48
  Healthcheck.configure do |config|
52
49
  config.success = 200
53
50
  config.error = 503
@@ -66,7 +63,7 @@ module PagesCore
66
63
  end
67
64
  end
68
65
 
69
- initializer :lograge do |app|
66
+ initializer "pages_core.lograge" do |app|
70
67
  app.config.lograge.enabled = true if ENV["ENABLE_LOGRAGE"]
71
68
  app.config.lograge.formatter = Lograge::Formatters::Json.new
72
69
  app.config.lograge.ignore_actions =
@@ -82,11 +79,12 @@ module PagesCore
82
79
  end
83
80
  end
84
81
 
85
- # React configuration
86
- initializer :react do |app|
87
- app.config.react.jsx_transform_options = {
88
- harmony: true
89
- }
82
+ initializer "pages_core.deprecator" do |app|
83
+ app.deprecators[:pages_core] = PagesCore.deprecator
84
+ end
85
+
86
+ initializer "pages_core.sitemap" do |_app|
87
+ PagesCore::Sitemap.register { |loc| pages_sitemap_url(loc, format: :xml) }
90
88
  end
91
89
  end
92
90
  end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "builder"
4
+
5
+ module PagesCore
6
+ class Sitemap
7
+ attr_reader :entries
8
+
9
+ def initialize(&)
10
+ @entries = {}
11
+ yield(self) if block_given?
12
+ end
13
+
14
+ class << self
15
+ def register(url = nil, &block)
16
+ sitemaps << url unless url.nil?
17
+ sitemaps << block unless block.nil?
18
+ end
19
+
20
+ def sitemaps
21
+ @sitemaps ||= []
22
+ end
23
+ end
24
+
25
+ def add(url, options = {})
26
+ entries[url] = options
27
+ end
28
+
29
+ def to_xml
30
+ xml = Builder::XmlMarkup.new
31
+ xml.instruct!
32
+ xml.urlset(xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9") do |doc|
33
+ entries.each do |url, opts|
34
+ xml_entry(doc, url, opts)
35
+ end
36
+ end
37
+ end
38
+
39
+ private
40
+
41
+ def format_time(timestamp)
42
+ if timestamp.is_a?(Date)
43
+ timestamp.strftime("%Y-%m-%d")
44
+ else
45
+ timestamp.strftime("%Y-%m-%dT%H:%M:%S#{timestamp.formatted_offset}")
46
+ end
47
+ end
48
+
49
+ def xml_entry(doc, entry_url, opts = {})
50
+ doc.url do |url|
51
+ url.loc(entry_url)
52
+ url.lastmod(format_time(opts[:lastmod])) if opts[:lastmod]
53
+ url.changefreq opts[:changefreq] if opts[:changefreq]
54
+ url.priority opts[:priority] if opts[:priority]
55
+ end
56
+ end
57
+ end
58
+ end
@@ -8,15 +8,15 @@ module PagesCore
8
8
  @parent = parent
9
9
  end
10
10
 
11
- def method_missing(method_name, *args, &block)
11
+ def method_missing(method_name, *, &block)
12
12
  if @parent && block
13
13
  @callback.call(@parent, method_name, block)
14
14
  elsif @parent
15
- @callback.call(@parent, method_name, *args)
15
+ @callback.call(@parent, method_name, *)
16
16
  elsif block
17
17
  @callback.call(method_name, block)
18
18
  else
19
- @callback.call(method_name, *args)
19
+ @callback.call(method_name, *)
20
20
  end
21
21
  end
22
22
 
data/lib/pages_core.rb CHANGED
@@ -6,7 +6,6 @@ require "fileutils"
6
6
  require "find"
7
7
  require "open-uri"
8
8
  require "pathname"
9
- require "ostruct"
10
9
 
11
10
  # Rails
12
11
  require "rails"
@@ -35,7 +34,6 @@ require "rails_i18n"
35
34
  require "RedCloth"
36
35
  require "rotp"
37
36
  require "rqrcode"
38
- require "sass-rails"
39
37
  require "typhoeus"
40
38
  require "will_paginate"
41
39
 
@@ -58,6 +56,7 @@ require "pages_core/extensions"
58
56
  require "pages_core/page_path_constraint"
59
57
  require "pages_core/pages_plugin"
60
58
  require "pages_core/pub_sub"
59
+ require "pages_core/sitemap"
61
60
  require "pages_core/templates"
62
61
  require "pages_core/version"
63
62
 
@@ -69,6 +68,10 @@ module PagesCore
69
68
  VERSION
70
69
  end
71
70
 
71
+ def deprecator
72
+ @deprecator ||= ActiveSupport::Deprecation.new("3.17", "PagesCore")
73
+ end
74
+
72
75
  def plugin_root
73
76
  Pathname.new(File.dirname(__FILE__)).join("..").expand_path
74
77
  end
@@ -77,10 +80,10 @@ module PagesCore
77
80
  yield configuration if block_given?
78
81
  end
79
82
 
80
- def configuration(key = nil, *args)
83
+ def configuration(key = nil, *)
81
84
  @configuration ||= PagesCore::Configuration::Pages.new
82
85
  if key
83
- @configuration.send(key, *args)
86
+ @configuration.send(key, *)
84
87
  else
85
88
  @configuration
86
89
  end
@@ -47,10 +47,10 @@ module PagesCore
47
47
  end
48
48
 
49
49
  def install_js_dependencies
50
- run("yarn add autoprefixer cssnano normalize.css postcss " \
50
+ run("pnpm add autoprefixer cssnano normalize.css postcss " \
51
51
  "postcss-calc postcss-cli postcss-import " \
52
52
  "postcss-import-ext-glob postcss-mixins postcss-preset-env " \
53
- "postcss-url")
53
+ "postcss-image-inliner")
54
54
  end
55
55
 
56
56
  def configure_postcss
@@ -1,12 +1,20 @@
1
1
  <!doctype html>
2
2
  <%= tag.html(lang: locale) do %>
3
- <%= head_tag do %>
4
- <%# default_meta_image "/images/facebook-share.png" %>
3
+ <head>
4
+ <%= document_title_tag %>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="apple-mobile-web-app-capable" content="yes">
7
+ <%= pages_meta_tags(@page) %>
8
+ <%= csrf_meta_tags unless static_cached? %>
9
+ <%= csp_meta_tag unless static_cached? %>
10
+
11
+ <%= yield :head %>
12
+
13
+ <%= tag.link(rel: "manifest", href: pwa_manifest_path(format: :json)) %>
14
+ <%= feed_tags %>
5
15
  <%= stylesheet_link_tag "application" %>
6
16
  <%= javascript_include_tag "application" %>
7
- <%= feed_tags %>
8
- <meta name="viewport" content="width=device-width, initial-scale=1">
9
- <% end %>
17
+ </head>
10
18
  <body>
11
19
  <% if Rails.env.development? %>
12
20
  <div class="grid-overlay"></div>
@@ -2,16 +2,12 @@ module.exports = {
2
2
  plugins: [
3
3
  require("postcss-import-ext-glob"),
4
4
  require("postcss-import"),
5
- require("postcss-url")(
6
- { filter: "**/*.svg",
7
- url: "inline",
8
- basePath: "../images" }
9
- ),
5
+ require("postcss-image-inliner")({ assetPaths: ["app/assets/images"] }),
10
6
  require("postcss-mixins"),
11
7
  require("postcss-simple-vars"),
12
8
  require("postcss-preset-env")({ stage: 1 }),
13
9
  require("postcss-calc")({ precision: 10 }),
14
10
  require("autoprefixer"),
15
11
  require("postcss-discard-duplicates")
16
- ],
12
+ ]
17
13
  };
@@ -1,4 +1,6 @@
1
- *, *:before, *:after {
1
+ *,
2
+ *:before,
3
+ *:after {
2
4
  box-sizing: border-box;
3
5
  }
4
6
 
@@ -1,5 +1,4 @@
1
- $breakpoint-mobile-small: 479;
1
+ $breakpoint-mobile: 767;
2
2
 
3
- @custom-media --tablet screen and (max-width: 991px);
3
+ @custom-media --medium screen and (max-width: 1100px);
4
4
  @custom-media --mobile screen and (max-width: 767px);
5
- @custom-media --mobile-small screen and (max-width: $(breakpoint-mobile-small)px);
@@ -1,5 +1,5 @@
1
1
  :root {
2
2
  --ease-out: cubic-bezier(0.165, 0.84, 0.44, 1);
3
- --ease-out-back: cubic-bezier(.35,1.47,.64,1);
3
+ --ease-out-back: cubic-bezier(0.35, 1.47, 0.64, 1);
4
4
  scroll-behavior: smooth;
5
5
  }
@@ -1,11 +1,11 @@
1
1
  :root {
2
2
  --black: #000000;
3
3
  --white: #ffffff;
4
- --blue: #0000ff;
4
+ --blue: #0000ff;
5
5
 
6
- --background-color: var(--white);
7
- --text-color: var(--black);
8
- --link-color: var(--blue);
6
+ --background-color: var(--white);
7
+ --text-color: var(--black);
8
+ --link-color: var(--blue);
9
9
  }
10
10
 
11
11
  body {
@@ -13,6 +13,7 @@ body {
13
13
  color: var(--text-color);
14
14
  }
15
15
 
16
- a, a:visited {
16
+ a,
17
+ a:visited {
17
18
  color: var(--link-color);
18
19
  }
@@ -2,5 +2,5 @@
2
2
  @font-face { font-family: "Example";
3
3
  font-style: normal;
4
4
  font-weight: 300;
5
- src: url("Example-Regular.woff") format("woff"); }
5
+ src: url("/Example-Regular.woff") format("woff"); }
6
6
  */
@@ -15,7 +15,7 @@
15
15
  --gutter: 2rem;
16
16
  --outer-padding: 2rem;
17
17
 
18
- @media (--tablet) {
18
+ @media (--medium) {
19
19
  //--columns: 9;
20
20
  --gutter: 1.5rem;
21
21
  --outer-padding: 1.5rem;
@@ -31,9 +31,10 @@
31
31
  }
32
32
 
33
33
  --column-width: calc(
34
- (100% -
35
- ((var(--gutter) * (var(--columns) - 1)) + (var(--outer-padding) * 2))) /
36
- var(--columns)
34
+ (
35
+ 100% -
36
+ ((var(--gutter) * (var(--columns) - 1)) + (var(--outer-padding) * 2))
37
+ ) / var(--columns)
37
38
  );
38
39
 
39
40
  /* @mixin grid-limit 1400px; */
@@ -44,8 +45,10 @@
44
45
  }
45
46
 
46
47
  .grid-overlay--active {
47
- --grid-overlay-width: var(--grid-limit,
48
- calc(100% - (var(--outer-padding) * 2)));
48
+ --grid-overlay-width: var(
49
+ --grid-limit,
50
+ calc(100% - (var(--outer-padding) * 2))
51
+ );
49
52
  display: block;
50
53
  position: fixed;
51
54
  z-index: 9000;
@@ -10,37 +10,36 @@
10
10
  }
11
11
 
12
12
  @define-mixin font-scale-base {
13
- --font-scale-coeff: calc((var(--font-scale-to) - var(--font-scale-from)) /
14
- ((var(--font-scale-end) / 100) -
15
- (var(--font-scale-start) / 100)));
13
+ --font-scale-coeff: calc(
14
+ (var(--font-scale-to) - var(--font-scale-from)) /
15
+ (var(--font-scale-end) - var(--font-scale-start))
16
+ );
16
17
 
17
- font-size: calc(calc((var(--font-scale-from) -
18
- (var(--font-scale-start) / 100) *
19
- var(--font-scale-coeff)) /
20
- 16) * 1rem +
21
- var(--font-scale-coeff) * 1vw);
18
+ font-size: calc(
19
+ (var(--font-scale-from) - var(--font-scale-start) * var(--font-scale-coeff)) /
20
+ 16 * 1rem + var(--font-scale-coeff) * 1vw
21
+ );
22
22
  }
23
23
 
24
24
  @define-mixin font-scale $from, $to, $start, $end {
25
25
  --font-scale-from: $from;
26
26
  --font-scale-to: $to;
27
- --font-scale-start: $start;
28
- --font-scale-end: $end;
27
+ --font-scale-start: calc($start / 100);
28
+ --font-scale-end: calc($end / 100);
29
29
  }
30
30
 
31
-
32
31
  /* ---- Definitions -------------------------------------------------------- */
33
32
 
34
33
  :root {
35
34
  --font-sans: Helvetica, sans-serif;
36
35
 
37
- --font-larger: 500 2.0rem/1.1 var(--font-sans);
38
- --font-large: 500 1.5rem/1.1 var(--font-sans);
39
- --font-medium: 500 1.5rem/1.1 var(--font-sans);
40
- --font-normal: normal 1.25rem/1.1 var(--font-sans);
41
- --font-small: normal 1.0rem/1.1 var(--font-sans);
36
+ --font-larger: 500 2rem/1.1 var(--font-sans);
37
+ --font-large: 500 1.5rem/1.1 var(--font-sans);
38
+ --font-medium: 500 1.5rem/1.1 var(--font-sans);
39
+ --font-normal: normal 1.25rem/1.1 var(--font-sans);
40
+ --font-small: normal 1rem/1.1 var(--font-sans);
42
41
 
43
- @media (--tablet) {
42
+ @media (--medium) {
44
43
  /*
45
44
  --font-larger: 500 1.5rem/1.1 var(--font-sans);
46
45
  --font-large: 500 1.5rem/1.1 var(--font-sans);
@@ -49,17 +48,16 @@
49
48
  }
50
49
  }
51
50
 
52
-
53
51
  /* ---- Font scale --------------------------------------------------------- */
54
52
 
55
53
  html {
56
54
  @mixin font-scale-base;
57
55
  @mixin font-scale 16, 18, 1440, 1920;
58
56
  @media screen and (max-width: 1440px) {
59
- @mixin font-scale 14, 16, $breakpoint-mobile-small, 1440;
57
+ @mixin font-scale 14, 16, $breakpoint-mobile, 1440;
60
58
  }
61
- @media (--mobile-small) {
62
- @mixin font-scale 12, 16, 1, $breakpoint-mobile-small;
59
+ @media (--mobile) {
60
+ @mixin font-scale 12, 16, 1, $breakpoint-mobile;
63
61
  }
64
62
  }
65
63
 
@@ -68,20 +66,38 @@ body {
68
66
  font-size: 100%;
69
67
  }
70
68
 
71
-
72
69
  /* ---- Rules -------------------------------------------------------------- */
73
70
 
74
- h1, h2, h3, h4, h5, h6, p, ul, ol {
71
+ h1,
72
+ h2,
73
+ h3,
74
+ h4,
75
+ h5,
76
+ h6,
77
+ p,
78
+ ul,
79
+ ol {
75
80
  margin: 1rem 0rem;
76
81
  @mixin child-margins;
77
82
  }
78
83
 
79
- h1, h2, h3, h4, h5, h6, p, ul, ol,
80
- figcaption, blockquote {
84
+ h1,
85
+ h2,
86
+ h3,
87
+ h4,
88
+ h5,
89
+ h6,
90
+ p,
91
+ ul,
92
+ ol,
93
+ figcaption,
94
+ blockquote {
81
95
  max-width: 60ch;
82
96
  }
83
97
 
84
- ul, ol, blockquote {
98
+ ul,
99
+ ol,
100
+ blockquote {
85
101
  margin-top: 2rem;
86
102
  margin-bottom: 2rem;
87
103
  @mixin child-margins;
@@ -2,10 +2,4 @@
2
2
 
3
3
  class ApplicationController < PagesCore::BaseController
4
4
  # Put frontend specific code in frontend_controller.rb
5
-
6
- helper :all # include all helpers, all the time
7
-
8
- # Prevent CSRF attacks by raising an exception.
9
- # For APIs, you may want to use :null_session instead.
10
- protect_from_forgery with: :exception
11
5
  end
@@ -31,7 +31,7 @@ require "shoulda-matchers"
31
31
  # directory. Alternatively, in the individual `*_spec.rb` files, manually
32
32
  # require only the support files necessary.
33
33
  #
34
- Dir[Rails.root.join("spec/support/**/*.rb")].each do |f|
34
+ Rails.root.glob("spec/support/**/*.rb").each do |f|
35
35
  require f
36
36
  end
37
37