pages_core 3.12.0 → 3.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/app/assets/builds/fonts/661557ef.ttf +0 -0
  4. data/app/assets/builds/fonts/a18fc2d2.woff2 +0 -0
  5. data/app/assets/builds/fonts/b2c7b78f.woff2 +0 -0
  6. data/app/assets/builds/fonts/ceddc204.ttf +0 -0
  7. data/app/assets/builds/pages_core/admin-dist.js +60 -14
  8. data/app/assets/builds/pages_core/admin-dist.js.map +7 -0
  9. data/app/assets/builds/pages_core/admin.css +9272 -0
  10. data/app/assets/images/pages/admin/angle-down-solid.svg +1 -0
  11. data/app/assets/images/pages/admin/icon.svg +1 -0
  12. data/app/assets/stylesheets/pages_core/admin/components/archive.css +6 -0
  13. data/app/assets/stylesheets/{pages/admin/components/attachments.scss → pages_core/admin/components/attachments.css} +35 -28
  14. data/app/assets/stylesheets/{pages/admin.scss → pages_core/admin/components/base.css} +125 -123
  15. data/app/assets/stylesheets/pages_core/admin/components/forms.css +223 -0
  16. data/app/assets/stylesheets/{pages/admin/components/header.scss → pages_core/admin/components/header.css} +76 -46
  17. data/app/assets/stylesheets/{pages/admin/components/image_editor.scss → pages_core/admin/components/image_editor.css} +42 -31
  18. data/app/assets/stylesheets/{pages/admin/components/image_grid.scss → pages_core/admin/components/image_grid.css} +76 -64
  19. data/app/assets/stylesheets/{pages/admin/components/image_uploader.scss → pages_core/admin/components/image_uploader.css} +12 -12
  20. data/app/assets/stylesheets/{pages/admin/components/layout.scss → pages_core/admin/components/layout.css} +13 -9
  21. data/app/assets/stylesheets/pages_core/admin/components/links.css +40 -0
  22. data/app/assets/stylesheets/pages_core/admin/components/list_table.css +66 -0
  23. data/app/assets/stylesheets/{pages/admin/components/login.scss → pages_core/admin/components/login.css} +6 -5
  24. data/app/assets/stylesheets/{pages/admin/components/modal.scss → pages_core/admin/components/modal.css} +10 -12
  25. data/app/assets/stylesheets/{pages/admin/components/page_tree.scss → pages_core/admin/components/page_tree.css} +54 -55
  26. data/app/assets/stylesheets/{pages/admin/components/pagination.scss → pages_core/admin/components/pagination.css} +17 -17
  27. data/app/assets/stylesheets/pages_core/admin/components/search.css +27 -0
  28. data/app/assets/stylesheets/{pages/admin/components/sidebar.scss → pages_core/admin/components/sidebar.css} +8 -7
  29. data/app/assets/stylesheets/{pages/admin/components/tag_editor.scss → pages_core/admin/components/tag_editor.css} +10 -15
  30. data/app/assets/stylesheets/{pages/admin/components/textarea.scss → pages_core/admin/components/textarea.css} +1 -1
  31. data/app/assets/stylesheets/{pages/admin/components/toast.scss → pages_core/admin/components/toast.css} +5 -3
  32. data/app/assets/stylesheets/{pages/admin/components/toolbar.scss → pages_core/admin/components/toolbar.css} +56 -29
  33. data/app/assets/stylesheets/{pages/admin/controllers/pages.scss → pages_core/admin/controllers/pages.css} +69 -52
  34. data/app/assets/stylesheets/pages_core/admin/controllers/users.css +3 -0
  35. data/app/assets/stylesheets/pages_core/admin/vars.css +34 -0
  36. data/app/assets/stylesheets/pages_core/admin.postcss.css +9 -0
  37. data/app/controllers/admin/pages_controller.rb +12 -11
  38. data/app/controllers/concerns/pages_core/rss_controller.rb +17 -1
  39. data/app/controllers/pages_core/admin_controller.rb +6 -0
  40. data/app/controllers/pages_core/frontend/pages_controller.rb +9 -5
  41. data/app/controllers/pages_core/sitemaps_controller.rb +3 -5
  42. data/app/formatters/pages_core/image_embedder.rb +5 -27
  43. data/app/helpers/admin/calendars_helper.rb +8 -0
  44. data/app/helpers/admin/news_helper.rb +13 -0
  45. data/app/helpers/admin/pages_helper.rb +32 -0
  46. data/app/helpers/pages_core/admin/admin_helper.rb +11 -54
  47. data/app/helpers/pages_core/admin/deprecated_admin_helper.rb +40 -0
  48. data/app/helpers/pages_core/images_helper.rb +37 -0
  49. data/app/javascript/admin-dist.ts +2 -0
  50. data/app/javascript/components/Attachments/{Attachment.jsx → Attachment.tsx} +44 -35
  51. data/app/javascript/components/Attachments/{AttachmentEditor.jsx → AttachmentEditor.tsx} +23 -23
  52. data/app/javascript/components/{EditableImage.jsx → EditableImage.tsx} +28 -25
  53. data/app/javascript/components/{FileUploadButton.jsx → FileUploadButton.tsx} +15 -16
  54. data/app/javascript/components/ImageCropper/FocalPoint.tsx +94 -0
  55. data/app/javascript/components/ImageCropper/{Image.jsx → Image.tsx} +13 -14
  56. data/app/javascript/components/ImageCropper/{Toolbar.jsx → Toolbar.tsx} +19 -15
  57. data/app/javascript/components/ImageCropper/{useCrop.js → useCrop.ts} +80 -37
  58. data/app/javascript/components/{ImageCropper.jsx → ImageCropper.tsx} +17 -15
  59. data/app/javascript/components/ImageEditor/{Form.jsx → Form.tsx} +24 -23
  60. data/app/javascript/components/{ImageEditor.jsx → ImageEditor.tsx} +17 -15
  61. data/app/javascript/components/ImageGrid/{DragElement.jsx → DragElement.tsx} +12 -10
  62. data/app/javascript/components/ImageGrid/{GridImage.jsx → GridImage.tsx} +40 -30
  63. data/app/javascript/components/ImageGrid/{Placeholder.jsx → Placeholder.tsx} +5 -6
  64. data/app/javascript/components/ImageGrid.jsx +3 -4
  65. data/app/javascript/components/{ImageUploader.jsx → ImageUploader.tsx} +46 -41
  66. data/app/javascript/components/Modal.tsx +48 -0
  67. data/app/javascript/components/PageImages.tsx +28 -0
  68. data/app/javascript/components/{PageTreeDraggable.jsx → PageTree/Draggable.tsx} +79 -57
  69. data/app/javascript/components/{PageTreeNode.jsx → PageTree/Node.tsx} +86 -77
  70. data/app/javascript/components/PageTree/types.ts +15 -0
  71. data/app/javascript/components/PageTree.tsx +206 -0
  72. data/app/javascript/components/RichTextToolbarButton.tsx +17 -0
  73. data/app/javascript/components/TagEditor/{AddTagForm.jsx → AddTagForm.tsx} +9 -10
  74. data/app/javascript/components/TagEditor/{Tag.jsx → Tag.tsx} +8 -9
  75. data/app/javascript/components/{TagEditor.jsx → TagEditor.tsx} +12 -13
  76. data/app/javascript/components/Toast.tsx +61 -0
  77. data/app/javascript/components/drag/{draggedOrder.js → draggedOrder.ts} +22 -12
  78. data/app/javascript/components/drag/types.ts +28 -0
  79. data/app/javascript/components/drag/{useDragCollection.js → useDragCollection.ts} +40 -22
  80. data/app/javascript/components/drag/{useDragUploader.js → useDragUploader.ts} +34 -25
  81. data/app/javascript/components/drag/useDraggable.ts +21 -0
  82. data/app/javascript/components/{drag.js → drag.ts} +1 -0
  83. data/app/javascript/controllers/{EditPageController.js → EditPageController.ts} +3 -1
  84. data/app/javascript/controllers/{LoginController.js → LoginController.ts} +7 -3
  85. data/app/javascript/controllers/{MainController.js → MainController.ts} +19 -14
  86. data/app/javascript/{index.js → index.ts} +8 -7
  87. data/app/javascript/lib/{Tree.js → Tree.ts} +106 -85
  88. data/app/javascript/lib/{copyToClipboard.js → copyToClipboard.ts} +1 -1
  89. data/app/javascript/lib/{readyHandler.js → readyHandler.ts} +4 -2
  90. data/app/javascript/lib/{request.js → request.ts} +11 -5
  91. data/app/javascript/stores/useModalStore.ts +15 -0
  92. data/app/javascript/stores/useToastStore.ts +26 -0
  93. data/app/javascript/stores.ts +2 -0
  94. data/app/javascript/types.ts +30 -0
  95. data/app/mailers/admin_mailer.rb +1 -0
  96. data/app/models/invite.rb +8 -0
  97. data/app/policies/page_policy.rb +4 -0
  98. data/app/views/admin/calendars/_sidebar.html.erb +50 -0
  99. data/app/views/admin/calendars/show.html.erb +15 -53
  100. data/app/views/admin/invites/new.html.erb +2 -8
  101. data/app/views/admin/invites/show.html.erb +2 -4
  102. data/app/views/admin/news/_sidebar.html.erb +51 -0
  103. data/app/views/admin/news/index.html.erb +21 -56
  104. data/app/views/admin/pages/_list_item.html.erb +4 -22
  105. data/app/views/admin/pages/_search_bar.html.erb +12 -0
  106. data/app/views/admin/pages/deleted.html.erb +10 -8
  107. data/app/views/admin/pages/edit.html.erb +20 -11
  108. data/app/views/admin/pages/index.html.erb +10 -8
  109. data/app/views/admin/pages/new.html.erb +10 -14
  110. data/app/views/admin/pages/search.html.erb +54 -0
  111. data/app/views/admin/password_resets/show.html.erb +3 -5
  112. data/app/views/admin/users/deactivated.html.erb +6 -7
  113. data/app/views/admin/users/edit.html.erb +7 -9
  114. data/app/views/admin/users/index.html.erb +3 -6
  115. data/app/views/admin/users/login.html.erb +4 -5
  116. data/app/views/admin/users/new.html.erb +2 -4
  117. data/app/views/admin/users/new_password.html.erb +4 -5
  118. data/app/views/admin/users/show.html.erb +11 -9
  119. data/app/views/errors/401.html.erb +2 -1
  120. data/app/views/errors/403.html.erb +2 -1
  121. data/app/views/errors/404.html.erb +1 -3
  122. data/app/views/errors/405.html.erb +2 -1
  123. data/app/views/errors/422.html.erb +2 -1
  124. data/app/views/errors/500.html.erb +2 -3
  125. data/app/views/feeds/pages.rss.builder +3 -9
  126. data/app/views/layouts/admin/_header.html.erb +1 -2
  127. data/app/views/layouts/admin/_page_header.html.erb +4 -4
  128. data/app/views/layouts/admin.html.erb +3 -3
  129. data/app/views/layouts/errors.html.erb +127 -4
  130. data/config/routes.rb +1 -0
  131. data/lib/pages_core/configuration/pages.rb +0 -1
  132. data/lib/pages_core/engine.rb +4 -3
  133. data/lib/pages_core.rb +0 -1
  134. data/lib/rails/generators/pages_core/frontend/frontend_generator.rb +33 -17
  135. data/lib/rails/generators/pages_core/frontend/templates/application.html.erb +0 -1
  136. data/lib/rails/generators/pages_core/frontend/templates/javascript/lib/gridOverlay.ts +40 -0
  137. data/lib/rails/generators/pages_core/frontend/templates/javascript/lib/responsiveEmbeds.ts +68 -0
  138. data/lib/rails/generators/pages_core/frontend/templates/postcss.config.js +17 -0
  139. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/application.postcss.css +4 -0
  140. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/components/base.css +24 -0
  141. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/components/layout.css +21 -0
  142. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/config.css +5 -0
  143. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/animation.css +5 -0
  144. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/colors.css +18 -0
  145. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/fonts.css +6 -0
  146. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/grid.css +65 -0
  147. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/typography.css +131 -0
  148. data/lib/rails/generators/pages_core/install/templates/pages_initializer.rb +0 -3
  149. metadata +104 -255
  150. data/app/assets/images/pages/admin/icon.png +0 -0
  151. data/app/assets/images/pages/admin/image-editor-bg.png +0 -0
  152. data/app/assets/images/pages/admin/list-table-pin-blue.gif +0 -0
  153. data/app/assets/images/pages/admin/list-table-pin-disabled.gif +0 -0
  154. data/app/assets/images/pages/admin/list-table-pin-green.gif +0 -0
  155. data/app/assets/images/pages/admin/list-table-pin-red.gif +0 -0
  156. data/app/assets/images/pages/admin/list-table-pin-yellow.gif +0 -0
  157. data/app/assets/images/pages/admin/loading-modal.gif +0 -0
  158. data/app/assets/images/pages/feed-icon-14x14.png +0 -0
  159. data/app/assets/stylesheets/pages/admin/components/archive.scss +0 -6
  160. data/app/assets/stylesheets/pages/admin/components/buttons.scss +0 -23
  161. data/app/assets/stylesheets/pages/admin/components/forms.scss +0 -169
  162. data/app/assets/stylesheets/pages/admin/components/links.scss +0 -43
  163. data/app/assets/stylesheets/pages/admin/components/list_table.scss +0 -61
  164. data/app/assets/stylesheets/pages/admin/controllers/users.scss +0 -3
  165. data/app/assets/stylesheets/pages/admin/mixins/breakpoints.scss +0 -21
  166. data/app/assets/stylesheets/pages/admin/mixins/clearfix.scss +0 -7
  167. data/app/assets/stylesheets/pages/admin/mixins/gradients.scss +0 -7
  168. data/app/assets/stylesheets/pages/admin/vars.scss +0 -30
  169. data/app/assets/stylesheets/pages/errors.css +0 -128
  170. data/app/javascript/admin-dist.js +0 -2
  171. data/app/javascript/components/ImageCropper/FocalPoint.jsx +0 -93
  172. data/app/javascript/components/Modal.jsx +0 -59
  173. data/app/javascript/components/PageImages.jsx +0 -25
  174. data/app/javascript/components/PageTree.jsx +0 -196
  175. data/app/javascript/components/RichTextToolbarButton.jsx +0 -20
  176. data/app/javascript/components/Toast.jsx +0 -72
  177. data/app/javascript/components/drag/useDraggable.js +0 -17
  178. data/app/javascript/stores/ModalStore.jsx +0 -12
  179. data/app/javascript/stores/ToastStore.jsx +0 -14
  180. data/app/javascript/stores.js +0 -2
  181. data/lib/rails/generators/pages_core/frontend/templates/javascript/lib/GridOverlay.js +0 -66
  182. data/lib/rails/generators/pages_core/frontend/templates/javascript/lib/ResponsiveEmbeds.js +0 -72
  183. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/application.sass.scss +0 -15
  184. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/components/base.scss +0 -12
  185. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/config.scss +0 -26
  186. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/framework/breakpoints.scss +0 -42
  187. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/framework/clearfix.scss +0 -7
  188. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/framework/fonts.scss +0 -32
  189. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/framework/grid.scss +0 -168
  190. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/framework/grid_overlay.scss +0 -44
  191. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/colors.scss +0 -8
  192. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/typography.scss +0 -90
  193. data/lib/rails/generators/pages_core/frontend/templates/stylesheets/vendor/normalize.css +0 -349
  194. data/vendor/assets/stylesheets/ReactCrop.css +0 -167
  195. /data/app/assets/stylesheets/{pages/admin/components/tabs.scss → pages_core/admin/components/tabs.css} +0 -0
  196. /data/app/javascript/components/Attachments/{Placeholder.jsx → Placeholder.tsx} +0 -0
  197. /data/app/javascript/components/ImageGrid/{FilePlaceholder.jsx → FilePlaceholder.tsx} +0 -0
  198. /data/app/javascript/{components.js → components.ts} +0 -0
  199. /data/app/javascript/{hooks.js → hooks.ts} +0 -0
