trusty-cms 7.0.9 → 7.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90afffae83c31538f9db86d664a6cf86d4a29b1e910a7bd9644d795949908a8a
4
- data.tar.gz: 2ed58dea81ef5468bf67ccbac8af93e0fee4918a4937cce840ef39846306e886
3
+ metadata.gz: c63368c558d26f890749954b24ddf5d6802059d20c0785d9bc593e44816ec0cb
4
+ data.tar.gz: 80ffc339a2e63778cad2e73f9a8fc6cf0601afdf6208766c4614fe220c8e1746
5
5
  SHA512:
6
- metadata.gz: 9c7197a1dde572a4b5280165ea6fcfa13be02c3830ff4bd3e5b0038d1ea4ddede69739b76f9373d575517b85fc3925022e357e0aa7efc3678de50aa5ed17faf3
7
- data.tar.gz: 99658f3bbb7c65c3fdb2e02ddbc2eab6f6cf02b757a332211b81a154eb45e0080c3b61d93d07497d38e4d0f2daa5b74425434cf18875b4ab69358a20d70ffa92
6
+ metadata.gz: 241df4d13c4d4d1edd897492450bfc611c703d738ee9064bab79772ee2fba4aedbbb74829672f29d8026c164357097b4f461a5d1474c263a092f17173f9e262c
7
+ data.tar.gz: a7224d0f909fd5edd57f96755e036c8fb82e90956d564387252ee7d078324a08813828664d556a539c91efba772922ee2f25819da941c33cffbc9e8b97e5655b
@@ -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
- index: version&.index,
118
- update_date: version&.created_at&.strftime('%B %d, %Y'),
119
- update_time: version&.created_at&.strftime('%I:%M %p'),
120
- updated_by: User.unscoped.find_by(id: version&.whodunnit)&.name || 'Unknown User',
121
- }
122
- end
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)
@@ -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
@@ -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'
@@ -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|
@@ -1,4 +1,4 @@
1
1
  module TrustyCms
2
- VERSION = '7.0.9'.freeze
2
+ VERSION = '7.0.10'.freeze
3
3
  end
4
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.9
4
+ version: 7.0.10
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-16 00:00:00.000000000 Z
11
+ date: 2025-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage-validator