trusty-cms 7.0.24 → 7.0.26
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/Gemfile.lock +1 -1
- data/README.md +5 -0
- data/app/controllers/admin/pages_controller.rb +0 -5
- data/app/controllers/admin/resource_controller.rb +1 -11
- data/app/models/page.rb +3 -5
- data/app/views/admin/pages/_fields.html.haml +10 -8
- data/lib/trusty_cms/version.rb +1 -1
- data/vendor/extensions/layouts-extension/lib/share_layouts/helpers/action_view.rb +7 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d45d76c458d982e12e398501691b9c80786772ae9a752b2476bcababf4f97ceb
|
4
|
+
data.tar.gz: c5ff04b23662c3df08191e9780008c1f28b7eaffcb6f54a912dda3521f2bf22e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b73ce6f51a809957d30ca3a51a67f2496db293b1160438608029d3a6e3ec40ea6aea40adad0d60374212a3475a508e900505b957890c486e505d47b15a3a69c
|
7
|
+
data.tar.gz: 0b72e9b00f8dd0b2b5964f4d00f6d6cc085052a7c0e9635f48a6aee8325460d2890449b0a65200b490087c4b3d82c589d63987e987954c9e5278f92a4e315134
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -106,6 +106,11 @@ DEFAULT_PAGE_TYPE_ROUTES = %w[
|
|
106
106
|
].freeze
|
107
107
|
```
|
108
108
|
|
109
|
+
### Save and View Draft Caching
|
110
|
+
To ensure that pages and drafts under development are not cached by the browser or content delivery networks (such as CloudFront), the CMS appends a `trusty-no-cache` URL parameter containing the current date and time when a user selects **Save and View Draft** or **Save and View Page**.
|
111
|
+
|
112
|
+
Because the `trusty-no-cache` parameter is always unique, it effectively bypasses caching mechanisms at both the CDN and browser levels, ensuring the user receives the most up-to-date version of the content with every request. Note that additional CDN configuration may be required to ensure query parameters are respected.
|
113
|
+
|
109
114
|
### Page Status Refresh Setup
|
110
115
|
|
111
116
|
To ensure **Scheduled Pages** automatically update their status to **Published** after their designated **Publish Date & Time**, follow these steps to set up an automated refresh using **AWS Lambda** and **EventBridge**.
|
@@ -2,7 +2,6 @@ class Admin::PagesController < Admin::ResourceController
|
|
2
2
|
before_action :initialize_meta_rows_and_buttons, only: %i[new edit create update]
|
3
3
|
before_action :count_deleted_pages, only: [:destroy]
|
4
4
|
before_action :set_page, only: %i[edit restore]
|
5
|
-
before_action :generate_view_page_url, only: [:edit]
|
6
5
|
rescue_from ActiveRecord::RecordInvalid, with: :validation_error
|
7
6
|
include Admin::NodeHelper
|
8
7
|
include Admin::PagesHelper
|
@@ -75,10 +74,6 @@ class Admin::PagesController < Admin::ResourceController
|
|
75
74
|
@page = Page.find(params[:id])
|
76
75
|
end
|
77
76
|
|
78
|
-
def generate_view_page_url
|
79
|
-
@view_page_url = generate_page_url(request.url, @page)
|
80
|
-
end
|
81
|
-
|
82
77
|
def set_site_and_homepage
|
83
78
|
@site ||= Page.current_site
|
84
79
|
@homepage = @site&.homepage || Page.homepage
|
@@ -202,19 +202,9 @@ class Admin::ResourceController < ApplicationController
|
|
202
202
|
end
|
203
203
|
|
204
204
|
def redirect_url
|
205
|
-
return edit_admin_page_url(model) if params[:continue]
|
206
205
|
return "#{edit_admin_page_url(model)}?view_page=true" if params[:save_and_view]
|
207
206
|
|
208
|
-
|
209
|
-
end
|
210
|
-
|
211
|
-
def index_page_for_model
|
212
|
-
parts = { action: 'index' }
|
213
|
-
if paginated? && model && i = model_class.all.index(model)
|
214
|
-
p = (i / pagination_parameters[:per_page].to_i) + 1
|
215
|
-
parts[:p] = p if p && p > 1
|
216
|
-
end
|
217
|
-
parts
|
207
|
+
params[:continue] ? { action: 'edit', id: model.id } : { action: 'index' }
|
218
208
|
end
|
219
209
|
|
220
210
|
def edit_model_path
|
data/app/models/page.rb
CHANGED
@@ -119,11 +119,9 @@ class Page < ActiveRecord::Base
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def path
|
122
|
-
if
|
123
|
-
|
124
|
-
|
125
|
-
clean_path(slug)
|
126
|
-
end
|
122
|
+
return '' if slug.blank?
|
123
|
+
|
124
|
+
parent? ? parent.child_path(self) : clean_path(slug)
|
127
125
|
end
|
128
126
|
|
129
127
|
alias_method :url, :path
|
@@ -76,20 +76,22 @@
|
|
76
76
|
= save_model_and_view_page_button(@page)
|
77
77
|
= t('or')
|
78
78
|
= link_to t('cancel'), admin_pages_url(site_id: @site_id), class: 'alt'
|
79
|
-
#view-page-url-data{ data: { url: @
|
79
|
+
#view-page-url-data{ data: { url: @page_url } }
|
80
80
|
- form_bottom.edit_timestamp do
|
81
81
|
= updated_stamp @page
|
82
82
|
|
83
83
|
-# Opens a new tab with the page URL when "Save and View Page" is selected
|
84
84
|
:javascript
|
85
85
|
document.addEventListener("DOMContentLoaded", function() {
|
86
|
-
|
87
|
-
|
86
|
+
const params = new URLSearchParams(window.location.search);
|
87
|
+
const dataDiv = document.getElementById("view-page-url-data");
|
88
|
+
const baseUrl = dataDiv?.dataset?.url;
|
88
89
|
|
89
|
-
if (params.get("view_page") === "true" &&
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
if (params.get("view_page") === "true" && baseUrl) {
|
91
|
+
const now = new Date().toISOString();
|
92
|
+
const separator = baseUrl.includes("?") ? "&" : "?";
|
93
|
+
const newTabUrl = `${baseUrl}${separator}trusty-no-cache=${encodeURIComponent(now)}`;
|
94
|
+
window.open(newTabUrl, '_blank');
|
94
95
|
}
|
95
96
|
});
|
97
|
+
|
data/lib/trusty_cms/version.rb
CHANGED
@@ -36,10 +36,15 @@ module ShareLayouts
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def find_page
|
39
|
-
page = Page.find_by_path(request.path) rescue nil
|
39
|
+
page = Page.find_by_path(request.path, can_view_drafts?) rescue nil
|
40
40
|
page.is_a?(RailsPage) ? page : RailsPage.new(:class_name => "RailsPage")
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def can_view_drafts?
|
46
|
+
user_signed_in? # CMS users can view drafts
|
47
|
+
end
|
43
48
|
end
|
44
49
|
end
|
45
50
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trusty-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TrustyCms CMS dev team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage-validator
|