@@ -1,12 +1,11 @@
1
- <%
2
- self.page_title = "Deactivated users"
3
- self.page_description = "Viewing deactivated users"
4
- self.page_description_links = link_to("View active users", admin_users_path)
5
- %>
1
+ <% content_for :page_title, "Deactivated users" %>
2
+ <% content_for :page_description, "Viewing deactivated users" %>
6
3
 
4
+ <% content_for(:page_description_links) do %>
5
+ <%= link_to("View active users", admin_users_path) %>
6
+ <% end %>
7
7
 
8
8
  <% content_for :sidebar do %>
9
9
  <% end %>
10
10
 
11
-
12
- <%= render partial: 'list', locals: {users: @users} %>
11
+ <%= render partial: "list", locals: { users: @users } %>
@@ -1,12 +1,10 @@
1
- <%
2
- self.page_title = "Editing user: #{@user.name}"
3
- if @user == current_user
4
- self.page_description = "You are editing " + link_to("your own", [:admin, @user]) + " profile."
5
- else
6
- self.page_description = "You are editing " + link_to("#{@user.name}", [:admin, @user]) + "'s profile."
7
- end
8
- self.page_description_links = link_to("View all users", admin_users_path)
9
- %>
1
+ <% content_for :page_title, "Editing user: #{@user.name}" %>
2
+
3
+ <% content_for :page_description do %>
4
+ You are editing
5
+ <%= link_to((@user == current_user ? "your own profile" : "#{@user.name}"),
6
+ [:admin, @user]) %>
7
+ <% end %>
10
8
 
