comfortable_mexican_sofa 1.0.43 → 1.0.44

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -6,13 +6,13 @@ gem 'paperclip', '>=2.3.8'
6
6
  gem 'mime-types', :require => 'mime/types'
7
7
 
8
8
  # If you wish to use sqlite in production
9
- # gem 'sqlite3-ruby', :require => 'sqlite3'
9
+ # gem 'sqlite3'
10
10
 
11
11
  group :development do
12
- gem 'sqlite3-ruby', :require => 'sqlite3'
12
+ gem 'sqlite3'
13
13
  end
14
14
 
15
15
  group :test do
16
- gem 'sqlite3-ruby', :require => 'sqlite3'
16
+ gem 'sqlite3'
17
17
  gem 'jeweler', '>=1.4.0'
18
18
  end
@@ -68,7 +68,7 @@ GEM
68
68
  rake (>= 0.8.7)
69
69
  thor (~> 0.14.4)
70
70
  rake (0.8.7)
71
- sqlite3-ruby (1.3.2)
71
+ sqlite3 (1.3.3)
72
72
  thor (0.14.6)
73
73
  treetop (1.4.9)
74
74
  polyglot (>= 0.3.1)
@@ -83,4 +83,4 @@ DEPENDENCIES
83
83
  mime-types
84
84
  paperclip (>= 2.3.8)
85
85
  rails (>= 3.0.3)
86
- sqlite3-ruby
86
+ sqlite3
data/README.md CHANGED
@@ -1,11 +1,7 @@
1
- Comfortable Mexican Sofa (CMS)
2
- ==============================
1
+ Comfortable Mexican Sofa (MicroCMS)
2
+ ===================================
3
3
 
4
- What is this?
5
- -------------
6
- ComfortableMexicanSofa is a micro CMS implemented as a Rails 3.* engine. This CMS is not a full-blown application like RadiantCMS. It's more like the ComatoseCMS, only more modern and infinitely more powerful and flexible. ComfortableMexicanSofa can function as a stand-alone installation, but it's designed to be used as an extension to your Rails application. If you have any (static) content that needs to be managed this CMS will handle it.
7
-
8
- This CMS also allows high level of integration. You can easily use page content anywhere within your app, and even use page content as renderable templates from inside your controllers. You may also reuse CMS's admin interface for your own admin backend.
4
+ ComfortableMexicanSofa is a tiny and powerful micro CMS for your Rails 3 application. This CMS is a plugin for your application, not the other way around. Implemented as an Engine so installation is no different than for any other plugin out there.
9
5
 
10
6
  Installation
11
7
  ------------
@@ -19,134 +15,153 @@ Then from the Rails project's root run:
19
15
  rails g cms
20
16
  rake db:migrate
21
17
 
