trusty-cms 7.0.11 → 7.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 449fe5133cb47597ee1a6088a2104532570912d8741e5d6b59b486b4ed74a470
4
- data.tar.gz: 41500d82c661b36dd039d5157029f25a1695b85b5aff10f57a92e8931bdb0be5
3
+ metadata.gz: 68da1e89b8b32169bb6baae3589febf0efdd68e428c5b2b9c75515031d136d99
4
+ data.tar.gz: a3cd6ddf61e71846d5c0e5d1e6ab1c348acbad2eda00f19e3cd9177b08267fb9
5
5
  SHA512:
6
- metadata.gz: cd847aa08fbda487d3ef6e216858ac4f643e15291ed52e03c4f4a2a545a48459e2ef55a289b3773b7b416cfac6fd97940a80857514888952e095ccf3d8100849
7
- data.tar.gz: e383a81c109eff12e51d99d09b9afb1a28af22fd5d6bc78741921ccba4257e4d70643b6361c2b7c7ead11e717bd1529b8cef04d0ff5c80f21650a49089c07758
6
+ metadata.gz: 4218c6ba21d0d1d5af483ef5dbbb10c9111345197203140db5d35dac610a0654235853636f0192cb4d81c170ed054d32cc886c09ccef7f74a9e31b4fbcf1540f
7
+ data.tar.gz: ba63184aeac33e4cd048ff7446cf656347861513b682e7835b441847aa4d0ad63e7b0ca7312029310b573cde87d9098039eb49de48e4859a6af2e30fa5ec4329
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusty-cms (7.0.11)
4
+ trusty-cms (7.0.13)
5
5
  RedCloth (= 4.3.3)
6
6
  activestorage-validator
7
7
  acts_as_list (>= 0.9.5, < 1.3.0)
data/README.md CHANGED
@@ -93,17 +93,25 @@ SecureRandom.base58(24)
93
93
  ```
94
94
 
95
95
  **2. Store the Token in Rails Credentials**
96
- Run the following command to edit your credentials:
96
+ To store your token securely, edit your Rails credentials by running the following command:
97
97
  ```bash
98
98
  bin/rails encrypted:edit config/credentials.yml.enc
99
- ```
100
- Add the token to your credentials:
99
+ ```
100
+ Then, add the token to your credentials file under the `trusty_cms` namespace:
101
101
  ```yaml
102
102
  trusty_cms:
103
103
  page_status_bearer_token: '<your bearer token>'
104
- ```
104
+ ```
105
+
106
+ **3. Add Google Tag Manager Container ID (Optional)**
107
+ If you'd like to enable trusty-cms to submit Google Tag Manager data for tracking admin page activity (this does not include public-facing pages), add your Google Tag Manager Container ID to the `trusty_cms` section of your `credentials.yml.enc` file:
108
+ ```yaml
109
+ trusty_cms:
110
+ page_status_bearer_token: '<your bearer token>'
111
+ gtm_container_id: 'GTM-xxxxxx'
112
+ ```
105
113
 
106
- **3. Create a Ruby Lambda Function in AWS**
114
+ **4. Create a Ruby Lambda Function in AWS**
107
115
  - Log into **AWS Lambda** and create a **new Ruby Lambda function**.
108
116
  - Note the **Ruby version** used, as you'll need it locally.
109
117
  - Use [rbenv](https://github.com/rbenv/rbenv) to manage the Ruby version locally:
@@ -112,7 +120,7 @@ trusty_cms:
112
120
  rbenv local 3.3.0
113
121
  ```
114
122
 
115
- **4. Write the Lambda Function Code**
123
+ **5. Write the Lambda Function Code**
116
124
  In your local development environment:
117
125
  - Create a new folder and open it in your IDE.
118
126
  - Save the following code in a file named `lambda_handler.rb`:
@@ -140,7 +148,7 @@ def lambda_handler(event:, context:)
140
148
  end
141
149
  ```
142
150
 
143
- **5. Install Dependencies**
151
+ **6. Install Dependencies**
144
152
  Run the following commands in your terminal:
145
153
  ```bash
146
154
  gem install bundler
@@ -156,25 +164,25 @@ bundle config set --local path 'vendor/bundle'
156
164
  bundle install
157
165
  ```
158
166
 
159
- **6. Package the Lambda Function**
167
+ **7. Package the Lambda Function**
160
168
  Archive your function and dependencies:
161
169
  ```bash
162
170
  zip -r lambda_package.zip .
