trusty-cms 7.0.7 → 7.0.9

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: 21602eb92fa965a61823801ab54c65663f5c91e13a5c379b0e6653868934285e
4
- data.tar.gz: d479f8e082e2efc68e9feb96b461e3ebd66cf681ec6bb2a0c5e6f7cead81fb59
3
+ metadata.gz: 90afffae83c31538f9db86d664a6cf86d4a29b1e910a7bd9644d795949908a8a
4
+ data.tar.gz: 2ed58dea81ef5468bf67ccbac8af93e0fee4918a4937cce840ef39846306e886
5
5
  SHA512:
6
- metadata.gz: 0a73dba1d21d9ad6998e71cb82aa8e704a63a173e66512d9aa029f26ce835e610356b58f321c5daad20e1cde525c1724fd222b3c571c2ea8ea062927f1f7f8a9
7
- data.tar.gz: d12a09d633c3b63817c9fa725bd4b30d74d590cf69859d2d580348ba8bebf26ccc6c72bbda4aeae4d7f599a1cc69a2cb2c453d4ce85b68ce19af78f2e8255d31
6
+ metadata.gz: 9c7197a1dde572a4b5280165ea6fcfa13be02c3830ff4bd3e5b0038d1ea4ddede69739b76f9373d575517b85fc3925022e357e0aa7efc3678de50aa5ed17faf3
7
+ data.tar.gz: 99658f3bbb7c65c3fdb2e02ddbc2eab6f6cf02b757a332211b81a154eb45e0080c3b61d93d07497d38e4d0f2daa5b74425434cf18875b4ab69358a20d70ffa92
data/Gemfile CHANGED
@@ -7,9 +7,6 @@ source 'https://rubygems.org'
7
7
  # requires trusty and therefore pulls in every
8
8
  # dependency mentioned in trusty.gemspec.
9
9
 
10
- gem 'paper_trail'
11
- gem 'paper_trail-association_tracking'
12
- gem 'psych', '5.2.2'
13
10
  gem 'trustygems', '~> 0.2.0'
14
11
 
15
12
  gemspec
@@ -22,8 +19,11 @@ group :development, :test do
22
19
  gem 'file_validators'
23
20
  gem 'launchy', '~> 3.0.1'
24
21
  gem 'mysql2'
22
+ gem 'paper_trail', '~> 16.0.0'
23
+ gem 'paper_trail-association_tracking', '~> 2.2.1'
25
24
  gem 'poltergeist', '~> 1.18.1'
26
25
  gem 'pry-byebug'
26
+ gem 'psych', '5.2.2'
27
27
  gem 'rails-observers'
28
28
  gem 'ransack'
29
29
  gem 'rspec-rails'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusty-cms (7.0.7)
4
+ trusty-cms (7.0.9)
5
5
  RedCloth (= 4.3.3)
6
6
  activestorage-validator
7
7
  acts_as_list (>= 0.9.5, < 1.3.0)
@@ -21,12 +21,15 @@ PATH
21
21
  mini_racer
22
22
  mutex_m
23
23
  mysql2
24
+ paper_trail (~> 16.0.0)
25
+ paper_trail-association_tracking (~> 2.2.1)
26
+ psych (= 5.2.2)
24
27
  rack (>= 2.0.1, < 3.2.0)
25
28
  rack-cache (~> 1.7)
26
29
  radius (~> 0.7)
27
30
  rails (~> 7.0.0)
28
31
  rake (< 14.0)
29
- ransack
32
+ ransack (~> 4.2.1)
30
33
  rdoc (>= 5.1, < 7.0)
31
34
  roadie-rails
32
35
  sass-rails
@@ -429,8 +432,8 @@ DEPENDENCIES
429
432
  file_validators
430
433
  launchy (~> 3.0.1)
431
434
  mysql2
432
- paper_trail
433
- paper_trail-association_tracking
435
+ paper_trail (~> 16.0.0)
436
+ paper_trail-association_tracking (~> 2.2.1)
434
437
  poltergeist (~> 1.18.1)
435
438
  pry-byebug
436
439
  psych (= 5.2.2)
data/INSTALL.md CHANGED
@@ -14,9 +14,11 @@ From within the directory containing your TrustyCMS instance:
14
14
  4. Run the Trusty CMS generator to get the project into shape: `rails g trusty_cms [project_name]`.
