Sha256: 1f71ee2c4f6dd1234da3328dc4330627f2cf71cde725cbaaa26407e494b9f8e3

Contents?: true

Size: 1.33 KB

Versions: 57

Compression:

Stored size: 1.33 KB

Contents

module Cmor
  module UserArea
    # Usage:
    #
    #     class ApplicationController < ActionController::Base
    #       view_helper Cmor::UserArea::ApplicationViewHelper, as: :user_area_helper
    #     end
    #
    class ApplicationViewHelper < Rao::ViewHelper::Base
      # Usage:
      #
      #     # app/views/layouts/application.html.erb
      #     <%= user_area_helper(self).render_navigation %>
      #
      def render_navigation(options = {})
        options.reverse_merge!(dropdown: false, bootstrap_version: 4)
        
        bootstrap_version = options.delete(:bootstrap_version)

        send("render_with_bootstrap_#{bootstrap_version}", options)
      end

      private

      def render_with_bootstrap_3(options)
        dropdown = options.delete(:dropdown)
        if dropdown
          c.render partial: "cmor/user_area/navigation_view_helper/bootstrap_3/render_dropdown"
        else
          c.render partial: "cmor/user_area/navigation_view_helper/bootstrap_3/render"
        end
      end

      def render_with_bootstrap_4(options)
        dropdown = options.delete(:dropdown)
        if dropdown
          c.render partial: "cmor/user_area/navigation_view_helper/bootstrap_4/render_dropdown"
        else
          c.render partial: "cmor/user_area/navigation_view_helper/bootstrap_4/render"
        end
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
cmor_user_area-0.0.60.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.59.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.58.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.57.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.56.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.55.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.54.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.53.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.52.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.51.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.50.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.49.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.48.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.45.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.44.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.43.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.42.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.41.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.40.pre app/view_helpers/cmor/user_area/application_view_helper.rb
cmor_user_area-0.0.39.pre app/view_helpers/cmor/user_area/application_view_helper.rb