updatign docs a bit
Oleg
committed Oct 29, 2010
commit 8f41eb69b0dba4fbee5e5f8bf4564c6adfabbab2
Showing 2
changed files with
61 additions
and 25 deletions
README.md
+60
-23
| @@ | @@ -31,7 +31,7 @@ At this point you should have database structure created, some assets copied to |
| config.authentication = 'ComfortableMexicanSofa::HttpAuth' | |
| end | |
| - | # Credentials for CmsHttpAuthentication |
| + | # Credentials for HttpAuth |
| ComfortableMexicanSofa::HttpAuth.username = 'username' | |
| ComfortableMexicanSofa::HttpAuth.password = 'password' | |
| @@ | @@ -49,33 +49,70 @@ Before creating pages and populating them with content we need to create a layou |
| <html> | |
| <body> | |
| <h1>My Awesome Site</h1> | |
| - | <cms:page:content> |
| + | { cms:page:content } |
| </body> | |
| </html> | |
| - | 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. |
| + | 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. |
| - | *Page Blocks* are pieces of content that will be output on the page: |
| - | |
| - | <cms:page:some_label:text> # same as <cms:page:some_label>, will render a text area during page creation |
| - | <cms:page:some_label:string> # will render a text field during page creation |
| - | <cms:page:some_label:datetime> # datetime select widget |
| - | <cms:page:some_label:integer> # a number field |
| - | |
| - | *Page Fields* are pieces of content that are not rendered. They are useful for hidden values you want to use inside your app. |
| - | |
| - | <cms:field:some_label:text> # text area for the page creation form |
| - | <cms:field:some_label:string> # same as <cms:field:some_label>, this is a text field |
| - | <cms:field:some_label:datetime> # datetime |
| - | <cms:field:some_label:integer> # a number field |
| - | |
| - | *Snippets* bits of reusable content that can be used in pages and layouts |
| + | **Page Blocks** are pieces of content that will be output on the page: |
| - | <cms:snippet:snippet_slug> |
| - | |
| - | *Partials* are exactly that. You don't want to do IRB inside CMS so there's a handy tag: |
| - | |
| - | <cms:partial:path/to/partial> |
| + | <dl> |
| + | <dt><em>{ cms:page:some_label:text }</em></dt> |
| + | <dd>alternatively <em>{ cms:page:some_label }</em>, will render a text area during page creation</dd> |
| + | |
| + | <dt><em>{ cms:page:some_label:string }</em></dt> |
| + | <dd>will render a text field during page creation</dd> |
| + | |
| + | <dt><em>{ cms:page:some_label:datetime }</em></dt> |
| + | <dd>datetime select widget</dd> |
| + | |
| + | <dt><em>{ cms:page:some_label:integer }</em></dt> |
| + | <dd>a number field</dd> |
| + | </dl> |
| + | |
| + | **Page Fields** are 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. |
| + | |
| + | <dl> |
| + | <dt><em>{ cms:field:some_label:text }</em></dt> |
| + | <dd>text area for the page creation form</dd> |
| + | |
| + | <dt><em>{ cms:field:some_label:string }</em></dt> |
| + | <dd>same as <em>{ cms:field:some_label }</em>, this is a text field</dd> |
| + | |
| + | <dt><em>{ cms:field:some_label:datetime }</em></dt> |
| + | <dd>datetime</dd> |
| + | |
| + | <dt><em>{ cms:field:some_label:integer }</em></dt> |
| + | <dd>a number field</dd> |
| + | </dl> |
| + | |
| + | **Snippets** bits of reusable content that can be used in pages and layouts |
| + | |
| + | <dl> |
| + | <dt><em>{ cms:snippet:snippet_slug }</em></dt> |
| + | <dd></dd> |
| + | </dl> |
| + | |
| + | **Helpers** are tags that map to your view helpers methods |
| + | |
| + | <dl> |
| + | <dt><em>{ cms:helper:method_name }</em></dt> |
| + | <dd>gets translated to <%= method_name() %></dd> |
| + | |
| + | <dt><em>{ cms:helper:method_name:value_a:value_b }</em></dt> |
| + | <dd>gets translated to <%= method_name('value_a', 'value_b') %></dd> |
| + | </dl> |
| + | |
| + | **Partials** are exactly that. You don't want to do IRB inside CMS so there's a handy tag: |
| + | |
| + | <dl> |
| + | <dt><em>{ cms:partial:path/to/partial }</em></dt> |
| + | <dd>gets translated to <%= render :partial => 'path/to/partial' %></dd> |
| + | |
| + | <dt><em>{ cms:partial:path/to/partial:value_a:value_b }</em></dt> |
| + | <dd>gets translated to <%= render :partial => 'path/to/partial', :locals => { :param_1 => 'value_a', :param_2 => 'value_b'} %></dd> |
| + | </dl> |
| You don't have to define entire html layout, however. You can simply re-use your application one. Page content will be yielded into it like any normal view. | |
config/initializers/comfortable_mexican_sofa.rb
+1
-2
| @@ | @@ -1,10 +1,9 @@ |
| # Comfortable Mexican Sofa initializer. Change defaults to whatever you require | |
| - | |
| ComfortableMexicanSofa.configure do |config| | |
| config.cms_title = 'ComfortableMexicanSofa' | |
| config.authentication = 'ComfortableMexicanSofa::HttpAuth' | |
| end | |
| - | # Credentials for CmsHttpAuthentication |
| + | # Credentials for HttpAuth |
| ComfortableMexicanSofa::HttpAuth.username = 'username' | |
| ComfortableMexicanSofa::HttpAuth.password = 'password' | |
| \ No newline at end of file | |