Sha256: d65e2dc76497e93d19e512ee3b119885c070caa29f245f09237b6a7a695c848d
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
module Cms module PathHelper def cms_index_path_for(resource, options={}) send("cms_#{resource_collection_name(resource).pluralize}_path", options) end def cms_index_url_for(resource, options={}) send("cms_#{resource_collection_name(resource).pluralize}_url", options) end def cms_new_path_for(resource, options={}) send("new_cms_#{resource_collection_name(resource)}_path", options) end def cms_new_url_for(resource, options={}) send("new_cms_#{resource_collection_name(resource)}_url", options) end def cms_connectable_path(connectable, options={}) if Portlet === connectable cms_portlet_path(connectable) else [:cms, connectable] end end def edit_cms_connectable_path(connectable, options={}) if Portlet === connectable edit_cms_portlet_path(connectable) else [:edit, :cms, connectable] end end private # Returns the name of the collection that this resouce belongs to # the resource can be a ContentType, ActiveRecord::Base instance # or just a string or symbol def resource_collection_name(resource) collection_name = case resource when ContentType then resource.name.underscore when ActiveRecord::Base then resource.class.name.underscore else resource.to_s end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nate-browsercms-3.0.210 | app/helpers/cms/path_helper.rb |
nate-browsercms-3.0.211 | app/helpers/cms/path_helper.rb |