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 +3 -3
- data/Gemfile.lock +2 -2
- data/README.md +116 -101
- data/VERSION +1 -1
- data/comfortable_mexican_sofa.gemspec +13 -6
- data/config/initializers/comfortable_mexican_sofa.rb +2 -1
- data/db/cms_seeds/example.local/layouts/default.yml +8 -0
- data/db/cms_seeds/example.local/layouts/nested.yml +6 -0
- data/db/cms_seeds/example.local/pages/child.yml +10 -0
- data/db/cms_seeds/example.local/pages/child/subchild.yml +14 -0
- data/db/cms_seeds/example.local/pages/index.yml +11 -0
- data/db/cms_seeds/example.local/snippets/example.yml +4 -0
- data/doc/page_editing.png +0 -0
- data/doc/sofa.png +0 -0
- data/lib/generators/README +2 -2
- data/lib/generators/cms_generator.rb +4 -0
- metadata +13 -6
- data/doc/README_FOR_APP +0 -95
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
|
9
|
+
# gem 'sqlite3'
|
10
10
|
|
11
11
|
group :development do
|
12
|
-
gem 'sqlite3
|
12
|
+
gem 'sqlite3'
|
13
13
|
end
|
14
14
|
|
15
15
|
group :test do
|
16
|
-
gem 'sqlite3
|
16
|
+
gem 'sqlite3'
|
17
17
|
gem 'jeweler', '>=1.4.0'
|
18
18
|
end
|
data/Gemfile.lock
CHANGED
@@ -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
|
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
|
86
|
+
sqlite3
|
data/README.md
CHANGED
@@ -1,11 +1,7 @@
|
|
1
|
-
Comfortable Mexican Sofa (
|
2
|
-
|
1
|
+
Comfortable Mexican Sofa (MicroCMS)
|
2
|
+
===================================
|
3
3
|
|
4
|
-
|
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
|
-
|
20
|
+
After finishing installation you should be able to navigate to http://yoursite/cms-admin
|
27
21
|
|
28
|
-
|
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>
|
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
|
-
|
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
|
-
|
43
|
-
|
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:
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
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
|
-
|
106
|
+
# if @cms_page is available (meaning Sofa is doing the rendering)
|
107
|
+
cms_page_content(:page_or_field_label)
|
63
108
|
|
64
|
-
|
65
|
-
|
109
|
+
# anywhere else
|
110
|
+
cms_page_content(:page_or_field_label, CmsPage.find_by_slug(...))
|
66
111
|
|
67
|
-
|
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
|
-
|
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
|
-
|
74
|
-
|
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
|
-
|
82
|
-
|
83
|
-
|
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
|
-
|
86
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
137
|
-
|
138
|
-
|
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
|
-
|
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
|
-
|
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.
|
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.
|
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-
|
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/
|
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
|
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
|
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
|
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,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
|
Binary file
|
data/doc/sofa.png
ADDED
Binary file
|
data/lib/generators/README
CHANGED
@@ -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
|
-
|
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
|
-
-
|
9
|
-
version: 1.0.
|
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-
|
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
|
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/
|
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:
|
387
|
+
hash: -4033881371897976307
|
381
388
|
segments:
|
382
389
|
- 0
|
383
390
|
version: "0"
|
data/doc/README_FOR_APP
DELETED
@@ -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
|