15
15
  - This will ask you if you want to replace a number of existing files (like application.rb); reply Y to all.
16
16
 
17
- 5. add config.extensions = [ :snippets, :clipped, :layouts, :multi_site ] to enable them in application.rb
17
+ 5. Add `config.extensions = [ :snippets, :clipped, :layouts, :multi_site ]` to enable them in application.rb
18
+
19
+ 6. Add `config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone]` to application.rb. This is required for pages to save previous versions.
18
20
 
19
21
  7. Add utf8 encoding to your db.yml
20
22
 
21
- 6. Run `bundle exec rake db:setup`, `bundle exec rake trusty_cms:install:migrations`, then
23
+ 8. Run `bundle exec rake db:setup`, `bundle exec rake trusty_cms:install:migrations`, then
22
24
  `bundle exec rake db:bootstrap`.
@@ -1,26 +1,47 @@
1
1
  (function(Dropdown, $) {
2
2
  Dropdown.setup = function(link) {
3
- var menuToWrap = Dropdown.findMenu(link);
4
- if ($(menuToWrap).parent("div").length == 0) {
5
- menuToWrap.wrap("<div class='dropdown_wrapper' style='position: absolute; display: none'></div>");
3
+ var menu = Dropdown.findMenu(link);
6
4
 
7
- $(link).on('click', function (event) {
8
- event.preventDefault();
9
- $(this).toggleClass('selected');
10
- Dropdown.findMenu(this).closest('.dropdown_wrapper').slideToggle();
11
- })
12
- }
13
- }
5
+ // Attach click handler to toggle dropdown
6
+ $(link).off('click').on('click', function(event) {
7
+ event.preventDefault();
8
+ event.stopPropagation();
9
+ var $link = $(this);
10
+ var $menuWrapper = $link.siblings("div.dropdown_wrapper");
11
+
12
+ if ($menuWrapper.is(':visible')) {
13
+ // If already visible, hide it
14
+ $menuWrapper.css('z-index', '').slideUp();
15
+ $link.removeClass('selected');
16
+ } else {
17
+ // Close other dropdowns
18
+ $('.dropdown_wrapper').css('z-index', '').slideUp();
19
+ $('a.dropdown').removeClass('selected');
20
+
21
+ // Show the current dropdown with priority z-index
22
+ $menuWrapper.css('z-index', '1000').slideDown();
23
+ $link.addClass('selected');
24
+ }
25
+ });
26
+ };
14
27
 
15
28
  Dropdown.findMenu = function(link) {
16
29
  var match = $(link).attr('href').match(/#(.+)$/)[1];
17
30
  return $('#' + match);
18
- }
31
+ };
32
+
33
+ // Close dropdown when clicking anywhere else
34
+ $(document).on('click', function(event) {
35
+ if (!$(event.target).closest('.dropdown_wrapper, a.dropdown').length) {
36
+ $('.dropdown_wrapper').css('z-index', '').slideUp();
37
+ $('a.dropdown').removeClass('selected');
38
+ }
39
+ });
19
40
 
20
41
  }(window.Dropdown = window.Dropdown || {}, jQuery));
21
42
 
22
43
  $(function () {
23
- $('a.dropdown').each(function(){
44
+ $('a.dropdown').each(function() {
24
45
  Dropdown.setup(this);
25
46
  });
26
47
  });
@@ -12,7 +12,9 @@
12
12
 
13
13
  .button {
14
14
  @include button;
15
+ display: inline-block;
15
16
  font-size: 1em;
17
+ margin: 0 0.25em 0 0.25em;
16
18
  text-decoration: none;
17
19
  }
18
20
 
@@ -103,3 +103,11 @@ textarea {
103
103
  display: none;
104
104
  }
105
105
  }
106
+
107
+ .search-form {
108
+ margin-left: 0.5em;
109
+ }
110
+
111
+ #search-input {
112
+ max-width: 25em;
113
+ }
@@ -1,7 +1,7 @@
1
1
  class Admin::LayoutsController < Admin::ResourceController
2
2
  paginate_models
3
3
  before_action :authorize_role
4
- only_allow_access_to :index, :show, :new, :create, :edit, :update, :remove, :destroy,
4
+ only_allow_access_to :index, :show, :new, :create, :edit, :update, :remove, :destroy, :search,
5
5
  when: %i[designer admin],
6
6
  denied_url: { controller: 'admin/pages', action: 'index' },