11
9
  <% content_for :sidebar do %>
12
10
  <% if @user != current_user %>
@@ -1,8 +1,5 @@
1
- <%
2
- self.page_title = "Users"
3
- self.page_description = "Viewing active users"
4
- %>
5
-
1
+ <% content_for :page_title, "Users" %>
2
+ <% content_for :page_description, "Viewing active users" %>
6
3
 
7
4
  <% content_for :sidebar do %>
8
5
  <% if policy(User).new? %>
@@ -24,4 +21,4 @@
24
21
  <% end %>
25
22
 
26
23
 
27
- <%= render partial: 'list', locals: {users: @users} %>
24
+ <%= render partial: "list", locals: { users: @users } %>
@@ -1,8 +1,7 @@
1
- <%
2
- self.page_title = "Sign in"
3
- self.page_description = "Please enter your email address and password to sign in"
4
- add_body_class "login"
5
- -%>
1
+ <% content_for :page_title, "Sign in" %>
2
+ <% content_for(:page_description,
3
+ "Please enter your email address and password to sign in") %>
4
+ <% content_for :body_class, "login" %>
6
5
 
7
6
  <% content_for :sidebar do %>
8
7
  <h2>Please note</h2>
@@ -1,7 +1,5 @@
1
- <%
2
- self.page_title = "Welcome"
3
- self.page_description = "Welcome to Pages"
4
- %>
1
+ <% content_for :page_title, "Welcome" %>
2
+ <% content_for :page_description, "Welcome to Pages" %>
5
3
 
