trusty-cms 7.0.1 → 7.0.3
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/.gitignore +0 -1
- data/Gemfile +2 -2
- data/Gemfile.lock +89 -102
- data/INSTALL.md +8 -6
- data/README.md +16 -11
- data/app/assets/stylesheets/admin/partials/_forms.scss +13 -0
- data/app/controllers/admin/configuration_controller.rb +1 -1
- data/app/controllers/admin/extensions_controller.rb +1 -0
- data/app/controllers/admin/layouts_controller.rb +2 -1
- data/app/controllers/admin/resource_controller.rb +10 -1
- data/app/controllers/admin/sites_controller.rb +1 -0
- data/app/controllers/admin/snippets_controller.rb +2 -1
- data/app/controllers/admin/users_controller.rb +2 -1
- data/app/helpers/admin/users_helper.rb +2 -1
- data/app/models/admins_site.rb +6 -0
- data/app/models/site.rb +2 -0
- data/app/models/trusty_cms/config.rb +2 -1
- data/app/models/user.rb +15 -4
- data/app/views/admin/layouts/_choose_site.html.haml +5 -3
- data/app/views/admin/layouts/_site_chooser.html.haml +2 -2
- data/app/views/admin/pages/_fields.html.haml +4 -3
- data/app/views/admin/pages/_node.html.haml +1 -1
- data/app/views/admin/snippets/_choose_site.html.haml +2 -1
- data/app/views/admin/users/_choose_site.html.haml +2 -1
- data/app/views/admin/users/_form.html.haml +3 -1
- data/bin/rails +2 -2
- data/config/application.rb +1 -0
- data/config/boot.rb +1 -1
- data/config/locales/en.yml +10 -8
- data/db/migrate/20241108172942_create_site_users.rb +8 -0
- data/lib/generators/extension_controller/extension_controller_generator.rb +1 -1
- data/lib/generators/extension_mailer/extension_mailer_generator.rb +1 -1
- data/lib/generators/extension_model/extension_model_generator.rb +1 -1
- data/lib/generators/instance/instance_generator.rb +24 -20
- data/lib/generators/trusty_cms/templates/boot.rb.erb +1 -1
- data/lib/login_system.rb +15 -15
- data/lib/tasks/framework.rake +3 -3
- data/lib/trusty_cms/available_locales.rb +1 -1
- data/lib/trusty_cms/task_support.rb +1 -1
- data/lib/trusty_cms/version.rb +1 -1
- data/spec/dummy/config/application.rb +2 -0
- data/spec/dummy/db/schema.rb +8 -1
- data/spec/factories/snippet.rb +10 -0
- data/spec/factories/user.rb +11 -11
- data/spec/models/snippets_spec.rb +29 -0
- data/spec/models/user_spec.rb +46 -0
- data/trusty_cms.gemspec +1 -1
- data/vendor/extensions/multi-site-extension/lib/multi_site/scoped_model.rb +17 -11
- data/vendor/extensions/multi-site-extension/lib/multi_site/site_chooser_helper.rb +10 -10
- metadata +12 -5
- data/app/users/_choose_site.html.haml +0 -4
@@ -17,7 +17,7 @@ module MultiSite
|
|
17
17
|
# that is, anything without a site is considered to be shared among all sites
|
18
18
|
# the default is false
|
19
19
|
|
20
|
-
def is_site_scoped(options={})
|
20
|
+
def is_site_scoped(options = {})
|
21
21
|
return if is_site_scoped?
|
22
22
|
|
23
23
|
options = {
|
@@ -25,7 +25,7 @@ module MultiSite
|
|
25
25
|
}.merge(options)
|
26
26
|
|
27
27
|
class_eval <<-EO
|
28
|
-
default_scope {where(site_scope_condition)}
|
28
|
+
#{ self == User ? 'default_scope { joins(user_scope_condition) }' : 'default_scope { where(site_scope_condition) }' }
|
29
29
|
extend MultiSite::ScopedModel::ScopedClassMethods
|
30
30
|
include MultiSite::ScopedModel::ScopedInstanceMethods
|
31
31
|
EO
|
@@ -52,8 +52,7 @@ module MultiSite
|
|
52
52
|
|
53
53
|
module ScopedClassMethods
|
54
54
|
|
55
|
-
|
56
|
-
def paginate_with_site(options={})
|
55
|
+
def paginate_with_site(options = {})
|
57
56
|
return paginate_without_site(options) unless sites?
|
58
57
|
where(site_scope_condition) do
|
59
58
|
paginate_without_site(options)
|
@@ -63,7 +62,7 @@ module MultiSite
|
|
63
62
|
%w{count average minimum maximum sum}.each do |getter|
|
64
63
|
define_method("#{getter}_with_site") do |*args|
|
65
64
|
return send("#{getter}_without_site".intern, *args) unless sites?
|
66
|
-
with_scope(:find => {:conditions => site_scope_condition}) do
|
65
|
+
with_scope(:find => { :conditions => site_scope_condition }) do
|
67
66
|
send "#{getter}_without_site".intern, *args
|
68
67
|
end
|
69
68
|
end
|
@@ -73,11 +72,11 @@ module MultiSite
|
|
73
72
|
# and should only be used in odd cases like migration.
|
74
73
|
def find_without_site(*args)
|
75
74
|
options = args.extract_options!
|
76
|
-
#set_readonly_option!(options)
|
75
|
+
# set_readonly_option!(options)
|
77
76
|
|
78
77
|
case args.first
|
79
|
-
|
80
|
-
|
78
|
+
when :first then find_initial_without_site(options) # defined here
|
79
|
+
when :all then all_without_site(options) # already defined by the alias chain
|
81
80
|
end
|
82
81
|
end
|
83
82
|
|
@@ -110,6 +109,12 @@ module MultiSite
|
|
110
109
|
condition
|
111
110
|
end
|
112
111
|
|
112
|
+
def user_scope_condition
|
113
|
+
return "" unless self.current_site
|
114
|
+
|
115
|
+
"INNER JOIN `admins_sites` ON `admins_sites`.`admin_id` = `admins`.`id` AND `admins_sites`.`site_id` = #{self.current_site.id}"
|
116
|
+
end
|
117
|
+
|
113
118
|
def plural_symbol_for_class
|
114
119
|
self.to_s.pluralize.underscore.intern
|
115
120
|
end
|
@@ -125,9 +130,10 @@ module MultiSite
|
|
125
130
|
|
126
131
|
module ScopedInstanceMethods
|
127
132
|
protected
|
128
|
-
|
129
|
-
|
130
|
-
|
133
|
+
|
134
|
+
def set_site
|
135
|
+
self.site ||= self.class.current_site! unless self.class.is_shareable?
|
136
|
+
end
|
131
137
|
end
|
132
138
|
end
|
133
139
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module MultiSite::SiteChooserHelper
|
2
2
|
|
3
|
-
def sites_chooser_thing
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
3
|
+
def sites_chooser_thing
|
4
|
+
return "" unless current_user.admin? && defined?(Site) && defined?(controller) && controller.sited_model? && controller.template_name == 'index' && Site.several?
|
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
|
+
chooser = %{<div id="site_chooser">}
|
7
|
+
# chooser << link_to("sites", admin_sites_url, {:id => 'show_site_list', :class => 'expandable'})
|
8
|
+
chooser << %{<ul id="nav"><li>Current Site: #{current_site.name}}
|
9
|
+
chooser << %{<ul class="expansion">#{options}</ul></li></ul>}
|
10
|
+
chooser << %{</div>}
|
11
|
+
chooser
|
12
|
+
end
|
13
13
|
|
14
14
|
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.3
|
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: 2024-
|
11
|
+
date: 2024-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage-validator
|
@@ -301,7 +301,7 @@ dependencies:
|
|
301
301
|
version: 2.0.1
|
302
302
|
- - "<"
|
303
303
|
- !ruby/object:Gem::Version
|
304
|
-
version: 3.
|
304
|
+
version: 3.2.0
|
305
305
|
type: :runtime
|
306
306
|
prerelease: false
|
307
307
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -311,7 +311,7 @@ dependencies:
|
|
311
311
|
version: 2.0.1
|
312
312
|
- - "<"
|
313
313
|
- !ruby/object:Gem::Version
|
314
|
-
version: 3.
|
314
|
+
version: 3.2.0
|
315
315
|
- !ruby/object:Gem::Dependency
|
316
316
|
name: rack-cache
|
317
317
|
requirement: !ruby/object:Gem::Requirement
|
@@ -730,6 +730,7 @@ files:
|
|
730
730
|
- app/mailers/application_mailer.rb
|
731
731
|
- app/mailers/devise_mailer.rb
|
732
732
|
- app/mailers/rad_social_mailer.rb
|
733
|
+
- app/models/admins_site.rb
|
733
734
|
- app/models/asset.rb
|
734
735
|
- app/models/asset_type.rb
|
735
736
|
- app/models/file_not_found_page.rb
|
@@ -753,7 +754,6 @@ files:
|
|
753
754
|
- app/models/trusty_cms/page_response_cache_director.rb
|
754
755
|
- app/models/user.rb
|
755
756
|
- app/models/user_action_observer.rb
|
756
|
-
- app/users/_choose_site.html.haml
|
757
757
|
- app/views/admin/assets/_asset.html.haml
|
758
758
|
- app/views/admin/assets/_asset_table.html.haml
|
759
759
|
- app/views/admin/assets/_errors.html.haml
|
@@ -908,6 +908,7 @@ files:
|
|
908
908
|
- db/migrate/20161027141250_add_position_to_pages.rb
|
909
909
|
- db/migrate/20200117141251_create_admin_users.rb
|
910
910
|
- db/migrate/20210331134718_create_active_storage_tables.active_storage.rb
|
911
|
+
- db/migrate/20241108172942_create_site_users.rb
|
911
912
|
- db/schema.rb
|
912
913
|
- lib/active_record_extensions/active_record_extensions.rb
|
913
914
|
- lib/annotatable.rb
|
@@ -1097,12 +1098,15 @@ files:
|
|
1097
1098
|
- spec/factories/layout.rb
|
1098
1099
|
- spec/factories/page.rb
|
1099
1100
|
- spec/factories/page_part.rb
|
1101
|
+
- spec/factories/snippet.rb
|
1100
1102
|
- spec/factories/user.rb
|
1101
1103
|
- spec/features/config_spec.rb
|
1102
1104
|
- spec/features/layouts_spec.rb
|
1103
1105
|
- spec/features/pages_spec.rb
|
1104
1106
|
- spec/fixtures/users.yml
|
1105
1107
|
- spec/models/layout_spec.rb
|
1108
|
+
- spec/models/snippets_spec.rb
|
1109
|
+
- spec/models/user_spec.rb
|
1106
1110
|
- spec/rails_helper.rb
|
1107
1111
|
- spec/spec_helper.rb
|
1108
1112
|
- spec/support/custom_actions.rb
|
@@ -1248,12 +1252,15 @@ test_files:
|
|
1248
1252
|
- spec/factories/layout.rb
|
1249
1253
|
- spec/factories/page.rb
|
1250
1254
|
- spec/factories/page_part.rb
|
1255
|
+
- spec/factories/snippet.rb
|
1251
1256
|
- spec/factories/user.rb
|
1252
1257
|
- spec/features/config_spec.rb
|
1253
1258
|
- spec/features/layouts_spec.rb
|
1254
1259
|
- spec/features/pages_spec.rb
|
1255
1260
|
- spec/fixtures/users.yml
|
1256
1261
|
- spec/models/layout_spec.rb
|
1262
|
+
- spec/models/snippets_spec.rb
|
1263
|
+
- spec/models/user_spec.rb
|
1257
1264
|
- spec/rails_helper.rb
|
1258
1265
|
- spec/spec_helper.rb
|
1259
1266
|
- spec/support/custom_actions.rb
|