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.
Files changed (144) hide show
  1. data/README.md +8 -18
  2. data/Rakefile +1 -4
  3. data/VERSION +1 -1
  4. data/app/controllers/cms_admin/base_controller.rb +8 -9
  5. data/app/controllers/cms_admin/layouts_controller.rb +5 -5
  6. data/app/controllers/cms_admin/pages_controller.rb +14 -14
  7. data/app/controllers/cms_admin/sites_controller.rb +4 -4
  8. data/app/controllers/cms_admin/snippets_controller.rb +4 -4
  9. data/app/controllers/cms_admin/uploads_controller.rb +2 -2
  10. data/app/controllers/cms_content_controller.rb +21 -8
  11. data/app/models/cms/block.rb +13 -0
  12. data/app/models/{cms_layout.rb → cms/layout.rb} +16 -44
  13. data/app/models/{cms_page.rb → cms/page.rb} +26 -57
  14. data/app/models/{cms_site.rb → cms/site.rb} +8 -6
  15. data/app/models/cms/snippet.rb +36 -0
  16. data/app/models/{cms_upload.rb → cms/upload.rb} +5 -3
  17. data/app/views/cms_admin/layouts/_form.html.erb +2 -2
  18. data/app/views/cms_admin/pages/_form.html.erb +5 -5
  19. data/app/views/cms_admin/pages/_form_blocks.html.erb +3 -3
  20. data/app/views/cms_admin/uploads/_index.html.erb +1 -1
  21. data/app/views/layouts/cms_admin.html.erb +2 -38
  22. data/app/views/layouts/cms_admin/_body.html.erb +17 -0
  23. data/app/views/layouts/cms_admin/_center.html.erb +6 -0
  24. data/app/views/layouts/cms_admin/_head.html.erb +11 -0
  25. data/app/views/layouts/cms_admin/_left.html.erb +7 -0
  26. data/app/views/layouts/cms_admin/_right.html.erb +1 -0
  27. data/comfortable_mexican_sofa.gemspec +94 -96
  28. data/config/environments/development.rb +1 -1
  29. data/config/environments/production.rb +1 -1
  30. data/config/environments/test.rb +1 -1
  31. data/config/initializers/comfortable_mexican_sofa.rb +10 -12
  32. data/db/cms_fixtures/example.com/layouts/default/_default.yml +1 -0
  33. data/db/cms_fixtures/example.com/layouts/default/content.html +5 -0
  34. data/db/cms_fixtures/example.com/layouts/default/css.css +1 -0
  35. data/db/cms_fixtures/example.com/layouts/default/js.js +1 -0
  36. data/db/cms_fixtures/example.com/layouts/default/nested/_nested.yml +1 -0
  37. data/db/cms_fixtures/example.com/layouts/default/nested/content.html +2 -0
  38. data/db/cms_fixtures/example.com/layouts/default/nested/css.css +1 -0
  39. data/db/cms_fixtures/example.com/layouts/default/nested/js.js +1 -0
  40. data/db/cms_fixtures/example.com/pages/index/_index.yml +2 -0
  41. data/db/cms_fixtures/example.com/pages/index/child/_child.yml +2 -0
  42. data/db/cms_fixtures/example.com/pages/index/child/left.html +1 -0
  43. data/db/cms_fixtures/example.com/pages/index/child/right.html +1 -0
  44. data/db/cms_fixtures/example.com/pages/index/content.html +2 -0
  45. data/db/cms_fixtures/example.com/snippets/default/_default.yml +1 -0
  46. data/db/cms_fixtures/example.com/snippets/default/content.html +1 -0
  47. data/db/migrate/01_create_cms.rb +11 -11
  48. data/db/migrate/upgrades/02_upgrade_to_1_1_0.rb +19 -0
  49. data/lib/comfortable_mexican_sofa.rb +6 -13
  50. data/lib/comfortable_mexican_sofa/configuration.rb +21 -20
  51. data/lib/comfortable_mexican_sofa/controller_methods.rb +3 -4
  52. data/lib/comfortable_mexican_sofa/engine.rb +1 -1
  53. data/lib/comfortable_mexican_sofa/fixtures.rb +155 -0
  54. data/lib/comfortable_mexican_sofa/form_builder.rb +7 -15
  55. data/lib/comfortable_mexican_sofa/{cms_tag.rb → tag.rb} +42 -23
  56. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_datetime.rb +4 -5
  57. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_integer.rb +4 -5
  58. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_string.rb +4 -5
  59. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/field_text.rb +4 -5
  60. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/helper.rb +2 -5
  61. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_datetime.rb +4 -5
  62. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_integer.rb +4 -5
  63. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_rich_text.rb +4 -5
  64. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_string.rb +4 -5
  65. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/page_text.rb +4 -5
  66. data/lib/comfortable_mexican_sofa/{cms_tag → tags}/partial.rb +2 -5
  67. data/lib/comfortable_mexican_sofa/tags/snippet.rb +13 -0
  68. data/lib/comfortable_mexican_sofa/view_methods.rb +4 -3
  69. data/lib/generators/cms_generator.rb +1 -1
  70. data/lib/tasks/comfortable_mexican_sofa.rake +12 -272
  71. data/public/javascripts/comfortable_mexican_sofa/cms.js +1 -1
  72. data/test/fixtures/{cms_blocks.yml → cms/blocks.yml} +2 -2
  73. data/test/fixtures/{cms_layouts.yml → cms/layouts.yml} +3 -3
  74. data/test/fixtures/{cms_pages.yml → cms/pages.yml} +4 -4
  75. data/test/fixtures/{cms_sites.yml → cms/sites.yml} +0 -0
  76. data/test/fixtures/{cms_snippets.yml → cms/snippets.yml} +1 -1
  77. data/test/fixtures/{cms_uploads.yml → cms/uploads.yml} +1 -1
  78. data/test/functional/cms_admin/layouts_controller_test.rb +6 -6
  79. data/test/functional/cms_admin/pages_controller_test.rb +64 -64
  80. data/test/functional/cms_admin/sites_controller_test.rb +5 -5
  81. data/test/functional/cms_admin/snippets_controller_test.rb +6 -6
  82. data/test/functional/cms_admin/uploads_controller_test.rb +4 -4
  83. data/test/functional/cms_content_controller_test.rb +27 -11
  84. data/test/integration/fixtures_test.rb +43 -0
  85. data/test/integration/sites_test.rb +23 -13
  86. data/test/test_helper.rb +9 -8
  87. data/test/unit/{cms_configuration_test.rb → configuration_test.rb} +5 -3
  88. data/test/unit/fixtures_test.rb +198 -0
  89. data/test/unit/models/block_test.rb +33 -0
  90. data/test/unit/models/layout_test.rb +129 -0
  91. data/test/unit/models/page_test.rb +199 -0
  92. data/test/unit/models/site_test.rb +41 -0
  93. data/test/unit/models/snippet_test.rb +32 -0
  94. data/test/unit/models/upload_test.rb +32 -0
  95. data/test/unit/{cms_tag_test.rb → tag_test.rb} +61 -44
  96. data/test/unit/tags/field_datetime_test.rb +44 -0
  97. data/test/unit/tags/field_integer_test.rb +43 -0
  98. data/test/unit/tags/field_string_test.rb +46 -0
  99. data/test/unit/tags/field_text_test.rb +42 -0
  100. data/test/unit/{cms_tags → tags}/helper_test.rb +18 -6
  101. data/test/unit/tags/page_datetime_test.rb +44 -0
  102. data/test/unit/tags/page_integer_test.rb +43 -0
  103. data/test/unit/tags/page_rich_text.rb +43 -0
  104. data/test/unit/{cms_tags → tags}/page_string_test.rb +15 -5
  105. data/test/unit/tags/page_text_test.rb +46 -0
  106. data/test/unit/{cms_tags → tags}/partial_test.rb +24 -8
  107. data/test/unit/tags/snippet_test.rb +45 -0
  108. data/test/unit/view_methods_test.rb +2 -2
  109. metadata +95 -121
  110. data/app/models/cms_block.rb +0 -28
  111. data/app/models/cms_snippet.rb +0 -69
  112. data/db/cms_seeds/example.local/layouts/default.yml +0 -8
  113. data/db/cms_seeds/example.local/layouts/nested.yml +0 -6
  114. data/db/cms_seeds/example.local/pages/child.yml +0 -10
  115. data/db/cms_seeds/example.local/pages/child/subchild.yml +0 -14
  116. data/db/cms_seeds/example.local/pages/index.yml +0 -11
  117. data/db/cms_seeds/example.local/snippets/example.yml +0 -4
  118. data/lib/comfortable_mexican_sofa/cms_tag/snippet.rb +0 -18
  119. data/test/cms_seeds/test.host/layouts/broken.yml +0 -1
  120. data/test/cms_seeds/test.host/layouts/default.yml +0 -3
  121. data/test/cms_seeds/test.host/layouts/nested.yml +0 -4
  122. data/test/cms_seeds/test.host/pages/broken.yml +0 -1
  123. data/test/cms_seeds/test.host/pages/child.yml +0 -10
  124. data/test/cms_seeds/test.host/pages/child/subchild.yml +0 -10
  125. data/test/cms_seeds/test.host/pages/index.yml +0 -10
  126. data/test/cms_seeds/test.host/snippets/broken.yml +0 -1
  127. data/test/cms_seeds/test.host/snippets/default.yml +0 -3
  128. data/test/integration/rake_tasks_test.rb +0 -65
  129. data/test/integration/render_cms_seed_test.rb +0 -34
  130. data/test/unit/cms_block_test.rb +0 -43
  131. data/test/unit/cms_layout_test.rb +0 -179
  132. data/test/unit/cms_page_test.rb +0 -257
  133. data/test/unit/cms_site_test.rb +0 -41
  134. data/test/unit/cms_snippet_test.rb +0 -77
  135. data/test/unit/cms_tags/field_datetime_test.rb +0 -34
  136. data/test/unit/cms_tags/field_integer_test.rb +0 -33
  137. data/test/unit/cms_tags/field_string_test.rb +0 -34
  138. data/test/unit/cms_tags/field_text_test.rb +0 -32
  139. data/test/unit/cms_tags/page_datetime_test.rb +0 -34
  140. data/test/unit/cms_tags/page_integer_test.rb +0 -33
  141. data/test/unit/cms_tags/page_rich_text.rb +0 -33
  142. data/test/unit/cms_tags/page_text_test.rb +0 -34
  143. data/test/unit/cms_tags/snippet_test.rb +0 -33
  144. data/test/unit/cms_upload_test.rb +0 -26