7
7
  denied_message: 'You must have at least editor privileges to perform this action.'
@@ -23,10 +23,19 @@ class Admin::PagesController < Admin::ResourceController
23
23
  end
24
24
 
25
25
  def index
26
- @homepage = Page.find_by_parent_id(nil)
26
+ set_site_and_homepage
27
+ @q = initialize_search
27
28
  response_for :plural
28
29
  end
29
30
 
31
+ def search
32
+ @site_id = params[:site_id] || Page.current_site.id
33
+ @q = initialize_search
34
+
35
+ @pages = fetch_search_results if search_title_present?
36
+ render
37
+ end
38
+
30
39
  def new
31
40
  assets = Asset.order('created_at DESC')
32
41
  @term = assets.ransack(params[:search] || '')
@@ -67,6 +76,25 @@ class Admin::PagesController < Admin::ResourceController
67
76
  @page = Page.find(params[:id])
68
77
  end
69
78
 
79
+ def set_site_and_homepage
80
+ @site ||= Page.current_site
81
+ @homepage = @site&.homepage || Page.homepage
82
+ @site_id = @site&.id
83
+ end
84
+
85
+ def initialize_search
86
+ Page.ransack(params[:search] || '')
87
+ end
88
+
89
+ def fetch_search_results
90
+ @title = params.dig(:search, :title)
91
+ Page.ransack(title_cont: @title, site_id_eq: @site_id).result
92
+ end
93
+
94
+ def search_title_present?
95
+ params.dig(:search, :title).present?
96
+ end
97
+
70
98
  def validation_error(e)
71
99
  flash[:error] = e.message
72
100
  render :new
@@ -7,13 +7,15 @@ module Admin::NodeHelper
7
7
 
8
8
  def render_node(page, index, parent_index = nil, simple = false)
9
9
  @current_node = prepare_page(page)
10
-
11
- @rendered_html += (render partial: 'admin/pages/node',
12
- locals: { level: index, index: index, parent_index: parent_index,
13
- page: page, simple: simple, branch: (page.children.count.positive?) })
10
+ @rendered_html += render_partial(page, index:, parent_index:, simple:)
14
11
  index
15
12
  end
16
13
 
14
+ def render_search_node(page)
15
+ @current_node = prepare_page(page)
16
+ @rendered_html = render_partial(page, index: 0, parent_index: nil, simple: false)
17
+ end
18
+
17
19
  def prepare_page(page)
18
20
  page.extend MenuRenderer
19
21
  page.view = self
@@ -90,4 +92,18 @@ module Admin::NodeHelper
90
92
  alt: '', title: '',
91
93
  style: 'display: none;')
92
94
  end
95
+
96
+ private
97
+
98
+ def render_partial(page, index:, parent_index:, simple:)
99
+ render partial: 'admin/pages/node',
100
+ locals: {
101
+ level: index,
102
+ index: index,
103
+ parent_index: parent_index,
104
+ page: page,
105
+ simple: simple,
106
+ branch: page.children.count.positive?,
107
+ }
108
+ end
93
109
  end
@@ -62,7 +62,9 @@ module MenuRenderer
62
62
  end
63
63
 
64
64
  def menu_list
65
- view.content_tag :ul, menu_items.join.html_safe, class: 'menu', id: "allowed_children_#{id}"
65
+ view.content_tag :div, class: 'dropdown_wrapper', style: 'position: absolute; display: none' do
66
+ view.content_tag :ul, menu_items.join.html_safe, class: 'menu', id: "allowed_children_#{id}"
67
+ end
66
68
  end
67
69
 
68
70
  def remove_link
data/app/models/page.rb CHANGED
@@ -155,6 +155,10 @@ class Page < ActiveRecord::Base
155
155
  end
156
156
  end
157
157
 
158
+ def self.ransackable_attributes(auth_object = nil)
159
+ ['site_id', 'title']
160
+ end
161
+
158
162
  private :set_response_headers
159
163
 
160
164
  def set_content_type(response)
@@ -1,4 +1,4 @@
1
- - if current_user.scoped_site? && defined?(Site) && defined?(controller) && controller.sited_model? && controller.template_name == 'index' && Site.several?
1
+ - if current_user.scoped_site? && defined?(Site) && defined?(controller) && controller.sited_model? && Site.several?
2
2
  .site_chooser
3
3
  %ul.nav
4
4
  %li
