module SideBarRenderer include Renderer include AdminHelper def render(request,params,user,current_module_app) @belong_module_app = get_module_app @current_module_app = current_module_app @request = request @params = params @current_user = user if display? content_tag :li, :class => (module_sidebar_active? ? 'active' : nil) do buf = link_to( content_tag(:i, nil, :class => @icon_class ) + content_tag(:span, I18n.t( @head_label )), eval(@head_link)) buf << content_tag( :ul, :class => ("nav nav-list active") )do # visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')||active_for_ob_auths_object("BulletinCategory")) @context_links.sort_by! {| obj | obj.priority}.collect do |link| link.render(request,params,@current_module_app,@current_user,@belong_module_app) end.join.html_safe end end end end protected def display? #控制sidebar 要不要算圖 if is_manager? || is_admin? #如果是系統管理員 或 是模組管理員 true elsif (@current_module_app.open rescue true) # 如果app 被設定成 開放 true elsif is_member? #如果app 是封閉 那至少需要是 member true else false end end def module_sidebar_active? active_for_controller? or active_for_app_auth? or active_for_ob_auths? end def active_for_controller? @active_for_controllers.include? controller end end