@@ -1,18 +1,20 @@
1
- class CmsPage < ActiveRecord::Base
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 :cms_tags
8
+ attr_accessor :tags
7
9
 
8
10
  # -- Relationships --------------------------------------------------------
9
- belongs_to :cms_site
10
- belongs_to :cms_layout
11
+ belongs_to :site
12
+ belongs_to :layout
11
13
  belongs_to :target_page,
12
- :class_name => 'CmsPage'
13
- has_many :cms_blocks,
14
+ :class_name => 'Cms::Page'
15
+ has_many :blocks,
14
16
  :dependent => :destroy
15
- accepts_nested_attributes_for :cms_blocks
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 :cms_site_id,
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 == CmsPage.root || CmsPage.count == 0 }
34
- validates :cms_layout,
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 => :cms_site_id }
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(cms_site, cms_page = nil, current_page = nil, depth = 0, exclude_self = true, spacer = '. . ')
48
- return [] if (current_page ||= cms_site.cms_pages.root) == cms_page && exclude_self || !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 == cms_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(cms_site, cms_page, child, depth + 1, exclude_self, spacer)
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 cms_blocks_attributes
100
- self.cms_blocks.inject([]) do |arr, block|
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.cms_tags = [] # resetting
116
- cms_layout ? CmsTag.process_content(self, cms_layout.merged_content) : ''
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 cms_tags(force_reload = false)
90
+ def tags(force_reload = false)
123
91
  self.content(true) if force_reload
124
- @cms_tags ||= []
92
+ @tags ||= []
125
93
  end
126
94
 
127
95
  # Full url for a page
128
96
  def url
129
- "http://#{self.cms_site.hostname}#{self.full_path}"
97
+ "http://#{self.site.hostname}#{self.full_path}"
130
98
  end
131
99
 
132
100
  protected
133
101
 
134
102
  def assign_parent
135
- self.parent ||= CmsPage.root unless self == CmsPage.root || CmsPage.count == 0
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 CmsSite < ActiveRecord::Base
1
+ class Cms::Site < ActiveRecord::Base
2
+
3
+ set_table_name :cms_sites
2
4
 
3
5
  # -- Relationships --------------------------------------------------------
4
- has_many :cms_layouts, :dependent => :destroy
5
- has_many :cms_pages, :dependent => :destroy
6
- has_many :cms_snippets, :dependent => :destroy
7
- has_many :cms_uploads, :dependent => :destroy
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
- CmsSite.all.collect{|s| ["#{s.label} (#{s.hostname})", s.id]}
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 CmsUpload < ActiveRecord::Base
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 :cms_site
9
+ belongs_to :site
8
10
 
9
11
  # -- Validations ----------------------------------------------------------
10
- validates :cms_site_id, :presence => true
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 = CmsLayout.options_for_select(@cms_site, @cms_layout)).present? %>
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 = CmsLayout.app_layouts_for_select).present? %>
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.cms_pages.count == 0 || @cms_site.cms_pages.root == @cms_page%>
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 = CmsLayout.options_for_select(@cms_site)).present? %>
19
- <%= form.select :cms_layout_id, options, {}, 'data-page-id' => @cms_page.id.to_i, :label => 'Layout' %>
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 = CmsPage.options_for_select(@cms_site, @cms_page)).present? %>
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 = CmsPage.options_for_select(@cms_site, @cms_page, nil, 0, false)).present? %>
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 :cms_blocks, :builder => ComfortableMexicanSofa::FormBuilder do |cms_blocks| %>
3
- <% @cms_page.cms_tags(true).each do |tag| %>
4
- <%= cms_blocks.send(tag.class.name.underscore.downcase.idify, tag)%>
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
- <% CmsUpload.order('file_file_name').all.each do |file| %>
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
- <head>
4
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
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,6 @@
1
+ <% flash.each do |type, message| %>
2
+ <div class='flash <%= type %>'><%= message %></div>
3
+ <% end %>
4
+ <div class='center_column_content'>
5
+ <%= yield %>
6
+ </div>
@@ -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.0.51"
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-04-13}
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/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",
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/cms_seeds/example.local/layouts/default.yml",
81
- "db/cms_seeds/example.local/layouts/nested.yml",
82
- "db/cms_seeds/example.local/pages/child.yml",
83
- "db/cms_seeds/example.local/pages/child/subchild.yml",
84
- "db/cms_seeds/example.local/pages/index.yml",
85
- "db/cms_seeds/example.local/snippets/example.yml",
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/cms_seeds/test.host/layouts/broken.yml",
194
- "test/cms_seeds/test.host/layouts/default.yml",
195
- "test/cms_seeds/test.host/layouts/nested.yml",
196
- "test/cms_seeds/test.host/pages/broken.yml",
197
- "test/cms_seeds/test.host/pages/child.yml",
198
- "test/cms_seeds/test.host/pages/child/subchild.yml",
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/rake_tasks_test.rb",
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/cms_block_test.rb",
226
- "test/unit/cms_configuration_test.rb",
227
- "test/unit/cms_layout_test.rb",
228
- "test/unit/cms_page_test.rb",
229
- "test/unit/cms_site_test.rb",
230
- "test/unit/cms_snippet_test.rb",
231
- "test/unit/cms_tag_test.rb",
232
- "test/unit/cms_tags/field_datetime_test.rb",
233
- "test/unit/cms_tags/field_integer_test.rb",
234
- "test/unit/cms_tags/field_string_test.rb",
235
- "test/unit/cms_tags/field_text_test.rb",
236
- "test/unit/cms_tags/helper_test.rb",
237
- "test/unit/cms_tags/page_datetime_test.rb",
238
- "test/unit/cms_tags/page_integer_test.rb",
239
- "test/unit/cms_tags/page_rich_text.rb",
240
- "test/unit/cms_tags/page_string_test.rb",
241
- "test/unit/cms_tags/page_text_test.rb",
242
- "test/unit/cms_tags/partial_test.rb",
243
- "test/unit/cms_tags/snippet_test.rb",
244
- "test/unit/cms_upload_test.rb",
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 Rails Engine CMS gem}
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/rake_tasks_test.rb",
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/cms_block_test.rb",
266
- "test/unit/cms_configuration_test.rb",
267
- "test/unit/cms_layout_test.rb",
268
- "test/unit/cms_page_test.rb",
269
- "test/unit/cms_site_test.rb",
270
- "test/unit/cms_snippet_test.rb",
271
- "test/unit/cms_tag_test.rb",
272
- "test/unit/cms_tags/field_datetime_test.rb",
273
- "test/unit/cms_tags/field_integer_test.rb",
274
- "test/unit/cms_tags/field_string_test.rb",
275
- "test/unit/cms_tags/field_text_test.rb",
276
- "test/unit/cms_tags/helper_test.rb",
277
- "test/unit/cms_tags/page_datetime_test.rb",
278
- "test/unit/cms_tags/page_integer_test.rb",
279
- "test/unit/cms_tags/page_rich_text.rb",
280
- "test/unit/cms_tags/page_string_test.rb",
281
- "test/unit/cms_tags/page_text_test.rb",
282
- "test/unit/cms_tags/partial_test.rb",
283
- "test/unit/cms_tags/snippet_test.rb",
284
- "test/unit/cms_upload_test.rb",
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