@@ -30,6 +30,9 @@
30
30
  = render :partial => 'admin/page_parts/page_part', :collection => @page.parts
31
31
  = render_region :parts_bottom, :locals => {:f => fields}
32
32
 
33
+ #previous-versions
34
+ = render :partial => 'admin/pages/previous_versions'
35
+
33
36
  .set
34
37
  - render_region :layout, :locals => {:f => fields} do |layout|
35
38
  - layout.edit_layout do
@@ -0,0 +1,28 @@
1
+ %fieldset
2
+ %h4
3
+ %i.fas.fa-clock-rotate-left
4
+ Previous Versions
5
+
6
+ - if @versions.present?
7
+ %section
8
+ %table
9
+ %thead
10
+ %tr
11
+ %th Date Updated
12
+ %th Time Updated
13
+ %th Updated By
14
+ %th Action
15
+ %tbody{ :id => 'versions-table' }
16
+ - @versions.each do |version|
17
+ %tr
18
+ %td= version[:update_date]
19
+ %td= version[:update_time]
20
+ %td= version[:updated_by]
21
+ %td
22
+ = link_to 'Restore',
23
+ restore_version_admin_page_path(@page.id, version_index: version[:index]),
24
+ method: :put,
25
+ data: { confirm: 'Are you sure you want to restore this version?' }
26
+ - else
27
+ %section
28
+ %p No previous versions are available.
@@ -0,0 +1,8 @@
1
+ = search_form_for @q, url: search_admin_pages_path, html: { method: :get, class: 'search-form' } do |f|
2
+ = hidden_field_tag :site_id, @site_id
3
+ .page-search
4
+ %i.fas.fa-search
5
+ = f.search_field :title, value: title, placeholder: 'Search by Page Title', id: 'search-input'
6
+ %input.button{ type: 'submit', value: 'Search' }
7
+ - if show_view_all_button
8
+ = link_to t("view_all_pages"), admin_pages_path, class: 'button'
@@ -2,7 +2,8 @@
2
2
 
3
3
  .outset
4
4
  = render_region :top
5
- %table.index.tablesaw#pages{:summary=>t('page_hierarchy')}
5
+ = render 'search_form', title: nil, show_view_all_button: false
6
+ %table.index.tablesaw#pages{ :summary => t('page_hierarchy') }
6
7
  %thead
7
8
  %tr
8
9
  - render_region :sitemap_head do |sitemap_head|
@@ -17,13 +18,13 @@
17
18
  = render_nodes(@homepage, 0).html_safe
18
19
  - else
19
20
  %tr.sortable
20
- %td.empty{:colspan => admin.page.index.node.length}= t('no_pages')
21
+ %td.empty{ :colspan => admin.page.index.node.length }= t('no_pages')
21
22
  = render_region :bottom
22
23
 
23
24
  - unless @homepage
24
25
  #actions
25
26
  %ul
26
27
  %li
27
- = link_to new_admin_page_path, :class => 'action_button' do
28
+ = link_to admin_pages_path, :class => 'action_button' do
28
29
  %i.fas.fa-plus-circle
29
30
  = t("new_homepage")
@@ -0,0 +1,24 @@
1
+ - @page_title = t('pages') + ' - ' + default_page_title
2
+
3
+ .outset
4
+ = render_region :top
5
+ = render 'search_form', title: @title, show_view_all_button: true
6
+ %table.index.tablesaw#pages{ :summary => t('page_hierarchy') }
7
+ %thead
8
+ %tr
9
+ - render_region :sitemap_head do |sitemap_head|
10
+ - sitemap_head.title_column_header do
11
+ %th.name= t('page')
12
+ - sitemap_head.status_column_header do
13
+ %th.status= t('status')
14
+ - sitemap_head.actions_column_header do
15
+ %th.actions= t('modify')
16
+ %tbody
17
+ - if @pages.present?
18
+ - @pages.each do |page|
19
+ = render_search_node(page).html_safe
20
+ - else
21
+ %tr.sortable
22
+ %td.empty{ :colspan => admin.page.index.node.length }= t('no_pages_found')
23
+
24
+ = render_region :bottom
@@ -1,2 +1,2 @@
1
- PaperTrail.config.track_associations = true
2
1
  PaperTrail.config.version_limit = 5
2
+ PaperTrail.config.track_associations = true
@@ -216,6 +216,7 @@ en:
216
216
  'no': 'No'
