comfortable_mexican_sofa 1.0.51 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -18
- data/Rakefile +1 -4
- data/VERSION +1 -1
- data/app/controllers/cms_admin/base_controller.rb +8 -9
- data/app/controllers/cms_admin/layouts_controller.rb +5 -5
- data/app/controllers/cms_admin/pages_controller.rb +14 -14
- data/app/controllers/cms_admin/sites_controller.rb +4 -4
- data/app/controllers/cms_admin/snippets_controller.rb +4 -4
- data/app/controllers/cms_admin/uploads_controller.rb +2 -2
- data/app/controllers/cms_content_controller.rb +21 -8
- data/app/models/cms/block.rb +13 -0
- data/app/models/{cms_layout.rb → cms/layout.rb} +16 -44
- data/app/models/{cms_page.rb → cms/page.rb} +26 -57
- data/app/models/{cms_site.rb → cms/site.rb} +8 -6
- data/app/models/cms/snippet.rb +36 -0
- data/app/models/{cms_upload.rb → cms/upload.rb} +5 -3
- data/app/views/cms_admin/layouts/_form.html.erb +2 -2
- data/app/views/cms_admin/pages/_form.html.erb +5 -5
- data/app/views/cms_admin/pages/_form_blocks.html.erb +3 -3
- data/app/views/cms_admin/uploads/_index.html.erb +1 -1
- data/app/views/layouts/cms_admin.html.erb +2 -38
- data/app/views/layouts/cms_admin/_body.html.erb +17 -0
- data/app/views/layouts/cms_admin/_center.html.erb +6 -0
- data/app/views/layouts/cms_admin/_head.html.erb +11 -0
- data/app/views/layouts/cms_admin/_left.html.erb +7 -0
- data/app/views/layouts/cms_admin/_right.html.erb +1 -0
- data/comfortable_mexican_sofa.gemspec +94 -96
- data/config/environments/development.rb +1 -1
- data/config/environments/production.rb +1 -1
- data/config/environments/test.rb +1 -1
- data/config/initializers/comfortable_mexican_sofa.rb +10 -12
- data/db/cms_fixtures/example.com/layouts/default/_default.yml +1 -0
- data/db/cms_fixtures/example.com/layouts/default/content.html +5 -0
- data/db/cms_fixtures/example.com/layouts/default/css.css +1 -0
- data/db/cms_fixtures/example.com/layouts/default/js.js +1 -0
- data/db/cms_fixtures/example.com/layouts/default/nested/_nested.yml +1 -0
- data/db/cms_fixtures/example.com/layouts/default/nested/content.html +2 -0
- data/db/cms_fixtures/example.com/layouts/default/nested/css.css +1 -0
- data/db/cms_fixtures/example.com/layouts/default/nested/js.js +1 -0
- data/db/cms_fixtures/example.com/pages/index/_index.yml +2 -0
- data/db/cms_fixtures/example.com/pages/index/child/_child.yml +2 -0
- data/db/cms_fixtures/example.com/pages/index/child/left.html +1 -0
- data/db/cms_fixtures/example.com/pages/index/child/right.html +1 -0
- data/db/cms_fixtures/example.com/pages/index/content.html +2 -0
- data/db/cms_fixtures/example.com/snippets/default/_default.yml +1 -0
- data/db/cms_fixtures/example.com/snippets/default/content.html +1 -0
- data/db/migrate/01_create_cms.rb +11 -11
- data/db/migrate/upgrades/02_upgrade_to_1_1_0.rb +19 -0
- data/lib/comfortable_mexican_sofa.rb +6 -13
- data/lib/comfortable_mexican_sofa/configuration.rb +21 -20
- data/lib/comfortable_mexican_sofa/controller_methods.rb +3 -4
- data/lib/comfortable_mexican_sofa/engine.rb +1 -1
- data/lib/comfortable_mexican_sofa/fixtures.rb +155 -0
- data/lib/comfortable_mexican_sofa/form_builder.rb +7 -15
- data/lib/comfortable_mexican_sofa/{cms_tag.rb → tag.rb} +42 -23
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_datetime.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_integer.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_string.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_text.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/helper.rb +2 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_datetime.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_integer.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_rich_text.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_string.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_text.rb +4 -5
- data/lib/comfortable_mexican_sofa/{cms_tag → tags}/partial.rb +2 -5
- data/lib/comfortable_mexican_sofa/tags/snippet.rb +13 -0
- data/lib/comfortable_mexican_sofa/view_methods.rb +4 -3
- data/lib/generators/cms_generator.rb +1 -1
- data/lib/tasks/comfortable_mexican_sofa.rake +12 -272
- data/public/javascripts/comfortable_mexican_sofa/cms.js +1 -1
- data/test/fixtures/{cms_blocks.yml → cms/blocks.yml} +2 -2
- data/test/fixtures/{cms_layouts.yml → cms/layouts.yml} +3 -3
- data/test/fixtures/{cms_pages.yml → cms/pages.yml} +4 -4
- data/test/fixtures/{cms_sites.yml → cms/sites.yml} +0 -0
- data/test/fixtures/{cms_snippets.yml → cms/snippets.yml} +1 -1
- data/test/fixtures/{cms_uploads.yml → cms/uploads.yml} +1 -1
- data/test/functional/cms_admin/layouts_controller_test.rb +6 -6
- data/test/functional/cms_admin/pages_controller_test.rb +64 -64
- data/test/functional/cms_admin/sites_controller_test.rb +5 -5
- data/test/functional/cms_admin/snippets_controller_test.rb +6 -6
- data/test/functional/cms_admin/uploads_controller_test.rb +4 -4
- data/test/functional/cms_content_controller_test.rb +27 -11
- data/test/integration/fixtures_test.rb +43 -0
- data/test/integration/sites_test.rb +23 -13
- data/test/test_helper.rb +9 -8
- data/test/unit/{cms_configuration_test.rb → configuration_test.rb} +5 -3
- data/test/unit/fixtures_test.rb +198 -0
- data/test/unit/models/block_test.rb +33 -0
- data/test/unit/models/layout_test.rb +129 -0
- data/test/unit/models/page_test.rb +199 -0
- data/test/unit/models/site_test.rb +41 -0
- data/test/unit/models/snippet_test.rb +32 -0
- data/test/unit/models/upload_test.rb +32 -0
- data/test/unit/{cms_tag_test.rb → tag_test.rb} +61 -44
- data/test/unit/tags/field_datetime_test.rb +44 -0
- data/test/unit/tags/field_integer_test.rb +43 -0
- data/test/unit/tags/field_string_test.rb +46 -0
- data/test/unit/tags/field_text_test.rb +42 -0
- data/test/unit/{cms_tags → tags}/helper_test.rb +18 -6
- data/test/unit/tags/page_datetime_test.rb +44 -0
- data/test/unit/tags/page_integer_test.rb +43 -0
- data/test/unit/tags/page_rich_text.rb +43 -0
- data/test/unit/{cms_tags → tags}/page_string_test.rb +15 -5
- data/test/unit/tags/page_text_test.rb +46 -0
- data/test/unit/{cms_tags → tags}/partial_test.rb +24 -8
- data/test/unit/tags/snippet_test.rb +45 -0
- data/test/unit/view_methods_test.rb +2 -2
- metadata +95 -121
- data/app/models/cms_block.rb +0 -28
- data/app/models/cms_snippet.rb +0 -69
- data/db/cms_seeds/example.local/layouts/default.yml +0 -8
- data/db/cms_seeds/example.local/layouts/nested.yml +0 -6
- data/db/cms_seeds/example.local/pages/child.yml +0 -10
- data/db/cms_seeds/example.local/pages/child/subchild.yml +0 -14
- data/db/cms_seeds/example.local/pages/index.yml +0 -11
- data/db/cms_seeds/example.local/snippets/example.yml +0 -4
- data/lib/comfortable_mexican_sofa/cms_tag/snippet.rb +0 -18
- data/test/cms_seeds/test.host/layouts/broken.yml +0 -1
- data/test/cms_seeds/test.host/layouts/default.yml +0 -3
- data/test/cms_seeds/test.host/layouts/nested.yml +0 -4
- data/test/cms_seeds/test.host/pages/broken.yml +0 -1
- data/test/cms_seeds/test.host/pages/child.yml +0 -10
- data/test/cms_seeds/test.host/pages/child/subchild.yml +0 -10
- data/test/cms_seeds/test.host/pages/index.yml +0 -10
- data/test/cms_seeds/test.host/snippets/broken.yml +0 -1
- data/test/cms_seeds/test.host/snippets/default.yml +0 -3
- data/test/integration/rake_tasks_test.rb +0 -65
- data/test/integration/render_cms_seed_test.rb +0 -34
- data/test/unit/cms_block_test.rb +0 -43
- data/test/unit/cms_layout_test.rb +0 -179
- data/test/unit/cms_page_test.rb +0 -257
- data/test/unit/cms_site_test.rb +0 -41
- data/test/unit/cms_snippet_test.rb +0 -77
- data/test/unit/cms_tags/field_datetime_test.rb +0 -34
- data/test/unit/cms_tags/field_integer_test.rb +0 -33
- data/test/unit/cms_tags/field_string_test.rb +0 -34
- data/test/unit/cms_tags/field_text_test.rb +0 -32
- data/test/unit/cms_tags/page_datetime_test.rb +0 -34
- data/test/unit/cms_tags/page_integer_test.rb +0 -33
- data/test/unit/cms_tags/page_rich_text.rb +0 -33
- data/test/unit/cms_tags/page_text_test.rb +0 -34
- data/test/unit/cms_tags/snippet_test.rb +0 -33
- data/test/unit/cms_upload_test.rb +0 -26
@@ -1,18 +1,20 @@
|
|
1
|
-
class
|
1
|
+
class Cms::Page < ActiveRecord::Base
|
2
|
+
|
3
|
+
set_table_name :cms_pages
|
2
4
|
|
3
5
|
# -- AR Extensions --------------------------------------------------------
|
4
6
|
acts_as_tree :counter_cache => :children_count
|
5
7
|
|
6
|
-
attr_accessor :
|
8
|
+
attr_accessor :tags
|
7
9
|
|
8
10
|
# -- Relationships --------------------------------------------------------
|
9
|
-
belongs_to :
|
10
|
-
belongs_to :
|
11
|
+
belongs_to :site
|
12
|
+
belongs_to :layout
|
11
13
|
belongs_to :target_page,
|
12
|
-
:class_name => '
|
13
|
-
has_many :
|
14
|
+
:class_name => 'Cms::Page'
|
15
|
+
has_many :blocks,
|
14
16
|
:dependent => :destroy
|
15
|
-
accepts_nested_attributes_for :
|
17
|
+
accepts_nested_attributes_for :blocks
|
16
18
|
|
17
19
|
# -- Callbacks ------------------------------------------------------------
|
18
20
|
before_validation :assign_parent,
|
@@ -23,19 +25,19 @@ class CmsPage < ActiveRecord::Base
|
|
23
25
|
after_save :sync_child_pages
|
24
26
|
|
25
27
|
# -- Validations ----------------------------------------------------------
|
26
|
-
validates :
|
28
|
+
validates :site_id,
|
27
29
|
:presence => true
|
28
30
|
validates :label,
|
29
31
|
:presence => true
|
30
32
|
validates :slug,
|
31
33
|
:presence => true,
|
32
34
|
:format => /^\w[a-z0-9_-]*$/i,
|
33
|
-
:unless => lambda{ |p| p ==
|
34
|
-
validates :
|
35
|
+
:unless => lambda{ |p| p == Cms::Page.root || p.site && p.site.pages.count == 0 }
|
36
|
+
validates :layout,
|
35
37
|
:presence => true
|
36
38
|
validates :full_path,
|
37
39
|
:presence => true,
|
38
|
-
:uniqueness => { :scope => :
|
40
|
+
:uniqueness => { :scope => :site_id }
|
39
41
|
validate :validate_target_page
|
40
42
|
|
41
43
|
# -- Scopes ---------------------------------------------------------------
|
@@ -44,50 +46,16 @@ class CmsPage < ActiveRecord::Base
|
|
44
46
|
|
45
47
|
# -- Class Methods --------------------------------------------------------
|
46
48
|
# Tree-like structure for pages
|
47
|
-
def self.options_for_select(
|
48
|
-
return [] if (current_page ||=
|
49
|
+
def self.options_for_select(site, page = nil, current_page = nil, depth = 0, exclude_self = true, spacer = '. . ')
|
50
|
+
return [] if (current_page ||= site.pages.root) == page && exclude_self || !current_page
|
49
51
|
out = []
|
50
|
-
out << [ "#{spacer*depth}#{current_page.label}", current_page.id ] unless current_page ==
|
52
|
+
out << [ "#{spacer*depth}#{current_page.label}", current_page.id ] unless current_page == page
|
51
53
|
current_page.children.each do |child|
|
52
|
-
out += options_for_select(
|
54
|
+
out += options_for_select(site, page, child, depth + 1, exclude_self, spacer)
|
53
55
|
end
|
54
56
|
return out.compact
|
55
57
|
end
|
56
58
|
|
57
|
-
# Attempting to initialize page object from yaml file that is found in config.seed_data_path
|
58
|
-
# This file defines all attributes of the page plus all the block information
|
59
|
-
def self.load_from_file(site, path)
|
60
|
-
return nil if ComfortableMexicanSofa.config.seed_data_path.blank?
|
61
|
-
path = (path == '/')? '/index' : path.to_s.chomp('/')
|
62
|
-
file_path = "#{ComfortableMexicanSofa.config.seed_data_path}/#{site.hostname}/pages#{path}.yml"
|
63
|
-
return nil unless File.exists?(file_path)
|
64
|
-
attributes = YAML.load_file(file_path).symbolize_keys!
|
65
|
-
attributes[:cms_layout] = CmsLayout.load_from_file(site, attributes[:cms_layout])
|
66
|
-
attributes[:parent] = CmsPage.load_from_file(site, attributes[:parent])
|
67
|
-
attributes[:cms_site] = site
|
68
|
-
attributes[:target_page]= CmsPage.load_from_file(site, attributes[:target_page])
|
69
|
-
new(attributes)
|
70
|
-
rescue
|
71
|
-
raise "Failed to load from #{file_path}"
|
72
|
-
end
|
73
|
-
|
74
|
-
# Wrapper around load_from_file and find_by_full_path
|
75
|
-
# returns page object if loaded / found
|
76
|
-
def self.load_for_full_path!(site, path)
|
77
|
-
if ComfortableMexicanSofa.configuration.seed_data_path
|
78
|
-
load_from_file(site, path)
|
79
|
-
else
|
80
|
-
site.cms_pages.find_by_full_path(path)
|
81
|
-
end || raise(ActiveRecord::RecordNotFound, "CmsPage with path: #{path} cannot be found")
|
82
|
-
end
|
83
|
-
|
84
|
-
# Non-blowing-up version of the method above
|
85
|
-
def self.load_for_full_path(site, path)
|
86
|
-
load_for_full_path!(site, path)
|
87
|
-
rescue ActiveRecord::RecordNotFound
|
88
|
-
nil
|
89
|
-
end
|
90
|
-
|
91
59
|
# -- Instance Methods -----------------------------------------------------
|
92
60
|
# For previewing purposes sometimes we need to have full_path set
|
93
61
|
def full_path
|
@@ -96,8 +64,8 @@ class CmsPage < ActiveRecord::Base
|
|
96
64
|
|
97
65
|
# Transforms existing cms_block information into a hash that can be used
|
98
66
|
# during form processing. That's the only way to modify cms_blocks.
|
99
|
-
def
|
100
|
-
self.
|
67
|
+
def blocks_attributes
|
68
|
+
self.blocks.inject([]) do |arr, block|
|
101
69
|
block_attr = {}
|
102
70
|
block_attr[:label] = block.label
|
103
71
|
block_attr[:content] = block.content
|
@@ -112,27 +80,28 @@ class CmsPage < ActiveRecord::Base
|
|
112
80
|
@content = read_attribute(:content)
|
113
81
|
@content = nil if force_reload
|
114
82
|
@content ||= begin
|
115
|
-
self.
|
116
|
-
|
83
|
+
self.tags = [] # resetting
|
84
|
+
layout ? ComfortableMexicanSofa::Tag.process_content(self, layout.merged_content) : ''
|
117
85
|
end
|
118
86
|
end
|
119
87
|
|
120
88
|
# Array of cms_tags for a page. Content generation is called if forced.
|
121
89
|
# These also include initialized cms_blocks if present
|
122
|
-
def
|
90
|
+
def tags(force_reload = false)
|
123
91
|
self.content(true) if force_reload
|
124
|
-
@
|
92
|
+
@tags ||= []
|
125
93
|
end
|
126
94
|
|
127
95
|
# Full url for a page
|
128
96
|
def url
|
129
|
-
"http://#{self.
|
97
|
+
"http://#{self.site.hostname}#{self.full_path}"
|
130
98
|
end
|
131
99
|
|
132
100
|
protected
|
133
101
|
|
134
102
|
def assign_parent
|
135
|
-
|
103
|
+
return unless site
|
104
|
+
self.parent ||= site.pages.root unless self == site.pages.root || site.pages.count == 0
|
136
105
|
end
|
137
106
|
|
138
107
|
def assign_full_path
|
@@ -1,10 +1,12 @@
|
|
1
|
-
class
|
1
|
+
class Cms::Site < ActiveRecord::Base
|
2
|
+
|
3
|
+
set_table_name :cms_sites
|
2
4
|
|
3
5
|
# -- Relationships --------------------------------------------------------
|
4
|
-
has_many :
|
5
|
-
has_many :
|
6
|
-
has_many :
|
7
|
-
has_many :
|
6
|
+
has_many :layouts, :dependent => :destroy
|
7
|
+
has_many :pages, :dependent => :destroy
|
8
|
+
has_many :snippets, :dependent => :destroy
|
9
|
+
has_many :uploads, :dependent => :destroy
|
8
10
|
|
9
11
|
# -- Validations ----------------------------------------------------------
|
10
12
|
validates :label,
|
@@ -17,7 +19,7 @@ class CmsSite < ActiveRecord::Base
|
|
17
19
|
|
18
20
|
# -- Class Methods --------------------------------------------------------
|
19
21
|
def self.options_for_select
|
20
|
-
|
22
|
+
Cms::Site.all.collect{|s| ["#{s.label} (#{s.hostname})", s.id]}
|
21
23
|
end
|
22
24
|
|
23
25
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Cms::Snippet < ActiveRecord::Base
|
2
|
+
|
3
|
+
set_table_name :cms_snippets
|
4
|
+
|
5
|
+
# -- Relationships --------------------------------------------------------
|
6
|
+
belongs_to :site
|
7
|
+
|
8
|
+
# -- Callbacks ------------------------------------------------------------
|
9
|
+
after_save :clear_cached_page_content
|
10
|
+
after_destroy :clear_cached_page_content
|
11
|
+
|
12
|
+
# -- Validations ----------------------------------------------------------
|
13
|
+
validates :site_id,
|
14
|
+
:presence => true
|
15
|
+
validates :label,
|
16
|
+
:presence => true
|
17
|
+
validates :slug,
|
18
|
+
:presence => true,
|
19
|
+
:uniqueness => { :scope => :site_id },
|
20
|
+
:format => { :with => /^\w[a-z0-9_-]*$/i }
|
21
|
+
|
22
|
+
# -- Class Methods --------------------------------------------------------
|
23
|
+
def self.content_for(slug)
|
24
|
+
(s = find_by_slug(slug)) ? s.content : ''
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
# Note: This might be slow. We have no idea where the snippet is used, so
|
30
|
+
# gotta reload every single page. Kinda sucks, but might be ok unless there
|
31
|
+
# are hundreds of pages.
|
32
|
+
def clear_cached_page_content
|
33
|
+
site.pages.all.each{ |page| page.save! }
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -1,13 +1,15 @@
|
|
1
|
-
class
|
1
|
+
class Cms::Upload < ActiveRecord::Base
|
2
|
+
|
3
|
+
set_table_name :cms_uploads
|
2
4
|
|
3
5
|
# -- AR Extensions --------------------------------------------------------
|
4
6
|
has_attached_file :file, ComfortableMexicanSofa.config.upload_file_options
|
5
7
|
|
6
8
|
# -- Relationships --------------------------------------------------------
|
7
|
-
belongs_to :
|
9
|
+
belongs_to :site
|
8
10
|
|
9
11
|
# -- Validations ----------------------------------------------------------
|
10
|
-
validates :
|
12
|
+
validates :site_id, :presence => true
|
11
13
|
validates_attachment_presence :file
|
12
14
|
|
13
15
|
end
|
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
<%= form.text_field :label, :label => 'Layout Name', :id => (@cms_layout.new_record?? 'slugify' : nil)%>
|
6
6
|
<%= form.text_field :slug, :id => 'slug' %>
|
7
|
-
<% if (options =
|
7
|
+
<% if (options = Cms::Layout.options_for_select(@cms_site, @cms_layout)).present? %>
|
8
8
|
<%= form.select :parent_id, [['---- Select Parent Layout ----', nil]] + options %>
|
9
9
|
<% end %>
|
10
|
-
<% if (options =
|
10
|
+
<% if (options = Cms::Layout.app_layouts_for_select).present? %>
|
11
11
|
<%= form.select :app_layout, [['---- Select Application Layout ----', nil]] + options %>
|
12
12
|
<% end %>
|
13
13
|
|
@@ -12,16 +12,16 @@
|
|
12
12
|
<%= form.text_field :label, :id => (@cms_page.new_record?? 'slugify' : nil) %>
|
13
13
|
|
14
14
|
<div class='page_form_extras'>
|
15
|
-
<% unless @cms_site.
|
15
|
+
<% unless @cms_site.pages.count == 0 || @cms_site.pages.root == @cms_page%>
|
16
16
|
<%= form.text_field :slug, :id => 'slug' %>
|
17
17
|
<% end %>
|
18
|
-
<% if (options =
|
19
|
-
<%= form.select :
|
18
|
+
<% if (options = Cms::Layout.options_for_select(@cms_site)).present? %>
|
19
|
+
<%= form.select :layout_id, options, {}, 'data-page-id' => @cms_page.id.to_i, :label => 'Layout' %>
|
20
20
|
<% end %>
|
21
|
-
<% if (options =
|
21
|
+
<% if (options = Cms::Page.options_for_select(@cms_site, @cms_page)).present? %>
|
22
22
|
<%= form.select :parent_id, options %>
|
23
23
|
<% end %>
|
24
|
-
<% if (options =
|
24
|
+
<% if (options = Cms::Page.options_for_select(@cms_site, @cms_page, nil, 0, false)).present? %>
|
25
25
|
<%= form.select :target_page_id, [['---- No Redirect ----', nil]] + options, :label => 'Redirect To Page' %>
|
26
26
|
<% end %>
|
27
27
|
<%= cms_hook :page_form, :object => form %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id='form_blocks'>
|
2
|
-
<%= fields_for :
|
3
|
-
<% @cms_page.
|
4
|
-
<%= cms_blocks.send(tag.class.
|
2
|
+
<%= fields_for :blocks, nil, :builder => ComfortableMexicanSofa::FormBuilder do |cms_blocks| %>
|
3
|
+
<% @cms_page.tags(true).select{|t| t.is_cms_block?}.each do |tag| %>
|
4
|
+
<%= cms_blocks.send(tag.class.to_s.demodulize.underscore, tag)%>
|
5
5
|
<% end %>
|
6
6
|
<% end %>
|
7
7
|
</div>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<a id='uploader_button' href='#' class='big button'>Upload Files</a>
|
4
4
|
</div>
|
5
5
|
<div id='uploaded_files'>
|
6
|
-
<%
|
6
|
+
<% Cms::Upload.order('file_file_name').all.each do |file| %>
|
7
7
|
<%= render :partial => 'cms_admin/uploads/file', :object => file %>
|
8
8
|
<% end %>
|
9
9
|
</div>
|
@@ -1,41 +1,5 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
|
4
|
-
|
5
|
-
<title><%= ComfortableMexicanSofa.config.cms_title %></title>
|
6
|
-
<%= csrf_meta_tag %>
|
7
|
-
<%= stylesheet_link_tag :cms, :cache => ('_cms' if ComfortableMexicanSofa.config.enable_caching) %>
|
8
|
-
<%= javascript_include_tag :cms, :cache => ('_cms' if ComfortableMexicanSofa.config.enable_caching) %>
|
9
|
-
<%= javascript_include_tag :tiny_mce %>
|
10
|
-
<%= yield :head %>
|
11
|
-
<%= cms_hook :html_head %>
|
12
|
-
</head>
|
13
|
-
<body class='c_<%= params[:controller].idify %> a_<%= params[:action].idify %>'>
|
14
|
-
<div class='body_wrapper'>
|
15
|
-
<div class='left_column'>
|
16
|
-
<div class='left_column_content'>
|
17
|
-
<% unless ComfortableMexicanSofa.config.auto_manage_sites %>
|
18
|
-
<%= active_link_to 'Sites', cms_admin_sites_path %>
|
19
|
-
<% end %>
|
20
|
-
<%= active_link_to 'Layouts', cms_admin_layouts_path %>
|
21
|
-
<%= active_link_to 'Pages', cms_admin_pages_path %>
|
22
|
-
<%= active_link_to 'Snippets', cms_admin_snippets_path %>
|
23
|
-
<%= cms_hook :navigation %>
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
<div class='right_column'>
|
27
|
-
<div class='right_column_content'>
|
28
|
-
<%= yield :right_column %>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
<div class='center_column'>
|
32
|
-
<% flash.each do |type, message| %>
|
33
|
-
<div class='flash <%= type %>'><%= message %></div>
|
34
|
-
<% end %>
|
35
|
-
<div class='center_column_content'>
|
36
|
-
<%= yield %>
|
37
|
-
</div>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
</body>
|
3
|
+
<%= render :partial => 'layouts/cms_admin/head' %>
|
4
|
+
<%= render :partial => 'layouts/cms_admin/body' %>
|
41
5
|
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<body class='c_<%= params[:controller].idify %> a_<%= params[:action].idify %>'>
|
2
|
+
<div class='body_wrapper'>
|
3
|
+
<div class='left_column'>
|
4
|
+
<div class='left_column_content'>
|
5
|
+
<%= render :partial => 'layouts/cms_admin/left'%>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
<div class='right_column'>
|
9
|
+
<div class='right_column_content'>
|
10
|
+
<%= render :partial => 'layouts/cms_admin/right'%>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
<div class='center_column'>
|
14
|
+
<%= render :partial => 'layouts/cms_admin/center' %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</body>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<head>
|
2
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
3
|
+
<title><%= ComfortableMexicanSofa.config.cms_title %></title>
|
4
|
+
<%= csrf_meta_tag %>
|
5
|
+
<%= stylesheet_link_tag :cms, :cache => ('_cms' if ComfortableMexicanSofa.config.enable_caching) %>
|
6
|
+
<%= javascript_include_tag :cms, :cache => ('_cms' if ComfortableMexicanSofa.config.enable_caching) %>
|
7
|
+
<%= javascript_include_tag :tiny_mce %>
|
8
|
+
|
9
|
+
<%= yield :head %>
|
10
|
+
<%= cms_hook :html_head %>
|
11
|
+
</head>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<% if ComfortableMexicanSofa.config.enable_multiple_sites %>
|
2
|
+
<%= active_link_to 'Sites', cms_admin_sites_path %>
|
3
|
+
<% end %>
|
4
|
+
<%= active_link_to 'Layouts', cms_admin_layouts_path %>
|
5
|
+
<%= active_link_to 'Pages', cms_admin_pages_path %>
|
6
|
+
<%= active_link_to 'Snippets', cms_admin_snippets_path %>
|
7
|
+
<%= cms_hook :navigation %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield :right_column %>
|
@@ -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.
|
8
|
+
s.version = "1.1.1"
|
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-05-02}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{oleg@theworkinggroup.ca}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -32,12 +32,12 @@ Gem::Specification.new do |s|
|
|
32
32
|
"app/controllers/cms_admin/snippets_controller.rb",
|
33
33
|
"app/controllers/cms_admin/uploads_controller.rb",
|
34
34
|
"app/controllers/cms_content_controller.rb",
|
35
|
-
"app/models/
|
36
|
-
"app/models/
|
37
|
-
"app/models/
|
38
|
-
"app/models/
|
39
|
-
"app/models/
|
40
|
-
"app/models/
|
35
|
+
"app/models/cms/block.rb",
|
36
|
+
"app/models/cms/layout.rb",
|
37
|
+
"app/models/cms/page.rb",
|
38
|
+
"app/models/cms/site.rb",
|
39
|
+
"app/models/cms/snippet.rb",
|
40
|
+
"app/models/cms/upload.rb",
|
41
41
|
"app/views/cms_admin/layouts/_form.html.erb",
|
42
42
|
"app/views/cms_admin/layouts/_index_branch.html.erb",
|
43
43
|
"app/views/cms_admin/layouts/edit.html.erb",
|
@@ -63,6 +63,11 @@ Gem::Specification.new do |s|
|
|
63
63
|
"app/views/cms_admin/uploads/_index.html.erb",
|
64
64
|
"app/views/cms_admin/uploads/destroy.js.erb",
|
65
65
|
"app/views/layouts/cms_admin.html.erb",
|
66
|
+
"app/views/layouts/cms_admin/_body.html.erb",
|
67
|
+
"app/views/layouts/cms_admin/_center.html.erb",
|
68
|
+
"app/views/layouts/cms_admin/_head.html.erb",
|
69
|
+
"app/views/layouts/cms_admin/_left.html.erb",
|
70
|
+
"app/views/layouts/cms_admin/_right.html.erb",
|
66
71
|
"comfortable_mexican_sofa.gemspec",
|
67
72
|
"config.ru",
|
68
73
|
"config/application.rb",
|
@@ -77,37 +82,48 @@ Gem::Specification.new do |s|
|
|
77
82
|
"config/initializers/paperclip.rb",
|
78
83
|
"config/locales/en.yml",
|
79
84
|
"config/routes.rb",
|
80
|
-
"db/
|
81
|
-
"db/
|
82
|
-
"db/
|
83
|
-
"db/
|
84
|
-
"db/
|
85
|
-
"db/
|
85
|
+
"db/cms_fixtures/example.com/layouts/default/_default.yml",
|
86
|
+
"db/cms_fixtures/example.com/layouts/default/content.html",
|
87
|
+
"db/cms_fixtures/example.com/layouts/default/css.css",
|
88
|
+
"db/cms_fixtures/example.com/layouts/default/js.js",
|
89
|
+
"db/cms_fixtures/example.com/layouts/default/nested/_nested.yml",
|
90
|
+
"db/cms_fixtures/example.com/layouts/default/nested/content.html",
|
91
|
+
"db/cms_fixtures/example.com/layouts/default/nested/css.css",
|
92
|
+
"db/cms_fixtures/example.com/layouts/default/nested/js.js",
|
93
|
+
"db/cms_fixtures/example.com/pages/index/_index.yml",
|
94
|
+
"db/cms_fixtures/example.com/pages/index/child/_child.yml",
|
95
|
+
"db/cms_fixtures/example.com/pages/index/child/left.html",
|
96
|
+
"db/cms_fixtures/example.com/pages/index/child/right.html",
|
97
|
+
"db/cms_fixtures/example.com/pages/index/content.html",
|
98
|
+
"db/cms_fixtures/example.com/snippets/default/_default.yml",
|
99
|
+
"db/cms_fixtures/example.com/snippets/default/content.html",
|
86
100
|
"db/migrate/01_create_cms.rb",
|
101
|
+
"db/migrate/upgrades/02_upgrade_to_1_1_0.rb",
|
87
102
|
"db/seeds.rb",
|
88
103
|
"doc/page_editing.png",
|
89
104
|
"doc/sofa.png",
|
90
105
|
"lib/comfortable_mexican_sofa.rb",
|
91
106
|
"lib/comfortable_mexican_sofa/acts_as_tree.rb",
|
92
|
-
"lib/comfortable_mexican_sofa/cms_tag.rb",
|
93
|
-
"lib/comfortable_mexican_sofa/cms_tag/field_datetime.rb",
|
94
|
-
"lib/comfortable_mexican_sofa/cms_tag/field_integer.rb",
|
95
|
-
"lib/comfortable_mexican_sofa/cms_tag/field_string.rb",
|
96
|
-
"lib/comfortable_mexican_sofa/cms_tag/field_text.rb",
|
97
|
-
"lib/comfortable_mexican_sofa/cms_tag/helper.rb",
|
98
|
-
"lib/comfortable_mexican_sofa/cms_tag/page_datetime.rb",
|
99
|
-
"lib/comfortable_mexican_sofa/cms_tag/page_integer.rb",
|
100
|
-
"lib/comfortable_mexican_sofa/cms_tag/page_rich_text.rb",
|
101
|
-
"lib/comfortable_mexican_sofa/cms_tag/page_string.rb",
|
102
|
-
"lib/comfortable_mexican_sofa/cms_tag/page_text.rb",
|
103
|
-
"lib/comfortable_mexican_sofa/cms_tag/partial.rb",
|
104
|
-
"lib/comfortable_mexican_sofa/cms_tag/snippet.rb",
|
105
107
|
"lib/comfortable_mexican_sofa/configuration.rb",
|
106
108
|
"lib/comfortable_mexican_sofa/controller_methods.rb",
|
107
109
|
"lib/comfortable_mexican_sofa/engine.rb",
|
110
|
+
"lib/comfortable_mexican_sofa/fixtures.rb",
|
108
111
|
"lib/comfortable_mexican_sofa/form_builder.rb",
|
109
112
|
"lib/comfortable_mexican_sofa/http_auth.rb",
|
110
113
|
"lib/comfortable_mexican_sofa/rails_extensions.rb",
|
114
|
+
"lib/comfortable_mexican_sofa/tag.rb",
|
115
|
+
"lib/comfortable_mexican_sofa/tags/field_datetime.rb",
|
116
|
+
"lib/comfortable_mexican_sofa/tags/field_integer.rb",
|
117
|
+
"lib/comfortable_mexican_sofa/tags/field_string.rb",
|
118
|
+
"lib/comfortable_mexican_sofa/tags/field_text.rb",
|
119
|
+
"lib/comfortable_mexican_sofa/tags/helper.rb",
|
120
|
+
"lib/comfortable_mexican_sofa/tags/page_datetime.rb",
|
121
|
+
"lib/comfortable_mexican_sofa/tags/page_integer.rb",
|
122
|
+
"lib/comfortable_mexican_sofa/tags/page_rich_text.rb",
|
123
|
+
"lib/comfortable_mexican_sofa/tags/page_string.rb",
|
124
|
+
"lib/comfortable_mexican_sofa/tags/page_text.rb",
|
125
|
+
"lib/comfortable_mexican_sofa/tags/partial.rb",
|
126
|
+
"lib/comfortable_mexican_sofa/tags/snippet.rb",
|
111
127
|
"lib/comfortable_mexican_sofa/view_hooks.rb",
|
112
128
|
"lib/comfortable_mexican_sofa/view_methods.rb",
|
113
129
|
"lib/generators/README",
|
@@ -190,21 +206,12 @@ Gem::Specification.new do |s|
|
|
190
206
|
"public/stylesheets/comfortable_mexican_sofa/structure.css",
|
191
207
|
"public/stylesheets/comfortable_mexican_sofa/typography.css",
|
192
208
|
"script/rails",
|
193
|
-
"test/
|
194
|
-
"test/
|
195
|
-
"test/
|
196
|
-
"test/
|
197
|
-
"test/
|
198
|
-
"test/
|
199
|
-
"test/cms_seeds/test.host/pages/index.yml",
|
200
|
-
"test/cms_seeds/test.host/snippets/broken.yml",
|
201
|
-
"test/cms_seeds/test.host/snippets/default.yml",
|
202
|
-
"test/fixtures/cms_blocks.yml",
|
203
|
-
"test/fixtures/cms_layouts.yml",
|
204
|
-
"test/fixtures/cms_pages.yml",
|
205
|
-
"test/fixtures/cms_sites.yml",
|
206
|
-
"test/fixtures/cms_snippets.yml",
|
207
|
-
"test/fixtures/cms_uploads.yml",
|
209
|
+
"test/fixtures/cms/blocks.yml",
|
210
|
+
"test/fixtures/cms/layouts.yml",
|
211
|
+
"test/fixtures/cms/pages.yml",
|
212
|
+
"test/fixtures/cms/sites.yml",
|
213
|
+
"test/fixtures/cms/snippets.yml",
|
214
|
+
"test/fixtures/cms/uploads.yml",
|
208
215
|
"test/fixtures/files/invalid_file.gif",
|
209
216
|
"test/fixtures/files/valid_image.jpg",
|
210
217
|
"test/fixtures/views/_nav_hook.html.erb",
|
@@ -216,38 +223,38 @@ Gem::Specification.new do |s|
|
|
216
223
|
"test/functional/cms_admin/uploads_controller_test.rb",
|
217
224
|
"test/functional/cms_content_controller_test.rb",
|
218
225
|
"test/integration/authentication_test.rb",
|
219
|
-
"test/integration/
|
220
|
-
"test/integration/render_cms_seed_test.rb",
|
226
|
+
"test/integration/fixtures_test.rb",
|
221
227
|
"test/integration/render_cms_test.rb",
|
222
228
|
"test/integration/sites_test.rb",
|
223
229
|
"test/integration/view_hooks_test.rb",
|
224
230
|
"test/test_helper.rb",
|
225
|
-
"test/unit/
|
226
|
-
"test/unit/
|
227
|
-
"test/unit/
|
228
|
-
"test/unit/
|
229
|
-
"test/unit/
|
230
|
-
"test/unit/
|
231
|
-
"test/unit/
|
232
|
-
"test/unit/
|
233
|
-
"test/unit/
|
234
|
-
"test/unit/
|
235
|
-
"test/unit/
|
236
|
-
"test/unit/
|
237
|
-
"test/unit/
|
238
|
-
"test/unit/
|
239
|
-
"test/unit/
|
240
|
-
"test/unit/
|
241
|
-
"test/unit/
|
242
|
-
"test/unit/
|
243
|
-
"test/unit/
|
244
|
-
"test/unit/
|
231
|
+
"test/unit/configuration_test.rb",
|
232
|
+
"test/unit/fixtures_test.rb",
|
233
|
+
"test/unit/models/block_test.rb",
|
234
|
+
"test/unit/models/layout_test.rb",
|
235
|
+
"test/unit/models/page_test.rb",
|
236
|
+
"test/unit/models/site_test.rb",
|
237
|
+
"test/unit/models/snippet_test.rb",
|
238
|
+
"test/unit/models/upload_test.rb",
|
239
|
+
"test/unit/tag_test.rb",
|
240
|
+
"test/unit/tags/field_datetime_test.rb",
|
241
|
+
"test/unit/tags/field_integer_test.rb",
|
242
|
+
"test/unit/tags/field_string_test.rb",
|
243
|
+
"test/unit/tags/field_text_test.rb",
|
244
|
+
"test/unit/tags/helper_test.rb",
|
245
|
+
"test/unit/tags/page_datetime_test.rb",
|
246
|
+
"test/unit/tags/page_integer_test.rb",
|
247
|
+
"test/unit/tags/page_rich_text.rb",
|
248
|
+
"test/unit/tags/page_string_test.rb",
|
249
|
+
"test/unit/tags/page_text_test.rb",
|
250
|
+
"test/unit/tags/partial_test.rb",
|
251
|
+
"test/unit/tags/snippet_test.rb",
|
245
252
|
"test/unit/view_methods_test.rb"
|
246
253
|
]
|
247
254
|
s.homepage = %q{http://github.com/twg/comfortable-mexican-sofa}
|
248
255
|
s.require_paths = ["lib"]
|
249
256
|
s.rubygems_version = %q{1.7.2}
|
250
|
-
s.summary = %q{ComfortableMexicanSofa is a
|
257
|
+
s.summary = %q{ComfortableMexicanSofa is a powerful micro CMS for Ruby on Rails 3 applications}
|
251
258
|
s.test_files = [
|
252
259
|
"test/functional/cms_admin/layouts_controller_test.rb",
|
253
260
|
"test/functional/cms_admin/pages_controller_test.rb",
|
@@ -256,32 +263,32 @@ Gem::Specification.new do |s|
|
|
256
263
|
"test/functional/cms_admin/uploads_controller_test.rb",
|
257
264
|
"test/functional/cms_content_controller_test.rb",
|
258
265
|
"test/integration/authentication_test.rb",
|
259
|
-
"test/integration/
|
260
|
-
"test/integration/render_cms_seed_test.rb",
|
266
|
+
"test/integration/fixtures_test.rb",
|
261
267
|
"test/integration/render_cms_test.rb",
|
262
268
|
"test/integration/sites_test.rb",
|
263
269
|
"test/integration/view_hooks_test.rb",
|
264
270
|
"test/test_helper.rb",
|
265
|
-
"test/unit/
|
266
|
-
"test/unit/
|
267
|
-
"test/unit/
|
268
|
-
"test/unit/
|
269
|
-
"test/unit/
|
270
|
-
"test/unit/
|
271
|
-
"test/unit/
|
272
|
-
"test/unit/
|
273
|
-
"test/unit/
|
274
|
-
"test/unit/
|
275
|
-
"test/unit/
|
276
|
-
"test/unit/
|
277
|
-
"test/unit/
|
278
|
-
"test/unit/
|
279
|
-
"test/unit/
|
280
|
-
"test/unit/
|
281
|
-
"test/unit/
|
282
|
-
"test/unit/
|
283
|
-
"test/unit/
|
284
|
-
"test/unit/
|
271
|
+
"test/unit/configuration_test.rb",
|
272
|
+
"test/unit/fixtures_test.rb",
|
273
|
+
"test/unit/models/block_test.rb",
|
274
|
+
"test/unit/models/layout_test.rb",
|
275
|
+
"test/unit/models/page_test.rb",
|
276
|
+
"test/unit/models/site_test.rb",
|
277
|
+
"test/unit/models/snippet_test.rb",
|
278
|
+
"test/unit/models/upload_test.rb",
|
279
|
+
"test/unit/tag_test.rb",
|
280
|
+
"test/unit/tags/field_datetime_test.rb",
|
281
|
+
"test/unit/tags/field_integer_test.rb",
|
282
|
+
"test/unit/tags/field_string_test.rb",
|
283
|
+
"test/unit/tags/field_text_test.rb",
|
284
|
+
"test/unit/tags/helper_test.rb",
|
285
|
+
"test/unit/tags/page_datetime_test.rb",
|
286
|
+
"test/unit/tags/page_integer_test.rb",
|
287
|
+
"test/unit/tags/page_rich_text.rb",
|
288
|
+
"test/unit/tags/page_string_test.rb",
|
289
|
+
"test/unit/tags/page_text_test.rb",
|
290
|
+
"test/unit/tags/partial_test.rb",
|
291
|
+
"test/unit/tags/snippet_test.rb",
|
285
292
|
"test/unit/view_methods_test.rb"
|
286
293
|
]
|
287
294
|
|
@@ -294,18 +301,12 @@ Gem::Specification.new do |s|
|
|
294
301
|
s.add_runtime_dependency(%q<paperclip>, [">= 2.3.8"])
|
295
302
|
s.add_runtime_dependency(%q<mime-types>, [">= 0"])
|
296
303
|
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
297
|
-
s.add_runtime_dependency(%q<rails>, [">= 3.0.3"])
|
298
|
-
s.add_runtime_dependency(%q<active_link_to>, [">= 0.0.6"])
|
299
|
-
s.add_runtime_dependency(%q<paperclip>, [">= 2.3.8"])
|
300
304
|
else
|
301
305
|
s.add_dependency(%q<rails>, [">= 3.0.3"])
|
302
306
|
s.add_dependency(%q<active_link_to>, [">= 0.0.6"])
|
303
307
|
s.add_dependency(%q<paperclip>, [">= 2.3.8"])
|
304
308
|
s.add_dependency(%q<mime-types>, [">= 0"])
|
305
309
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
306
|
-
s.add_dependency(%q<rails>, [">= 3.0.3"])
|
307
|
-
s.add_dependency(%q<active_link_to>, [">= 0.0.6"])
|
308
|
-
s.add_dependency(%q<paperclip>, [">= 2.3.8"])
|
309
310
|
end
|
310
311
|
else
|
311
312
|
s.add_dependency(%q<rails>, [">= 3.0.3"])
|
@@ -313,9 +314,6 @@ Gem::Specification.new do |s|
|
|
313
314
|
s.add_dependency(%q<paperclip>, [">= 2.3.8"])
|
314
315
|
s.add_dependency(%q<mime-types>, [">= 0"])
|
315
316
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
316
|
-
s.add_dependency(%q<rails>, [">= 3.0.3"])
|
317
|
-
s.add_dependency(%q<active_link_to>, [">= 0.0.6"])
|
318
|
-
s.add_dependency(%q<paperclip>, [">= 2.3.8"])
|
319
317
|
end
|
320
318
|
end
|
321
319
|
|