comfortable_mexican_sofa 1.0.44 → 1.0.45

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,7 +7,7 @@ Installation
7
7
  ------------
8
8
  Add gem definition to your Gemfile:
9
9
 
10
- config.gem 'comfortable_mexican_sofa'
10
+ gem 'comfortable_mexican_sofa'
11
11
 
12
12
  Then from the Rails project's root run:
13
13
 
@@ -15,6 +15,8 @@ Then from the Rails project's root run:
15
15
  rails g cms
16
16
  rake db:migrate
17
17
 
18
+ When upgrading to a newer version just run `rails g cms` and replace files when prompted. You may also need to run `rake db:migrate` again.
19
+
18
20
  Usage
19
21
  -----
20
22
  After finishing installation you should be able to navigate to http://yoursite/cms-admin
@@ -122,7 +124,7 @@ If you wish, you can re-use Sofa's admin area for things you need to administer
122
124
  # your code goes here
123
125
  end
124
126
 
125
- From your views you can user `cms_form_for` method to re-use Sofa's FormBuilder. There are also some existing styles for tables, will\_paginate helpers, etc. Take a look in [/public/stylesheets/comfortable\_mexican\_sofa/content.css](https://github.com/twg/comfortable-mexican-sofa/blob/master/public/stylesheets/comfortable_mexican_sofa/content.css)
127
+ From your views you can use `cms_form_for` method to re-use Sofa's FormBuilder. There are also some existing styles for tables, will\_paginate helpers, etc. Take a look in [/public/stylesheets/comfortable\_mexican\_sofa/content.css](https://github.com/twg/comfortable-mexican-sofa/blob/master/public/stylesheets/comfortable_mexican_sofa/content.css)
126
128
 
127
129
  You will probably want to add a navigation link on the left side, and for that you will want to use ViewHook functionality. Create a partial that has a link to your admin area and declare in in Sofa's initializer: `ComfortableMexicanSofa::ViewHooks.add(:navigation, '/admin/navigation')`. Similarly you can add extra stylesheets, etc into admin area in the same way.
128
130
 
@@ -138,9 +140,9 @@ Do you have other authentication system in place (like Devise, AuthLogic, etc) a
138
140
 
139
141
  You can put this module in /config/initializers/comfortable\_mexican\_sofa.rb and change authentication method: `config.authentication = 'CmsDeviseAuth'`. Now to access Sofa's admin area users will be authenticated against your existing authentication system.
140
142
 
141
- Working with fixtures
142
- ---------------------
143
- Comfortable Mexican Sofa has fixtures, functionality that helps manage content during development phase. It's very different from Rails seeds as Sofa's fixtures are loaded with each page load. The database is completely bypassed when fixtures are active. This way, you can source-control content before going live, disabling fixtures and dumping everything into the database.
143
+ Working with seeds
144
+ ------------------
145
+ Comfortable Mexican Sofa has seeds, functionality that helps manage content during development phase. It's very different from Rails seeds as Sofa's seeds are loaded with each page load. The database is completely bypassed when seeds are active. This way, you can source-control content before going live, disabling seeds and dumping everything into the database.
144
146
 