217
217
  no_layouts: 'No Layouts'
218
218
  no_pages: 'No Pages'
219
+ no_pages_found: 'No Pages Found'
219
220
  normal_page: 'Normal Page'
220
221
  notes: 'Notes'
221
222
  optional: 'Optional'
@@ -326,6 +327,7 @@ en:
326
327
  users_controller:
327
328
  cannot_delete_self: 'You cannot delete yourself.'
328
329
  version: 'Version'
330
+ view_all_pages: 'View All Pages'
329
331
  view_site: 'View Site'
330
332
  warning: 'Warning'
331
333
  website: 'Website'
data/config/routes.rb CHANGED
@@ -14,6 +14,7 @@ TrustyCms::Application.routes.draw do
14
14
  resources :children, controller: 'pages'
15
15
  get 'remove', on: :member
16
16
  put 'restore/:version_index', on: :member, to: 'pages#restore', as: :restore_version
17
+ get 'search', on: :collection, to: 'pages#search', as: :search
17
18
  end
18
19
  resources :layouts do
19
20
  get 'remove', on: :member
@@ -177,6 +177,10 @@ module TrustyCms
177
177
  index.sitemap_head.concat %w{title_column_header status_column_header actions_column_header}
178
178
  index.node.concat %w{title_column status_column actions_column}
179
179
  end
180
+ page.search = RegionSet.new do |search|
181
+ search.sitemap_head.concat %w{title_column_header status_column_header actions_column_header}
182
+ search.node.concat %w{title_column status_column actions_column}
183
+ end
180
184
  page.remove = page.children = page.index
181
185
  page.new = page._part = page.edit
182
186
  end
@@ -1,3 +1,9 @@
1
+ require 'ckeditor'
2
+ require 'devise'
3
+ require 'ransack'
4
+ require 'paper_trail'
5
+ require 'paper_trail-association_tracking'
6
+
1
7
  module TrustyCms
2
8
  class Engine < Rails::Engine
3
9
  isolate_namespace TrustyCms
@@ -19,8 +25,3 @@ module TrustyCms
19
25
  end
20
26
  end
21
27
  end
22
-
23
- require 'ckeditor'
24
- require 'devise'
25
- require 'ransack'
26
-
@@ -1,4 +1,4 @@
1
1
  module TrustyCms
2
- VERSION = '7.0.7'.freeze
2
+ VERSION = '7.0.9'.freeze
3
3
  end
4
4
 
@@ -10,8 +10,8 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
14
- create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
13
+ ActiveRecord::Schema[7.0].define(version: 2025_01_03_191134) do
14
+ create_table "active_storage_attachments", charset: "utf8", force: :cascade do |t|
15
15
  t.string "name", null: false
16
16
  t.string "record_type", null: false
17
17
  t.bigint "record_id", null: false
@@ -21,7 +21,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
21
21
  t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
22
22
  end
23
23
 
24
- create_table "active_storage_blobs", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
24
+ create_table "active_storage_blobs", charset: "utf8", force: :cascade do |t|
25
25
  t.string "key", null: false
26
26
  t.string "filename", null: false
27
27
  t.string "content_type"
@@ -33,13 +33,13 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
33
33
  t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
34
34
  end
35
35
 
36
- create_table "active_storage_variant_records", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
36
+ create_table "active_storage_variant_records", charset: "utf8", force: :cascade do |t|
37
37
  t.bigint "blob_id", null: false
38
38
  t.string "variation_digest", null: false
39
39
  t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
40
40
  end
41
41
 
42
- create_table "admins", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
42
+ create_table "admins", charset: "utf8", force: :cascade do |t|
43
43
  t.string "email", default: "", null: false
44
44
  t.string "encrypted_password", default: "", null: false
45
45
  t.string "reset_password_token"
@@ -69,14 +69,14 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
69
69
  t.datetime "updated_at", precision: nil, null: false
70
70
  end
71
71
 
72
- create_table "admins_sites", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
72
+ create_table "admins_sites", charset: "utf8", force: :cascade do |t|
73
73
  t.integer "admin_id", null: false
74
74
  t.integer "site_id", null: false
75
75
  t.index ["admin_id"], name: "index_admins_sites_on_admin_id"
76
76
  t.index ["site_id"], name: "index_admins_sites_on_site_id"
77
77
  end
78
78
 