6
4
  <div class="content">
7
5
  <p>Welcome to Pages! Before you can log on, we need to create the first user account.</p>
@@ -1,8 +1,7 @@
1
- <%
2
- self.page_title = "Log in &raquo; Forgotten password"
3
- self.page_description = "Creating a new password"
4
- add_body_class = "login"
5
- %>
1
+ <% content_for :page_title, "Log in &raquo; Forgotten password" %>
2
+ <% content_for :page_description, "Creating a new password" %>
3
+ <% content_for :body_class, "login" -%>
4
+
6
5
  <div class="content">
7
6
  <p>
8
7
  Did you lose your password? Don't worry, it happens.
@@ -1,12 +1,14 @@
1
- <%
2
- self.page_title = "#{@user.name}"
3
- if @user == current_user
4
- self.page_description = "You are viewing " + link_to( "your own", admin_user_path( @user ) ) + " profile."
5
- else
6
- self.page_description = "You are viewing " + link_to( "#{@user.name}", admin_user_path( @user ) ) + "'s profile."
7
- end
8
- self.page_description_links = [ ( link_to( "Edit", edit_admin_user_path( @user ) ) if policy(@user).edit? ), link_to( "View all users", admin_users_path ) ].compact.join( link_separator )
9
- %>
1
+ <% content_for :page_title, @user.name %>
2
+
3
+ <% content_for :page_description do %>
4
+ You are viewing
5
+ <%= link_to((@user == current_user ? "your own profile" : "#{@user.name}"),
6
+ [:admin, @user]) %>
7
+ <% end %>
8
+
9
+ <% content_for(:page_description_links) do %>
10
+ <%= link_to("Edit", edit_admin_user_path(@user)) if policy(@user).edit? %>
11
+ <% end %>
10
12
 
