[refs #2161] Split platforms on three groups

This commit is contained in:
konstantin.grabar 2011-11-02 00:53:25 +04:00
parent dee94bf751
commit 2c0422a3bc
4 changed files with 28 additions and 6 deletions

View File

@ -6,8 +6,12 @@ class CategoriesController < ApplicationController
before_filter :check_global_access, :only => [:platforms, :new, :create] before_filter :check_global_access, :only => [:platforms, :new, :create]
def platforms def platforms
@platforms = Platform.all @all_platforms = Platform.all
@platforms_count = Platform.joins(:repositories => :projects).group('platforms.id').count @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 end
def index def index

View File

@ -5,9 +5,27 @@
%li.active= link_to t("layout.categories.platforms"), platforms_categories_path %li.active= link_to t("layout.categories.platforms"), platforms_categories_path
.content .content
%h2.title= t("layout.platforms.list_header") %h2.title= t("layout.platforms.list_header")
%br
.inner .inner
%h3.title= t("layout.platforms.list_header_main")
%table.table %table.table
- @platforms.each do |platform| - @main_platforms.each do |platform|
%tr{:class => cycle("odd", "even")} %tr{:class => cycle("odd", "even")}
%td= link_to platform.name, platform_categories_path(platform) %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

View File

@ -39,7 +39,7 @@
%a{:href => all_build_lists_path}= t("layout.menu.build_lists") %a{:href => all_build_lists_path}= t("layout.menu.build_lists")
-if current_user.can_perform?('categories', 'index') -if current_user.can_perform?('categories', 'index')
%li{:class => controller.controller_path == 'categories' ? 'active' : '' } %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') -if current_user.can_perform?('roles', 'index')
%li{:class => controller.controller_path == 'roles' ? 'active' : '' } %li{:class => controller.controller_path == 'roles' ? 'active' : '' }
%a{:href => roles_path}= t("layout.menu.roles") %a{:href => roles_path}= t("layout.menu.roles")

View File

@ -117,7 +117,7 @@ Rosa::Application.routes.draw do
resources :repositories, :only => [:new, :create] resources :repositories, :only => [:new, :create]
end 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/status_build', :to => "build_lists#status_build"
match 'build_lists/post_build', :to => "build_lists#post_build" match 'build_lists/post_build', :to => "build_lists#post_build"