79
- create_table "assets", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
79
+ create_table "assets", charset: "utf8", force: :cascade do |t|
80
80
  t.string "caption"
81
81
  t.string "title"
82
82
  t.string "asset_file_name"
@@ -92,19 +92,19 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
92
92
  t.string "original_extension"
93
93
  end
94
94
 
95
- create_table "config", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
95
+ create_table "config", charset: "utf8", force: :cascade do |t|
96
96
  t.string "key", limit: 40, default: "", null: false
97
97
  t.string "value", default: ""
98
98
  t.index ["key"], name: "key", unique: true
99
99
  end
100
100
 
101
- create_table "extension_meta", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
101
+ create_table "extension_meta", charset: "utf8", force: :cascade do |t|
102
102
  t.string "name"
103
103
  t.integer "schema_version", default: 0
104
104
  t.boolean "enabled", default: true
105
105
  end
106
106
 
107
- create_table "layouts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
107
+ create_table "layouts", charset: "utf8", force: :cascade do |t|
108
108
  t.string "name", limit: 100
109
109
  t.text "content"
110
110
  t.datetime "created_at", precision: nil
@@ -116,20 +116,20 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
116
116
  t.integer "site_id"
117
117
  end
118
118
 
119
- create_table "page_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
119
+ create_table "page_attachments", charset: "utf8", force: :cascade do |t|
120
120
  t.integer "asset_id"
121
121
  t.integer "page_id"
122
122
  t.integer "position"
123
123
  end
124
124
 
125
- create_table "page_fields", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
125
+ create_table "page_fields", charset: "utf8", force: :cascade do |t|
126
126
  t.integer "page_id"
127
127
  t.string "name"
128
128
  t.string "content"
129
129
  t.index ["page_id", "name", "content"], name: "index_page_fields_on_page_id_and_name_and_content"
130
130
  end
131
131
 
132
- create_table "page_parts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
132
+ create_table "page_parts", charset: "utf8", force: :cascade do |t|
133
133
  t.string "name", limit: 100
134
134
  t.string "filter_id", limit: 25
135
135
  t.text "content", size: :medium
@@ -137,7 +137,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
137
137
  t.index ["page_id", "name"], name: "parts_by_page"
138
138
  end
139
139
 
140
- create_table "pages", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
140
+ create_table "pages", charset: "utf8", force: :cascade do |t|
141
141
  t.string "title"
142
142
  t.string "slug", limit: 100
143
143
  t.string "breadcrumb", limit: 160
@@ -162,7 +162,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
162
162
  t.index ["virtual", "status_id"], name: "pages_published"
163
163
  end
164
164
 
165
- create_table "sessions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
165
+ create_table "sessions", charset: "utf8", force: :cascade do |t|
166
166
  t.string "session_id"
167
167
  t.text "data"
168
168
  t.datetime "updated_at", precision: nil
@@ -170,7 +170,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
170
170
  t.index ["updated_at"], name: "index_sessions_on_updated_at"
171
171
  end
172
172
 
173
- create_table "sites", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
173
+ create_table "sites", charset: "utf8", force: :cascade do |t|
174
174
  t.string "name"
175
175
  t.string "domain"
176
176
  t.integer "homepage_id"
@@ -184,7 +184,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
184
184
  t.string "base_domain"
185
185
  end
186
186
 
187
- create_table "snippets", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
187
+ create_table "snippets", charset: "utf8", force: :cascade do |t|
188
188
  t.string "name", limit: 100, default: "", null: false
189
189
  t.string "filter_id", limit: 25
190
190
  t.text "content"
@@ -197,7 +197,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
197
197
  t.index ["name", "site_id"], name: "name_site_id", unique: true
198
198
  end
199
199
 
200
- create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
200
+ create_table "users", charset: "utf8", force: :cascade do |t|
201
201
  t.string "name", limit: 100
202
202
  t.string "email"
203
203
  t.string "login", limit: 40, default: "", null: false
@@ -218,6 +218,27 @@ ActiveRecord::Schema[7.0].define(version: 2024_11_08_172942) do
218
218
  t.datetime "password_reset_sent_at", precision: nil
219
219
  end
220
220
 