22
- At this point you should have database structure created, some assets copied to /public directory and [initializer](https://github.com/twg/comfortable-mexican-sofa/blob/master/config/initializers/comfortable_mexican_sofa.rb) set up.
23
-
24
18
  Usage
25
19
  -----
26
- Now you should be able to navigate to http://yoursite/cms-admin
20
+ After finishing installation you should be able to navigate to http://yoursite/cms-admin
27
21
 
28
- ### Step 1: Create Layout
29
- Before creating pages and populating them with content we need to create a layout. Layout is the template of your pages. It defines some reusable content (like header and footer, for example) and places where the content goes. A very simple layout can look like this:
22
+ Default username and password is 'username' and 'password'. You probably want to change it right away. Admin credentials (among other things) can be found and changed in the cms initializer: [/config/initializers/comfortable\_mexican\_sofa.rb](https://github.com/twg/comfortable-mexican-sofa/blob/master/config/initializers/comfortable_mexican_sofa.rb)
30
23
 
24
+ Before creating pages and populating them with content we need to create a layout. A layout is the template of your pages; it defines some reusable content (like header and footer, for example) and places where the content goes. A very simple layout can look like this:
25
+
31
26
  <html>
32
27
  <body>
33
- <h1>My Awesome Site</h1>
34
- {{ cms:page:content }}
28
+ <h1>{{ cms:page:header:string }}</h1>
29
+ {{ cms:page:content:text }}
35
30
  </body>
36
31
  </html>
37
-
38
- So there's your layout and the `{{cms:page:content}}` defines a place where renderable `content` will go. There's just a handful of tags that you can use.
39
32
 
40
- Layout may also be linked to the `application layout`. As a result cms page content will end up inside `<%= yeild %>` of your application layout.
33
+ Once you have a layout, you may start creating pages and populating content. It's that easy.
34
+
35
+ ![Sofa's Page Edit View](https://github.com/twg/comfortable-mexican-sofa/raw/master/doc/page_editing.png)
41
36
 
42
- #### Page Blocks
43
- pieces of content that will be output on the page:
37
+ CMS Tags
38
+ --------
39
+ There are a number of cms tags that define where the content goes and how it's populated. **Page** and **Field** tags are used during layout creation. **Snippet**, **Helper** and **Partial** tags can be peppered pretty much anywhere. Tag is structured like so:
40
+
41
+ {{ cms:page:content:text }}
42
+ \ \ \ \
43
+ \ \ \ ‾ tag format or extra attributes
44
+ \ \ ‾‾‾‾‾‾‾ label/slug/path for the tag,
45
+ \ ‾‾‾‾‾‾‾‾‾‾‾‾ tag type (page, field, snippet, helper, partial)
46
+ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ cms tag identifier
47
+
48
+ Here's a number of tag variations:
49
+
50
+ # Page tags are pieces of text content that will get rendered on the page. Format defines how form field
51
+ # gets rendered in the page editing/creation section of the admin area.
52
+
53
+ {{ cms:page:some_label:text }}
54
+ {{ cms:page:some_label }} # shorthand for above. 'text' is default format for pages
55
+ {{ cms:page:some_label:string }} # in admin area text field is displayed instead of textarea
56
+ {{ cms:page:some_label:datetime }} # similarly, datetime widget in the admin area
57
+ {{ cms:page:some_label:integer }} # a number field
58
+ {{ cms:page:some_label:rich_text }} # TinyMCE wysiwyg editor will be used to edit this content
59
+
60
+ # Field tags are pieces of text content that are NOT rendered on the page. They can be accessed via
61
+ # your application's layout / helpers / partials etc. Useful for populating this like <meta> tags.
62
+ # Field formats are exactly the same as for Page tags.
63
+
64
+ {{ cms:field:some_label:string }}
65
+ {{ cms:field:some_label }} # same as above. 'string' is default format for fields
66
+
67
+ # Snippet tags are bits or reusable content that can be used anywhere. Imagine creating content like
68
+ # a sharing widget, or business address that you want to randomly use across your site.
44
69
 
45
- {{ cms:page:some_label:text }} # will render a text area during page creation
46
- # alternatively you may use: {{ cms:page:some_label }}
47
- {{ cms:page:some_label:string }} # will render a text field during page creation
48
- {{ cms:page:some_label:datetime }} # datetime select widget
49
- {{ cms:page:some_label:integer }} # a number field
70
+ {{ cms:snippet:some_label }}
71
+
72
+ # Helper is a wrapper for your regular helpers. Normally you cannot have IRB in CMS content, so there are
73
+ # tags that allow calling helpers and partials.
74
+
75
+ {{ cms:helper:method_name }} # same as <%= method_name() %>
76
+ {{ cms:helper:method_name:x:y:z }} # same as <%= method_name('x', 'y', 'z') %>
77
+
78
+ # Partial tags are wrappers just like above helper ones.
79
+
80
+ {{ cms:partial:path/to/partial }} # same as <%= render :partial => 'path/to/partial' %>
81
+ {{ cms:partial:path/to/partial:a:b }} # same as <%= render :partial => 'path/to/partial',
82
+ # :locals => { :param_1 => 'a', :param_1 => 'b' } %>
83
+
84
+ Multiple Sites
85
+ --------------
86
+ Sofa is able to manage multiple sites from the same application. For instance: 'site-a.example.com' and 'site-b.example.com' will have distinct set of layouts, pages, snippets, etc. To enable multi-site functionality make sure you have this setting in the initializer: `config.auto_manage_sites = false`. When this setting is set to `true`, Sofa assumes there's only one site and will manage hostname associated with it automatically.
87
+
88
+ Integrating CMS with your app
89
+ -----------------------------
90
+ Comfortable Mexican Sofa is a plugin, so it allows you to easily access content it manages. Here's some things you can do.
50
91
 
51
- #### Page Fields
52
- pieces of content that are not rendered. They are useful for hidden values you want to use inside your app. `@cms_page` instance variable is available when you need to access field values.
92
+ You can use your existing application layout. When creating CMS layouts there's an option to use an application layout. Suddenly all CMS pages using that layout will be rendered through <%= yield %> of your application layout.
53
93
 
54
- {{ cms:field:some_label:text }} # text area for the page creation form
55
- {{ cms:field:some_label:string }} # same as {{ cms:field:some_label }}, this is a text field
56
- {{ cms:field:some_label:datetime }} # datetime
57
- {{ cms:field:some_label:integer }} # a number field
94
+ You can use CMS pages as regular views:
95
+
96
+ def show
97
+ @dinosaur = Dinosaur.find(params[:id])
98
+ # CMS page probably should have either helper or partial tag to display @dinosaur details
99
+ render :cms_page => '/dinosaur
100
+ end
101
+
102
+ Actually, you don't need to explicitly render a CMS page like that. Sofa will try to rescue a TemplateNotFound by providing a matching CMS page.
58
103
 
59
- #### Snippets
60
- bits of reusable content that can be used in pages and layouts
104
+ You can access **Page** or **Field** tag content directly from your application (layouts/helpers/partials) via `cms_page_content` method. This is how you can pull things like meta tags into your application layout.
61
105
 
62
- {{ cms:snippet:snippet_slug }}
106
+ # if @cms_page is available (meaning Sofa is doing the rendering)
107
+ cms_page_content(:page_or_field_label)
63
108
 
64
- #### Helpers
65
- are tags that map to your view helpers methods
109
+ # anywhere else
110
+ cms_page_content(:page_or_field_label, CmsPage.find_by_slug(...))
66
111
 
67
- {{ cms:helper:method_name }} # gets translated to <%= method_name( ) %>
68
- {{ cms:helper:method_name:x:y:z }} # gets translated to <%= method_name('x', 'y', 'z') %>
112
+ Similarly you can access **Snippet** content:
69
113
 
70
- #### Partials
71
- are exactly that. You don't want to do IRB inside CMS so there's a handy tag:
114
+ cms_snippet_content(:snippet_slug)
72
115
 
73
- {{ cms:partial:path/to/partial }} # gets translated to <%= render :partial => 'path/to/partial' %>
74
- {{ cms:partial:path/to/partial:x:y }} # gets translated to <%= render :partial => 'path/to/partial',
75
- # :locals => { :param_1 => 'x', :param_2 => 'y'} %>
76
-
77
- ### Step 2: Create Page
78
- Now you're ready to create a page. Based on how you defined your layout, you should have form inputs ready to be populated.
79
- Save a page, and it will be accessible from the public side.
116
+ Extending Admin Area
117
+ --------------------
80
118
 
81
- Integrating CMS with your app
82
- -----------------------------
83
- Unlike most CMS solutions, Sofa is here only to help. Your application is more important. There are few useful ways you can use CMS functionality from your application.
119
+ If you wish, you can re-use Sofa's admin area for things you need to administer in your application. To do this, first you will need to make your admin controllers to inherit from CmsAdmin::BaseController. This way, your admin views will be using Sofa's admin layout and it's basic HttpAuth.
120
+
121
+ class Admin::CategoriesController < CmsAdmin::BaseController
122
+ # your code goes here
123
+ end
124
+
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)
84
126
 
85
- * When CMS renders a page, you automatically have access to `@cms_page` variable.
86
- * CMS can take over the rendering of views for your application. For example, http://your-app.local/books hits books\_controller#index and if you don't have a view setup CMS will try to serve a page with '/books' path. You can even force your controller to render a particular page like this: `render :cms_page => '/books'`
127
+ 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
+
129
+ Do you have other authentication system in place (like Devise, AuthLogic, etc) and wish to use that? For that, you will need to create a module that does the authentication check and make Comfortable Mexican Sofa use it. For example:
130
+
131
+ module CmsDeviseAuth
132
+ def authenticate
133
+ unless current_user && current_user.admin?
134
+ redirect_to new_user_session_path
135
+ end
136
+ end
137
+ end
138
+
139
+ 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.
87
140
 
88
141
  Working with fixtures
89
142
  ---------------------
90
- During development it's often more convenient to work with files that can be source controlled, versus putting content in the database and then manage database dump. Thankfully Sofa makes working with fixtures easy.
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.
91
144
 
92
- ### Setting up Fixtures
93
- First of all you need to set a path where fixture files will be found:
145
+ First, you will need to set a path where fixture files will be found (inside Sofa's initializer):
94
146
 
95
- # in config/initializers/comfortable_mexican_sofa.rb
96
147
  if Rails.env.development? || Rails.env.test?
97
148
  ComfortableMexicanSofa.config.seed_data_path = File.expand_path('db/cms_seeds', Rails.root)
98
149
  end
99
150
 
100
- This is an example of the file/folder structure for fixtures:
101
-
102
- your-site.local/
103
- - layouts/
104
- - default_layout.yml
105
- - pages
106
- - index.yml
107
- - help.yml
108
- - help/
109
- - more_help.yml
110
- - snippets
111
- - random_snippet.yml
112
-
113
- Then it's a matter of populating the content. Few rules to remember:
114
-
115
- - root page is always index.yml
116
- - sections of the page are defined by cms\_block\_attributes
117
- - parent pages are identified by full_path (slug for layouts)
118
- - folder structure reflects tree structure of the site
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.
119
152
 
120
- Example fixture files for a [layout](https://github.com/twg/comfortable-mexican-sofa/blob/master/test/cms_seeds/test.host/layouts/nested.yml), [page](https://github.com/twg/comfortable-mexican-sofa/blob/master/test/cms_seeds/test.host/pages/child/subchild.yml) and [snippet](https://github.com/twg/comfortable-mexican-sofa/blob/master/test/cms_seeds/test.host/snippets/default.yml)
121
-
122
- **Note:** If ComfortableMexicanSofa.config.seed\_data\_path is set no content is loaded from database. Only fixture files are used.
123
-
124
- ### Importing fixtures into database
125
- Now that you have all those fixture files, how do we get them into database? Easy:
126
-
127
- rake comfortable_mexican_sofa:import:all FROM=your-site.local TO=your-site.com SEED_PATH=/path/to/fixtures
153
+ There's a rake task that makes moving fixtures into database (and vice-versa) easy:
128
154
 
129
- PATH is optional if seed\_data\_path configuration option is set.
130
-
131
- ### Exporting database data into fixtures
132
- If you need to pull down database content into fixtures it's done as follows:
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
133
157
 
158
+ # from database to fixtures
134
159
  rake comfortable_mexican_sofa:export:all FROM=your-site.com TO=your-site.local SEED_PATH=/path/to/fixtures
135
160
 
136
- During import/export it will prompt you if there are any files/database entries that are going to be overwritten
137
-
138
- Admin Area Integration
139
- ----------------------
140
- Sofa has a wonderful admin area. Why would you want to make your own layout, styling and so on if you can reuse what CMS has.
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.
141
164
 
142
- You can easily make your controllers use layouts and CMS authentication like this:
165
+ ![Looks pretty comfortable to me. No idea what makes it Mexican.](https://github.com/twg/comfortable-mexican-sofa/raw/master/doc/sofa.png)
143
166
 
144
- class Admin::UsersController < CmsAdmin::BaseController
145
- # ...
146
- end
147
-
148
- To add your own tabs to the admin area you can use hooks:
149
-
150
- # in config/initializers/comfortable_mexican_sofa.rb
151
- ComfortableMexicanSofa::ViewHooks.add(:navigation, '/path/to/view/partial')
152
- ComfortableMexicanSofa::ViewHooks.add(:html_head, '/path/to/view/partial')
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)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.43
1
+ 1.0.44
@@ -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.43"
8
+ s.version = "1.0.44"
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-03}
12
+ s.date = %q{2011-02-07}
13
13
  s.description = %q{}
14
14
  s.email = %q{oleg@theworkinggroup.ca}
15
15
  s.extra_rdoc_files = [
@@ -77,9 +77,16 @@ Gem::Specification.new do |s|
77
77
  "config/initializers/paperclip.rb",
78
78
  "config/locales/en.yml",
79
79
  "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",
80
86
  "db/migrate/01_create_cms.rb",
81
87
  "db/seeds.rb",
82
- "doc/README_FOR_APP",
88
+ "doc/page_editing.png",
89
+ "doc/sofa.png",
83
90
  "lib/comfortable_mexican_sofa.rb",
84
91
  "lib/comfortable_mexican_sofa/acts_as_tree.rb",
85
92
  "lib/comfortable_mexican_sofa/cms_tag.rb",
@@ -287,7 +294,7 @@ Gem::Specification.new do |s|
287
294
  s.add_runtime_dependency(%q<active_link_to>, [">= 0.0.6"])
288
295
  s.add_runtime_dependency(%q<paperclip>, [">= 2.3.8"])
289
296
  s.add_runtime_dependency(%q<mime-types>, [">= 0"])
290
- s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
297
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
291
298
  s.add_runtime_dependency(%q<rails>, [">= 3.0.3"])
292
299
  s.add_runtime_dependency(%q<active_link_to>, [">= 0.0.6"])
293
300
  s.add_runtime_dependency(%q<paperclip>, [">= 2.3.8"])
@@ -296,7 +303,7 @@ Gem::Specification.new do |s|
296
303
  s.add_dependency(%q<active_link_to>, [">= 0.0.6"])
297
304
  s.add_dependency(%q<paperclip>, [">= 2.3.8"])
298
305
  s.add_dependency(%q<mime-types>, [">= 0"])
299
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
306
+ s.add_dependency(%q<sqlite3>, [">= 0"])
300
307
  s.add_dependency(%q<rails>, [">= 3.0.3"])
301
308
  s.add_dependency(%q<active_link_to>, [">= 0.0.6"])
302
309
  s.add_dependency(%q<paperclip>, [">= 2.3.8"])
@@ -306,7 +313,7 @@ Gem::Specification.new do |s|
306
313
  s.add_dependency(%q<active_link_to>, [">= 0.0.6"])
307
314
  s.add_dependency(%q<paperclip>, [">= 2.3.8"])
308
315
  s.add_dependency(%q<mime-types>, [">= 0"])
309
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
316
+ s.add_dependency(%q<sqlite3>, [">= 0"])
310
317
  s.add_dependency(%q<rails>, [">= 3.0.3"])
311
318
  s.add_dependency(%q<active_link_to>, [">= 0.0.6"])
312
319
  s.add_dependency(%q<paperclip>, [">= 2.3.8"])
@@ -15,7 +15,8 @@ ComfortableMexicanSofa.configure do |config|
15
15
  # config.admin_route_redirect = '/cms-admin/pages'
16
16
 
17
17
  # Location of YAML files that can be used to render pages instead of pulling
18
- # data from the database. Not active if not specified.
18
+ # data from the database. Not active if not specified. Containing folder name
19
+ # should be the hostname of the site. Example: my-app.local
19
20
  # config.seed_data_path = File.expand_path('db/cms_seeds', Rails.root)
20
21
 
21
22
  # Let CMS handle site creation and management. Enabled by default.
@@ -0,0 +1,8 @@
1
+ label: Default Layout
2
+ slug: default
3
+ content: |-
4
+ <html>
5
+ <body>
6
+ {{ cms:page:content }}
7
+ </body>
8
+ </html>
@@ -0,0 +1,6 @@
1
+ label: Nested Layout
2
+ slug: nested
3
+ parent: default
4
+ content: |-
5
+ <div class='left'> {{ cms:page:left }} </div>
6
+ <div class='left'> {{ cms:page:right }} </div>
@@ -0,0 +1,10 @@
1
+ label: Child Page
2
+ parent: /
3
+ cms_layout: default
4
+ full_path: /child
5
+ slug: child
6
+ cms_blocks_attributes:
7
+ -
8
+ label: content
9
+ content: |-
10
+ Child Page Content
@@ -0,0 +1,14 @@
1
+ label: Sub-Child Page
2
+ parent: /child
3
+ cms_layout: nested
4
+ full_path: /child/subchild
5
+ slug: subchild
6
+ cms_blocks_attributes:
7
+ -
8
+ label: left
9
+ content: |-
10
+ Sub Child Page Left Content
11
+ -
12
+ label: right
13
+ content: |-
14
+ Sub Child Page Right Content
@@ -0,0 +1,11 @@
1
+ label: Home Page
2
+ parent:
3
+ cms_layout: default
4
+ full_path: /
5
+ slug:
6
+ cms_blocks_attributes:
7
+ -
8
+ label: content
9
+ content: |-
10
+ Home Page Content
11
+ {{ cms:snippet:example }}
@@ -0,0 +1,4 @@
1
+ label: Example Snippet
2
+ slug: example
3
+ content: |-
4
+ Content for Example Snippet
Binary file
Binary file
@@ -13,5 +13,5 @@ Hey! Everything is almost done. Please don't forget to
13
13
 
14
14
  * run migrations -> `rake db:migrate`
15
15
 
16
- After that go to http://your-awesome-app/cms-admin to start
17
- populating content.
16
+ After that go to http://your-awesome-app/cms-admin to start populating content.
17
+ Default username and password are: username // password
@@ -27,6 +27,10 @@ class CmsGenerator < Rails::Generators::Base
27
27
  directory 'public/images/comfortable_mexican_sofa', 'public/images/comfortable_mexican_sofa'
28
28
  end
29
29
 
30
+ def generate_cms_seeds
31
+ directory 'db/cms_seeds', 'db/cms_seeds'
32
+ end
33
+
30
34
  def show_readme
31
35
  readme 'lib/generators/README'
32
36
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 43
9
- version: 1.0.43
8
+ - 44
9
+ version: 1.0.44
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-03 00:00:00 -05:00
18
+ date: 2011-02-07 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -77,7 +77,7 @@ dependencies:
77
77
  prerelease: false
78
78
  version_requirements: *id004
79
79
  - !ruby/object:Gem::Dependency
80
- name: sqlite3-ruby
80
+ name: sqlite3
81
81
  requirement: &id005 !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
@@ -204,9 +204,16 @@ files:
204
204
  - config/initializers/paperclip.rb
205
205
  - config/locales/en.yml
206
206
  - config/routes.rb
207
+ - db/cms_seeds/example.local/layouts/default.yml
208
+ - db/cms_seeds/example.local/layouts/nested.yml
209
+ - db/cms_seeds/example.local/pages/child.yml
210
+ - db/cms_seeds/example.local/pages/child/subchild.yml
211
+ - db/cms_seeds/example.local/pages/index.yml
212
+ - db/cms_seeds/example.local/snippets/example.yml
207
213
  - db/migrate/01_create_cms.rb
208
214
  - db/seeds.rb
209
- - doc/README_FOR_APP
215
+ - doc/page_editing.png
216
+ - doc/sofa.png
210
217
  - lib/comfortable_mexican_sofa.rb
211
218
  - lib/comfortable_mexican_sofa/acts_as_tree.rb
212
219
  - lib/comfortable_mexican_sofa/cms_tag.rb
@@ -377,7 +384,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
377
384
  requirements:
378
385
  - - ">="
379
386
  - !ruby/object:Gem::Version
380
- hash: 3545665435183444768
387
+ hash: -4033881371897976307
381
388
  segments:
382
389
  - 0
383
390
  version: "0"
@@ -1,95 +0,0 @@
1
- :type can be 'string', 'text', ('rich_text', 'datetime')
2
-
3
- < cms:page:default >
4
-
5
- < cms:page:label:type > # page content that gets rendered
6
- < cms:field:label:type > # page content that not rendered, but accessible via @cms_page object
7
- < cms:snippet:label > # snippet content that gets rendered
8
- < cms:partial:path > # interface to Rails partial
9
-
10
- ??? pages need to be aware of tags inside of them
11
-
12
-
13
- MAYBE: allow html escaping based on tag definition
14
-
15
-
16
- Example:
17
- --------
18
- parent layout:
19
-
20
- <cms:field:css/>
21
- <cms:field:meta_keywords/>
22
- <cms:field:google_tracking/>
23
-
24
- <cms:page:header>
25
- <cms:page:content> <- child layout content goes here
26
- <cms:page:footer>
27
-
28
- child layout
29
-
30
- <cms:page:left>
31
- <cms:page:image:file>
32
- <cms:page:right>
33
-
34
- Repeatable partials:
35
- --------------------
36
- Stored as a serialized array data
37
-
38
- <cms:group:person>
39
- <person:name:string/>
40
- <person:bio/>
41
- </cms:group:person>
42
-
43
- -- Person ---
44
- Blah: [ ]
45
- Meh: [ ]
46
- + add more person
47
-
48
- -- Car ---
49
- Something: [ ]
50
- + add more car
51
-
52
-
53
- File Upload Field
54
- -----------------
55
- < cms:page:avatar:file >
56
- !!! this allows uploading of files and attaches them to an Asset system. Content stores ID of the asset.
57
-
58
-
59
- < cms:group:person:face:file > <- this will make many files, how to link???
60
- < cms:group:person:name >
61
-
62
-
63
- STI?? [ merging CmsTag class with CmsPageContent AR class ]
64
- -----------------------------------------------------------
65
-
66
- CmsPageContent <- generic old 'cms_block'
67
- CmsPageStringContent
68
- CmsPageTextContent
69
- CmsPageFileContent ???
70
- CmsGroupContent
71
-
72
- CmsFieldStringContent < CmsPageContent
73
-
74
-
75
- IRB Escaping
76
- ------------
77
- < cms:partial:blsh> -> "<%= render blah %>" <-------- this is OK
78
- <%= blah %> <-------- this is NOT OK
79
-
80
-
81
- Can run irb escaping after pages and snippets are expanded.
82
- Partials are injected later and should not be escaped.
83
-
84
-
85
- Rendering Process
86
- -----------------
87
- Layout
88
- => Form
89
- -> render form, with possible db content
90
- -> save form
91
- => Page
92
- -> get defined tags
93
- -> replace tags with content from db
94
-
95
- Page