From 2c0422a3bc942b5de4f865ae45a5c4a73ebd6ad4 Mon Sep 17 00:00:00 2001 From: "konstantin.grabar" Date: Wed, 2 Nov 2011 00:53:25 +0400 Subject: [PATCH] [refs #2161] Split platforms on three groups --- app/controllers/categories_controller.rb | 8 ++++++-- app/views/categories/platforms.html.haml | 22 ++++++++++++++++++++-- app/views/layouts/application.html.haml | 2 +- config/routes.rb | 2 +- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index 4905d7a53..68bf9ec24 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -6,8 +6,12 @@ class CategoriesController < ApplicationController before_filter :check_global_access, :only => [:platforms, :new, :create] def platforms - @platforms = Platform.all - @platforms_count = Platform.joins(:repositories => :projects).group('platforms.id').count + @all_platforms = Platform.all + @all_platforms_count = Platform.joins(:repositories => :projects).group('platforms.id').count + @personal_platforms = Platform.personal + @personal_platforms_count = Platform.personal.joins(:repositories => :projects).group('platforms.id').count + @main_platforms = Platform.main + @main_platforms_count = Platform.main.joins(:repositories => :projects).group('platforms.id').count end def index diff --git a/app/views/categories/platforms.html.haml b/app/views/categories/platforms.html.haml index 16fe5938f..47c21fb61 100644 --- a/app/views/categories/platforms.html.haml +++ b/app/views/categories/platforms.html.haml @@ -5,9 +5,27 @@ %li.active= link_to t("layout.categories.platforms"), platforms_categories_path .content %h2.title= t("layout.platforms.list_header") + %br .inner + %h3.title= t("layout.platforms.list_header_main") %table.table - - @platforms.each do |platform| + - @main_platforms.each do |platform| %tr{:class => cycle("odd", "even")} %td= link_to platform.name, platform_categories_path(platform) - %td.last= @platforms_count[platform.id].to_i + %td.last= @main_platforms_count[platform.id].to_i + %br + .inner + %h3.title= t("layout.platforms.list_header_personal") + %table.table + - @personal_platforms.each do |platform| + %tr{:class => cycle("odd", "even")} + %td= link_to platform.name, platform_categories_path(platform) + %td.last= @personal_latforms_count[platform.id].to_i + %br + .inner + %h3.title= t("layout.platforms.list_header_all") + %table.table + - @all_platforms.each do |platform| + %tr{:class => cycle("odd", "even")} + %td= link_to platform.name, platform_categories_path(platform) + %td.last= @all_platforms_count[platform.id].to_i diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 420776ff1..dc1092e56 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -39,7 +39,7 @@ %a{:href => all_build_lists_path}= t("layout.menu.build_lists") -if current_user.can_perform?('categories', 'index') %li{:class => controller.controller_path == 'categories' ? 'active' : '' } - %a{:href => categories_path}= t("layout.menu.categories") + %a{:href => catalogs_path}= t("layout.menu.categories") -if current_user.can_perform?('roles', 'index') %li{:class => controller.controller_path == 'roles' ? 'active' : '' } %a{:href => roles_path}= t("layout.menu.roles") diff --git a/config/routes.rb b/config/routes.rb index 1351cffe0..b548aea84 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -117,7 +117,7 @@ Rosa::Application.routes.draw do resources :repositories, :only => [:new, :create] end - match '/catalogs', :to => 'categories#platforms' + match '/catalogs', :to => 'categories#platforms', :catalogs match 'build_lists/status_build', :to => "build_lists#status_build" match 'build_lists/post_build', :to => "build_lists#post_build"