11
13
  <% content_for :sidebar do %>
12
14
  <h2>People</h2>
@@ -1,4 +1,5 @@
1
- <% @page_title = "Unauthorized" %>
1
+ <% content_for :page_title, "Unauthorized" %>
2
+
2
3
  <p>
3
4
  You are not authorized to access this resource.
4
5
  </p>
@@ -1,4 +1,5 @@
1
- <% @page_title = "Forbidden" %>
1
+ <% content_for :page_title, "Forbidden" %>
2
+
2
3
  <p>
3
4
  You are not authorized to access this resource.
4
5
  </p>
@@ -1,6 +1,4 @@
1
- <%
2
- @page_title = "Page not found"
3
- %>
1
+ <% content_for :page_title, "Page not found" %>
4
2
 
5
3
  <p>
6
4
  The page you were looking for could not be found. It might have been removed,
@@ -1,4 +1,5 @@
1
- <% @page_title = "405: Method Not Allowed" %>
1
+ <% content_for :page_title, "405: Method Not Allowed" %>
2
+
2
3
  <p>This method has not been implemented.</p>
3
4
 
4
5
  <%= render partial: 'errors/generic_help' %>
@@ -1,4 +1,5 @@
1
- <% @page_title = "422: Unacceptable" %>
1
+ <% content_for :page_title, "422: Unacceptable" %>
2
+
2
3
  <p>
3
4
  The change you wanted was rejected.
4
5
  Maybe you tried to change something you didn't have access to.
@@ -1,6 +1,5 @@
1
- <%
2
- @page_title = "500 Internal Server Error"
3
- %>
1
+ <% content_for :page_title, "500 Internal Server Error" %>
2
+
4
3
  <p>
5
4
  We're experiencing an internal server problem. Please try again later.
6
5
  </p>
@@ -4,9 +4,7 @@ xml << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
4
4
  xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
5
5
  xml.channel do
6
6
  xml.title(@title || PagesCore.config(:site_name))
7
- xml.link(
8
- url_for(controller: "pages", action: "index", only_path: false)
9
- )
7
+ xml.link(root_url)
10
8
  xml.description "Recent items"
11
9
  xml.language locale
12
10
  xml.generator "Pages"
@@ -15,12 +13,8 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
15
13
  xml.item do
16
14
  xml.title { xml.cdata! item.name.to_s }
17
15
  xml.link page_url(@locale, item, only_path: false)
18
- if PagesCore.config.rss_fulltext?
19
- xml.description { xml.cdata! item.body.to_html }
20
- else
21
- xml.description do
22
- xml.cdata!((item.extended? ? item.excerpt : item.body).to_html)
23
- end
16
+ xml.description do
17
+ xml.cdata! item.excerpt.to_html + item.body.to_html
24
18
  end
25
19
  xml.guid page_url(@locale, item, only_path: false)
26
20
  xml.pubDate item.published_at.to_fs(:rfc822)
@@ -1,6 +1,6 @@
1
1
  <header>
2
2
  <div class="logo">
3
- <%= link_to image_tag("pages/admin/icon.png"), '/admin' %>
3
+ <%= link_to image_tag("pages/admin/icon.svg"), '/admin' %>
4
4
  </div>
5
5
  <div class="site-name">
6
6
  <h1>
@@ -10,7 +10,6 @@
10
10
  <% if logged_in? %>
11
11
  <div class="user">
12
12
  Hello, <%= link_to(current_user.name, admin_user_url(current_user)) %>
13
- <%= link_separator %>
14
13
  <%= link_to("Log out", session_path, method: "delete") %>
15
14
  </div>
16
15
  <% end %>
@@ -1,12 +1,12 @@
1
- <% if @page_description || @content_tabs %>
1
+ <% if content_for?(:page_description) || @content_tabs %>
2
2
  <div class="page-description"<% if @content_tabs %> class="with_content_tabs"<% end %>>
3
- <% if @page_description_links -%>
3
+ <% if content_for?(:page_description_links) %>
4
4
  <div class="links">
5
- <%= @page_description_links.html_safe %>
5
+ <%= content_for(:page_description_links) %>
6
6
  </div>
7
7
  <% end %>
8
8
  <h3>
9
- <%= (@page_description || @page_title).html_safe %>
9
+ <%= content_for(:page_description) || content_for(:page_title) %>
10
10
  </h3>
