Unstatic plugin

Plugin details

Allows you to define dynamically-editable content areas in your existing templates through a simple helper method.

Repositoryhttp://svn.megablaix.com/plugins/unstatic Author Justin Blake Tags cms, helpers LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://svn.megablaix.com/plugins/unstatic
script/generate unstatic_migration
rake db:migrate



Now add the following to config/routes.rb:

map.resources :unstatic_nodes
map.resources :unstatic_sessions
map.unstatic_login '/unstatic/login', :controller => "unstatic_sessions", :action => "new"
map.unstatic_logout '/unstatic/logout', :controller => "unstatic_sessions", :action => "destroy"



You can run the specs to make sure everything's working (assuming you have rspec set up):

rake spec:plugins:unstatic



===Usage

Put the following anywhere in your views that you'd like to have editable content:

<%= unstatic_content("Name") %>



"Name" should be a descriptive string to identify the content node. E.g. "Sidebar", "Footer", etc. Each string will represent a different unstatic content node. You can use the same string in multiple calls to the helper if you'd like to display and edit the same content in multiple locations.

Normal visits will render content in the database for the "Footer" unstatic node (or nothing if the node hasn't been created). Visits while logged in to unstatic will render the content, as well as a link to create/edit the content.

In order to edit the content, you'll need to log in. Unstatic currently doesn't have an interface for managing passwords, so you'll have to add one through script/console:

script/console
> UnstaticPassword.create(:password => "my_password")



Now log in at:
http://mysite.com/unstatic/login

After logging in, when you visit a page that calls unstatic_content(), you'll see a link to edit.

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | Back in time (4 older versions) | Last edited by: scott, about 1 year ago