diff --git a/app/assets/stylesheets/admin/dashboards.css b/app/assets/stylesheets/admin/dashboards.css new file mode 100644 index 000000000..bd375e716 --- /dev/null +++ b/app/assets/stylesheets/admin/dashboards.css @@ -0,0 +1,3 @@ +/* + *= require lib/dashboards +*/ \ No newline at end of file diff --git a/app/controllers/admin/dashboards_controller.rb b/app/controllers/admin/dashboards_controller.rb index 328a4a57c..e874b6638 100644 --- a/app/controllers/admin/dashboards_controller.rb +++ b/app/controllers/admin/dashboards_controller.rb @@ -3,6 +3,8 @@ class Admin::DashboardsController < OrbitBackendController #before_filter :set_current_user #before_filter :authenticate_user!, :except => [:index] # before_filter :is_admin? + + layout "basic_back_end" def index @module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link') @@ -28,13 +30,14 @@ class Admin::DashboardsController < OrbitBackendController a = {} args.each do |module_app| 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| a.merge!(object => object.updated_at) unless (object.archived rescue nil) end end 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 def get_most_visited(*args) diff --git a/app/views/admin/dashboards/index.html.erb b/app/views/admin/dashboards/index.html.erb index dcdf5a098..beaf9fe60 100644 --- a/app/views/admin/dashboards/index.html.erb +++ b/app/views/admin/dashboards/index.html.erb @@ -1,447 +1,5 @@ -<% content_for :page_specific_css do -%> - <%= stylesheet_link_tag "item" %> -<% end -%> -
-
-

<%= t(:content) %>

-
-

<%= t(:all_content) %><%= @module_app_contents_total %>

- - - - - - - -
<%= t(:module) %><%= t(:quantity) %>
-
-
-
-
-
-
-
-
-
-
- - - <% @module_app_contents.each do |module_app_content| %> - - - - - <% end %> - -
<%= link_to t("dashboard.#{module_app_content[0]}"), get_link(module_app_content[0]) %><%= module_app_content[1] %>
-
-
-
-
-
- - - + + + + + + +
+
+
+
+
+

+ + + <%= t(:recent_update) %> +

+
+
+ + + + + + + + + <% @recent_updated.each do |object| %> + + + + + <% end %> + +
<%= t(:title) %><%= t(:module) %>
<%= link_to ((object[0].title rescue nil) || (object[0].page.title rescue nil)), get_link_to_object(object[0]) %><%= link_to t("dashboard.#{object[0].class.to_s.underscore}"), get_link(object[0].class.to_s.underscore) %>
+ +
+
+
+
+

+ + + <%= t(:all_content) %> +

+
+
+ + + + + + + + + <% @module_app_contents.each do |module_app_content| %> + + + + + <% end %> + +
<%= t(:module) %><%= t(:quantity) %>
<%= link_to t("dashboard.#{module_app_content[0]}"), get_link(module_app_content[0]) %><%= module_app_content[1] %>
+ +
+
+
+
+
+
+
+

+ + + Event +

+
+
+ 23/12/2012 +

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore.

+ 23/02/2012 +

Lorem ipsum dolor sit amet dolore.

+ 13/02/2012 +

Lorem ipsum dolor sit amet dolore.

+ 13/02/2012 +

Lorem ipsum dolor sit amet dolore.

+ 13/02/2012 +

Lorem ipsum dolor sit amet dolore.

+
+
+
+
+

+ + + Most Visited Page +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ModuleQuantity
Page215
Announcement145
Link73
431
565
+ +
+
+
+
+
\ No newline at end of file diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index af7a5c798..be4b540e9 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -1,20 +1,9 @@ -
-
- <%= 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 %> -
-
-
-
-
-
-
-
+
+ + \ No newline at end of file diff --git a/app/views/layouts/_side_bar_content.html.erb b/app/views/layouts/_side_bar_content.html.erb index 27519a20a..270566a34 100644 --- a/app/views/layouts/_side_bar_content.html.erb +++ b/app/views/layouts/_side_bar_content.html.erb @@ -1,19 +1,13 @@ -<%#= content_tag :li, :class => active_for_controllers('purchases') do -%> - <%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> -<%# end -%> -<% content_for :page_specific_javascript do %> - <%= javascript_include_tag "/static/kernel.js" %> -<% end %> - - -<%OrbitApp::Module::SideBarRegisition.all.each do |t| %> - <%= t.render(request,params,current_user,@module_app) %> - - -<% end %> - -
- <% flash.each do |key, msg| %> - <%= content_tag :span, msg, :class => [key, "notice label label-warning"] %> +
+
+ + \ No newline at end of file diff --git a/app/views/layouts/back_end.html.erb b/app/views/layouts/back_end.html.erb index 4603684e5..8db541d8b 100644 --- a/app/views/layouts/back_end.html.erb +++ b/app/views/layouts/back_end.html.erb @@ -5,24 +5,21 @@ <%= render 'layouts/meta' %> <%= render 'layouts/google_font' %> <%= stylesheet_link_tag "back_end" %> - <%= stylesheet_link_tag params[:controller] rescue nil %> + <%= stylesheet_link_tag params[:controller] %> <%= render 'layouts/ie_html5_fix' %> <%= javascript_include_tag "back_end" %> - <%= javascript_include_tag params[:controller] rescue nil %> + <%= javascript_include_tag params[:controller] %> <%= yield :page_specific_css %> <%= yield :page_specific_javascript %> <%= csrf_meta_tag %> <%= render 'layouts/orbit_bar' unless @no_orbit_bar %> - <%#= render 'layouts/side_bar' unless @no_side_bar %> - + <% if !(yield :side_bar).blank? %> + <%= yield :side_bar %> + <% else %> + <%= render 'layouts/side_bar' %> + <% end unless @no_side_bar %>
diff --git a/app/views/layouts/basic_back_end.html.erb b/app/views/layouts/basic_back_end.html.erb new file mode 100644 index 000000000..801925fd2 --- /dev/null +++ b/app/views/layouts/basic_back_end.html.erb @@ -0,0 +1,25 @@ + + + + <%= @title || APP_CONFIG['orbit'] %> + <%= 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 %> + + + <%= 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 %> + + diff --git a/lib/orbit_app/helper/context_link_renderer.rb b/lib/orbit_app/helper/context_link_renderer.rb index 530b09460..df2e88b4f 100644 --- a/lib/orbit_app/helper/context_link_renderer.rb +++ b/lib/orbit_app/helper/context_link_renderer.rb @@ -8,7 +8,7 @@ module ContextLinkRenderer @params = params @current_user = current_user 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 diff --git a/lib/orbit_app/helper/renderer.rb b/lib/orbit_app/helper/renderer.rb index 70b0f111d..2f0aa6ed4 100644 --- a/lib/orbit_app/helper/renderer.rb +++ b/lib/orbit_app/helper/renderer.rb @@ -9,10 +9,14 @@ module Renderer protected def active_for_app_auth? module_app = get_module_app - if module_app.nil? - false + if controller.eql?('admin/module_apps_new_interface') + if module_app.nil? + false + else + module_app.id.to_s == @params[:module_app_id] ? true : false + end else - module_app.id.to_s == @params[:module_app_id] ? true : false + false end end @@ -28,6 +32,19 @@ protected 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 current_or_guest_user end diff --git a/lib/orbit_app/helper/side_bar_renderer.rb b/lib/orbit_app/helper/side_bar_renderer.rb index e0e1f9942..e58af3994 100644 --- a/lib/orbit_app/helper/side_bar_renderer.rb +++ b/lib/orbit_app/helper/side_bar_renderer.rb @@ -1,21 +1,39 @@ module SideBarRenderer include Renderer include AdminHelper + include ActionView::Helpers::TextHelper 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 :div, class: "sub-nav-block" do + concat content_tag :h4, I18n.t(@head_label) + concat (content_tag :ul, class: "nav nav-list" do + @context_links.sort_by {| obj | obj.priority}.map{ |link| + link.render(request, params, @current_module_app, @current_user, @belong_module_app) + }.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 - 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 + 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 @@ -35,7 +53,7 @@ module SideBarRenderer end 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 def active_for_controller? diff --git a/lib/orbit_app/module/side_bar.rb b/lib/orbit_app/module/side_bar.rb index 574e22833..92d7f400c 100644 --- a/lib/orbit_app/module/side_bar.rb +++ b/lib/orbit_app/module/side_bar.rb @@ -48,6 +48,7 @@ module OrbitApp @active_for_controllers = [] @active_for_object_auth = [] @active_for_app_auth = [] + @active_for_tag = [] @head_link = "" @app_base_path = '' @module_app_key = key @@ -147,6 +148,7 @@ module OrbitApp @active_for_action = options[:active_for_action] || [] @active_for_object_auth = options[:active_for_object_auth] || [] @active_for_app_auth = options[:active_for_app_auth] || [] + @active_for_tag = options[:active_for_tag] || [] @module_app_key = options[:module_app_key] @get_module_app = options[:get_module_app] end @@ -177,7 +179,8 @@ module OrbitApp for_action = @active_for_action.blank? ? false : active_for_action? 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_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 def active_for_action? diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb index bbcd33429..ce8257383 100644 --- a/vendor/built_in_modules/announcement/init.rb +++ b/vendor/built_in_modules/announcement/init.rb @@ -48,7 +48,7 @@ module Announcement side_bar do head_label_i18n 'announcement.announcement',:icon_class=>"icons-megaphone" 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'] head_link_path "panel_announcement_back_end_bulletins_path" @@ -74,7 +74,7 @@ module Announcement context_link 'tags', :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Announcement'}))" , :priority=>4, - # :active_for_action=>{:bulletin_categorys=>:index}, + :active_for_tag => 'Announcement', :available_for => [:manager] diff --git a/vendor/built_in_modules/archive/init.rb b/vendor/built_in_modules/archive/init.rb index acf9ae6ad..26f520767 100644 --- a/vendor/built_in_modules/archive/init.rb +++ b/vendor/built_in_modules/archive/init.rb @@ -70,7 +70,7 @@ module Archive context_link 'tags', :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Archive'}))" , :priority=>4, - # :active_for_action=>{:bulletin_categorys=>:index}, + :active_for_tag => 'Archive', :available_for => [:admin] end diff --git a/vendor/built_in_modules/calendar/init.rb b/vendor/built_in_modules/calendar/init.rb index a1fded82c..8fd6b2041 100644 --- a/vendor/built_in_modules/calendar/init.rb +++ b/vendor/built_in_modules/calendar/init.rb @@ -29,7 +29,7 @@ module Calendar context_link 'tags', :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Calendar'}))" , :priority=>4, - # :active_for_action=>{:bulletin_categorys=>:index}, + :active_for_tag => 'Calendar', :available_for => [:manager] end end diff --git a/vendor/built_in_modules/faq/init.rb b/vendor/built_in_modules/faq/init.rb index 1b05a37f9..fc7e7562f 100644 --- a/vendor/built_in_modules/faq/init.rb +++ b/vendor/built_in_modules/faq/init.rb @@ -68,7 +68,7 @@ module Faq context_link 'tags', :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Faq'}))" , :priority=>4, - # :active_for_action=>{:bulletin_categorys=>:index}, + :active_for_tag => 'Faq', :available_for => [:manager] end end diff --git a/vendor/built_in_modules/gallery/init.rb b/vendor/built_in_modules/gallery/init.rb index 9414adecb..8cc3bc727 100644 --- a/vendor/built_in_modules/gallery/init.rb +++ b/vendor/built_in_modules/gallery/init.rb @@ -59,7 +59,7 @@ module Gallery context_link 'tags', :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'Gallery'}))" , :priority=>4, - # :active_for_action=>{:bulletin_categorys=>:index}, + :active_for_tag => 'Gallery', :available_for => [:manager] context_link 'module_authorization', diff --git a/vendor/built_in_modules/web_resource/init.rb b/vendor/built_in_modules/web_resource/init.rb index b7e8bc1e0..e98697ded 100644 --- a/vendor/built_in_modules/web_resource/init.rb +++ b/vendor/built_in_modules/web_resource/init.rb @@ -57,7 +57,7 @@ module WebResource context_link 'tags', :link_path=>"admin_module_tags_path(:module_app_id => ModuleApp.first(conditions: {title: 'WebResource'}))" , :priority=>4, - # :active_for_action=>{:bulletin_categorys=>:index}, + :active_for_tag => 'WebResource', :available_for => [:manager] context_link 'module_authorization',