Tag: BrowserCMS

BrowserCMS Gotcha – missing cms/application.js

Posted by – January 14, 2010

I came across an issue today whilst putting together a site using the BrowserCMS content management system for Rails (and if you need a CMS, look no further).

Essentially I was ending up with a situation whereby when I was trying to remove an item from a container I was getting the following error:

No action responded to show. Actions: cms_connectable_path,  cms_index_path_for, 
cms_index_url_for, cms_new_path_for,  cms_new_url_for, cms_toolbar, container, 
container_has_block?, create,  current_page, destroy, edit_cms_connectable_path, 
handle_access_denied,  handle_server_error, move_down, move_to_bottom, 
move_to_top, move_up,  new, page_title, render_breadcrumbs, and render_portlet

After a little digging, I discovered that this is not a rails bug, or a BrowserCMS issue, but a missing Javascript file that needs to be in all of your templates (as well as the cms_toolbar) cms/application.js.  This file attaches all the required js functions to the BCMS buttons, and thus turns the necessary GETs into POSTs etc etc etc.

However, you don’t want this included all the time, but only when you’re logged in as an adminstrator or someone who requires the use of those buttons.  Therefore, the following code is required in each of your templates:

< %= able_to? :edit_content, :publish_content, :administrate do
     javascript_include_tag ["cms/application"], :cache => true
 end %>

This will ensure that everything hooks up as it needs to, and only when it needs to.