221
+ create_table "version_associations", charset: "utf8", force: :cascade do |t|
222
+ t.integer "version_id"
223
+ t.string "foreign_key_name", null: false
224
+ t.integer "foreign_key_id"
225
+ t.string "foreign_type"
226
+ t.index ["foreign_key_name", "foreign_key_id", "foreign_type"], name: "index_version_associations_on_foreign_key"
227
+ t.index ["version_id"], name: "index_version_associations_on_version_id"
228
+ end
229
+
230
+ create_table "versions", charset: "utf8mb4", force: :cascade do |t|
231
+ t.string "whodunnit"
232
+ t.datetime "created_at"
233
+ t.bigint "item_id", null: false
234
+ t.string "item_type", limit: 191, null: false
235
+ t.string "event", null: false
236
+ t.text "object", size: :long
237
+ t.integer "transaction_id"
238
+ t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
239
+ t.index ["transaction_id"], name: "index_versions_on_transaction_id"
240
+ end
241
+
221
242
  add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
222
243
  add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
223
244
  end
data/trusty_cms.gemspec CHANGED
@@ -43,12 +43,15 @@ a general purpose content management system--not merely a blogging engine.'
43
43
  s.add_dependency 'mini_racer'
44
44
  s.add_dependency 'mutex_m'
45
45
  s.add_dependency 'mysql2'
46
+ s.add_dependency 'paper_trail', '~> 16.0.0'
47
+ s.add_dependency 'paper_trail-association_tracking', '~> 2.2.1'
48
+ s.add_dependency 'psych', '5.2.2'
46
49
  s.add_dependency 'rack', '>= 2.0.1', '< 3.2.0'
47
50
  s.add_dependency 'rack-cache', '~> 1.7'
48
51
  s.add_dependency 'radius', '~> 0.7'
49
52
  s.add_dependency 'rails', '~> 7.0.0'
50
53
  s.add_dependency 'rake', '< 14.0'
51
- s.add_dependency 'ransack'
54
+ s.add_dependency 'ransack', '~> 4.2.1'
52
55
  s.add_dependency 'rdoc', '>= 5.1', '< 7.0'
53
56
  s.add_dependency 'RedCloth', '4.3.3'
54
57
  s.add_dependency 'roadie-rails'
@@ -5,7 +5,6 @@ module MultiSite::PagesControllerExtensions
5
5
  alias_method :discover_current_site, :discover_current_site_with_root
6
6
 
7
7
  alias_method :index_without_site, :index
8
- alias_method :index, :index_with_site
9
8
 
10
9
  alias_method :continue_url_without_site, :continue_url
11
10
  alias_method :continue_url, :continue_url_with_site
@@ -37,13 +36,6 @@ module MultiSite::PagesControllerExtensions
37
36
  end
38
37
  end
39
38
 
40
- def index_with_site
41
- @site ||= Page.current_site
42
- @homepage ||= @site.homepage if @site
43
- @homepage ||= Page.homepage
44
- response_for :plural
45
- end
46
-
47
39
  def remove_with_back
48
40
  session[:came_from] = request.env["HTTP_REFERER"]
49
41
  remove_without_back
@@ -1,7 +1,7 @@
1
1
  module MultiSite::SiteChooserHelper
2
2
 
3
3
  def sites_chooser_thing
4
- return "" unless current_user.admin? && defined?(Site) && defined?(controller) && controller.sited_model? && controller.template_name == 'index' && Site.several?
4
+ return "" unless current_user.admin? && defined?(Site) && defined?(controller) && controller.sited_model? && Site.several?
5
5
  options = Site.all.map { |site| "<li>" + link_to(site.name, "#{request.path}?site_id=#{site.id}", :class => site == current_site ? 'fg' : '') + "</li>" }.join("")
6
6
  chooser = %{<div id="site_chooser">}
7
7
  # chooser << link_to("sites", admin_sites_url, {:id => 'show_site_list', :class => 'expandable'})
@@ -24,6 +24,7 @@ class MultiSiteExtension < TrustyCms::Extension
24
24
  admin.layouts.index.add(:before_nav, "admin/layouts/site_chooser")
25
25
  admin.pages.index.add(:before_nav, "admin/layouts/site_chooser")
26
26
  admin.snippets.index.add(:before_nav, "admin/layouts/site_chooser")
27
+ admin.pages.search.add(:before_nav, "admin/layouts/site_chooser")
27
28
  Layout.send :is_site_scoped
28
29
  Snippet.send :is_site_scoped
