trusty-cms 7.0.9 → 7.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/admin/pages_controller.rb +8 -7
- data/app/controllers/page_status_controller.rb +2 -1
- data/app/helpers/admin/pages_helper.rb +6 -0
- data/app/models/page.rb +4 -0
- data/app/views/admin/pages/_fields.html.haml +5 -1
- data/config/locales/en.yml +1 -0
- data/lib/trusty_cms/admin_ui.rb +1 -1
- data/lib/trusty_cms/version.rb +1 -1
- 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: 449fe5133cb47597ee1a6088a2104532570912d8741e5d6b59b486b4ed74a470
|
4
|
+
data.tar.gz: 41500d82c661b36dd039d5157029f25a1695b85b5aff10f57a92e8931bdb0be5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd847aa08fbda487d3ef6e216858ac4f643e15291ed52e03c4f4a2a545a48459e2ef55a289b3773b7b416cfac6fd97940a80857514888952e095ccf3d8100849
|
7
|
+
data.tar.gz: e383a81c109eff12e51d99d09b9afb1a28af22fd5d6bc78741921ccba4257e4d70643b6361c2b7c7ead11e717bd1529b8cef04d0ff5c80f21650a49089c07758
|
data/Gemfile.lock
CHANGED
@@ -3,6 +3,7 @@ class Admin::PagesController < Admin::ResourceController
|
|
3
3
|
before_action :count_deleted_pages, only: [:destroy]
|
4
4
|
before_action :set_page, only: %i[edit restore]
|
5
5
|
rescue_from ActiveRecord::RecordInvalid, with: :validation_error
|
6
|
+
include Admin::PagesHelper
|
6
7
|
|
7
8
|
class PreviewStop < ActiveRecord::Rollback
|
8
9
|
def message
|
@@ -113,13 +114,13 @@ class Admin::PagesController < Admin::ResourceController
|
|
113
114
|
versions
|
114
115
|
.sort_by(&:created_at).reverse
|
115
116
|
.map do |version|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
117
|
+
{
|
118
|
+
index: version&.index,
|
119
|
+
update_date: version&.created_at&.strftime('%B %d, %Y'),
|
120
|
+
update_time: version&.created_at&.strftime('%I:%M %p'),
|
121
|
+
updated_by: User.unscoped.find_by(id: version&.whodunnit)&.name || 'Unknown User',
|
122
|
+
}
|
123
|
+
end
|
123
124
|
end
|
124
125
|
|
125
126
|
def restore_page_version(page, index)
|
@@ -32,7 +32,8 @@ class PageStatusController < ApplicationController
|
|
32
32
|
|
33
33
|
pages.each do |page|
|
34
34
|
page_id = page.id
|
35
|
-
|
35
|
+
published_at = page.published_at
|
36
|
+
if published_at && published_at <= Time.now
|
36
37
|
page.update(status_id: Status[:published].id)
|
37
38
|
updated_pages << page_id
|
38
39
|
else
|
@@ -17,4 +17,10 @@ module Admin::PagesHelper
|
|
17
17
|
def clean_page_description(page)
|
18
18
|
page.description.to_s.strip.gsub(/\t/, '').gsub(/\s+/, ' ')
|
19
19
|
end
|
20
|
+
|
21
|
+
def parent_page_options(current_site, page)
|
22
|
+
parent_pages = Page.parent_pages(current_site.homepage_id)
|
23
|
+
selected_page_id = page.id.presence_in(parent_pages.pluck(:id)) || page.parent_id.presence_in(parent_pages.pluck(:id))
|
24
|
+
options_for_select(parent_pages.map { |p| [p.title, p.id] }, selected_page_id)
|
25
|
+
end
|
20
26
|
end
|
data/app/models/page.rb
CHANGED
@@ -159,6 +159,10 @@ class Page < ActiveRecord::Base
|
|
159
159
|
['site_id', 'title']
|
160
160
|
end
|
161
161
|
|
162
|
+
def self.parent_pages(homepage_id)
|
163
|
+
where(parent_id: homepage_id).or(where(id: homepage_id))
|
164
|
+
end
|
165
|
+
|
162
166
|
private :set_response_headers
|
163
167
|
|
164
168
|
def set_content_type(response)
|
@@ -1,7 +1,6 @@
|
|
1
1
|
= fields.hidden_field :lock_version
|
2
2
|
= fields.hidden_field :parent_id
|
3
3
|
= fields.hidden_field :class_name
|
4
|
-
|
5
4
|
= render_region :form_top, :locals => {:f => fields}
|
6
5
|
|
7
6
|
- render_region :form, :locals => {:f => fields} do |form|
|
@@ -43,6 +42,10 @@
|
|
43
42
|
.page-type
|
44
43
|
= fields.label :class_name, t('page_type')
|
45
44
|
= fields.select :class_name, [[t('select.normal'), '']] + Page.descendants.map { |p| [p.display_name, p.name] }.sort_by { |p| p.first }
|
45
|
+
- layout.edit_parent do
|
46
|
+
.parent-page
|
47
|
+
= fields.label :parent_id, t('parent_page')
|
48
|
+
= fields.select :parent_id, parent_page_options(current_site, @page)
|
46
49
|
- layout.edit_status do
|
47
50
|
- if current_user.admin? || current_user.editor?
|
48
51
|
.status
|
@@ -56,6 +59,7 @@
|
|
56
59
|
class: 'datetime',
|
57
60
|
type: 'datetime-local',
|
58
61
|
value: (@page.published_at? ? @page.published_at.strftime('%Y-%m-%dT%H:%M') : nil)
|
62
|
+
|
59
63
|
= render_region :layout_row, :locals => {:f => fields}
|
60
64
|
|
61
65
|
.error.hidden
|
data/config/locales/en.yml
CHANGED
@@ -231,6 +231,7 @@ en:
|
|
231
231
|
removed_many: "The pages were successfully removed from the site."
|
232
232
|
removed_one: "The page was successfully removed from the site."
|
233
233
|
saved: "Your page has been saved below."
|
234
|
+
parent_page: 'Parent Page'
|
234
235
|
password: 'Password'
|
235
236
|
password_confirmation: 'Confirm New Password'
|
236
237
|
personal: 'Personal'
|
data/lib/trusty_cms/admin_ui.rb
CHANGED
@@ -170,7 +170,7 @@ module TrustyCms
|
|
170
170
|
page.edit = RegionSet.new do |edit|
|
171
171
|
edit.main.concat %w{edit_header edit_form edit_popups}
|
172
172
|
edit.form.concat %w{edit_title edit_extended_metadata edit_page_parts}
|
173
|
-
edit.layout.concat %w{edit_layout edit_type edit_status edit_published_at}
|
173
|
+
edit.layout.concat %w{edit_layout edit_type edit_parent edit_status edit_published_at}
|
174
174
|
edit.form_bottom.concat %w{edit_buttons edit_timestamp}
|
175
175
|
end
|
176
176
|
page.index = RegionSet.new do |index|
|
data/lib/trusty_cms/version.rb
CHANGED
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.11
|
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-
|
11
|
+
date: 2025-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage-validator
|