11
11
  <% if @content_tabs %>
12
12
  <ul class="content-tabs"
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <title>
6
- <%= [@page_title, "Pages"].reject(&:blank?).uniq.join(" - ") %>
6
+ <%= [content_for(:page_title), "Pages"].reject(&:blank?).uniq.join(" - ") %>
7
7
  </title>
8
8
 
9
9
  <link rel="shortcut icon"
@@ -13,7 +13,7 @@
13
13
  href="<%= asset_path 'pages/favicon.gif' %>"
14
14
  type="image/gif" />
15
15
 
16
- <%= stylesheet_link_tag "pages/admin" %>
16
+ <%= stylesheet_link_tag "pages_core/admin" %>
17
17
 
18
18
  <% if Dir.glob(Rails.root.join("app/assets/stylesheets/admin.*")).any? %>
19
19
  <%= stylesheet_link_tag "admin" %>
@@ -34,7 +34,7 @@
34
34
  <%= google_analytics_tags "UA-5468672-21" %>
35
35
  </head>
36
36
 
37
- <body class="<%= body_classes.join(" ") %>"
37
+ <body class="<%= content_for(:body_class) %>"
38
38
  data-controller="<%= controller.class.to_s %>"
39
39
  data-action="<%= controller.action_name %>"
40
40
  data-locale="<%= @locale %>">
@@ -5,13 +5,136 @@
5
5
  <head>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