163
171
  ```
164
172
 
165
- **7. Upload to AWS Lambda**
173
+ **8. Upload to AWS Lambda**
166
174
  - In **AWS Lambda**, open your function.
167
175
  - Select **Upload From > .zip file**.
168
176
  - Upload the `lambda_package.zip` file.
169
177
 
170
- **8. Configure Environment Variables**
178
+ **9. Configure Environment Variables**
171
179
  In the AWS Lambda Configuration:
172
180
  - Go to **Environment Variables** > **Edit**.
173
181
  - Add the following:
174
182
  - `API_ENDPOINT`: `<your-url>/page-status/refresh`
175
183
  - `BEARER_TOKEN`: `<your bearer token>`
176
184
 
177
- **9. Set Up EventBridge Trigger**
185
+ **10. Set Up EventBridge Trigger**
178
186
  - In **Configuration Settings > Triggers**, create a **new EventBridge Trigger**.
179
187
  - Set the **Schedule** to match your desired **page status refresh frequency**.
180
188
 
@@ -15,7 +15,7 @@ class PageStatusController < ApplicationController
15
15
 
16
16
  def authenticate_bearer_token
17
17
  provided_token = request.headers['Authorization']&.split(' ')&.last
18
- expected_token = Rails.application.credentials[:trusty_cms][:page_status_bearer_token]
18
+ expected_token = Rails.application.credentials&.dig(:trusty_cms, :page_status_bearer_token)
19
19
 
20
20
  if provided_token.blank?
21
21
  render json: { error: 'Missing Bearer Token' }, status: :unauthorized and return
@@ -103,7 +103,7 @@ module StandardTags
103
103
  <pre><code><r:children:each [offset="number"] [limit="number"]
104
104
  [by="published_at|updated_at|created_at|slug|title|keywords|description"]
105
105
  [order="asc|desc"]
106
- [status="draft|reviewed|published|hidden|all"]
106
+ [status="draft|reviewed|scheduled|published|all"]
107
107
  [paginated="true"]
108
108
  [per_page="number"]
109
109
  >
data/app/models/status.rb CHANGED
@@ -32,6 +32,5 @@ class Status
32
32
  Status.new(id: 50, name: 'Reviewed'),
33
33
  Status.new(id: 90, name: 'Scheduled'),
34
34
  Status.new(id: 100, name: 'Published'),
35
- Status.new(id: 101, name: 'Hidden'),
36
35
  ]
37
36
  end
@@ -1,3 +1,4 @@
1
+ - gtm_container_id = Rails.application.credentials&.dig(:trusty_cms, :gtm_container_id)
1
2
  <!DOCTYPE html>
2
3
  %html{ :xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en", :class => "tablesaw-enhanced fontawesome-i2svg-active fontawesome-i2svg-complete" }
3
4
  %head
@@ -8,6 +9,19 @@
8
9
  - @stylesheets.uniq.each do |stylesheet|
9
10
  = stylesheet_link_tag stylesheet, media: "all"
10
11
 
12
+ - if gtm_container_id
13
+ %script{:type=>"text/javascript"}
14
+ :plain
15
+ (function(w, d, s, l, i) {
16
+ w[l] = w[l] || [];
17
+ w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
18
+ var f = d.getElementsByTagName(s)[0],
19
+ j = d.createElement(s),
20
+ dl = l != 'dataLayer' ? '&l=' + l : '';
21
+ j.async = true;
22
+ j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
23
+ f.parentNode.insertBefore(j, f);
24
+ })(window, document, 'script', 'dataLayer', "#{gtm_container_id}");
11
25
  %script{:type=>"text/javascript"}
12
26
  var relative_url_root = "#{ActionController::Base.relative_url_root}";
13
27
 
@@ -30,6 +44,9 @@
30
44
  = csrf_meta_tags
31
45
 
32
46
  %body{:class=>body_classes.join(" ")}
47
+ - if gtm_container_id
48
+ %noscript
49
+ %iframe{src: "https://www.googletagmanager.com/ns.html?id=#{gtm_container_id}", height: "0", width: "0", style: "display:none;visibility:hidden"}
33
50
  #page.trusty-container
34
51
  %header
35
52
  - if logged_in?
@@ -141,7 +141,7 @@ en:
141
141
  <pre><code><r:children:each [offset=\"number\"] [limit=\"number\"]
142
142
  [by=\"published_at|updated_at|created_at|slug|title|keywords|description\"]
143
143
  [order=\"asc|desc\"]
144
- [status=\"draft|reviewed|published|hidden|all\"]
144
+ [status=\"draft|reviewed|scheduled|published|all\"]
145
145
  [paginated=\"true\"]
146
146
  [per_page=\"number\"]
147
147
  >
@@ -107,7 +107,7 @@
107
107
 
108
108
  <pre><code><r&#58;children&#58;each [offset="number"] [limit="number"]
109
109
  [by="published_at|updated_at|created_at|slug|title|keywords|description"]
110
- [order="asc|desc"] [status="draft|reviewed|published|hidden|all"]>
110
+ [order="asc|desc"] [status="draft|reviewed|scheduled|published|all"]>
111
111
  ...
112
112
  </r&#58;children&#58;each>
113
113
  </code></pre>
@@ -1,4 +1,3 @@
1
1
  module TrustyCms
2
- VERSION = '7.0.11'.freeze
2
+ VERSION = '7.0.13'.freeze
3
3
  end
4
-
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.11
4
+ version: 7.0.13
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-01-20 00:00:00.000000000 Z
11
+ date: 2025-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage-validator