Created
September 2, 2011 15:57
-
-
Save nelsonenzo/1189000 to your computer and use it in GitHub Desktop.
Refinery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rails generate refinery_engine singular_model_name attribute:type [attribute:type ...] | |
note: to see all the options supported by the refinery_engine generator just run rails g refinery_engine | |
field type description | |
text a multiline visual editor | |
resource a link which pops open a dialog which allows the user to select an existing file or upload a new one | |
image a link which pops open a dialog which allows the user to select an existing image or upload a new one | |
string and integer a standard single line text input | |
example: | |
$ rails generate refinery_engine event title:string date:datetime photo:image blurb:text | |
*note - "event", or whatever, should be singular. | |
then run: | |
$ bundle install | |
$ rails generate refinerycms_events | |
$ rake db:migrate | |
*note: When new engines are added it’s a good idea to restart your server for new changes to be loaded in. | |
You will get a new menu item on the front end. | |
An Admin Panel on the back end | |
index.html.erb, show.html.erb for the front end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Over Riding A View | |
$ rake refinery:override view=pages/show | |
$ Copied view template file to app/views/pages/show.html.erb | |
Now edit app/views/pages/show.html.erb and it will look like this: | |
<%= render :partial => "/shared/content_page" %> | |
Every view in Refinery has an instance variable called @page available. | |
The best way to explain how this works is just to show you. | |
Replace the contents of app/views/pages/show.html.erb with this: | |
<section id='body_content'> | |
<%=raw @page[:body] %> | |
</section> | |
<section id='side_body_content'> | |
<%=raw @page[:side_body] %> | |
</section> | |
The CSS: | |
edit the css directly in application.css | |
When on the home page of your site, Refinery automatically loads an extra stylesheet located in | |
public/stylesheets/home.css as often sites have a different style on the home page. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StarGreetz Server the app is currently on: | |
current app is at: | |
50.18.78.202:3011 | |
#see gist on Screen if you need help stopping server. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment