refinerycms-multisite 0.0.5 → 0.0.6

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.
data/app/models/site.rb CHANGED
@@ -1,15 +1,3 @@
1
1
  class Site < ActiveRecord::Base
2
- belongs_to :page
3
- attr_accessible :name, :page_id, :stylesheet, :hostnames,
4
- :hostnames_attributes
5
-
6
- has_many :hostnames,
7
- :dependent => :destroy
8
-
9
- accepts_nested_attributes_for :hostnames, :allow_destroy => true
10
-
11
- def self.find_by_hostname(hostname)
12
- Site.joins(:hostnames).where(:hostnames=>{:hostname=>hostname}).first ||
13
- Site.joins(:hostnames).where(:hostnames=>{:hostname=>'*'}).first
14
- end
15
- end
2
+ include Refinery::SiteModel
3
+ end
@@ -1,15 +1,10 @@
1
1
  <h1 id='logo'>
2
2
  <%= link_to RefinerySetting.find_or_set(:site_name, "Company Name"), root_path %>
3
3
  </h1>
4
- <%=
5
- ::Fiber.new {
6
- ::Fiber.yield(
7
- render(:partial => "/shared/menu", :locals => {
4
+ <%= render(:partial => "/shared/menu", :locals => {
8
5
  :dom_id => 'menu',
9
6
  :css => 'menu',
10
7
  :roots => @menu_pages.where(:parent_id => @site.try(:page_id)),
11
8
  :collection => @menu_pages.where(@menu_pages.arel_table[:parent_id].not_eq(nil)),
12
9
  :selected_item => (@page if defined?(::Page))
13
- })
14
- )
15
- }.resume %>
10
+ }) %>
@@ -1,5 +1,5 @@
1
1
  module Refinerycms
2
2
  module Multisite
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -19,6 +19,35 @@ module Refinery
19
19
  end
20
20
  end
21
21
  end
22
+
23
+ module SiteModel
24
+ extend ActiveSupport::Concern
25
+
26
+ included do
27
+ belongs_to :page
28
+ attr_accessible :name, :page_id, :stylesheet, :hostnames,
29
+ :hostnames_attributes
30
+
31
+ has_many :hostnames, :dependent => :destroy
32
+
33
+ accepts_nested_attributes_for :hostnames, :allow_destroy => true
34
+ end
35
+
36
+ module ClassMethods
37
+ def find_by_hostname(hostname)
38
+ Site.joins(:hostnames).where(:hostnames=>{:hostname=>hostname}).first ||
39
+ Site.joins(:hostnames).where(:hostnames=>{:hostname=>'*'}).first
40
+ end
41
+ end
42
+
43
+ module InstanceMethods
44
+ end
45
+ end
46
+
47
+ module SiteModelClassMethods
48
+ #include ActiveRecord
49
+
50
+ end
22
51
  end
23
52
 
24
53
  module PagesControllerSite
@@ -44,4 +73,4 @@ class ActionController::Base
44
73
  alias_method_chain :home, :site
45
74
  end
46
75
  end
47
- end
76
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-multisite
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Andreas K\xC3\xB6nig"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-18 00:00:00 +02:00
18
+ date: 2011-05-26 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency