Side bar for dashboard

This commit is contained in:
chris 2013-05-02 11:35:48 +08:00
parent 67bb08c338
commit f9fda13879
17 changed files with 262 additions and 550 deletions

View File

@ -0,0 +1,3 @@
/*
*= require lib/dashboards
*/

View File

@ -4,6 +4,8 @@ class Admin::DashboardsController < OrbitBackendController
#before_filter :authenticate_user!, :except => [:index] #before_filter :authenticate_user!, :except => [:index]
# before_filter :is_admin? # before_filter :is_admin?
layout "basic_back_end"
def index def index
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link') @module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link') @recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
@ -28,13 +30,14 @@ class Admin::DashboardsController < OrbitBackendController
a = {} a = {}
args.each do |module_app| args.each do |module_app|
module_app_class = module_app.classify.constantize module_app_class = module_app.classify.constantize
objects = module_app_class.order_by(:updated_at, :desc).limit(10) objects = module_app_class.order_by(:updated_at, :desc).limit(20)
objects.each do |object| objects.each do |object|
a.merge!(object => object.updated_at) unless (object.archived rescue nil) a.merge!(object => object.updated_at) unless (object.archived rescue nil)
end end
end end
sorted_objects = a.sort {|a,b| b[1]<=>a[1]} sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
sorted_objects[0..9] sorted_objects[0..19]
Kaminari.paginate_array(sorted_objects).page(params[:page_recent]).per(5)
end end
def get_most_visited(*args) def get_most_visited(*args)

View File

@ -1,447 +1,5 @@
<% content_for :page_specific_css do -%> <!-- <div id="isotope">
<%= stylesheet_link_tag "item" %>
<% end -%>
<div id="isotope">
<div class="item element">
<h3><i class="icons-book-2"></i><%= t(:content) %></h3>
<div class="detail w-a h-a">
<p class="totle"><span><%= t(:all_content) %></span><%= @module_app_contents_total %></p>
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:module) %></th>
<th class="span2"><%= t(:quantity) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<% @module_app_contents.each do |module_app_content| %>
<tr>
<td><%= link_to t("dashboard.#{module_app_content[0]}"), get_link(module_app_content[0]) %></td>
<td class="span2"><%= module_app_content[1] %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:member) %></a></h3>
<div class="detail w-a h-a">
<p class="totle"><span><%= t(:all_member) %></span>2,217</p>
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:role) %></th>
<th class="span2"><%= t(:quantity) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>University</td>
<td>2,304</td>
</tr>
<tr>
<td>Master</td>
<td>783</td>
</tr>
<tr>
<td>Doctor</td>
<td>45</td>
</tr>
<tr>
<td>Staff</td>
<td>62</td>
</tr>
<tr>
<td>Teacher</td>
<td>52</td>
</tr>
<tr>
<td>Professor</td>
<td>20</td>
</tr>
<tr>
<td>Assistant Professor</td>
<td>41</td>
</tr>
<tr>
<td>Substitute teacher</td>
<td>37</td>
</tr>
<tr>
<td>Lecturer</td>
<td>41</td>
</tr>
<tr>
<td>Part-time teacher</td>
<td>20</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:file_) %></a></a></h3>
<div class="detail w-a h-a">
<p class="totle"><span><%= t(:all_file) %></span>3,422</p>
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:file_type) %></th>
<th class="span2"><%= t(:quantity) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Word</td>
<td>304</td>
</tr>
<tr>
<td>PDF</td>
<td>783</td>
</tr>
<tr>
<td>PowerPoint</td>
<td>45</td>
</tr>
<tr>
<td>Excel</td>
<td>62</td>
</tr>
<tr>
<td>Jpeg</td>
<td>52</td>
</tr>
<tr>
<td>Gif</td>
<td>20</td>
</tr>
<tr>
<td>Png</td>
<td>41</td>
</tr>
<tr>
<td>Avi</td>
<td>37</td>
</tr>
<tr>
<td>Txt</td>
<td>41</td>
</tr>
<tr>
<td>Zip</td>
<td>20</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div> -->
<!-- <div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:referral_in_links) %></a></h3>
<div class="detail w-a h-a">
<p class="totle"><span><%= t(:statistics) %></span>517</p>
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:site_name) %></th>
<th class="span2"><%= t(:statistics) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Ruling</td>
<td class="span2">36</td>
</tr>
<tr>
<td>Yahoo</td>
<td class="span2">31</td>
</tr>
<tr>
<td>Google</td>
<td class="span2">3,187</td>
</tr>
<tr>
<td>facebook</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title5</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title6</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title7</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title8</td>
<td class="span2">公告</td>
</tr>
<tr>
<td>Title9</td>
<td class="span2">頁面</td>
</tr>
<tr>
<td>Title10</td>
<td class="span2">公告</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div> -->
<!-- <div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:most_visited_page) %></a></h3>
<div class="detail noStatistics w-b h-a">
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:title) %></th>
<th class="span2"><%= t(:module) %></th>
<th class="span2"><%= t(:hits) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Title1</td>
<td class="span2">公告</td>
<td class="span2">2,549</td>
</tr>
<tr>
<td>Title2</td>
<td class="span2">頁面</td>
<td class="span2">1,022</td>
</tr>
<tr>
<td>Title3</td>
<td class="span2">頁面</td>
<td class="span2">928</td>
</tr>
<tr>
<td>Title4</td>
<td class="span2">公告</td>
<td class="span2">904</td>
</tr>
<tr>
<td>Title5</td>
<td class="span2">公告</td>
<td class="span2">867</td>
</tr>
<tr>
<td>Title6</td>
<td class="span2">頁面</td>
<td class="span2">830</td>
</tr>
<tr>
<td>Title7</td>
<td class="span2">頁面</td>
<td class="span2">749</td>
</tr>
<tr>
<td>Title8</td>
<td class="span2">公告</td>
<td class="span2">702</td>
</tr>
<tr>
<td>Title9</td>
<td class="span2">頁面</td>
<td class="span2">639</td>
</tr>
<tr>
<td>Title10</td>
<td class="span2">公告</td>
<td class="span2">549</td>
</tr>
<tr>
<td>Title1</td>
<td class="span2">公告</td>
<td class="span2">2,549</td>
</tr>
<tr>
<td>Title2</td>
<td class="span2">頁面</td>
<td class="span2">1,022</td>
</tr>
<tr>
<td>Title3</td>
<td class="span2">頁面</td>
<td class="span2">928</td>
</tr>
<tr>
<td>Title4</td>
<td class="span2">公告</td>
<td class="span2">904</td>
</tr>
<tr>
<td>Title5</td>
<td class="span2">公告</td>
<td class="span2">867</td>
</tr>
<tr>
<td>Title6</td>
<td class="span2">頁面</td>
<td class="span2">830</td>
</tr>
<tr>
<td>Title7</td>
<td class="span2">頁面</td>
<td class="span2">749</td>
</tr>
<tr>
<td>Title8</td>
<td class="span2">公告</td>
<td class="span2">702</td>
</tr>
<tr>
<td>Title9</td>
<td class="span2">頁面</td>
<td class="span2">639</td>
</tr>
<tr>
<td>Title10</td>
<td class="span2">公告</td>
<td class="span2">549</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element">
<h3><i class="icons-"></i><a href=""><%= t(:site_info) %></a></h3>
<div class="detail noStatistics w-b h-a">
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:item) %></th>
<th class="span6"><%= t(:content) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<tr>
<td>Title:</td>
<td class="span6">National Chengchi University</td>
</tr>
<tr>
<td>Description:</td>
<td class="span6">......</td>
</tr>
<tr>
<td>Keywords</td>
<td class="span6">.....</td>
</tr>
<tr>
<td>Online Date:</td>
<td class="span6">2012/04/30</td>
</tr>
<tr>
<td>WedID:</td>
<td class="span6">nccu</td>
</tr>
<tr>
<td>Softwave Version:</td>
<td class="span6">R4 beta</td>
</tr>
<tr>
<td>Warranty:</td>
<td class="span6">Valid</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div> -->
<div class="item element"> <div class="item element">
@ -492,43 +50,6 @@
</div> </div>
</div> </div>
<div class="item element">
<h3><i class="icons-cycle"></i><%= t(:recent_update) %></h3>
<div class="detail noStatistics w-b h-a">
<table class="table table-striped">
<thead>
<tr>
<th><%= t(:title) %></th>
<th class="span2"><%= t(:module) %></th>
</tr>
</thead>
</table>
<div class="detal-list my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<table class="table table-striped">
<tbody>
<% @recent_updated.each do |object| %>
<tr>
<td><%= link_to ((object[0].title rescue nil) || (object[0].page.title rescue nil)), get_link_to_object(object[0]) %></td>
<td class="span2"><%= link_to t("dashboard.#{object[0].class.to_s.underscore}"), get_link(object[0].class.to_s.underscore) %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="item element"> <div class="item element">
<h3><i class="icons-trophy"></i><%= t(:most_visited_page) %></h3> <h3><i class="icons-trophy"></i><%= t(:most_visited_page) %></h3>
<div class="detail noStatistics w-b h-a"> <div class="detail noStatistics w-b h-a">
@ -567,4 +88,146 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div> -->
<section id="main-wrap">
<div class="wrap-inner initial">
<div class="row-fluid">
<div class="box span8">
<div class="box-header">
<h2>
<i class="icons-cycle"></i>
<span class="break"></span>
<%= t(:recent_update) %>
</h2>
</div>
<div class="box-content">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th><%= t(:title) %></th>
<th class="span2"><%= t(:module) %></th>
</tr>
</thead>
<tbody>
<% @recent_updated.each do |object| %>
<tr>
<td><%= link_to ((object[0].title rescue nil) || (object[0].page.title rescue nil)), get_link_to_object(object[0]) %></td>
<td><%= link_to t("dashboard.#{object[0].class.to_s.underscore}"), get_link(object[0].class.to_s.underscore) %></td>
</tr>
<% end %>
</tbody>
</table>
<ul class="pager">
<li><a href="#">Previous</a></li>
<li><a href="#">Next</a></li>
</ul>
</div>
</div>
<div class="box span4">
<div class="box-header">
<h2>
<i class="icons-book-2"></i>
<span class="break"></span>
<%= t(:all_content) %>
</h2>
</div>
<div class="box-content">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th><%= t(:module) %></th>
<th class="span1"><%= t(:quantity) %></th>
</tr>
</thead>
<tbody>
<% @module_app_contents.each do |module_app_content| %>
<tr>
<td><%= link_to t("dashboard.#{module_app_content[0]}"), get_link(module_app_content[0]) %></td>
<td><%= module_app_content[1] %></td>
</tr>
<% end %>
</tbody>
</table>
<ul class="pager">
<li><a href="#">Previous</a></li>
<li><a href="#">Next</a></li>
</ul>
</div>
</div>
</div>
<hr>
<div class="row-fluid">
<div class="box span5">
<div class="box-header">
<h2>
<i class="icons-star"></i>
<span class="break"></span>
Event
</h2>
</div>
<div class="box-content">
<span class="label label-info">23/12/2012</span>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore.</p>
<span class="label label-info">23/02/2012</span>
<p>Lorem ipsum dolor sit amet dolore.</p>
<span class="label label-info">13/02/2012</span>
<p>Lorem ipsum dolor sit amet dolore.</p>
<span class="label label-info">13/02/2012</span>
<p>Lorem ipsum dolor sit amet dolore.</p>
<span class="label label-info">13/02/2012</span>
<p>Lorem ipsum dolor sit amet dolore.</p>
</div>
</div>
<div class="box span7">
<div class="box-header">
<h2>
<i class="icons-trophy"></i>
<span class="break"></span>
Most Visited Page
</h2>
</div>
<div class="box-content">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Module</th>
<th class="span1">Quantity</th>
</tr>
</thead>
<tbody>
<tr>
<td>Page</td>
<td>215</td>
</tr>
<tr>
<td>Announcement</td>
<td>145</td>
</tr>
<tr>
<td>Link</td>
<td>73</td>
</tr>
<tr>
<td>4</td>
<td>31</td>
</tr>
<tr>
<td>5</td>
<td>65</td>
</tr>
</tbody>
</table>
<ul class="pager">
<li><a href="#">Previous</a></li>
<li><a href="#">Next</a></li>
</ul>
</div>
</div>
</div>
</div>
</section>

View File

@ -1,20 +1,9 @@
<div id="main-sidebar" class="my_scroll"> <nav id="sidebar">
<div id="position"> <h2 class="position">
<%= link_to content_tag(:i, nil, :class => (local_assigns.has_key? :icon) ? icon : 'icons-gauge') + content_tag(:span, (local_assigns.has_key? :link_name) ? link_name : t(:dashboard_)), (local_assigns.has_key? :link_url) ? link_url : admin_dashboards_path %> <%= link_to content_tag(:i, nil, :class => (local_assigns.has_key? :icon) ? icon : 'icons-gauge'), (local_assigns.has_key? :link_url) ? link_url : admin_dashboards_path %>
<div id="collapse-menu"><i class="icon-chevron-right"></i><i class="icon-chevron-right"></i></div> </h2>
</div> <div id="sidebar-menu">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<div class="viewport">
<div class="overview">
<ul class="nav nav-list">
<%= render ((local_assigns.has_key? :side_bar_content) ? side_bar_content : 'layouts/side_bar_content') %> <%= render ((local_assigns.has_key? :side_bar_content) ? side_bar_content : 'layouts/side_bar_content') %>
</ul>
</div> </div>
</div> <div class="sub-nav-arrow"></div>
</div> </nav>

View File

@ -1,19 +1,13 @@
<%#= content_tag :li, :class => active_for_controllers('purchases') do -%> <div class="scroller">
<%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> <ul class="sidebar-nav">
<%# end -%> <% OrbitApp::Module::SideBarRegisition.all.each do |t| %>
<% content_for :page_specific_javascript do %> <%= t.render_head(request, params, current_user, @module_app) %>
<%= javascript_include_tag "/static/kernel.js" %> <% end %>
<% end %> </ul>
</div>
<div class="sub-nav-block-list">
<%OrbitApp::Module::SideBarRegisition.all.each do |t| %> <% OrbitApp::Module::SideBarRegisition.all.each do |t| %>
<%= t.render(request,params,current_user,@module_app) %> <%= t.render(request, params, current_user, @module_app) %>
<% end %>
<div class="content">
<% flash.each do |key, msg| %>
<%= content_tag :span, msg, :class => [key, "notice label label-warning"] %>
<% end %> <% end %>
</div> </div>

View File

@ -5,24 +5,21 @@
<%= render 'layouts/meta' %> <%= render 'layouts/meta' %>
<%= render 'layouts/google_font' %> <%= render 'layouts/google_font' %>
<%= stylesheet_link_tag "back_end" %> <%= stylesheet_link_tag "back_end" %>
<%= stylesheet_link_tag params[:controller] rescue nil %> <%= stylesheet_link_tag params[:controller] %>
<%= render 'layouts/ie_html5_fix' %> <%= render 'layouts/ie_html5_fix' %>
<%= javascript_include_tag "back_end" %> <%= javascript_include_tag "back_end" %>
<%= javascript_include_tag params[:controller] rescue nil %> <%= javascript_include_tag params[:controller] %>
<%= yield :page_specific_css %> <%= yield :page_specific_css %>
<%= yield :page_specific_javascript %> <%= yield :page_specific_javascript %>
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
</head> </head>
<body id="dashboards"> <body id="dashboards">
<%= render 'layouts/orbit_bar' unless @no_orbit_bar %> <%= render 'layouts/orbit_bar' unless @no_orbit_bar %>
<%#= render 'layouts/side_bar' unless @no_side_bar %> <% if !(yield :side_bar).blank? %>
<nav id="sidebar"> <%= yield :side_bar %>
<h2 class="position"><a href="#"><i class="icons-gauge"></i></a></h2> <% else %>
<div id="sidebar-menu"> <%= render 'layouts/side_bar' %>
<div class="scroller"> <% end unless @no_side_bar %>
</div>
</div>
</nav>
<section id="main-wrap"> <section id="main-wrap">
<div class="wrap-inner"> <div class="wrap-inner">
<div id="filter" class="topnav clearfix"> <div id="filter" class="topnav clearfix">

View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML>
<html>
<head>
<title><%= @title || APP_CONFIG['orbit'] %></title>
<%= render 'layouts/meta' %>
<%= render 'layouts/google_font' %>
<%= stylesheet_link_tag "basic" %>
<%= stylesheet_link_tag params[:controller] %>
<%= render 'layouts/ie_html5_fix' %>
<%= javascript_include_tag "basic" %>
<%= javascript_include_tag params[:controller] %>
<%= yield :page_specific_css %>
<%= yield :page_specific_javascript %>
<%= csrf_meta_tag %>
</head>
<body id="dashboards">
<%= render 'layouts/orbit_bar' unless @no_orbit_bar %>
<% if !(yield :side_bar).blank? %>
<%= yield :side_bar %>
<% else %>
<%= render 'layouts/side_bar' %>
<% end unless @no_side_bar %>
<%= yield %>
</body>
</html>

View File

@ -8,7 +8,7 @@ module ContextLinkRenderer
@params = params @params = params
@current_user = current_user @current_user = current_user
if display? if display?
content_tag :li, link_to((I18n.t(@label_i18n) + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, eval(@path)), :class => (active? ? 'active' : nil) content_tag :li, link_to(content_tag(:span, I18n.t(@label_i18n)), eval(@path)), :class => (active? ? 'active' : nil)
end end
end end

View File

@ -9,11 +9,15 @@ module Renderer
protected protected
def active_for_app_auth? def active_for_app_auth?
module_app = get_module_app module_app = get_module_app
if controller.eql?('admin/module_apps_new_interface')
if module_app.nil? if module_app.nil?
false false
else else
module_app.id.to_s == @params[:module_app_id] ? true : false module_app.id.to_s == @params[:module_app_id] ? true : false
end end
else
false
end
end end
def active_for_ob_auths? def active_for_ob_auths?
@ -28,6 +32,19 @@ protected
end end
end end
def active_for_tag?
module_app = get_module_app
if controller.eql?('admin/module_tags')
if module_app.nil?
false
else
module_app.id.to_s == @params[:module_app_id] ? true : false
end
else
false
end
end
def current_user def current_user
current_or_guest_user current_or_guest_user
end end

View File

@ -1,6 +1,7 @@
module SideBarRenderer module SideBarRenderer
include Renderer include Renderer
include AdminHelper include AdminHelper
include ActionView::Helpers::TextHelper
def render(request,params,user,current_module_app) def render(request,params,user,current_module_app)
@belong_module_app = get_module_app @belong_module_app = get_module_app
@ -9,12 +10,29 @@ module SideBarRenderer
@params = params @params = params
@current_user = user @current_user = user
if display? if display?
content_tag :li, :class => (module_sidebar_active? ? 'active' : nil) do content_tag :div, class: "sub-nav-block" do
buf = link_to( content_tag(:i, nil, :class => @icon_class ) + content_tag(:span, I18n.t( @head_label )), eval(@head_link)) concat content_tag :h4, I18n.t(@head_label)
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")) concat (content_tag :ul, class: "nav nav-list" do
@context_links.sort_by! {| obj | obj.priority}.collect do |link| @context_links.sort_by {| obj | obj.priority}.map{ |link|
link.render(request,params,@current_module_app,@current_user,@belong_module_app) link.render(request, params, @current_module_app, @current_user, @belong_module_app)
end.join.html_safe }.join.html_safe
end)
end
end
end
def render_head(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
link_to eval(@head_link) do
content_tag :span do
content_tag(:i, nil, class: @icon_class)
end
end end
end end
end end
@ -35,7 +53,7 @@ module SideBarRenderer
end end
def module_sidebar_active? def module_sidebar_active?
active_for_controller? or active_for_app_auth? or active_for_ob_auths? active_for_controller? or active_for_app_auth? or active_for_ob_auths? or active_for_tag?
end end
def active_for_controller? def active_for_controller?

View File

@ -48,6 +48,7 @@ module OrbitApp
@active_for_controllers = [] @active_for_controllers = []
@active_for_object_auth = [] @active_for_object_auth = []
@active_for_app_auth = [] @active_for_app_auth = []
@active_for_tag = []
@head_link = "" @head_link = ""
@app_base_path = '' @app_base_path = ''
@module_app_key = key @module_app_key = key
@ -147,6 +148,7 @@ module OrbitApp
@active_for_action = options[:active_for_action] || [] @active_for_action = options[:active_for_action] || []
@active_for_object_auth = options[:active_for_object_auth] || [] @active_for_object_auth = options[:active_for_object_auth] || []
@active_for_app_auth = options[:active_for_app_auth] || [] @active_for_app_auth = options[:active_for_app_auth] || []
@active_for_tag = options[:active_for_tag] || []
@module_app_key = options[:module_app_key] @module_app_key = options[:module_app_key]
@get_module_app = options[:get_module_app] @get_module_app = options[:get_module_app]
end end
@ -177,7 +179,8 @@ module OrbitApp
for_action = @active_for_action.blank? ? false : active_for_action? for_action = @active_for_action.blank? ? false : active_for_action?
for_app_auth = @active_for_app_auth.blank? ? false : active_for_app_auth? for_app_auth = @active_for_app_auth.blank? ? false : active_for_app_auth?
for_ob_auth = @active_for_object_auth.blank? ? false : active_for_ob_auths? for_ob_auth = @active_for_object_auth.blank? ? false : active_for_ob_auths?
for_action || for_app_auth || for_ob_auth for_tag = @active_for_tag.blank? ? false : active_for_tag?
for_action || for_app_auth || for_ob_auth || for_tag
end end
def active_for_action? def active_for_action?

View File

@ -48,7 +48,7 @@ module Announcement
side_bar do side_bar do
head_label_i18n 'announcement.announcement',:icon_class=>"icons-megaphone" head_label_i18n 'announcement.announcement',:icon_class=>"icons-megaphone"
available_for [:admin,:guest,:manager,:sub_manager] available_for [:admin,:guest,:manager,:sub_manager]
active_for_controllers ({:private=>['bulletins', 'bulletin_categorys', 'approvals','tags']}) active_for_controllers ({:private=>['bulletins', 'bulletin_categorys', 'approvals','module_tags']})
active_for_object_auth ['BulletinCategory'] active_for_object_auth ['BulletinCategory']
head_link_path "panel_announcement_back_end_bulletins_path" head_link_path "panel_announcement_back_end_bulletins_path"
@ -74,7 +74,7 @@ module Announcement
context_link 'tags', context_link 'tags',
:link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Announcement'}))" , :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Announcement'}))" ,
:priority=>4, :priority=>4,
# :active_for_action=>{:bulletin_categorys=>:index}, :active_for_tag => 'Announcement',
:available_for => [:manager] :available_for => [:manager]

View File

@ -70,7 +70,7 @@ module Archive
context_link 'tags', context_link 'tags',
:link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Archive'}))" , :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Archive'}))" ,
:priority=>4, :priority=>4,
# :active_for_action=>{:bulletin_categorys=>:index}, :active_for_tag => 'Archive',
:available_for => [:admin] :available_for => [:admin]
end end

View File

@ -29,7 +29,7 @@ module Calendar
context_link 'tags', context_link 'tags',
:link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Calendar'}))" , :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Calendar'}))" ,
:priority=>4, :priority=>4,
# :active_for_action=>{:bulletin_categorys=>:index}, :active_for_tag => 'Calendar',
:available_for => [:manager] :available_for => [:manager]
end end
end end

View File

@ -68,7 +68,7 @@ module Faq
context_link 'tags', context_link 'tags',
:link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Faq'}))" , :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Faq'}))" ,
:priority=>4, :priority=>4,
# :active_for_action=>{:bulletin_categorys=>:index}, :active_for_tag => 'Faq',
:available_for => [:manager] :available_for => [:manager]
end end
end end

View File

@ -59,7 +59,7 @@ module Gallery
context_link 'tags', context_link 'tags',
:link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Gallery'}))" , :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Gallery'}))" ,
:priority=>4, :priority=>4,
# :active_for_action=>{:bulletin_categorys=>:index}, :active_for_tag => 'Gallery',
:available_for => [:manager] :available_for => [:manager]
context_link 'module_authorization', context_link 'module_authorization',

View File

@ -57,7 +57,7 @@ module WebResource
context_link 'tags', context_link 'tags',
:link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'WebResource'}))" , :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'WebResource'}))" ,
:priority=>4, :priority=>4,
# :active_for_action=>{:bulletin_categorys=>:index}, :active_for_tag => 'WebResource',
:available_for => [:manager] :available_for => [:manager]
context_link 'module_authorization', context_link 'module_authorization',