145
147
  First, you will need to set a path where fixture files will be found (inside Sofa's initializer):
146
148
 
@@ -148,20 +150,19 @@ First, you will need to set a path where fixture files will be found (inside Sof
148
150
  ComfortableMexicanSofa.config.seed_data_path = File.expand_path('db/cms_seeds', Rails.root)
149
151
  end
150
152
 
151
- If you ran `rails g cms`, you should find an example set of fixtures in /db/cms\_seeds directory. Please note that seeds are nested in the folder that is the hostname of your site. Each file is an YAML representation of a database entry for that layout/page/snippet.
153
+ If you ran `rails g cms`, you should find an example set of seeds in /db/cms\_seeds directory. Please note that seeds are nested in the folder that is the hostname of your site. Each file is an YAML representation of a database entry for that layout/page/snippet.
152
154
 
153
- There's a rake task that makes moving fixtures into database (and vice-versa) easy:
155
+ There's a rake task that makes moving seeds into database (and vice-versa) easy:
154
156
 
155
- # from fixtures into database
156
- rake comfortable_mexican_sofa:import:all FROM=your-site.local TO=your-site.com SEED_PATH=/path/to/fixtures
157
+ # from seeds into database
158
+ rake comfortable_mexican_sofa:import:all FROM=your-site.local TO=your-site.com SEED_PATH=/path/to/seeds
157
159
 
158
- # from database to fixtures
159
- rake comfortable_mexican_sofa:export:all FROM=your-site.com TO=your-site.local SEED_PATH=/path/to/fixtures
160
+ # from database to seeds
161
+ rake comfortable_mexican_sofa:export:all FROM=your-site.com TO=your-site.local SEED_PATH=/path/to/seeds
160
162
 
161
- What else?
162
- ----------
163
- Versioning control will be eventually implemented. Also I'd love to hear ideas how this CMS can be improved. But feel free to just fork and hack away.
164
-
163
+ ---
165
164
  ![Looks pretty comfortable to me. No idea what makes it Mexican.](https://github.com/twg/comfortable-mexican-sofa/raw/master/doc/sofa.png)
166
165
 
167
- ComfortableMexicanSofa is released under the [MIT license](https://github.com/twg/comfortable-mexican-sofa/raw/master/LICENSE) and is copyright 2009-11 Oleg Khabarov, [The Working Group Inc](http://www.twg.ca)
166
+ ComfortableMexicanSofa is released under the [MIT license](https://github.com/twg/comfortable-mexican-sofa/raw/master/LICENSE)
167
+
168
+ Copyright 2009-2011 Oleg Khabarov, [The Working Group Inc](http://www.twg.ca)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.44
1
+ 1.0.45
@@ -86,6 +86,11 @@ class CmsPage < ActiveRecord::Base
86
86
  end
87
87
 
88
88
  # -- Instance Methods -----------------------------------------------------
89
+ # For previewing purposes sometimes we need to have full_path set
90
+ def full_path
91
+ self.read_attribute(:full_path) || self.assign_full_path
92
+ end
93
+
89
94
  # Transforms existing cms_block information into a hash that can be used
90
95
  # during form processing. That's the only way to modify cms_blocks.
91
96
  def cms_blocks_attributes
@@ -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.44"
8
+ s.version = "1.0.45"
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-02-07}
12
+ s.date = %q{2011-02-17}
13
13
  s.description = %q{}
14
14
  s.email = %q{oleg@theworkinggroup.ca}
15
15
  s.extra_rdoc_files = [
@@ -1,7 +1,6 @@
1
1
  module ComfortableMexicanSofa::ControllerMethods
2
2
 
3
3
  def self.included(base)
4
- base.alias_method_chain :render, :cms
5
4
 
6
5
  # If application controller doesn't have template associated with it
7
6
  # CMS will attempt to find one. This is so you don't have to explicitly
@@ -13,29 +12,29 @@ module ComfortableMexicanSofa::ControllerMethods
13
12
  raise e
14
13
  end
15
14
  end
16
- end
17
-
18
- # Now you can render cms_page simply by calling:
19
- # render :cms_page => '/path/to/page'
20
- # This way application controllers can use CMS content while populating
21
- # instance variables that can be used in partials (that are included by
22
- # by the cms page and/or layout)
23
- def render_with_cms(options = {}, locals = {}, &block)
24
- if options.is_a?(Hash) && path = options.delete(:cms_page)
25
- site = CmsSite.find_by_hostname(request.host.downcase)
26
- page = CmsPage.load_from_file(site, path) if site && ComfortableMexicanSofa.configuration.seed_data_path
27
- page ||= site && site.cms_pages.find_by_full_path(path)
28
- if page
29
- cms_app_layout = page.cms_layout.try(:app_layout)
30
- options[:layout] ||= cms_app_layout.blank?? nil : cms_app_layout
31
- options[:inline] = page.content
32
- @cms_page = page
33
- render_without_cms(options, locals, &block)
15
+
16
+ # Now you can render cms_page simply by calling:
17
+ # render :cms_page => '/path/to/page'
18
+ # This way application controllers can use CMS content while populating
19
+ # instance variables that can be used in partials (that are included by
20
+ # by the cms page and/or layout)
21
+ def render(options = {}, locals = {}, &block)
22
+ if options.is_a?(Hash) && path = options.delete(:cms_page)
23
+ site = CmsSite.find_by_hostname(request.host.downcase)
24
+ page = CmsPage.load_from_file(site, path) if site && ComfortableMexicanSofa.configuration.seed_data_path
25
+ page ||= site && site.cms_pages.find_by_full_path(path)
26
+ if page
27
+ cms_app_layout = page.cms_layout.try(:app_layout)
28
+ options[:layout] ||= cms_app_layout.blank?? nil : cms_app_layout
29
+ options[:inline] = page.content
30
+ @cms_page = page
31
+ super(options, locals, &block)
32
+ else
33
+ raise ActionView::MissingTemplate.new([path], path, "CMS page not found", nil)
34
+ end
34
35
  else
35
- raise ActionView::MissingTemplate.new([path], path, "CMS page not found", nil)
36
+ super(options, locals, &block)
36
37
  end
37
- else
38
- render_without_cms(options, locals, &block)
39
38
  end
40
39
  end
41
40
  end
@@ -62,6 +62,9 @@ class CmsPageTest < ActiveSupport::TestCase
62
62
  end
63
63
 
64
64
  def test_initialization_of_full_path
65
+ page = CmsPage.new
66
+ assert_equal '/', page.full_path
67
+
65
68
  page = CmsPage.new(new_params)
66
69
  assert page.invalid?
67
70
  assert_has_errors_on page, :cms_site_id
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 44
9
- version: 1.0.44
8
+ - 45
9
+ version: 1.0.45
10
10
  platform: ruby
11
11
  authors:
12
12
  - Oleg Khabarov
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-07 00:00:00 -05:00
18
+ date: 2011-02-17 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -384,7 +384,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
384
384
  requirements:
385
385
  - - ">="
386
386
  - !ruby/object:Gem::Version
387
- hash: -4033881371897976307
387
+ hash: -53123372768433435
388
388
  segments:
389
389
  - 0
390
390
  version: "0"