comfortable_mexican_sofa 1.4.7 → 1.4.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -1
- data/README.md +2 -2
- data/VERSION +1 -1
- data/app/controllers/cms_admin/pages_controller.rb +1 -1
- data/app/controllers/cms_content_controller.rb +5 -13
- data/app/models/cms/block.rb +1 -3
- data/app/models/cms/categorization.rb +1 -3
- data/app/models/cms/category.rb +1 -3
- data/app/models/cms/file.rb +1 -3
- data/app/models/cms/layout.rb +1 -3
- data/app/models/cms/page.rb +1 -3
- data/app/models/cms/revision.rb +1 -3
- data/app/models/cms/site.rb +17 -3
- data/app/models/cms/snippet.rb +1 -3
- data/app/views/cms_admin/sites/index.html.erb +1 -0
- data/comfortable_mexican_sofa.gemspec +3 -3
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/db/migrate/01_create_cms.rb +7 -7
- data/db/migrate/upgrades/02_upgrade_to_1_1_0.rb +4 -6
- data/db/migrate/upgrades/03_upgrade_to_1_2_0.rb +4 -6
- data/db/migrate/upgrades/04_upgrade_to_1_3_0.rb +4 -6
- data/db/migrate/upgrades/05_upgrade_to_1_4_0.rb +5 -7
- data/doc/preview.png +0 -0
- data/lib/comfortable_mexican_sofa.rb +7 -0
- data/lib/comfortable_mexican_sofa/extensions/rails.rb +0 -5
- data/lib/comfortable_mexican_sofa/tag.rb +2 -0
- data/lib/comfortable_mexican_sofa/view_methods.rb +1 -1
- data/test/functional/cms_admin/pages_controller_test.rb +1 -1
- data/test/unit/models/site_test.rb +26 -0
- metadata +10 -10
- data/doc/page_editing.png +0 -0
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# ComfortableMexicanSofa (Rails 3 CMS Engine) [![Build Status](
|
1
|
+
# ComfortableMexicanSofa (Rails 3 CMS Engine) [![Build Status](http://travis-ci.org/twg/comfortable-mexican-sofa.png)](http://travis-ci.org/twg/comfortable-mexican-sofa)
|
2
2
|
|
3
3
|
ComfortableMexicanSofa is a powerful CMS Engine for your Rails 3 applications.
|
4
4
|
|
@@ -49,7 +49,7 @@ Once you have a layout, you may start creating pages and populating content. It'
|
|
49
49
|
|
50
50
|
For more information please [see Wiki pages](https://github.com/twg/comfortable-mexican-sofa/wiki).
|
51
51
|
|
52
|
-
![Sofa's Page Edit View](https://github.com/twg/comfortable-mexican-sofa/raw/master/doc/
|
52
|
+
![Sofa's Page Edit View](https://github.com/twg/comfortable-mexican-sofa/raw/master/doc/preview.png)
|
53
53
|
|
54
54
|
ComfortableMexicanSofa is released under the [MIT license](https://github.com/twg/comfortable-mexican-sofa/raw/master/LICENSE)
|
55
55
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.8
|
@@ -62,7 +62,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def reorder
|
65
|
-
(params[:
|
65
|
+
(params[:cms_page] || []).each_with_index do |id, index|
|
66
66
|
if (cms_page = Cms::Page.find_by_id(id))
|
67
67
|
cms_page.update_attribute(:position, index)
|
68
68
|
end
|
@@ -35,18 +35,10 @@ protected
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def load_cms_site
|
38
|
-
if params[:site_id]
|
39
|
-
|
38
|
+
@cms_site ||= if params[:site_id]
|
39
|
+
Cms::Site.find_by_id(params[:site_id])
|
40
40
|
else
|
41
|
-
|
42
|
-
Cms::Site.find_all_by_hostname(request.host.downcase).each do |site|
|
43
|
-
if site.path.blank?
|
44
|
-
@cms_site = site
|
45
|
-
elsif "#{request.fullpath}/".match /^\/#{Regexp.escape(site.path.to_s)}\//
|
46
|
-
@cms_site = site
|
47
|
-
break
|
48
|
-
end
|
49
|
-
end unless @cms_site
|
41
|
+
Cms::Site.find_site(request.host.downcase, request.fullpath)
|
50
42
|
end
|
51
43
|
|
52
44
|
if @cms_site
|
@@ -62,11 +54,11 @@ protected
|
|
62
54
|
return unless ComfortableMexicanSofa.config.enable_fixtures
|
63
55
|
ComfortableMexicanSofa::Fixtures.import_all(@cms_site.hostname)
|
64
56
|
end
|
65
|
-
|
57
|
+
|
66
58
|
def load_cms_page
|
67
59
|
@cms_page = @cms_site.pages.published.find_by_full_path!("/#{params[:cms_path]}")
|
68
60
|
return redirect_to(@cms_page.target_page.full_path) if @cms_page.target_page
|
69
|
-
|
61
|
+
|
70
62
|
rescue ActiveRecord::RecordNotFound
|
71
63
|
if @cms_page = @cms_site.pages.published.find_by_full_path('/404')
|
72
64
|
render_html(404)
|
data/app/models/cms/block.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
class Cms::Block < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(self)
|
6
4
|
|
7
5
|
set_table_name :cms_blocks
|
8
6
|
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class Cms::Categorization < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(self)
|
6
4
|
|
7
5
|
set_table_name :cms_categorizations
|
8
6
|
|
data/app/models/cms/category.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
class Cms::Category < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(self)
|
6
4
|
|
7
5
|
set_table_name :cms_categories
|
8
6
|
|
data/app/models/cms/file.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
class Cms::File < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(self)
|
6
4
|
|
7
5
|
set_table_name :cms_files
|
8
6
|
|
data/app/models/cms/layout.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
class Cms::Layout < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(self)
|
6
4
|
|
7
5
|
set_table_name :cms_layouts
|
8
6
|
|
data/app/models/cms/page.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
class Cms::Page < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(self)
|
6
4
|
|
7
5
|
set_table_name :cms_pages
|
8
6
|
|
data/app/models/cms/revision.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
class Cms::Revision < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(self)
|
6
4
|
|
7
5
|
set_table_name :cms_revisions
|
8
6
|
|
data/app/models/cms/site.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
class Cms::Site < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(self)
|
6
4
|
|
7
5
|
set_table_name :cms_sites
|
8
6
|
|
@@ -27,6 +25,22 @@ class Cms::Site < ActiveRecord::Base
|
|
27
25
|
# -- Scopes ---------------------------------------------------------------
|
28
26
|
scope :mirrored, where(:is_mirrored => true)
|
29
27
|
|
28
|
+
# -- Class Methods --------------------------------------------------------
|
29
|
+
# returning the Cms::Site instance based on host and path
|
30
|
+
def self.find_site(host, path = nil)
|
31
|
+
return Cms::Site.first if Cms::Site.count == 1
|
32
|
+
cms_site = nil
|
33
|
+
Cms::Site.find_all_by_hostname(host).each do |site|
|
34
|
+
if site.path.blank?
|
35
|
+
cms_site = site
|
36
|
+
elsif "#{path}/".match /^\/#{Regexp.escape(site.path.to_s)}\//
|
37
|
+
cms_site = site
|
38
|
+
break
|
39
|
+
end
|
40
|
+
end
|
41
|
+
return cms_site
|
42
|
+
end
|
43
|
+
|
30
44
|
protected
|
31
45
|
|
32
46
|
def assign_label
|
data/app/models/cms/snippet.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
class Cms::Snippet < ActiveRecord::Base
|
2
2
|
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(self)
|
6
4
|
|
7
5
|
set_table_name :cms_snippets
|
8
6
|
|
@@ -7,6 +7,7 @@
|
|
7
7
|
<div class='item'>
|
8
8
|
<div class='icon'></div>
|
9
9
|
<div class='action_links'>
|
10
|
+
<%= link_to t('.select'), cms_admin_site_pages_path(site) %>
|
10
11
|
<%= link_to t('.edit'), edit_cms_admin_site_path(site) %>
|
11
12
|
<%= link_to t('.delete'), cms_admin_site_path(site), :method => :delete, :confirm => t('.are_you_sure') %>
|
12
13
|
</div>
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{comfortable_mexican_sofa}
|
8
|
-
s.version = "1.4.
|
8
|
+
s.version = "1.4.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oleg Khabarov", "The Working Group Inc"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-09-05}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{oleg@theworkinggroup.ca}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -196,7 +196,7 @@ Gem::Specification.new do |s|
|
|
196
196
|
"db/migrate/upgrades/04_upgrade_to_1_3_0.rb",
|
197
197
|
"db/migrate/upgrades/05_upgrade_to_1_4_0.rb",
|
198
198
|
"db/seeds.rb",
|
199
|
-
"doc/
|
199
|
+
"doc/preview.png",
|
200
200
|
"doc/sofa.png",
|
201
201
|
"gemfiles/Gemfile.rails-3.0.x",
|
202
202
|
"gemfiles/Gemfile.rails-3.1.x",
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/db/migrate/01_create_cms.rb
CHANGED
@@ -2,9 +2,7 @@ class CreateCms < ActiveRecord::Migration
|
|
2
2
|
|
3
3
|
def self.up
|
4
4
|
|
5
|
-
|
6
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
7
|
-
end
|
5
|
+
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
|
8
6
|
|
9
7
|
# -- Sites --------------------------------------------------------------
|
10
8
|
create_table :cms_sites do |t|
|
@@ -104,18 +102,18 @@ class CreateCms < ActiveRecord::Migration
|
|
104
102
|
|
105
103
|
create_table :cms_categorizations, :force => true do |t|
|
106
104
|
t.integer :category_id
|
107
|
-
t.string
|
105
|
+
t.string :categorized_type
|
108
106
|
t.integer :categorized_id
|
109
107
|
end
|
110
108
|
add_index :cms_categorizations, [:category_id, :categorized_type, :categorized_id], :unique => true,
|
111
109
|
:name => 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id'
|
110
|
+
|
111
|
+
ActiveRecord::Base.establish_connection
|
112
112
|
end
|
113
113
|
|
114
114
|
def self.down
|
115
115
|
|
116
|
-
|
117
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
118
|
-
end
|
116
|
+
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
|
119
117
|
|
120
118
|
drop_table :cms_sites
|
121
119
|
drop_table :cms_layouts
|
@@ -126,5 +124,7 @@ class CreateCms < ActiveRecord::Migration
|
|
126
124
|
drop_table :cms_revisions
|
127
125
|
drop_table :cms_categories
|
128
126
|
drop_table :cms_categorizations
|
127
|
+
|
128
|
+
ActiveRecord::Base.establish_connection
|
129
129
|
end
|
130
130
|
end
|
@@ -1,25 +1,23 @@
|
|
1
1
|
class UpgradeTo110 < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
|
6
4
|
rename_column :cms_layouts, :cms_site_id, :site_id
|
7
5
|
rename_column :cms_pages, :cms_site_id, :site_id
|
8
6
|
rename_column :cms_pages, :cms_layout_id, :layout_id
|
9
7
|
rename_column :cms_blocks, :cms_page_id, :page_id
|
10
8
|
rename_column :cms_snippets, :cms_site_id, :site_id
|
11
9
|
rename_column :cms_uploads, :cms_site_id, :site_id
|
10
|
+
ActiveRecord::Base.establish_connection
|
12
11
|
end
|
13
12
|
|
14
13
|
def self.down
|
15
|
-
|
16
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
17
|
-
end
|
14
|
+
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
|
18
15
|
rename_column :cms_uploads, :site_id, :cms_site_id
|
19
16
|
rename_column :cms_snippets, :site_id, :cms_site_id
|
20
17
|
rename_column :cms_blocks, :page_id, :cms_page_id
|
21
18
|
rename_column :cms_layouts, :site_id, :cms_site_id
|
22
19
|
rename_column :cms_pages, :layout_id, :cms_layout_id
|
23
20
|
rename_column :cms_pages, :site_id, :cms_site_id
|
21
|
+
ActiveRecord::Base.establish_connection
|
24
22
|
end
|
25
23
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class UpgradeTo120 < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
|
6
4
|
create_table :cms_revisions, :force => true do |t|
|
7
5
|
t.string :record_type
|
8
6
|
t.integer :record_id
|
@@ -10,12 +8,12 @@ class UpgradeTo120 < ActiveRecord::Migration
|
|
10
8
|
t.datetime :created_at
|
11
9
|
end
|
12
10
|
add_index :cms_revisions, [:record_type, :record_id, :created_at]
|
11
|
+
ActiveRecord::Base.establish_connection
|
13
12
|
end
|
14
13
|
|
15
14
|
def self.down
|
16
|
-
|
17
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
18
|
-
end
|
15
|
+
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
|
19
16
|
drop_table :cms_revisions
|
17
|
+
ActiveRecord::Base.establish_connection
|
20
18
|
end
|
21
19
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class UpgradeTo130 < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
|
6
4
|
add_column :cms_sites, :is_mirrored, :boolean, :null => false, :default => false
|
7
5
|
add_column :cms_sites, :path, :string
|
8
6
|
add_column :cms_sites, :locale, :string, :null => false, :default => 'en'
|
@@ -11,12 +9,11 @@ class UpgradeTo130 < ActiveRecord::Migration
|
|
11
9
|
add_column :cms_layouts, :is_shared, :boolean, :null => false, :default => false
|
12
10
|
add_column :cms_pages, :is_shared, :boolean, :null => false, :default => false
|
13
11
|
add_column :cms_snippets, :is_shared, :boolean, :null => false, :default => false
|
12
|
+
ActiveRecord::Base.establish_connection
|
14
13
|
end
|
15
14
|
|
16
15
|
def self.down
|
17
|
-
|
18
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
19
|
-
end
|
16
|
+
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
|
20
17
|
remove_index :cms_sites, :is_mirrored
|
21
18
|
remove_column :cms_sites, :path
|
22
19
|
remove_column :cms_sites, :is_mirrored
|
@@ -25,5 +22,6 @@ class UpgradeTo130 < ActiveRecord::Migration
|
|
25
22
|
remove_column :cms_layouts, :is_shared
|
26
23
|
remove_column :cms_pages, :is_shared
|
27
24
|
remove_column :cms_snippets, :is_shared
|
25
|
+
ActiveRecord::Base.establish_connection
|
28
26
|
end
|
29
27
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class UpgradeTo140 < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
|
4
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
5
|
-
end
|
3
|
+
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
|
6
4
|
rename_table :cms_uploads, :cms_files
|
7
5
|
add_column :cms_files, :label, :string
|
8
6
|
add_column :cms_files, :description, :string, :limit => 2048
|
@@ -17,17 +15,16 @@ class UpgradeTo140 < ActiveRecord::Migration
|
|
17
15
|
|
18
16
|
create_table :cms_categorizations, :force => true do |t|
|
19
17
|
t.integer :category_id
|
20
|
-
t.string
|
18
|
+
t.string :categorized_type
|
21
19
|
t.integer :categorized_id
|
22
20
|
end
|
23
21
|
add_index :cms_categorizations, [:category_id, :categorized_type, :categorized_id], :unique => true,
|
24
22
|
:name => 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id'
|
23
|
+
ActiveRecord::Base.establish_connection
|
25
24
|
end
|
26
25
|
|
27
26
|
def self.down
|
28
|
-
|
29
|
-
establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
30
|
-
end
|
27
|
+
ComfortableMexicanSofa.establish_connection(ActiveRecord::Base)
|
31
28
|
remove_index :cms_files, [:site_id, :label]
|
32
29
|
remove_column :cms_files, :description
|
33
30
|
remove_column :cms_files, :label
|
@@ -35,5 +32,6 @@ class UpgradeTo140 < ActiveRecord::Migration
|
|
35
32
|
|
36
33
|
drop_table :cms_categories
|
37
34
|
drop_table :cms_categorizations
|
35
|
+
ActiveRecord::Base.establish_connection
|
38
36
|
end
|
39
37
|
end
|
data/doc/preview.png
ADDED
Binary file
|
@@ -50,5 +50,12 @@ module ComfortableMexicanSofa
|
|
50
50
|
Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 1 && Rails.configuration.assets.enabled
|
51
51
|
end
|
52
52
|
|
53
|
+
# Establishing database connection if custom one is defined
|
54
|
+
def establish_connection(klass)
|
55
|
+
if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
|
56
|
+
klass.establish_connection "#{ComfortableMexicanSofa.config.database_config}_#{Rails.env}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
53
60
|
end
|
54
61
|
end
|
@@ -3,11 +3,6 @@ class String
|
|
3
3
|
def idify
|
4
4
|
self.strip.gsub(/\W/, '_').gsub(/\s|^_*|_*$/, '').squeeze('_')
|
5
5
|
end
|
6
|
-
|
7
|
-
# Capitalize all words in the string
|
8
|
-
def capitalize_all(delimiter = ' ')
|
9
|
-
self.split(delimiter).collect{|w| w.capitalize }.join(' ')
|
10
|
-
end
|
11
6
|
end
|
12
7
|
|
13
8
|
module Enumerable
|
@@ -23,7 +23,7 @@ module ComfortableMexicanSofa::ViewMethods
|
|
23
23
|
# Content of a snippet. Example:
|
24
24
|
# cms_snippet_content(:my_snippet)
|
25
25
|
def cms_snippet_content(snippet_slug, cms_site = nil)
|
26
|
-
return '' unless cms_site ||= (@cms_site || Cms::Site.
|
26
|
+
return '' unless cms_site ||= (@cms_site || Cms::Site.find_site(request.host.downcase, request.fullpath))
|
27
27
|
return '' unless snippet = cms_site.snippets.find_by_slug(snippet_slug)
|
28
28
|
render :inline => ComfortableMexicanSofa::Tag.process_content(Cms::Page.new, snippet.content)
|
29
29
|
end
|
@@ -340,7 +340,7 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
340
340
|
assert_equal 0, page_one.position
|
341
341
|
assert_equal 1, page_two.position
|
342
342
|
|
343
|
-
post :reorder, :site_id => cms_sites(:default), :
|
343
|
+
post :reorder, :site_id => cms_sites(:default), :cms_page => [page_two.id, page_one.id]
|
344
344
|
assert_response :success
|
345
345
|
page_one.reload
|
346
346
|
page_two.reload
|
@@ -80,4 +80,30 @@ class CmsSiteTest < ActiveSupport::TestCase
|
|
80
80
|
assert_equal 1, Cms::Site.mirrored.count
|
81
81
|
end
|
82
82
|
|
83
|
+
def test_find_site
|
84
|
+
site_a = cms_sites(:default)
|
85
|
+
assert_equal 'test.host', site_a.hostname
|
86
|
+
assert_equal nil, site_a.path
|
87
|
+
|
88
|
+
assert_equal site_a, Cms::Site.find_site('test.host')
|
89
|
+
assert_equal site_a, Cms::Site.find_site('test.host', '/some/path')
|
90
|
+
assert_equal site_a, Cms::Site.find_site('test99.host', '/some/path')
|
91
|
+
|
92
|
+
site_b = Cms::Site.create!(:hostname => 'test2.host', :path => 'en')
|
93
|
+
site_c = Cms::Site.create!(:hostname => 'test2.host', :path => 'fr')
|
94
|
+
|
95
|
+
assert_equal site_a, Cms::Site.find_site('test.host')
|
96
|
+
assert_equal site_a, Cms::Site.find_site('test.host', '/some/path')
|
97
|
+
assert_equal nil, Cms::Site.find_site('test99.host', '/some/path')
|
98
|
+
|
99
|
+
assert_equal nil, Cms::Site.find_site('test2.host')
|
100
|
+
assert_equal nil, Cms::Site.find_site('test2.host', '/some/path')
|
101
|
+
assert_equal site_b, Cms::Site.find_site('test2.host', '/en')
|
102
|
+
assert_equal site_b, Cms::Site.find_site('test2.host', '/en/some/path')
|
103
|
+
assert_equal nil, Cms::Site.find_site('test2.host', '/english/some/path')
|
104
|
+
|
105
|
+
assert_equal site_c, Cms::Site.find_site('test2.host', '/fr')
|
106
|
+
assert_equal site_c, Cms::Site.find_site('test2.host', '/fr/some/path')
|
107
|
+
end
|
108
|
+
|
83
109
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-09-05 00:00:00.000000000 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
18
|
-
requirement: &
|
18
|
+
requirement: &70169043481960 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 3.0.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70169043481960
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: active_link_to
|
29
|
-
requirement: &
|
29
|
+
requirement: &70169043481480 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 1.0.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70169043481480
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: paperclip
|
40
|
-
requirement: &
|
40
|
+
requirement: &70169043481000 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
version: 2.3.14
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70169043481000
|
49
49
|
description: ''
|
50
50
|
email: oleg@theworkinggroup.ca
|
51
51
|
executables: []
|
@@ -233,7 +233,7 @@ files:
|
|
233
233
|
- db/migrate/upgrades/04_upgrade_to_1_3_0.rb
|
234
234
|
- db/migrate/upgrades/05_upgrade_to_1_4_0.rb
|
235
235
|
- db/seeds.rb
|
236
|
-
- doc/
|
236
|
+
- doc/preview.png
|
237
237
|
- doc/sofa.png
|
238
238
|
- gemfiles/Gemfile.rails-3.0.x
|
239
239
|
- gemfiles/Gemfile.rails-3.1.x
|
@@ -347,7 +347,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
347
347
|
version: '0'
|
348
348
|
segments:
|
349
349
|
- 0
|
350
|
-
hash:
|
350
|
+
hash: -3607967943366637378
|
351
351
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
352
352
|
none: false
|
353
353
|
requirements:
|
data/doc/page_editing.png
DELETED
Binary file
|