8
- <title><%= @page_title || "We're sorry" %></title>
9
- <%= stylesheet_link_tag "pages/errors" %>
8
+ <title><%= content_for(:page_title) || "We're sorry" %></title>
9
+ <style>
10
+ body {
11
+ background: #fff;
12
+ background: linear-gradient(180deg, rgba(236, 236, 236, 1) 0%, rgba(255, 255, 255, 1) 50%);
13
+ background-repeat: no-repeat;
14
+ margin: 0;
15
+ padding: 0;
16
+ border: 0;
17
+ font-family: Helvetica, Arial, sans-serif;
18
+ font-size: 16px;
19
+ color: #111;
20
+ line-height: 1.5;
21
+ }
22
+
23
+ main {
24
+ width: 600px;
25
+ margin: 150px auto;
26
+ }
27
+
28
+ h1, h2, h3, h4, h5, h6, p, ul, form {
29
+ margin: 0 0 16px 0;
30
+ }
31
+
32
+ h4 {
33
+ margin-bottom: 0;
34
+ font-size: 1em;
35
+ font-weight: bold;
36
+ }
37
+
38
+ h4 em {
39
+ font-weight: normal;
40
+ font-style: normal;
41
+ }
42
+
43
+ ul {
44
+ list-style-type: disc;
45
+ list-style-position: inside;
46
+ padding: 0;
47
+ }
48
+
49
+ ul li {
50
+ margin: 0;
51
+ padding: 0;
52
+ }
53
+
54
+ h1 {
55
+ font-weight: bold;
56
+ color: #111;
57
+ font-size: 36px;
58
+ }
59
+
60
+ p.footer {
61
+ margin-top: 64px;
62
+ font-size: 12px;
63
+ color: #868686;
64
+ }
65
+
66
+ p.error_id {
67
+ margin-top: 64px;
68
+ font-size: 12px;
69
+ color: #dcdbd2;
70
+ }
71
+
72
+ input[type=text],
73
+ textarea {
74
+ vertical-align: top;
75
+ border: 1px solid #c4c2bb;
76
+ color: #444;
77
+ font-family: Helvetica, Arial, sans-serif;
78
+ font-size: 18px;
79
+ padding: 6px 8px 6px 8px;
80
+ width: 490px;
81
+ border-radius: 3px;
82
+ }
83
+
84
+ input.with_button {
85
+ width: 400px;
86
+ margin-right: 4px;
87
+ }
88
+
89
+ a,
90
+ a:visited {
91
+ color: #0751b6;
92
+ text-decoration: underline;
93
+ }
94
+
95
+ a:hover {
96
+ color: #042d65;
97
+ }
98
+
99
+ form {
100
+ vertical-align: top;
101
+ }
102
+
103
+ button.clean-gray {
104
+ background-color: #eeeeee;
105
+ background-image: linear-gradient(top, #f8f8f8, #e0e0e0);
106
+ border: 1px solid #ccc;
107
+ border-bottom: 1px solid #bbb;
108
+ border-radius: 3px;
109
+ color: #333;
110
+ font: bold 15px Helvetica, Arial, sans-serif;
111
+ line-height: 1;
112
+ padding: 9px 0;
113
+ text-align: center;
114
+ text-shadow: 0 1px 0 #eee;
115
+ width: 150px;
116
+ }
117
+
118
+ button.clean-gray:hover {
119
+ background-color: #dddddd;
120
+ background-image: linear-gradient(top, #f0f0f0, #dddddd);
121
+ border: 1px solid #bbb;
122
+ border-bottom: 1px solid #aaa;
123
+ cursor: pointer;
124
+ text-shadow: 0 1px 0 #ddd;
125
+ }
126
+
127
+ button.clean-gray:active {
128
+ border: 1px solid #aaa;
129
+ border-bottom: 1px solid #888;
130
+ box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
131
+ }
132
+ </style>
10
133
  </head>
11
134
  <body>
12
135
  <main>
13
- <% if @page_title %>
14
- <h1><%= @page_title %></h1>
136
+ <% if content_for?(:page_title) %>
137
+ <h1><%= content_for(:page_title) %></h1>
15
138
  <% end %>
16
139
  <%= yield %>
17
140
  </main>
data/config/routes.rb CHANGED
@@ -88,6 +88,7 @@ Rails.application.routes.draw do
88
88
  resources :pages do
89
89
  collection do
90
90
  get "deleted"
91
+ get "search"
91
92
  end
92
93
 
93
94
  member do
@@ -11,7 +11,6 @@ module PagesCore
11
11
  setting :localizations, :boolean, false
12
12
  setting :locales, :hash
13
13
  setting :text_filter, :symbol, :textile
14
- setting :rss_fulltext, :boolean, true
15
14
  setting :image_fallback_url, :string
16
15
  setting :default_author, :string
17
16
  setting :error_404_layout, :string
@@ -28,10 +28,11 @@ module PagesCore
28
28
  initializer :assets do |_config|
29
29
  Rails.application.config.assets.precompile += %w[
30
30
  pages_core/admin-dist.js
31
- pages/admin.css
32
- pages/errors.css
31
+ pages_core/admin.css
32
+ pages_core/fonts/*.ttf
33
+ pages_core/fonts/*.woff2
33
34
  pages/favicon.gif
34
- pages/admin/icon.png
35
+ pages/admin/icon.svg
35
36
  pages/*.gif
36
37
  pages/*.png
37
38
  pages/*.jpg
data/lib/pages_core.rb CHANGED
@@ -41,7 +41,6 @@ require "will_paginate"
41
41
  require "will_paginate/view_helpers/action_view"
42
42
 
43
43
  # Assets
44
- require "font-awesome-rails"
45
44
  require "react-rails"
46
45
 
47
46
  # Pages
@@ -14,40 +14,56 @@ module PagesCore
14
14
  end
15
15
 
16
16
  def create_css_framework
17
- ["application.sass.scss",
18
- "config.scss",
19
- "components/base.scss",
20
- "framework/breakpoints.scss",
21
- "framework/clearfix.scss",
22
- "framework/grid.scss",
23
- "framework/grid_overlay.scss",
24
- "framework/fonts.scss",
25
- "global/colors.scss",
26
- "global/typography.scss",
27
- "vendor/normalize.css"].each do |f|
17
+ ["application.postcss.css",
18
+ "config.css",
19
+ "components/base.css",
20
+ "components/layout.css",
21
+ "global/animation.css",
22
+ "global/colors.css",
23
+ "global/fonts.css",
24
+ "global/grid.css",
25
+ "global/typography.css"].each do |f|
28
26
  template("stylesheets/#{f}", File.join("app/assets/stylesheets/#{f}"))
29
27
  end
30
28
  end
31
29
 
32
30
  def create_js_framework
33
- ["lib/ResponsiveEmbeds.js",
34
- "lib/GridOverlay.js"].each do |f|
31
+ ["lib/responsiveEmbeds.ts",
32
+ "lib/gridOverlay.ts"].each do |f|
35
33
  template("javascript/#{f}", File.join("app/javascript/#{f}"))
36
34
  end
37
35
 
38
36
  append_to_file "app/javascript/application.js" do
39
37
  <<~JS
40
38
  // Responsive embeds
41
- import ResponsiveEmbeds from "./lib/ResponsiveEmbeds";
42
- ResponsiveEmbeds.start();
39
+ import responsiveEmbeds from "./lib/responsiveEmbeds";
40
+ responsiveEmbeds();
43
41
 
44
42
  // Grid overlay
45
- import GridOverlay from "./lib/GridOverlay";
46
- GridOverlay.start();
43
+ import gridOverlay from "./lib/gridOverlay";
44
+ gridOverlay();
47
45
  JS
48
46
  end
49
47
  end
50
48
 
49
+ def install_js_dependencies
50
+ run("yarn add autoprefixer cssnano normalize.css postcss " \
51
+ "postcss-calc postcss-cli postcss-import " \
52
+ "postcss-import-ext-glob postcss-mixins postcss-preset-env " \
53
+ "postcss-url")
54
+ end
55
+
56
+ def configure_postcss
57
+ copy_file("postcss.config.js",
58
+ File.join("postcss.config.js"))
59
+ end
60
+
61
+ def configure_build_script
62
+ script = "postcss ./app/assets/stylesheets/application.postcss.css " \
63
+ "-o ./app/assets/builds/application.css"
64
+ run %(npm set-script build:css "#{script}")
65
+ end
66
+
51
67
  def remove_application_css
52
68
  remove_file("app/assets/stylesheets/application.css")
53
69
  end
@@ -4,7 +4,6 @@
4
4
  <%= javascript_include_tag "application" %>
5
5
  <%= feed_tags %>
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <%# google_analytics_tags "UA-xxxxxxxx-1" %>
8
7
  <% end %>
9
8
  <body>
10
9
  <% if Rails.env.development? %>
@@ -0,0 +1,40 @@
1
+ function ready(callback: () => void) {
2
+ if (document.readyState === "complete" ||
3
+ (document.readyState !== "loading" && !document.documentElement.doScroll)) {
4
+ callback();
5
+ } else {
6
+ document.addEventListener("DOMContentLoaded", callback);
7
+ }
8
+ }
9
+
10
+ function applyGrid () {
11
+ let showGrid = false;
12
+ const gridOverlay = document.querySelector(".grid-overlay");
13
+
14
+ const setState = (newState: boolean) => {
15
+ showGrid = newState;
16
+
17
+ if (newState) {
18
+ window.localStorage.setItem("showGrid", "true");
19
+ gridOverlay.classList.add("grid-overlay--active");
20
+ } else {
21
+ window.localStorage.removeItem("showGrid");
22
+ gridOverlay.classList.remove("grid-overlay--active");
23
+ }
24
+ };
25
+
26
+ if (gridOverlay) {
27
+ setState(window.localStorage.getItem("showGrid") == "true");
28
+
29
+ // Keyboard toggle
30
+ document.addEventListener("keyup", (evt: KeyboardEvent) => {
31
+ if (evt.ctrlKey && evt.which == 71) {
32
+ setState(!showGrid);
33
+ }
34
+ });
35
+ }
36
+ }
37
+
38
+ export default function gridOverlay() {
39
+ ready(applyGrid);
40
+ }
@@ -0,0 +1,68 @@
1
+ const selectors = [
2
+ "iframe[src*=\"bandcamp.com\"]",
3
+ "iframe[src*=\"player.vimeo.com\"]",
4
+ "iframe[src*=\"youtube.com\"]",
5
+ "iframe[src*=\"youtube-nocookie.com\"]",
6
+ "iframe[src*=\"spotify.com\"]",
7
+ "iframe[src*=\"kickstarter.com\"][src*=\"video.html\"]"
8
+ ];
9
+
10
+ function readyHandler(fn: () => void) {
11
+ if (document.readyState === "complete" || document.readyState === "interactive") {
12
+ setTimeout(fn, 1);
13
+ } else {
14
+ document.addEventListener("DOMContentLoaded", fn);
15
+ }
16
+ }
17
+
18
+ function wrapEmbed(embed: HTMLElement): HTMLElement {
19
+ const parent = embed.parentNode as HTMLElement;
20
+
21
+ // Recycle the existing container if the embed is already responsive.
22
+ if (parent &&
23
+ parent.tagName === "DIV" &&
24
+ parent.childNodes.length === 1 &&
25
+ parent.style.position === "relative") {
26
+ return parent;
27
+ }
28
+
29
+ const wrapper = document.createElement("div");
30
+ if (parent.tagName === "P") {
31
+ parent.parentNode.replaceChild(wrapper, parent);
32
+ } else {
33
+ parent.replaceChild(wrapper, embed);
34
+ }
35
+ wrapper.appendChild(embed);
36
+ return wrapper;
37
+ }
38
+
39
+ function applyEmbed(embed: HTMLElement) {
40
+ const parent = embed.parentNode as HTMLElement;
41
+
42
+ if (parent && parent.classList.contains("responsive-embed")) {
43
+ return;
44
+ }
45
+
46
+ const width = embed.offsetWidth;
47
+ const height = embed.offsetHeight;
48
+ const ratio = height / width;
49
+ const wrapper = wrapEmbed(embed);
50
+
51
+ wrapper.classList.add("responsive-embed");
52
+ wrapper.style.position = "relative";
53
+ wrapper.style.width = "100%";
54
+ wrapper.style.paddingTop = 0;
55
+ wrapper.style.paddingBottom = `${ratio * 100}%`;
56
+
57
+ embed.style.position = "absolute";
58
+ embed.style.width = "100%";
59
+ embed.style.height = "100%";
60
+ embed.style.top = "0";
61
+ embed.style.left = "0";
62
+ }
63
+
64
+ export default function responsiveEmbeds() {
65
+ readyHandler(() => {
66
+ document.querySelectorAll(selectors.join(",")).forEach(applyEmbed);
67
+ });
68
+ }
@@ -0,0 +1,17 @@
1
+ module.exports = {
2
+ plugins: [
3
+ require("postcss-import-ext-glob"),
4
+ require("postcss-import"),
5
+ require("postcss-url")(
6
+ { filter: "**/*.svg",
7
+ url: "inline",
8
+ basePath: "../images" }
9
+ ),
10
+ require("postcss-mixins"),
11
+ require("postcss-simple-vars"),
12
+ require("postcss-preset-env")({ stage: 1 }),
13
+ require("postcss-calc")({ precision: 10 }),
14
+ require("autoprefixer"),
15
+ require("postcss-discard-duplicates")
16
+ ],
17
+ };
@@ -0,0 +1,4 @@
1
+ @import "normalize.css";
2
+ @import "config";
3
+ @import-glob "global/*.css";
4
+ @import-glob "components/*.css";