Sha256: 68f223843f250ce4b00a9ae8bbe63d43b5c3518f32a315b6ea320938ff347d51

Contents?: true

Size: 782 Bytes

Versions: 5

Compression:

Stored size: 782 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # A helper to get the root path for a feature.
  module FeaturePathHelper
    # Returns the defined root path for a given feature.
    #
    # feature - the Feature we want to find the root path for.
    #
    # Returns a url.
    def main_feature_path(feature)
      current_params = try(:params) || {}
      EngineRouter.main_proxy(feature).root_path(locale: current_params[:locale])
    end

    # Returns the defined admin root path for a given feature.
    #
    # feature - the Feature we want to find the root path for.
    #
    # Returns a url.
    def manage_feature_path(feature)
      current_params = try(:params) || {}
      EngineRouter.admin_proxy(feature).root_path(locale: current_params[:locale])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-core-0.8.4 app/helpers/decidim/feature_path_helper.rb
decidim-core-0.8.3 app/helpers/decidim/feature_path_helper.rb
decidim-core-0.8.2 app/helpers/decidim/feature_path_helper.rb
decidim-core-0.8.1 app/helpers/decidim/feature_path_helper.rb
decidim-core-0.8.0 app/helpers/decidim/feature_path_helper.rb