orbit4-5/lib/orbit_app/helper/side_bar_renderer.rb

42 lines
1.1 KiB
Ruby
Raw Normal View History

module SideBarRenderer
include Renderer
include ActionView::Helpers::TextHelper
def render(request,params,current_module_app)
@belong_module_app = get_module_app
@current_module_app = current_module_app
@request = request
@params = params
content_tag :div, class: "sub-nav-block #{@icon_class}" do
concat content_tag :h4, I18n.t(@head_label)
concat (content_tag :ul, class: "nav nav-list" do
end)
end
end
def render_head(request, params, current_module_app)
@belong_module_app = get_module_app
@current_module_app = current_module_app
@request = request
@params = params
content_tag :li, class: (module_sidebar_active? ? 'active' : nil) do
link_to Rails.application.routes.url_helpers.send(@head_link) do
content_tag :span do
content_tag(:i, nil, class: @icon_class)
end
end
end
end
protected
def module_sidebar_active?
active_for_controller?
end
def active_for_controller?
@active_for_controllers.include? controller
end
end