pages_core 3.14.0 → 3.15.1
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/assets/builds/fonts/6569749d.ttf +0 -0
- data/app/assets/builds/fonts/7b7db107.woff2 +0 -0
- data/app/assets/builds/fonts/921961e9.woff2 +0 -0
- data/app/assets/builds/fonts/ee32bc60.ttf +0 -0
- data/app/assets/builds/pages_core/admin-dist.js +19 -8
- data/app/assets/builds/pages_core/admin-dist.js.map +4 -4
- data/app/assets/builds/pages_core/admin.css +699 -394
- data/app/assets/builds/pages_core/mailer.css +99 -0
- data/app/assets/fonts/Inter-Black.woff2 +0 -0
- data/app/assets/fonts/Inter-BlackItalic.woff2 +0 -0
- data/app/assets/fonts/Inter-Bold.woff2 +0 -0
- data/app/assets/fonts/Inter-BoldItalic.woff2 +0 -0
- data/app/assets/fonts/Inter-ExtraBold.woff2 +0 -0
- data/app/assets/fonts/Inter-ExtraBoldItalic.woff2 +0 -0
- data/app/assets/fonts/Inter-ExtraLight.woff2 +0 -0
- data/app/assets/fonts/Inter-ExtraLightItalic.woff2 +0 -0
- data/app/assets/fonts/Inter-Italic.woff2 +0 -0
- data/app/assets/fonts/Inter-Light.woff2 +0 -0
- data/app/assets/fonts/Inter-LightItalic.woff2 +0 -0
- data/app/assets/fonts/Inter-Medium.woff2 +0 -0
- data/app/assets/fonts/Inter-MediumItalic.woff2 +0 -0
- data/app/assets/fonts/Inter-Regular.woff2 +0 -0
- data/app/assets/fonts/Inter-SemiBold.woff2 +0 -0
- data/app/assets/fonts/Inter-SemiBoldItalic.woff2 +0 -0
- data/app/assets/fonts/Inter-Thin.woff2 +0 -0
- data/app/assets/fonts/Inter-ThinItalic.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-Black.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-BlackItalic.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-Bold.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-BoldItalic.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-ExtraBold.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-ExtraBoldItalic.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-ExtraLight.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-ExtraLightItalic.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-Italic.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-Light.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-LightItalic.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-Medium.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-MediumItalic.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-Regular.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-SemiBold.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-SemiBoldItalic.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-Thin.woff2 +0 -0
- data/app/assets/fonts/InterDisplay-ThinItalic.woff2 +0 -0
- data/app/assets/fonts/InterVariable-Italic.woff2 +0 -0
- data/app/assets/fonts/InterVariable.woff2 +0 -0
- data/app/assets/stylesheets/pages_core/admin/components/archive.css +1 -1
- data/app/assets/stylesheets/pages_core/admin/components/attachments.css +22 -34
- data/app/assets/stylesheets/pages_core/admin/components/base.css +1 -68
- data/app/assets/stylesheets/pages_core/admin/components/forms.css +109 -48
- data/app/assets/stylesheets/pages_core/admin/components/header.css +56 -58
- data/app/assets/stylesheets/pages_core/admin/components/image_editor.css +35 -24
- data/app/assets/stylesheets/pages_core/admin/components/image_grid.css +28 -27
- data/app/assets/stylesheets/pages_core/admin/components/image_uploader.css +5 -5
- data/app/assets/stylesheets/pages_core/admin/components/layout.css +7 -1
- data/app/assets/stylesheets/pages_core/admin/components/list_table.css +24 -15
- data/app/assets/stylesheets/pages_core/admin/components/page_tree.css +63 -104
- data/app/assets/stylesheets/pages_core/admin/components/pagination.css +12 -13
- data/app/assets/stylesheets/pages_core/admin/components/search.css +1 -16
- data/app/assets/stylesheets/pages_core/admin/components/sidebar.css +5 -11
- data/app/assets/stylesheets/pages_core/admin/components/tag_editor.css +22 -36
- data/app/assets/stylesheets/pages_core/admin/components/toast.css +1 -2
- data/app/assets/stylesheets/pages_core/admin/components/toolbar.css +10 -10
- data/app/assets/stylesheets/pages_core/admin/components/totp.css +1 -1
- data/app/assets/stylesheets/pages_core/admin/controllers/pages.css +37 -51
- data/app/assets/stylesheets/pages_core/admin/global/fonts.css +271 -0
- data/app/assets/stylesheets/pages_core/admin/global/typography.css +109 -0
- data/app/assets/stylesheets/pages_core/admin/vars.css +1 -3
- data/app/assets/stylesheets/pages_core/{admin.postcss.css → admin.css} +1 -0
- data/app/assets/stylesheets/pages_core/mailer.css +90 -0
- data/app/controllers/admin/account_recoveries_controller.rb +2 -2
- data/app/controllers/admin/pages_controller.rb +22 -42
- data/app/controllers/concerns/pages_core/error_reporting.rb +1 -1
- data/app/controllers/concerns/pages_core/page_parameters.rb +29 -0
- data/app/controllers/concerns/pages_core/policies_helper.rb +1 -1
- data/app/controllers/concerns/pages_core/preview_pages_controller.rb +20 -20
- data/app/controllers/pages_core/admin_controller.rb +0 -2
- data/app/controllers/pages_core/frontend/pages_controller.rb +2 -6
- data/app/formatters/pages_core/html_formatter.rb +2 -4
- data/app/helpers/admin/menu_helper.rb +5 -4
- data/app/helpers/admin/pages_helper.rb +1 -21
- data/app/helpers/pages_core/admin/admin_helper.rb +2 -3
- data/app/helpers/pages_core/admin/content_tabs_helper.rb +1 -2
- data/app/helpers/pages_core/admin/labelled_field_helper.rb +1 -1
- data/app/helpers/pages_core/attachments_helper.rb +1 -1
- data/app/helpers/pages_core/frontend_helper.rb +1 -1
- data/app/helpers/pages_core/images_helper.rb +10 -8
- data/app/helpers/pages_core/labelled_form_builder.rb +2 -7
- data/app/helpers/pages_core/page_path_helper.rb +1 -1
- data/app/javascript/components/Attachments/Attachment.tsx +20 -18
- data/app/javascript/components/Attachments/AttachmentEditor.tsx +11 -9
- data/app/javascript/components/{Attachments.jsx → Attachments/List.tsx} +58 -63
- data/app/javascript/components/Attachments/useAttachments.ts +15 -0
- data/app/javascript/components/Attachments.tsx +14 -0
- data/app/javascript/components/DateRangeSelect.tsx +105 -0
- data/app/javascript/components/DateTimeSelect.tsx +136 -0
- data/app/javascript/components/EditableImage.tsx +11 -9
- data/app/javascript/components/FileUploadButton.tsx +7 -7
- data/app/javascript/components/ImageCropper/FocalPoint.tsx +9 -12
- data/app/javascript/components/ImageCropper/Image.tsx +10 -8
- data/app/javascript/components/ImageCropper/Toolbar.tsx +11 -12
- data/app/javascript/components/ImageCropper/useCrop.ts +24 -53
- data/app/javascript/components/ImageCropper.tsx +10 -15
- data/app/javascript/components/ImageEditor/Form.tsx +12 -8
- data/app/javascript/components/ImageEditor.tsx +12 -7
- data/app/javascript/components/ImageGrid/DragElement.tsx +9 -12
- data/app/javascript/components/{ImageGrid.jsx → ImageGrid/Grid.tsx} +62 -71
- data/app/javascript/components/ImageGrid/GridImage.tsx +22 -23
- data/app/javascript/components/ImageGrid/Placeholder.tsx +2 -2
- data/app/javascript/components/ImageGrid/useImageGrid.ts +26 -0
- data/app/javascript/components/ImageGrid.tsx +15 -0
- data/app/javascript/components/ImageUploader.tsx +35 -22
- data/app/javascript/components/LabelledField.tsx +34 -0
- data/app/javascript/components/Modal.tsx +2 -2
- data/app/javascript/components/PageForm/Block.tsx +81 -0
- data/app/javascript/components/PageForm/Content.tsx +54 -0
- data/app/javascript/components/PageForm/Dates.tsx +66 -0
- data/app/javascript/components/PageForm/Files.tsx +28 -0
- data/app/javascript/components/PageForm/Form.tsx +41 -0
- data/app/javascript/components/PageForm/Images.tsx +28 -0
- data/app/javascript/components/PageForm/LocaleLinks.tsx +36 -0
- data/app/javascript/components/PageForm/Metadata.tsx +67 -0
- data/app/javascript/components/PageForm/Options.tsx +180 -0
- data/app/javascript/components/PageForm/PageDescription.tsx +48 -0
- data/app/javascript/components/PageForm/PathSegment.tsx +65 -0
- data/app/javascript/components/PageForm/TabPanel.tsx +21 -0
- data/app/javascript/components/PageForm/Tabs.tsx +33 -0
- data/app/javascript/components/PageForm/UnconfiguredContent.tsx +42 -0
- data/app/javascript/components/PageForm/pageParams.ts +95 -0
- data/app/javascript/components/PageForm/preview.ts +23 -0
- data/app/javascript/components/PageForm/usePage.ts +169 -0
- data/app/javascript/components/PageForm/useTabs.ts +46 -0
- data/app/javascript/components/PageForm.tsx +169 -0
- data/app/javascript/components/PageImages.tsx +7 -9
- data/app/javascript/components/PageTree/Draggable.tsx +40 -39
- data/app/javascript/components/PageTree/Node.tsx +62 -56
- data/app/javascript/components/PageTree/PageName.tsx +28 -0
- data/app/javascript/components/PageTree.tsx +65 -53
- data/app/javascript/components/{RichTextArea.jsx → RichTextArea.tsx} +98 -79
- data/app/javascript/components/RichTextToolbarButton.tsx +4 -6
- data/app/javascript/components/TagEditor/AddTagForm.tsx +19 -12
- data/app/javascript/components/TagEditor/Editor.tsx +32 -0
- data/app/javascript/components/TagEditor/Tag.tsx +6 -4
- data/app/javascript/components/TagEditor/useTags.ts +58 -0
- data/app/javascript/components/TagEditor.tsx +8 -58
- data/app/javascript/components/Toast.tsx +3 -3
- data/app/javascript/components/drag/draggedOrder.ts +22 -14
- data/app/javascript/components/drag/useDragCollection.ts +35 -30
- data/app/javascript/components/drag/useDragUploader.ts +32 -21
- data/app/javascript/components/drag/useDraggable.ts +7 -6
- data/app/javascript/components/drag.ts +0 -1
- data/app/javascript/components.ts +1 -3
- data/app/javascript/features/RichText.tsx +2 -3
- data/app/javascript/features/contentTabs.ts +79 -0
- data/app/javascript/index.ts +5 -12
- data/app/javascript/lib/Tree.ts +31 -45
- data/app/javascript/lib/request.ts +11 -11
- data/app/javascript/stores/useToastStore.ts +1 -1
- data/app/javascript/types/Attachments.ts +29 -0
- data/app/javascript/types/Crop.ts +36 -0
- data/app/javascript/types/Drag.ts +34 -0
- data/app/javascript/types/Images.ts +47 -0
- data/app/javascript/types/PageEditor.ts +26 -0
- data/app/javascript/types/Pages.ts +75 -0
- data/app/javascript/types/Tags.ts +9 -0
- data/app/javascript/types/Template.ts +24 -0
- data/app/javascript/types/Trees.ts +19 -0
- data/app/javascript/types.ts +2 -25
- data/app/mailers/admin_mailer.rb +5 -9
- data/app/models/attachment.rb +1 -1
- data/app/models/autopublisher.rb +1 -1
- data/app/models/concerns/pages_core/authenticable_user.rb +63 -0
- data/app/models/concerns/pages_core/emailable.rb +16 -0
- data/app/models/concerns/pages_core/page_model/dated_page.rb +3 -3
- data/app/models/concerns/pages_core/page_model/templateable.rb +2 -16
- data/app/models/concerns/pages_core/taggable.rb +2 -19
- data/app/models/invite.rb +2 -6
- data/app/models/otp_secret.rb +4 -4
- data/app/models/page.rb +0 -3
- data/app/models/user.rb +2 -46
- data/app/policies/page_policy.rb +6 -2
- data/app/resources/admin/page_resource.rb +95 -0
- data/app/resources/admin/page_tree_resource.rb +27 -0
- data/app/resources/admin/template_configuration_resource.rb +50 -0
- data/app/views/admin/news/_sidebar.html.erb +2 -4
- data/app/views/admin/news/index.html.erb +0 -1
- data/app/views/admin/pages/_form.html.erb +10 -30
- data/app/views/admin/pages/_search_bar.html.erb +1 -1
- data/app/views/admin/pages/edit.html.erb +1 -57
- data/app/views/admin/pages/index.html.erb +1 -1
- data/app/views/admin/pages/new.html.erb +1 -44
- data/app/views/admin/sessions/new.html.erb +9 -11
- data/app/views/admin/users/_access_control.html.erb +5 -1
- data/app/views/admin/users/_list.html.erb +12 -7
- data/app/views/admin_mailer/account_recovery.html.erb +20 -0
- data/app/views/admin_mailer/invite.html.erb +11 -0
- data/app/views/layouts/admin/_header.html.erb +2 -4
- data/app/views/layouts/admin/_page_header.html.erb +1 -2
- data/app/views/layouts/admin.html.erb +1 -1
- data/app/views/layouts/pages_core/mailer.html.erb +11 -0
- data/config/locales/en.yml +0 -4
- data/config/routes.rb +3 -7
- data/db/migrate/20240126160700_add_2fa_fields.rb +5 -1
- data/db/migrate/20240131140700_change_email_to_citext.rb +18 -0
- data/db/migrate/20240201160700_remove_persistent_data.rb +7 -0
- data/db/migrate/20240508145300_remove_categories.rb +21 -0
- data/lib/pages_core/configuration/base.rb +2 -2
- data/lib/pages_core/engine.rb +1 -0
- data/lib/pages_core/templates/configuration.rb +1 -1
- data/lib/pages_core/templates/configuration_proxy.rb +2 -2
- data/lib/pages_core/templates/template_configuration.rb +11 -1
- data/lib/pages_core/templates.rb +6 -4
- data/lib/pages_core/version.rb +1 -1
- data/lib/pages_core.rb +1 -0
- data/lib/rails/generators/pages_core/frontend/templates/javascript/lib/gridOverlay.ts +6 -7
- data/lib/rails/generators/pages_core/frontend/templates/javascript/lib/responsiveEmbeds.ts +17 -12
- data/lib/rails/generators/pages_core/rspec/rspec_generator.rb +0 -2
- data/lib/rails/generators/pages_core/rspec/templates/rails_helper.rb +3 -4
- metadata +119 -36
- data/app/assets/builds/fonts/2a3059ad.ttf +0 -0
- data/app/assets/builds/fonts/47262711.woff2 +0 -0
- data/app/assets/builds/fonts/500ddeb0.woff2 +0 -0
- data/app/assets/builds/fonts/81221036.ttf +0 -0
- data/app/assets/stylesheets/pages_core/admin/components/login.css +0 -27
- data/app/controllers/admin/categories_controller.rb +0 -56
- data/app/controllers/concerns/pages_core/admin/persistent_params.rb +0 -75
- data/app/helpers/pages_core/admin/page_blocks_helper.rb +0 -66
- data/app/helpers/pages_core/admin/page_json_helper.rb +0 -23
- data/app/javascript/components/DateRangeSelect.jsx +0 -225
- data/app/javascript/components/PageDates.jsx +0 -73
- data/app/javascript/components/PageFiles.jsx +0 -25
- data/app/javascript/components/PageTree/types.ts +0 -15
- data/app/javascript/components/drag/types.ts +0 -28
- data/app/javascript/controllers/EditPageController.ts +0 -22
- data/app/javascript/controllers/MainController.ts +0 -74
- data/app/javascript/controllers/PageOptionsController.js +0 -67
- data/app/models/category.rb +0 -22
- data/app/models/concerns/pages_core/has_otp.rb +0 -27
- data/app/models/page_category.rb +0 -6
- data/app/views/admin/pages/_edit_content.html.erb +0 -19
- data/app/views/admin/pages/_edit_files.html.erb +0 -4
- data/app/views/admin/pages/_edit_images.html.erb +0 -4
- data/app/views/admin/pages/_edit_metadata.html.erb +0 -35
- data/app/views/admin/pages/_edit_options.html.erb +0 -91
- data/app/views/admin_mailer/account_recovery.text.erb +0 -10
- data/app/views/admin_mailer/invite.text.erb +0 -7
- data/lib/rails/generators/pages_core/rspec/templates/mailer_macros.rb +0 -11
@@ -12,22 +12,20 @@
|
|
12
12
|
|
13
13
|
<div class="login-form">
|
14
14
|
<%= form_tag admin_session_path do %>
|
15
|
-
<
|
15
|
+
<div class="field">
|
16
16
|
<label>Email address</label>
|
17
17
|
<%= text_field_tag(:email, "", autocomplete: "email") %>
|
18
|
-
</
|
19
|
-
<
|
18
|
+
</div>
|
19
|
+
<div class="field">
|
20
20
|
<label>Password</label>
|
21
21
|
<%= password_field_tag(:password, "", autocomplete: "current-password") %>
|
22
|
-
</
|
23
|
-
<
|
22
|
+
</div>
|
23
|
+
<div class="buttons">
|
24
24
|
<button type="submit">Sign in</button>
|
25
|
+
</div>
|
26
|
+
<p>
|
27
|
+
<%= link_to("<b>Help!</b> I forgot my password!".html_safe,
|
28
|
+
new_admin_account_recovery_path) %>
|
25
29
|
</p>
|
26
|
-
<ul>
|
27
|
-
<li>
|
28
|
-
<%= link_to("<b>Help!</b> I forgot my password!".html_safe,
|
29
|
-
new_admin_account_recovery_path) %>
|
30
|
-
</li>
|
31
|
-
</ul>
|
32
30
|
<% end %>
|
33
31
|
</div>
|
@@ -4,7 +4,11 @@
|
|
4
4
|
</h2>
|
5
5
|
<p>
|
6
6
|
<% if f.object.kind_of?(User) && f.object != current_user %>
|
7
|
-
<%= f.check_box :activated %>
|
7
|
+
<%= f.check_box :activated %>
|
8
|
+
<label for="user_activated">
|
9
|
+
The user account is activated
|
10
|
+
</label>
|
11
|
+
<br />
|
8
12
|
<% end %>
|
9
13
|
<% Role.roles.each do |role| %>
|
10
14
|
<%= check_box_tag("#{model_name_from_record_or_class(f.object).param_key}[role_names][]",
|
@@ -3,8 +3,9 @@
|
|
3
3
|
<th>Name</th>
|
4
4
|
<th>Email</th>
|
5
5
|
<th>Can access</th>
|
6
|
+
<th>2FA</th>
|
6
7
|
<th>Last seen</th>
|
7
|
-
<th></th>
|
8
|
+
<th colspan="2"></th>
|
8
9
|
</tr>
|
9
10
|
<% @invites.each do |invite| %>
|
10
11
|
<tr class="invite">
|
@@ -15,13 +16,14 @@
|
|
15
16
|
<td>
|
16
17
|
<%= invite.roles.map(&:to_s).sort.to_sentence %>
|
17
18
|
</td>
|
19
|
+
<td></td>
|
18
20
|
<td>
|
19
21
|
<% if invite.sent_at? %>
|
20
22
|
Invited
|
21
23
|
<%= time_ago_in_words(invite.sent_at) %> ago
|
22
24
|
<% end %>
|
23
25
|
</td>
|
24
|
-
<td>
|
26
|
+
<td colspan="2">
|
25
27
|
<% if current_user.role?(:users) %>
|
26
28
|
<%= link_to("View invite",
|
27
29
|
admin_invite_with_token_url(invite, invite.token)) %> /
|
@@ -36,16 +38,14 @@
|
|
36
38
|
<% end %>
|
37
39
|
<% @users.each do |user| -%>
|
38
40
|
<tr class="user-<%= user.id %>">
|
39
|
-
<td>
|
40
|
-
|
41
|
-
<% if policy(user).edit? %>
|
42
|
-
(<%= link_to "edit", edit_admin_user_url( user ), class: :edit %>)
|
43
|
-
<% end %>
|
41
|
+
<td class="name">
|
42
|
+
<%= link_to user.name, admin_user_url( user ) %>
|
44
43
|
</td>
|
45
44
|
<td>
|
46
45
|
<%= user.email %>
|
47
46
|
</td>
|
48
47
|
<td><%= user.roles.map(&:to_s).sort.to_sentence %></td>
|
48
|
+
<td><%= user.otp_enabled? ? "Enabled" : "" %></td>
|
49
49
|
<td>
|
50
50
|
<% if user.online? -%>
|
51
51
|
<strong>Online now</strong>
|
@@ -62,6 +62,11 @@
|
|
62
62
|
notes.join( ", " )
|
63
63
|
%>
|
64
64
|
</td>
|
65
|
+
<td>
|
66
|
+
<% if policy(user).edit? %>
|
67
|
+
<%= link_to("Edit", edit_admin_user_url(user), class: :edit) %>
|
68
|
+
<% end %>
|
69
|
+
</td>
|
65
70
|
</tr>
|
66
71
|
<% end -%>
|
67
72
|
</table>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<h1>
|
2
|
+
Recover your account
|
3
|
+
</h1>
|
4
|
+
<p>
|
5
|
+
Hi, <%= @user.name %>!
|
6
|
+
</p>
|
7
|
+
<p>
|
8
|
+
We've received a request to recover your account on
|
9
|
+
<%= PagesCore.config(:site_name) %>.
|
10
|
+
</p>
|
11
|
+
<p>
|
12
|
+
Please click the following link to continue:<br>
|
13
|
+
<%= link_to(@url, @url) %>
|
14
|
+
</p>
|
15
|
+
<p>
|
16
|
+
The link will expire in 24 hours.
|
17
|
+
</p>
|
18
|
+
<p>
|
19
|
+
If you do not want to recover your password, please ignore this email.
|
20
|
+
</p>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<h1>
|
2
|
+
Welcome!
|
3
|
+
</h1>
|
4
|
+
<p>
|
5
|
+
<%= @invite.user.name %> has invited you to Pages on
|
6
|
+
<%= PagesCore.config(:site_name) %>.<br>
|
7
|
+
Click the button below to create your account and get started.
|
8
|
+
</p>
|
9
|
+
<div class="buttons">
|
10
|
+
<%= link_to("Create account", @url, class: "primary button") %>
|
11
|
+
</div>
|
@@ -1,10 +1,8 @@
|
|
1
1
|
<header>
|
2
|
-
<div class="logo">
|
3
|
-
<%= link_to image_tag("pages/admin/icon.svg"), '/admin' %>
|
4
|
-
</div>
|
5
2
|
<div class="site-name">
|
6
3
|
<h1>
|
7
|
-
<%= link_to
|
4
|
+
<%= link_to("Pages", "/admin", class: "logo") %>
|
5
|
+
<%= PagesCore.config :site_name %>
|
8
6
|
</h1>
|
9
7
|
</div>
|
10
8
|
<% if logged_in? %>
|
@@ -13,8 +13,7 @@
|
|
13
13
|
role="tablist">
|
14
14
|
<% content_tabs.map do |t| %>
|
15
15
|
<li id="content-tab-link-<%= t[:key] %>"
|
16
|
-
data-tab="<%= t[:key] %>"
|
17
|
-
data-main-target="link">
|
16
|
+
data-tab="<%= t[:key] %>">
|
18
17
|
<% if t[:options][:disabled] == true %>
|
19
18
|
<%= t[:name] %>
|
20
19
|
<% else %>
|
data/config/locales/en.yml
CHANGED
@@ -19,10 +19,6 @@ en:
|
|
19
19
|
image: Profile picture
|
20
20
|
pages_core:
|
21
21
|
account_holder_exists: Account holder already exists
|
22
|
-
categories_controller:
|
23
|
-
created: New category created
|
24
|
-
deleted: Category was deleted
|
25
|
-
updated: Category was updated
|
26
22
|
changes_saved: Your changes were saved
|
27
23
|
invalid_login: >
|
28
24
|
The provided email address and password combination was not valid
|
data/config/routes.rb
CHANGED
@@ -17,9 +17,7 @@ Rails.application.routes.draw do
|
|
17
17
|
collection do
|
18
18
|
get "search"
|
19
19
|
post "search"
|
20
|
-
|
21
|
-
member do
|
22
|
-
put "preview"
|
20
|
+
post "preview"
|
23
21
|
end
|
24
22
|
resources :files, controller: "page_files"
|
25
23
|
end
|
@@ -37,6 +35,8 @@ Rails.application.routes.draw do
|
|
37
35
|
resource :sitemap, only: [:show]
|
38
36
|
|
39
37
|
namespace :admin do
|
38
|
+
get "users/login" => redirect("/admin/login")
|
39
|
+
|
40
40
|
# Invites
|
41
41
|
resources :invites do
|
42
42
|
member do
|
@@ -63,16 +63,12 @@ Rails.application.routes.draw do
|
|
63
63
|
resources :users do
|
64
64
|
collection do
|
65
65
|
get "deactivated"
|
66
|
-
get "login"
|
67
66
|
end
|
68
67
|
member do
|
69
68
|
delete "delete_image"
|
70
69
|
end
|
71
70
|
end
|
72
71
|
|
73
|
-
# Categories
|
74
|
-
resources :categories
|
75
|
-
|
76
72
|
# Authentication
|
77
73
|
resource :session, only: %i[create destroy] do
|
78
74
|
member { post :verify_otp }
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Add2faFields < ActiveRecord::Migration[7.0]
|
4
|
+
class User < ApplicationRecord; end
|
5
|
+
|
4
6
|
def change
|
5
7
|
change_table :users do |t|
|
6
8
|
t.boolean :otp_enabled, null: false, default: false
|
@@ -14,7 +16,9 @@ class Add2faFields < ActiveRecord::Migration[7.0]
|
|
14
16
|
|
15
17
|
reversible do |dir|
|
16
18
|
dir.up do
|
17
|
-
User.find_each
|
19
|
+
User.find_each do |u|
|
20
|
+
u.update_columns(session_token: SecureRandom.hex(32))
|
21
|
+
end
|
18
22
|
change_column_null :users, :session_token, false
|
19
23
|
end
|
20
24
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ChangeEmailToCitext < ActiveRecord::Migration[7.0]
|
4
|
+
def up
|
5
|
+
enable_extension "citext"
|
6
|
+
%i[users invites].each do |t|
|
7
|
+
change_column t, :email, :citext
|
8
|
+
add_index t, :email, unique: true, name: "index_#{t}_on_email"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
%i[users invites].each do |t|
|
14
|
+
change_column t, :email, :string
|
15
|
+
remove_index t, name: "index_#{t}_on_email"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RemoveCategories < ActiveRecord::Migration[7.0]
|
4
|
+
def change
|
5
|
+
drop_table :page_categories do |t|
|
6
|
+
t.integer :page_id
|
7
|
+
t.integer :category_id
|
8
|
+
t.index :category_id
|
9
|
+
t.index :page_id
|
10
|
+
end
|
11
|
+
|
12
|
+
drop_table :categories do |t|
|
13
|
+
t.string :name
|
14
|
+
t.string :slug
|
15
|
+
t.integer :position
|
16
|
+
t.datetime :created_at, null: false
|
17
|
+
t.datetime :updated_at, null: false
|
18
|
+
t.index :slug
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -18,11 +18,11 @@ module PagesCore
|
|
18
18
|
args.any? ? set(key, *args) : get(key)
|
19
19
|
end
|
20
20
|
|
21
|
-
define_method "#{key}=" do |value|
|
21
|
+
define_method :"#{key}=" do |value|
|
22
22
|
set(key, value)
|
23
23
|
end
|
24
24
|
|
25
|
-
define_method "#{key}?" do
|
25
|
+
define_method :"#{key}?" do
|
26
26
|
get(key) ? true : false
|
27
27
|
end
|
28
28
|
end
|
data/lib/pages_core/engine.rb
CHANGED
@@ -95,7 +95,7 @@ module PagesCore
|
|
95
95
|
|
96
96
|
def valid_template_options
|
97
97
|
%i[template image images files text_filter blocks
|
98
|
-
enabled_blocks sub_template tags dates]
|
98
|
+
enabled_blocks sub_template tags dates name]
|
99
99
|
end
|
100
100
|
|
101
101
|
def configure_block(tpl_name, block_name, title = nil, options = {})
|
@@ -9,11 +9,11 @@ module PagesCore
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def method_missing(method_name, *args, &block)
|
12
|
-
if @parent &&
|
12
|
+
if @parent && block
|
13
13
|
@callback.call(@parent, method_name, block)
|
14
14
|
elsif @parent
|
15
15
|
@callback.call(@parent, method_name, *args)
|
16
|
-
elsif
|
16
|
+
elsif block
|
17
17
|
@callback.call(method_name, block)
|
18
18
|
else
|
19
19
|
@callback.call(method_name, *args)
|
@@ -29,7 +29,7 @@ module PagesCore
|
|
29
29
|
|
30
30
|
(config.get(:default, :blocks).to_a + template_blocks)
|
31
31
|
.compact
|
32
|
-
.select { |_, opts| opts[:localized] }.map(&:first)
|
32
|
+
.select { |_, opts| opts[:localized] }.map(&:first).uniq
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
@@ -53,6 +53,10 @@ module PagesCore
|
|
53
53
|
self.class.config
|
54
54
|
end
|
55
55
|
|
56
|
+
def name
|
57
|
+
value(:name) || default_name
|
58
|
+
end
|
59
|
+
|
56
60
|
def value(*path)
|
57
61
|
path = [path, :value].flatten
|
58
62
|
value = config.get(*[:default, path].flatten)
|
@@ -103,6 +107,12 @@ module PagesCore
|
|
103
107
|
size: :small
|
104
108
|
}
|
105
109
|
end
|
110
|
+
|
111
|
+
def default_name
|
112
|
+
return "[Default]" if template_name == :index
|
113
|
+
|
114
|
+
template_name.to_s.humanize
|
115
|
+
end
|
106
116
|
end
|
107
117
|
|
108
118
|
class << self
|
data/lib/pages_core/templates.rb
CHANGED
@@ -10,6 +10,10 @@ require "pages_core/templates/template_configuration"
|
|
10
10
|
module PagesCore
|
11
11
|
module Templates
|
12
12
|
class << self
|
13
|
+
def all
|
14
|
+
names.map { |n| PagesCore::Templates::TemplateConfiguration.new(n) }
|
15
|
+
end
|
16
|
+
|
13
17
|
def names
|
14
18
|
@names ||= find_all_templates
|
15
19
|
end
|
@@ -17,10 +21,8 @@ module PagesCore
|
|
17
21
|
private
|
18
22
|
|
19
23
|
def template_paths
|
20
|
-
[
|
21
|
-
|
22
|
-
Rails.root.join("app/views/pages/templates")
|
23
|
-
]
|
24
|
+
[PagesCore.plugin_root.join("app/views/pages/templates"),
|
25
|
+
Rails.root.join("app/views/pages/templates")]
|
24
26
|
end
|
25
27
|
|
26
28
|
def template_files
|
data/lib/pages_core/version.rb
CHANGED
data/lib/pages_core.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
function ready(callback: () => void) {
|
2
|
-
if (document.readyState
|
3
|
-
(
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
}
|
2
|
+
if (document.readyState !== "loading") {
|
3
|
+
callback();
|
4
|
+
} else {
|
5
|
+
document.addEventListener("DOMContentLoaded", callback);
|
6
|
+
}
|
8
7
|
}
|
9
8
|
|
10
|
-
function applyGrid
|
9
|
+
function applyGrid() {
|
11
10
|
let showGrid = false;
|
12
11
|
const gridOverlay = document.querySelector(".grid-overlay");
|
13
12
|
|
@@ -1,14 +1,17 @@
|
|
1
1
|
const selectors = [
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
8
|
];
|
9
9
|
|
10
10
|
function readyHandler(fn: () => void) {
|
11
|
-
if (
|
11
|
+
if (
|
12
|
+
document.readyState === "complete" ||
|
13
|
+
document.readyState === "interactive"
|
14
|
+
) {
|
12
15
|
setTimeout(fn, 1);
|
13
16
|
} else {
|
14
17
|
document.addEventListener("DOMContentLoaded", fn);
|
@@ -19,12 +22,14 @@ function wrapEmbed(embed: HTMLElement): HTMLElement {
|
|
19
22
|
const parent = embed.parentNode as HTMLElement;
|
20
23
|
|
21
24
|
// Recycle the existing container if the embed is already responsive.
|
22
|
-
if (
|
25
|
+
if (
|
26
|
+
parent &&
|
23
27
|
parent.tagName === "DIV" &&
|
24
28
|
parent.childNodes.length === 1 &&
|
25
|
-
parent.style.position === "relative"
|
26
|
-
|
27
|
-
|
29
|
+
parent.style.position === "relative"
|
30
|
+
) {
|
31
|
+
return parent;
|
32
|
+
}
|
28
33
|
|
29
34
|
const wrapper = document.createElement("div");
|
30
35
|
if (parent.tagName === "P") {
|
@@ -51,7 +56,7 @@ function applyEmbed(embed: HTMLElement) {
|
|
51
56
|
wrapper.classList.add("responsive-embed");
|
52
57
|
wrapper.style.position = "relative";
|
53
58
|
wrapper.style.width = "100%";
|
54
|
-
wrapper.style.paddingTop = 0;
|
59
|
+
wrapper.style.paddingTop = "0";
|
55
60
|
wrapper.style.paddingBottom = `${ratio * 100}%`;
|
56
61
|
|
57
62
|
embed.style.position = "absolute";
|
@@ -23,14 +23,12 @@ module PagesCore
|
|
23
23
|
def setup_rspec
|
24
24
|
create_file File.join(".rspec"), "--format Fuubar\n--colour\n" \
|
25
25
|
"--require spec_helper"
|
26
|
-
create_file File.join("spec/controllers/.keep")
|
27
26
|
create_file File.join("spec/mailers/preview/.keep")
|
28
27
|
create_file File.join("spec/models/.keep")
|
29
28
|
create_file File.join("spec/system/.keep")
|
30
29
|
template "spec_helper.rb", File.join("spec/spec_helper.rb")
|
31
30
|
template "rails_helper.rb", File.join("spec/rails_helper.rb")
|
32
31
|
template "factories.rb", File.join("spec/factories.rb")
|
33
|
-
template "mailer_macros.rb", File.join("spec/support/mailer_macros.rb")
|
34
32
|
template("page_templates_spec.rb",
|
35
33
|
File.join("spec/system/page_templates_spec.rb"))
|
36
34
|
end
|
@@ -6,16 +6,16 @@ ENV["RAILS_ENV"] ||= "test"
|
|
6
6
|
require "simplecov"
|
7
7
|
SimpleCov.start "rails" if ARGV.grep(/spec\.rb/).empty?
|
8
8
|
|
9
|
+
require "spec_helper"
|
9
10
|
require File.expand_path("../config/environment", __dir__)
|
10
11
|
|
11
12
|
# Prevent database truncation if the environment is production
|
12
13
|
if Rails.env.production?
|
13
14
|
abort("The Rails environment is running in production mode!")
|
14
15
|
end
|
15
|
-
require "spec_helper"
|
16
16
|
require "rspec/rails"
|
17
|
-
# Add additional requires below this line. Rails is not loaded until this point!
|
18
17
|
|
18
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
19
19
|
require "shoulda-matchers"
|
20
20
|
|
21
21
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
@@ -41,7 +41,7 @@ ActiveRecord::Migration.maintain_test_schema!
|
|
41
41
|
|
42
42
|
RSpec.configure do |config|
|
43
43
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
44
|
-
config.
|
44
|
+
# config.fixture_paths = [Rails.root.join("spec/fixtures")]
|
45
45
|
|
46
46
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
47
47
|
# examples within a transaction, remove the following line or assign false
|
@@ -69,7 +69,6 @@ RSpec.configure do |config|
|
|
69
69
|
# config.filter_gems_from_backtrace("gem name")
|
70
70
|
|
71
71
|
config.include ActiveJob::TestHelper
|
72
|
-
config.include MailerMacros
|
73
72
|
|
74
73
|
# Use FactoryBot shorthand
|
75
74
|
config.include FactoryBot::Syntax::Methods
|