29
30
  User.send :is_site_scoped, :shareable => true
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.7
4
+ version: 7.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - TrustyCms CMS dev team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-08 00:00:00.000000000 Z
11
+ date: 2025-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage-validator
@@ -292,6 +292,48 @@ dependencies:
292
292
  - - ">="
293
293
  - !ruby/object:Gem::Version
294
294
  version: '0'
295
+ - !ruby/object:Gem::Dependency
296
+ name: paper_trail
297
+ requirement: !ruby/object:Gem::Requirement
298
+ requirements:
299
+ - - "~>"
300
+ - !ruby/object:Gem::Version
301
+ version: 16.0.0
302
+ type: :runtime
303
+ prerelease: false
304
+ version_requirements: !ruby/object:Gem::Requirement
305
+ requirements:
306
+ - - "~>"
307
+ - !ruby/object:Gem::Version
308
+ version: 16.0.0
309
+ - !ruby/object:Gem::Dependency
310
+ name: paper_trail-association_tracking
311
+ requirement: !ruby/object:Gem::Requirement
312
+ requirements:
313
+ - - "~>"
314
+ - !ruby/object:Gem::Version
315
+ version: 2.2.1
316
+ type: :runtime
317
+ prerelease: false
318
+ version_requirements: !ruby/object:Gem::Requirement
319
+ requirements:
320
+ - - "~>"
321
+ - !ruby/object:Gem::Version
322
+ version: 2.2.1
323
+ - !ruby/object:Gem::Dependency
324
+ name: psych
325
+ requirement: !ruby/object:Gem::Requirement
326
+ requirements:
327
+ - - '='
328
+ - !ruby/object:Gem::Version
329
+ version: 5.2.2
330
+ type: :runtime
331
+ prerelease: false
332
+ version_requirements: !ruby/object:Gem::Requirement
333
+ requirements:
334
+ - - '='
335
+ - !ruby/object:Gem::Version
336
+ version: 5.2.2
295
337
  - !ruby/object:Gem::Dependency
296
338
  name: rack
297
339
  requirement: !ruby/object:Gem::Requirement
@@ -372,16 +414,16 @@ dependencies:
372
414
  name: ransack
373
415
  requirement: !ruby/object:Gem::Requirement
374
416
  requirements:
375
- - - ">="
417
+ - - "~>"
376
418
  - !ruby/object:Gem::Version
377
- version: '0'
419
+ version: 4.2.1
378
420
  type: :runtime
379
421
  prerelease: false
380
422
  version_requirements: !ruby/object:Gem::Requirement
381
423
  requirements:
382
- - - ">="
424
+ - - "~>"
383
425
  - !ruby/object:Gem::Version
384
- version: '0'
426
+ version: 4.2.1
385
427
  - !ruby/object:Gem::Dependency
386
428
  name: rdoc
387
429
  requirement: !ruby/object:Gem::Requirement
@@ -790,11 +832,14 @@ files:
790
832
  - app/views/admin/pages/_meta_row.html.haml
791
833
  - app/views/admin/pages/_node.html.haml
792
834
  - app/views/admin/pages/_popups.html.haml
835
+ - app/views/admin/pages/_previous_versions.haml
836
+ - app/views/admin/pages/_search_form.html.haml
793
837
  - app/views/admin/pages/children.html.haml
794
838
  - app/views/admin/pages/edit.html.haml
795
839
  - app/views/admin/pages/index.html.haml
796
840
  - app/views/admin/pages/new.html.haml
797
841
  - app/views/admin/pages/remove.html.haml
842
+ - app/views/admin/pages/search.html.haml
798
843
  - app/views/admin/preferences/edit.html.haml
799
844
  - app/views/admin/references/_tag_reference.haml
800
845
  - app/views/admin/references/filters.haml
@@ -1164,7 +1209,7 @@ homepage: https://github.com/pgharts/trusty-cms
1164
1209
  licenses:
1165
1210
  - MIT
1166
1211
  metadata: {}
1167
- post_install_message:
1212
+ post_install_message:
1168
1213
  rdoc_options:
1169
1214
  - "--title"
1170
1215
  - TrustyCms -- Content Management You Can Trust
@@ -1213,7 +1258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1213
1258
  version: 1.3.1
1214
1259
  requirements: []
1215
1260
  rubygems_version: 3.2.33
1216
- signing_key:
1261
+ signing_key:
1217
1262
  specification_version: 4
1218
1263
  summary: A no-fluff content management system designed for small teams.
1219
1264
  test_files: