Module: Cms::PathHelper

Included in:
ApplicationController
Defined in:
app/helpers/cms/path_helper.rb

Overview

TODO:

All methods really need to be renamed to match conventions for Engines.

In CMS::Engine, shouldn’t have cms_ in method name. From app, should be cms.xyz_path

Instance Method Summary collapse

Instance Method Details

#cms_connectable_path(connectable, options = {}) ⇒ Object



26
27
28
29
30
31
32
# File 'app/helpers/cms/path_helper.rb', line 26

def cms_connectable_path(connectable, options={})
  if Portlet === connectable
    cms.portlet_path(connectable)
  else
    connectable
  end
end

#cms_index_path_for(resource, options = {}) ⇒ Object



8
9
10
# File 'app/helpers/cms/path_helper.rb', line 8

def cms_index_path_for(resource, options={})
  polymorphic_path(build_path_for(resource), options)
end

#cms_index_url_for(resource, options = {}) ⇒ Object

Deprecated.

Remove all usages of this in favor of cms_index_path_for ()



13
14
15
# File 'app/helpers/cms/path_helper.rb', line 13

def cms_index_url_for(resource, options={})
  send("#{resource_collection_name(resource).underscore.pluralize.gsub('/', '_')}_url", options)
end

#cms_new_path_for(resource, options = {}) ⇒ Object



17
18
19
# File 'app/helpers/cms/path_helper.rb', line 17

def cms_new_path_for(resource, options={})
  new_polymorphic_path(build_path_for(resource), options)
end

#cms_new_url_for(resource, options = {}) ⇒ Object

Deprecated.

Remove all usages of this in favor of cms_new_path_for ()



22
23
24
# File 'app/helpers/cms/path_helper.rb', line 22

def cms_new_url_for(resource, options={})
  send("new_#{resource_collection_name(resource).underscore.gsub('/', '_')}_url", options)
end

#edit_cms_connectable_path(connectable, options = {}) ⇒ Object

TODO:

Really needs to be renamed to match conventions for Engines.

In CMS::Engine, should be edit_connectable_path From app, should be cms.edit_connectable_path



37
38
39
40
41
42
43
# File 'app/helpers/cms/path_helper.rb', line 37

def edit_cms_connectable_path(connectable, options={})
  if Portlet === connectable
    edit_portlet_path(connectable, options)
  else
    polymorphic_path([:edit, connectable], options)
  end
end

#engine_for(resource) ⇒ Object

Returns the Engine Proxy that this resource is from.



46
47
48
49
# File 'app/helpers/cms/path_helper.rb', line 46

def engine_for(resource)
  EngineHelper.decorate(resource)
  send(resource.engine_name)
end

#path_elements_for(resource) ⇒ Object



51
52
53
54
# File 'app/helpers/cms/path_helper.rb', line 51

def path_elements_for(resource)
  EngineHelper.decorate(resource)
  resource.path_elements
end