trusty-cms 7.0.19 → 7.0.20
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 +3 -1
- data/README.md +19 -0
- data/app/controllers/admin/pages_controller.rb +10 -5
- data/app/helpers/admin/url_helper.rb +33 -0
- data/app/models/page.rb +1 -1
- data/app/views/admin/pages/_fields.html.haml +4 -0
- data/app/views/admin/pages/_path_row.haml +5 -0
- data/app/views/admin/pages/_search_form.html.haml +1 -1
- data/app/views/admin/pages/_url_row.haml +5 -0
- data/app/views/admin/pages/search.html.haml +2 -2
- data/config/locales/en.yml +2 -0
- data/lib/trusty_cms/version.rb +1 -1
- data/trusty_cms.gemspec +1 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37a5978bda243d56eb15cd2fddca3156c0e45ed5a61e328fb39c7eaa8c84853f
|
4
|
+
data.tar.gz: b6fc1b14ea84740df2ce0436854232d38a530269215b6501bbdac37fa27d9eb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd523345862bf8e7f266688ac143567ff251d4addc1160302523232a126584080ebff5069ccd94961fe6b06940270cddc150789ce9d27a088ae1528a9cecceef
|
7
|
+
data.tar.gz: a4814549c19beb1313eebfdfdb82f1e978d47e3e38a55b5abf9c3dbf49cc9649847b9dc1189c1e74d67641b5a5b7adb18b1239e25f12bc987bd86ea2de1a320f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
trusty-cms (7.0.
|
4
|
+
trusty-cms (7.0.20)
|
5
5
|
RedCloth (= 4.3.3)
|
6
6
|
activestorage-validator
|
7
7
|
acts_as_list (>= 0.9.5, < 1.3.0)
|
@@ -36,6 +36,7 @@ PATH
|
|
36
36
|
stringex (>= 2.7.1, < 2.9.0)
|
37
37
|
tzinfo (>= 1.2.3, < 2.1.0)
|
38
38
|
uglifier (>= 3.2, < 5.0)
|
39
|
+
uri
|
39
40
|
will_paginate (>= 3, < 5)
|
40
41
|
|
41
42
|
GEM
|
@@ -402,6 +403,7 @@ GEM
|
|
402
403
|
concurrent-ruby (~> 1.0)
|
403
404
|
uglifier (4.2.1)
|
404
405
|
execjs (>= 0.3.0, < 3)
|
406
|
+
uri (1.0.2)
|
405
407
|
warden (1.2.9)
|
406
408
|
rack (>= 2.0.9)
|
407
409
|
websocket-driver (0.7.6)
|
data/README.md
CHANGED
@@ -77,6 +77,25 @@ Steps:
|
|
77
77
|
|
78
78
|
rspec
|
79
79
|
|
80
|
+
### Page Type Routes Setup
|
81
|
+
If your TrustyCMS project includes custom Page models, additional configuration is required to ensure proper URL formatting in the Admin interface. This setup allows TrustyCMS to determine the live URL of a page while editing, and to display it conveniently in the Edit Page dropdown menu.
|
82
|
+
|
83
|
+
To enable this, create the following initializer file: `config/initializers/page_type_routes.rb`
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
PAGE_TYPE_ROUTES = {
|
87
|
+
BlogPage: 'blog',
|
88
|
+
DonationPage: 'donate',
|
89
|
+
ExhibitionPage: 'exhibit',
|
90
|
+
NonTicketedEventPage: 'event',
|
91
|
+
PackagePage: 'package',
|
92
|
+
PersonPage: 'biography',
|
93
|
+
ProductionPage: 'production',
|
94
|
+
VenuePage: 'venues',
|
95
|
+
}.freeze
|
96
|
+
```
|
97
|
+
|
98
|
+
This `PAGE_TYPE_ROUTES` constant maps custom Page model names to their corresponding route segments as defined in `config/routes.rb`. TrustyCMS will use these mappings to generate URLs for pages in the admin interface.
|
80
99
|
|
81
100
|
### Page Status Refresh Setup
|
82
101
|
|
@@ -3,7 +3,9 @@ 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::NodeHelper
|
6
7
|
include Admin::PagesHelper
|
8
|
+
include Admin::UrlHelper
|
7
9
|
|
8
10
|
class PreviewStop < ActiveRecord::Rollback
|
9
11
|
def message
|
@@ -33,7 +35,7 @@ class Admin::PagesController < Admin::ResourceController
|
|
33
35
|
@site_id = params[:site_id] || Page.current_site.id
|
34
36
|
@q = initialize_search
|
35
37
|
|
36
|
-
@pages = fetch_search_results if
|
38
|
+
@pages = fetch_search_results if search_query_present?
|
37
39
|
render
|
38
40
|
end
|
39
41
|
|
@@ -48,6 +50,8 @@ class Admin::PagesController < Admin::ResourceController
|
|
48
50
|
def edit
|
49
51
|
verify_site_id
|
50
52
|
load_assets
|
53
|
+
@page_url = generate_page_url(request.url, @page)
|
54
|
+
@page_path = format_path(@page.path)
|
51
55
|
@versions = format_versions(@page.versions)
|
52
56
|
response_for :edit
|
53
57
|
end
|
@@ -100,12 +104,13 @@ class Admin::PagesController < Admin::ResourceController
|
|
100
104
|
end
|
101
105
|
|
102
106
|
def fetch_search_results
|
103
|
-
@
|
104
|
-
Page.ransack(title_cont: @
|
107
|
+
@query = params.dig(:search, :query)
|
108
|
+
Page.ransack(title_cont: @query, site_id_eq: @site_id).result
|
109
|
+
.or(Page.ransack(slug_cont: @query, site_id_eq: @site_id).result)
|
105
110
|
end
|
106
111
|
|
107
|
-
def
|
108
|
-
params.dig(:search, :
|
112
|
+
def search_query_present?
|
113
|
+
params.dig(:search, :query).present?
|
109
114
|
end
|
110
115
|
|
111
116
|
def validation_error(e)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Admin::UrlHelper
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
def build_url(base_url, page)
|
5
|
+
if page.class.name == 'Page'
|
6
|
+
"#{base_url}#{page.path}"
|
7
|
+
else
|
8
|
+
path = lookup_page_path(page)
|
9
|
+
path ? "#{base_url}/#{path}/#{page.slug}" : nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def extract_base_url(url)
|
14
|
+
uri = URI.parse(url)
|
15
|
+
host = uri.host
|
16
|
+
scheme = uri.scheme
|
17
|
+
return "#{scheme}://#{host}:#{uri.port}" if host&.include?('localhost')
|
18
|
+
|
19
|
+
"#{scheme}://#{host}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def generate_page_url(url, page)
|
23
|
+
base_url = extract_base_url(url)
|
24
|
+
build_url(base_url, page)
|
25
|
+
end
|
26
|
+
|
27
|
+
def lookup_page_path(page)
|
28
|
+
# Use the globally defined PAGE_TYPE_ROUTES from the parent application
|
29
|
+
return nil unless defined?(PAGE_TYPE_ROUTES) && PAGE_TYPE_ROUTES.is_a?(Hash)
|
30
|
+
|
31
|
+
PAGE_TYPE_ROUTES[page.class.name.to_sym]
|
32
|
+
end
|
33
|
+
end
|
data/app/models/page.rb
CHANGED
@@ -12,6 +12,10 @@
|
|
12
12
|
.drawer
|
13
13
|
.drawer_contents#attributes
|
14
14
|
%table.fieldset
|
15
|
+
- if @page_url.present?
|
16
|
+
= render :partial => 'url_row', :locals => {:page_url => @page_url}
|
17
|
+
- if @page_path.present?
|
18
|
+
= render :partial => 'path_row', :locals => {:page_path => @page_path}
|
15
19
|
= render :partial => 'meta_row', :collection => @meta, :locals => {:f => fields}
|
16
20
|
= render :partial => 'admin/page_fields/page_field', :collection => @page.fields
|
17
21
|
= render_region :extended_metadata, :locals => {:f => fields}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
= hidden_field_tag :site_id, @site_id
|
3
3
|
.page-search
|
4
4
|
%i.fas.fa-search
|
5
|
-
= f.search_field :
|
5
|
+
= f.search_field :query, value: @query, placeholder: 'Search by Page Title or Slug', id: 'search-input'
|
6
6
|
%input.button{ type: 'submit', value: 'Search' }
|
7
7
|
- if show_view_all_button
|
8
8
|
= link_to t("view_all_pages"), admin_pages_path, class: 'button'
|
@@ -1,8 +1,8 @@
|
|
1
|
-
- @page_title = t('
|
1
|
+
- @page_title = t('search') + ' - ' + default_page_title
|
2
2
|
|
3
3
|
.outset
|
4
4
|
= render_region :top
|
5
|
-
= render 'search_form',
|
5
|
+
= render 'search_form', query: @query, show_view_all_button: true
|
6
6
|
%table.index.tablesaw#pages{ :summary => t('page_hierarchy') }
|
7
7
|
%thead
|
8
8
|
%tr
|
data/config/locales/en.yml
CHANGED
@@ -270,6 +270,7 @@ en:
|
|
270
270
|
saving_changes: Saving Changes
|
271
271
|
saving_preferences: Saving preferences
|
272
272
|
scheduled: "Scheduled"
|
273
|
+
search: 'Search'
|
273
274
|
search_tags: 'Search Tags:'
|
274
275
|
select:
|
275
276
|
default: '<default>'
|
@@ -322,6 +323,7 @@ en:
|
|
322
323
|
days: "days"
|
323
324
|
weeks: "weeks"
|
324
325
|
months: "months"
|
326
|
+
url: 'URL'
|
325
327
|
user: 'User'
|
326
328
|
username: 'Username'
|
327
329
|
username_or_email: 'Username or E-mail Address'
|
data/lib/trusty_cms/version.rb
CHANGED
data/trusty_cms.gemspec
CHANGED
@@ -59,5 +59,6 @@ a general purpose content management system--not merely a blogging engine.'
|
|
59
59
|
s.add_dependency 'stringex', '>= 2.7.1', '< 2.9.0'
|
60
60
|
s.add_dependency 'tzinfo', '>= 1.2.3', '< 2.1.0'
|
61
61
|
s.add_dependency 'uglifier', '>= 3.2', '< 5.0'
|
62
|
+
s.add_dependency 'uri'
|
62
63
|
s.add_dependency 'will_paginate', '>= 3', '< 5'
|
63
64
|
end
|
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.20
|
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-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage-validator
|
@@ -546,6 +546,20 @@ dependencies:
|
|
546
546
|
- - "<"
|
547
547
|
- !ruby/object:Gem::Version
|
548
548
|
version: '5.0'
|
549
|
+
- !ruby/object:Gem::Dependency
|
550
|
+
name: uri
|
551
|
+
requirement: !ruby/object:Gem::Requirement
|
552
|
+
requirements:
|
553
|
+
- - ">="
|
554
|
+
- !ruby/object:Gem::Version
|
555
|
+
version: '0'
|
556
|
+
type: :runtime
|
557
|
+
prerelease: false
|
558
|
+
version_requirements: !ruby/object:Gem::Requirement
|
559
|
+
requirements:
|
560
|
+
- - ">="
|
561
|
+
- !ruby/object:Gem::Version
|
562
|
+
version: '0'
|
549
563
|
- !ruby/object:Gem::Dependency
|
550
564
|
name: will_paginate
|
551
565
|
requirement: !ruby/object:Gem::Requirement
|
@@ -765,6 +779,7 @@ files:
|
|
765
779
|
- app/helpers/admin/references_helper.rb
|
766
780
|
- app/helpers/admin/regions_helper.rb
|
767
781
|
- app/helpers/admin/resource_helper.rb
|
782
|
+
- app/helpers/admin/url_helper.rb
|
768
783
|
- app/helpers/admin/users_helper.rb
|
769
784
|
- app/helpers/admin/welcome_helper.rb
|
770
785
|
- app/helpers/application_helper.rb
|
@@ -831,10 +846,12 @@ files:
|
|
831
846
|
- app/views/admin/pages/_fields.html.haml
|
832
847
|
- app/views/admin/pages/_meta_row.html.haml
|
833
848
|
- app/views/admin/pages/_node.html.haml
|
849
|
+
- app/views/admin/pages/_path_row.haml
|
834
850
|
- app/views/admin/pages/_popups.html.haml
|
835
851
|
- app/views/admin/pages/_previous_versions.haml
|
836
852
|
- app/views/admin/pages/_search_form.html.haml
|
837
853
|
- app/views/admin/pages/_search_result_node.html.haml
|
854
|
+
- app/views/admin/pages/_url_row.haml
|
838
855
|
- app/views/admin/pages/children.html.haml
|
839
856
|
- app/views/admin/pages/edit.html.haml
|
840
857
|
- app/views/admin/pages/index.html.haml
|