trusty-multi-site-extension 2.0.6 → 2.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cc418f29b7ebc97289a7e27876e6128e567a9c4
4
- data.tar.gz: 54329c1b4e9d59134c227fae36d075c93c4ccce5
3
+ metadata.gz: cbd421050fbfed411b830b354e526fa4100b7108
4
+ data.tar.gz: b01afa801a4f5853d0876834d716105356b9adab
5
5
  SHA512:
6
- metadata.gz: 21ac25398cdefa494ecccf8ef6536c3a4ec32a5b824e457af2cf97ad9f6e7e210e910970a090c64a0dd519b7b56eb78cd6395aafb66ff7af0e73d3d84d6597ba
7
- data.tar.gz: e5853a79398180f3d805e94e51e86da8877a9dc456276d10ad4434d5da1d021e4d7401bc654f34d528b813e09e792da86e52a005479caf36c897bf6d6b5de8e2
6
+ metadata.gz: ed7737f122b223547b2e97ae18a02ad3f3ade52bd77c3eafc81795aa945591d92aff2eef27a20da6b7ba0d5c3194d5738b756466870c0d724d30ae45359cefe9
7
+ data.tar.gz: 2ad905c588a12005d7bb3c2d7f901cbbf04ccf1b55524a5e4e3843e339f7bdb64ba1ebe96d5e84e5d245cf87fe72f5c349b4fac40fffb3b695d69371d3696ae0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusty-multi-site-extension (2.0.6)
4
+ trusty-multi-site-extension (2.0.7)
5
5
  acts_as_list (= 0.4.0)
6
6
  trusty-cms (~> 2.0.0)
7
7
  trusty-snippets-extension (~> 2.0.0)
@@ -154,7 +154,7 @@ GEM
154
154
  byebug (~> 5.0)
155
155
  pry (~> 0.10)
156
156
  rack (1.6.4)
157
- rack-cache (1.6.0)
157
+ rack-cache (1.5.1)
158
158
  rack (>= 0.4)
159
159
  rack-test (0.6.3)
160
160
  rack (>= 1.0)
@@ -300,4 +300,4 @@ DEPENDENCIES
300
300
  trustygems (~> 0.2.0)
301
301
 
302
302
  BUNDLED WITH
303
- 1.10.6
303
+ 1.11.2
@@ -18,15 +18,17 @@ module MultiSite::PageExtensions
18
18
  path = root.path if clean_path(path) == "/"
19
19
  result = root.find_by_path(path, live)
20
20
 
21
- # If the result is a FileNotFoundPage that doesn't match the current
22
- # site, try to find one that does.
21
+ # If the result is a FileNotFoundPage and it
22
+ # doesn't match the current site, try to find one that does.
23
23
  if result.is_a?(FileNotFoundPage) && result.site_id != homepage.site_id
24
24
  get_site_specific_file_not_found(result)
25
+
26
+ # Otherwise, just go with it.
25
27
  else
26
28
  result
27
29
  end
28
-
29
30
  end
31
+
30
32
  def current_site
31
33
  @current_site ||= Site.default
32
34
  end
@@ -2,8 +2,21 @@ module MultiSite::SiteControllerExtensions
2
2
  def self.included(base)
3
3
  base.class_eval do
4
4
  before_filter :set_site
5
+ alias_method_chain :process_page, :home_path
5
6
  end
6
7
  end
8
+
9
+ # If it's a file not found page and the path doesn't include
10
+ # the site's homepage path, try redirecting to include it.
11
+ def process_page_with_home_path(page)
12
+ homepage = Page.current_site.homepage
13
+ if page.is_a?(FileNotFoundPage) && !params[:url].include?(homepage.slug)
14
+ false if redirect_to "/#{homepage.slug}/#{params[:url]}"
15
+ else
16
+ process_page_without_home_path(page)
17
+ end
18
+
19
+ end
7
20
 
8
21
  def set_site
9
22
  Page.current_site = Site.find_for_host(request.host)
@@ -1,7 +1,7 @@
1
1
  require_dependency 'application_controller'
2
2
 
3
3
  class MultiSiteExtension < TrustyCms::Extension
4
- version "2.0.6"
4
+ version "2.0.7"
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. }
@@ -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 = "2.0.6"
7
+ s.version = "2.0.7"
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"]
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: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Cribbs
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-02-10 00:00:00.000000000 Z
13
+ date: 2016-02-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: acts_as_list
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  requirements: []
147
147
  rubyforge_project:
148
- rubygems_version: 2.4.8
148
+ rubygems_version: 2.4.6
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: Extends Trusty CMS Layouts to support multiple sites, defined by domain
@@ -161,3 +161,4 @@ test_files:
161
161
  - spec/models/site_spec.rb
162
162
  - spec/spec.opts
163
163
  - spec/spec_helper.rb
164
+ has_rdoc: