Module: Decidim::ComponentPathHelper
- Included in:
 - Events::SimpleEvent
 
- Defined in:
 - app/helpers/decidim/component_path_helper.rb
 
Overview
A helper to get the root path for a component.
Instance Method Summary collapse
- 
  
    
      #can_be_managed?(component)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Returns whether the component can be managed or not by checking if it has an admin engine.
 - 
  
    
      #main_component_path(component)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the defined root path for a given component.
 - 
  
    
      #main_component_url(component)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the defined root url for a given component.
 - 
  
    
      #manage_component_path(component)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the defined admin root path for a given component.
 
Instance Method Details
#can_be_managed?(component) ⇒ Boolean
Returns whether the component can be managed or not by checking if it has an admin engine.
component - the Component we want to find if it is manageable or not.
Returns a boolean matching the question.
      42 43 44  | 
    
      # File 'app/helpers/decidim/component_path_helper.rb', line 42 def can_be_managed?(component) component.manifest.admin_engine.present? end  | 
  
#main_component_path(component) ⇒ Object
Returns the defined root path for a given component.
component - the Component we want to find the root path for.
Returns a relative url.
      11 12 13 14  | 
    
      # File 'app/helpers/decidim/component_path_helper.rb', line 11 def main_component_path(component) current_params = try(:params) || {} EngineRouter.main_proxy(component).root_path(locale: current_params[:locale]) end  | 
  
#main_component_url(component) ⇒ Object
Returns the defined root url for a given component.
component - the Component we want to find the root path for.
Returns an absolute url.
      21 22 23 24  | 
    
      # File 'app/helpers/decidim/component_path_helper.rb', line 21 def main_component_url(component) current_params = try(:params) || {} EngineRouter.main_proxy(component).root_url(locale: current_params[:locale]) end  | 
  
#manage_component_path(component) ⇒ Object
Returns the defined admin root path for a given component.
component - the Component we want to find the root path for.
Returns a relative url.
      31 32 33 34  | 
    
      # File 'app/helpers/decidim/component_path_helper.rb', line 31 def manage_component_path(component) current_params = try(:params) || {} EngineRouter.admin_proxy(component).root_path(locale: current_params[:locale]) end  |