trusty-multi-site-extension 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +25 -16
- data/lib/multi_site/application_controller_filter_extensions.rb +4 -3
- data/lib/multi_site/page_extensions.rb +2 -1
- data/lib/multi_site/pages_controller_extensions.rb +13 -6
- data/lib/multi_site/resource_controller_extensions.rb +6 -5
- data/lib/multi_site/route_extensions.rb +3 -2
- data/lib/multi_site/route_set_extensions.rb +3 -2
- data/lib/multi_site/scoped_model.rb +20 -19
- data/lib/multi_site/scoped_validation.rb +4 -3
- data/lib/multi_site/site_controller_extensions.rb +3 -2
- data/multi_site_extension.rb +2 -2
- data/trusty-multi-site-extension.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 877d368dd287154bc9f2e2e515a6534f8cae8d7c
|
4
|
+
data.tar.gz: dde29d83b5a15dccd6796f87427e91e4b9205643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a1f4ad2da09fb226b5f8f7b59f7aea57129212564de962e495087d8cf2623363a0054876c482194b8df195da5e7035424359299ce593a8f45f3c56bac0a58fe
|
7
|
+
data.tar.gz: 8f1ac3e4a540e0d14b6c360190b928d919fad668f0029c4d33b853bdec1919831aec80d64a60d119a5d74cb322530901328cd99485c53a2add6f1af3980e016e
|
data/Gemfile.lock
CHANGED
@@ -8,7 +8,7 @@ GIT
|
|
8
8
|
PATH
|
9
9
|
remote: .
|
10
10
|
specs:
|
11
|
-
trusty-multi-site-extension (3.0.
|
11
|
+
trusty-multi-site-extension (3.0.2)
|
12
12
|
acts_as_list (= 0.9.5)
|
13
13
|
rake (< 11.0)
|
14
14
|
trusty-cms (~> 3.0.0)
|
@@ -72,7 +72,7 @@ GEM
|
|
72
72
|
rack-test (>= 0.5.4)
|
73
73
|
xpath (~> 2.0)
|
74
74
|
chunky_png (1.3.8)
|
75
|
-
ckeditor (4.2.
|
75
|
+
ckeditor (4.2.4)
|
76
76
|
cocaine
|
77
77
|
orm_adapter (~> 0.5.0)
|
78
78
|
climate_control (0.2.0)
|
@@ -97,6 +97,8 @@ GEM
|
|
97
97
|
sass-rails (< 5.1)
|
98
98
|
sprockets (< 4.0)
|
99
99
|
concurrent-ruby (1.0.5)
|
100
|
+
css_parser (1.5.0)
|
101
|
+
addressable
|
100
102
|
daemons (1.2.4)
|
101
103
|
database_cleaner (1.3.0)
|
102
104
|
delocalize (0.4.0)
|
@@ -113,7 +115,7 @@ GEM
|
|
113
115
|
ffi (1.9.18)
|
114
116
|
globalid (0.4.0)
|
115
117
|
activesupport (>= 4.2.0)
|
116
|
-
haml (5.0.
|
118
|
+
haml (5.0.2)
|
117
119
|
temple (>= 0.8.0)
|
118
120
|
tilt
|
119
121
|
haml-rails (1.0.0)
|
@@ -135,7 +137,7 @@ GEM
|
|
135
137
|
thor (>= 0.14, < 2.0)
|
136
138
|
launchy (2.4.3)
|
137
139
|
addressable (~> 2.3)
|
138
|
-
libv8 (3.16.14.19)
|
140
|
+
libv8 (3.16.14.19-x86_64-darwin-16)
|
139
141
|
loofah (2.0.3)
|
140
142
|
nokogiri (>= 1.5.9)
|
141
143
|
mail (2.6.6)
|
@@ -147,7 +149,7 @@ GEM
|
|
147
149
|
mini_portile2 (2.1.0)
|
148
150
|
minitest (5.10.1)
|
149
151
|
multi_json (1.12.1)
|
150
|
-
mysql2 (0.4.
|
152
|
+
mysql2 (0.4.8)
|
151
153
|
nio4r (2.1.0)
|
152
154
|
nokogiri (1.7.1)
|
153
155
|
mini_portile2 (~> 2.1.0)
|
@@ -197,11 +199,17 @@ GEM
|
|
197
199
|
rake (>= 0.8.7)
|
198
200
|
thor (>= 0.18.1, < 2.0)
|
199
201
|
rake (10.5.0)
|
200
|
-
rb-fsevent (0.
|
201
|
-
rb-inotify (0.9.
|
202
|
-
ffi (>= 0.5.0)
|
202
|
+
rb-fsevent (0.10.2)
|
203
|
+
rb-inotify (0.9.10)
|
204
|
+
ffi (>= 0.5.0, < 2)
|
203
205
|
rdoc (5.1.0)
|
204
206
|
ref (2.0.0)
|
207
|
+
roadie (3.2.2)
|
208
|
+
css_parser (~> 1.4)
|
209
|
+
nokogiri (~> 1.5)
|
210
|
+
roadie-rails (1.2.1)
|
211
|
+
railties (>= 3.0, < 5.2)
|
212
|
+
roadie (~> 3.1)
|
205
213
|
rspec-core (3.6.0)
|
206
214
|
rspec-support (~> 3.6.0)
|
207
215
|
rspec-expectations (3.6.0)
|
@@ -219,16 +227,16 @@ GEM
|
|
219
227
|
rspec-mocks (~> 3.6.0)
|
220
228
|
rspec-support (~> 3.6.0)
|
221
229
|
rspec-support (3.6.0)
|
222
|
-
ruby_parser (3.
|
223
|
-
sexp_processor (~> 4.
|
224
|
-
sass (3.4.
|
230
|
+
ruby_parser (3.10.1)
|
231
|
+
sexp_processor (~> 4.9)
|
232
|
+
sass (3.4.25)
|
225
233
|
sass-rails (5.0.6)
|
226
234
|
railties (>= 4.0.0, < 6)
|
227
235
|
sass (~> 3.1)
|
228
236
|
sprockets (>= 2.8, < 4.0)
|
229
237
|
sprockets-rails (>= 2.0, < 4.0)
|
230
238
|
tilt (>= 1.1, < 3)
|
231
|
-
sexp_processor (4.
|
239
|
+
sexp_processor (4.10.0)
|
232
240
|
slop (3.6.0)
|
233
241
|
sprockets (3.7.1)
|
234
242
|
concurrent-ruby (~> 1.0)
|
@@ -248,8 +256,8 @@ GEM
|
|
248
256
|
rack (>= 1.0.0)
|
249
257
|
thor (0.19.4)
|
250
258
|
thread_safe (0.3.6)
|
251
|
-
tilt (2.0.
|
252
|
-
trusty-cms (3.0.
|
259
|
+
tilt (2.0.8)
|
260
|
+
trusty-cms (3.0.9)
|
253
261
|
RedCloth (~> 4.3.2)
|
254
262
|
acts_as_tree (~> 2.6.1)
|
255
263
|
bundler (~> 1.7)
|
@@ -265,9 +273,10 @@ GEM
|
|
265
273
|
rack (~> 2.0.1)
|
266
274
|
rack-cache (~> 1.7)
|
267
275
|
radius (~> 0.7)
|
268
|
-
rails (~> 5.0.
|
276
|
+
rails (~> 5.0.1)
|
269
277
|
rake (< 11.0)
|
270
278
|
rdoc (~> 5.1)
|
279
|
+
roadie-rails (~> 1.2.1)
|
271
280
|
sass-rails (~> 5.0.6)
|
272
281
|
stringex (~> 2.7.1)
|
273
282
|
therubyracer (~> 0.12.3)
|
@@ -309,4 +318,4 @@ DEPENDENCIES
|
|
309
318
|
trustygems (~> 0.2.0)
|
310
319
|
|
311
320
|
BUNDLED WITH
|
312
|
-
1.15.
|
321
|
+
1.15.3
|
@@ -2,8 +2,9 @@ module MultiSite::ApplicationControllerFilterExtensions
|
|
2
2
|
|
3
3
|
def self.included(base)
|
4
4
|
base.class_eval {
|
5
|
-
|
6
|
-
|
5
|
+
prepend_before_action :set_site
|
6
|
+
alias_method :authenticate_without_site, :authenticate
|
7
|
+
alias_method :authenticate, :authenticate_with_site
|
7
8
|
}
|
8
9
|
end
|
9
10
|
|
@@ -18,4 +19,4 @@ protected
|
|
18
19
|
true if self.current_site = discover_current_site
|
19
20
|
end
|
20
21
|
|
21
|
-
end
|
22
|
+
end
|
@@ -4,7 +4,8 @@ module MultiSite::PageExtensions
|
|
4
4
|
def self.included(base)
|
5
5
|
base.class_eval {
|
6
6
|
include InstanceMethods
|
7
|
-
|
7
|
+
alias_method :url_without_sites, :url
|
8
|
+
alias_method :url, :url_with_sites
|
8
9
|
mattr_accessor :current_site
|
9
10
|
belongs_to :site
|
10
11
|
before_create :associate_with_site
|
@@ -1,10 +1,17 @@
|
|
1
1
|
module MultiSite::PagesControllerExtensions
|
2
2
|
def self.included(base)
|
3
3
|
base.class_eval {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
alias_method :discover_current_site_without_root, :discover_current_site
|
5
|
+
alias_method :discover_current_site, :discover_current_site_with_root
|
6
|
+
|
7
|
+
alias_method :index_without_site, :index
|
8
|
+
alias_method :index, :index_with_site
|
9
|
+
|
10
|
+
alias_method :continue_url_without_site, :continue_url
|
11
|
+
alias_method :continue_url, :continue_url_with_site
|
12
|
+
|
13
|
+
alias_method :remove_without_back, :remove
|
14
|
+
alias_method :remove, :remove_with_back
|
8
15
|
responses.destroy.default do
|
9
16
|
return_url = session[:came_from]
|
10
17
|
session[:came_from] = nil
|
@@ -17,7 +24,7 @@ module MultiSite::PagesControllerExtensions
|
|
17
24
|
}
|
18
25
|
end
|
19
26
|
|
20
|
-
# for compatibility with the standard issue of multi_site,
|
27
|
+
# for compatibility with the standard issue of multi_site,
|
21
28
|
# a root parameter overrides other ways of setting site
|
22
29
|
|
23
30
|
def discover_current_site_with_root
|
@@ -41,7 +48,7 @@ module MultiSite::PagesControllerExtensions
|
|
41
48
|
session[:came_from] = request.env["HTTP_REFERER"]
|
42
49
|
remove_without_back
|
43
50
|
end
|
44
|
-
|
51
|
+
|
45
52
|
def continue_url_with_site(options={})
|
46
53
|
options[:redirect_to] || (params[:continue] ? edit_admin_page_url(model) : admin_pages_url(:site_id => model.site.id))
|
47
54
|
end
|
@@ -2,7 +2,8 @@ module MultiSite::ResourceControllerExtensions
|
|
2
2
|
|
3
3
|
def self.included(base)
|
4
4
|
base.class_eval {
|
5
|
-
|
5
|
+
alias_method :discover_current_site_without_input, :discover_current_site
|
6
|
+
alias_method :discover_current_site, :discover_current_site_with_input
|
6
7
|
}
|
7
8
|
end
|
8
9
|
|
@@ -10,21 +11,21 @@ module MultiSite::ResourceControllerExtensions
|
|
10
11
|
Page.current_site = site
|
11
12
|
set_session_site
|
12
13
|
end
|
13
|
-
|
14
|
+
|
14
15
|
# among other things this determines whether the site chooser is shown in the submenu
|
15
16
|
|
16
17
|
def sited_model?
|
17
18
|
model_class == Page || model_class.is_site_scoped?
|
18
19
|
end
|
19
|
-
|
20
|
+
|
20
21
|
protected
|
21
22
|
|
22
23
|
def discover_current_site_with_input
|
23
24
|
site_from_param || site_from_session || discover_current_site_without_input
|
24
25
|
end
|
25
|
-
|
26
|
+
|
26
27
|
# for interface consistency we want to be able to remember site choices between requests
|
27
|
-
|
28
|
+
|
28
29
|
def set_session_site(site_id=nil)
|
29
30
|
site_id ||= current_site.id.to_s if current_site.is_a? Site
|
30
31
|
session[:site_id] = site_id
|
@@ -2,7 +2,8 @@ module MultiSite
|
|
2
2
|
module RouteExtensions
|
3
3
|
|
4
4
|
def self.included(base)
|
5
|
-
base.
|
5
|
+
base.alias_method :recognition_conditions_without_site, :recognition_conditions
|
6
|
+
base.alias_method :recognition_conditions, :recognition_conditions_with_site
|
6
7
|
end
|
7
8
|
|
8
9
|
def recognition_conditions_with_site
|
@@ -18,4 +19,4 @@ module MultiSite
|
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
|
-
ActionController::Routing::Route.send :include, MultiSite::RouteExtensions
|
22
|
+
ActionController::Routing::Route.send :include, MultiSite::RouteExtensions
|
@@ -2,7 +2,8 @@ module MultiSite
|
|
2
2
|
module RouteSetExtensions
|
3
3
|
|
4
4
|
def self.included(base)
|
5
|
-
base.
|
5
|
+
base.alias_method :extract_request_environment_without_site, :extract_request_environment
|
6
|
+
base.alias_method :extract_request_environment, :extract_request_environment_with_site
|
6
7
|
end
|
7
8
|
|
8
9
|
def extract_request_environment_with_site(request)
|
@@ -13,4 +14,4 @@ module MultiSite
|
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
|
-
ActionController::Routing::RouteSet.send :include, MultiSite::RouteSetExtensions
|
17
|
+
ActionController::Routing::RouteSet.send :include, MultiSite::RouteSetExtensions
|
@@ -1,25 +1,25 @@
|
|
1
1
|
module MultiSite
|
2
|
-
|
2
|
+
|
3
3
|
module ScopedModel
|
4
4
|
def self.included(base)
|
5
5
|
base.extend ClassMethods
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
module ClassMethods
|
9
9
|
def is_site_scoped?
|
10
10
|
false
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
# only option at the moment is :shareable, which we take to mean that sites are optional:
|
14
14
|
# if true it causes us not to set the site automatically or to validate its presence,
|
15
|
-
# and to extend the scoping conditions so that objects with no site are returned as
|
15
|
+
# and to extend the scoping conditions so that objects with no site are returned as
|
16
16
|
# well as objects with the specified site
|
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
20
|
def is_site_scoped(options={})
|
21
21
|
return if is_site_scoped?
|
22
|
-
|
22
|
+
|
23
23
|
options = {
|
24
24
|
:shareable => false
|
25
25
|
}.merge(options)
|
@@ -29,7 +29,7 @@ module MultiSite
|
|
29
29
|
extend MultiSite::ScopedModel::ScopedClassMethods
|
30
30
|
include MultiSite::ScopedModel::ScopedInstanceMethods
|
31
31
|
EO
|
32
|
-
|
32
|
+
|
33
33
|
belongs_to :site
|
34
34
|
Site.send(:has_many, plural_symbol_for_class)
|
35
35
|
|
@@ -38,12 +38,14 @@ module MultiSite
|
|
38
38
|
|
39
39
|
class << self
|
40
40
|
attr_accessor :shareable
|
41
|
-
|
41
|
+
alias_method :paginate_without_site, :paginate
|
42
|
+
alias_method :paginate, :paginate_with_site
|
42
43
|
%w{count average minimum maximum sum}.each do |getter|
|
43
|
-
|
44
|
+
alias_method "#{getter}_without_site".intern, getter.intern
|
45
|
+
alias_method getter.intern, "#{getter}_with_site".intern
|
44
46
|
end
|
45
47
|
end
|
46
|
-
|
48
|
+
|
47
49
|
self.shareable = options[:shareable]
|
48
50
|
end
|
49
51
|
end
|
@@ -66,7 +68,7 @@ module MultiSite
|
|
66
68
|
end
|
67
69
|
end
|
68
70
|
end
|
69
|
-
|
71
|
+
|
70
72
|
# this only works with :all and :first
|
71
73
|
# and should only be used in odd cases like migration.
|
72
74
|
def find_without_site(*args)
|
@@ -78,12 +80,12 @@ module MultiSite
|
|
78
80
|
when :all then all_without_site(options) # already defined by the alias chain
|
79
81
|
end
|
80
82
|
end
|
81
|
-
|
83
|
+
|
82
84
|
def find_initial_without_site(options)
|
83
85
|
options.update(:limit => 1)
|
84
86
|
all_without_site(options).first
|
85
87
|
end
|
86
|
-
|
88
|
+
|
87
89
|
def sites?
|
88
90
|
Site.table_exists? && Site.several?
|
89
91
|
end
|
@@ -96,22 +98,22 @@ module MultiSite
|
|
96
98
|
def current_site
|
97
99
|
Page.current_site
|
98
100
|
end
|
99
|
-
|
101
|
+
|
100
102
|
def site_scope_condition
|
101
103
|
if self.shareable
|
102
104
|
condition = ""
|
103
105
|
condition << "#{self.table_name}.site_id = #{self.current_site.id} OR " if self.current_site
|
104
|
-
condition << "#{self.table_name}.site_id IS NULL"
|
106
|
+
condition << "#{self.table_name}.site_id IS NULL"
|
105
107
|
else
|
106
108
|
condition = "#{self.table_name}.site_id = #{self.current_site!.id}"
|
107
109
|
end
|
108
110
|
condition
|
109
111
|
end
|
110
|
-
|
112
|
+
|
111
113
|
def plural_symbol_for_class
|
112
114
|
self.to_s.pluralize.underscore.intern
|
113
115
|
end
|
114
|
-
|
116
|
+
|
115
117
|
def is_site_scoped?
|
116
118
|
true
|
117
119
|
end
|
@@ -120,7 +122,7 @@ module MultiSite
|
|
120
122
|
!!self.shareable
|
121
123
|
end
|
122
124
|
end
|
123
|
-
|
125
|
+
|
124
126
|
module ScopedInstanceMethods
|
125
127
|
protected
|
126
128
|
def set_site
|
@@ -129,4 +131,3 @@ module MultiSite
|
|
129
131
|
end
|
130
132
|
end
|
131
133
|
end
|
132
|
-
|
@@ -3,7 +3,7 @@ module MultiSite::ScopedValidation
|
|
3
3
|
def self.included(base)
|
4
4
|
|
5
5
|
base.class_eval do
|
6
|
-
# scoping validations to the site should be very simple
|
6
|
+
# scoping validations to the site should be very simple
|
7
7
|
# all you would normally need is something like this:
|
8
8
|
#
|
9
9
|
# validates_uniqueness_of :email, :scope => :site_id
|
@@ -23,9 +23,10 @@ module MultiSite::ScopedValidation
|
|
23
23
|
validates_uniqueness_of_without_site(*attr)
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
alias_method :validates_uniqueness_of_without_site, :validates_uniqueness_of
|
27
|
+
alias_method :validates_uniqueness_of, :validates_uniqueness_of_with_site
|
27
28
|
end
|
28
|
-
|
29
|
+
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module MultiSite::SiteControllerExtensions
|
2
2
|
def self.included(base)
|
3
3
|
base.class_eval do
|
4
|
-
|
5
|
-
|
4
|
+
before_action :set_site
|
5
|
+
alias_method :process_page_without_home_path, :process_page
|
6
|
+
alias_method :process_page, :process_page_with_home_path
|
6
7
|
end
|
7
8
|
end
|
8
9
|
|
data/multi_site_extension.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_dependency 'application_controller'
|
2
2
|
|
3
3
|
class MultiSiteExtension < TrustyCms::Extension
|
4
|
-
version "3.0.
|
4
|
+
version "3.0.2"
|
5
5
|
description %{ Enables virtual sites to be created with associated domain names.
|
6
6
|
Also scopes the sitemap view to any given page (or the root of an
|
7
7
|
individual site) and allows model classes to be scoped by site. }
|
@@ -11,7 +11,7 @@ class MultiSiteExtension < TrustyCms::Extension
|
|
11
11
|
def activate
|
12
12
|
# ActionController::Routing modules are required rather than sent as includes
|
13
13
|
# because the routing persists between dev. requests and is not compatible
|
14
|
-
# with multiple
|
14
|
+
# with multiple alias_method calls.
|
15
15
|
|
16
16
|
# likewise for ScopedValidation, which is a pre-emptive hack that shouldn't run more than once.
|
17
17
|
|
@@ -4,7 +4,7 @@ require "trusty-multi-site-extension"
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "trusty-multi-site-extension"
|
7
|
-
s.version = "3.0.
|
7
|
+
s.version = "3.0.2"
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.authors = ["Sean Cribbs", "Eric Sipple", "Danielle Greaves", "Brittany Martin"]
|
10
10
|
s.description = %q{Extends Trusty CMS Layouts to support multiple sites, defined by domain}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trusty-multi-site-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Cribbs
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-08-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: acts_as_list
|