From e7407ae28f0810b16b0e45cce37f854d243f76d3 Mon Sep 17 00:00:00 2001 From: George Vinogradov Date: Fri, 10 Aug 2012 18:09:44 +0400 Subject: [PATCH 1/2] [issue #590] Dirty hack to fix BuildList#index --- app/controllers/projects/build_lists_controller.rb | 6 ++++-- app/views/projects/build_lists/index.html.haml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index bc1238367..9045a49ed 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -25,8 +25,10 @@ class Projects::BuildListsController < Projects::BaseController def index @action_url = @project ? search_project_build_lists_path(@project) : search_build_lists_path @filter = BuildList::Filter.new(@project, current_user, params[:filter] || {}) - @build_lists = @filter.find.includes [:save_to_platform, :save_to_repository, :arch, :user => [:groups], :project => [:owner]] - @build_lists = @build_lists.recent.paginate :page => params[:page] + + @bls = @filter.find.recent.paginate :page => params[:page] + @build_lists = BuildList.where(:id => @bls.pluck("#{BuildList.table_name}.id")).recent + @build_lists = @build_lists.includes [:save_to_platform, :save_to_repository, :arch, :user, :project => [:owner]] @build_server_status = begin BuildServer.get_status diff --git a/app/views/projects/build_lists/index.html.haml b/app/views/projects/build_lists/index.html.haml index 61f04fbe6..b7c8ac2b6 100644 --- a/app/views/projects/build_lists/index.html.haml +++ b/app/views/projects/build_lists/index.html.haml @@ -70,7 +70,7 @@ }); -= will_paginate @build_lists += will_paginate @bls = render 'filter' = render @project ? 'projects/base/submenu' : 'projects/build_lists/submenu' From 9030056c1b9653268a4470ff734e26ceb85a1d2f Mon Sep 17 00:00:00 2001 From: George Vinogradov Date: Fri, 10 Aug 2012 20:14:45 +0400 Subject: [PATCH 2/2] [issue #590] Changed _build_list partial. --- .../projects/build_lists/_build_list.html.haml | 9 ++++++--- config/locales/en.yml | 7 ------- config/locales/models/arch.en.yml | 16 ++++++++++++++++ config/locales/models/arch.ru.yml | 16 ++++++++++++++++ config/locales/models/project.en.yml | 1 + config/locales/models/project.ru.yml | 1 + config/locales/ru.yml | 7 ------- 7 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 config/locales/models/arch.en.yml create mode 100644 config/locales/models/arch.ru.yml diff --git a/app/views/projects/build_lists/_build_list.html.haml b/app/views/projects/build_lists/_build_list.html.haml index 1ac0852b7..520023631 100644 --- a/app/views/projects/build_lists/_build_list.html.haml +++ b/app/views/projects/build_lists/_build_list.html.haml @@ -5,8 +5,11 @@ - if BuildList::HUMAN_STATUSES[build_list.status].in? [:build_pending, :build_started, :build_publish] %time.js-relative-date{:datetime => build_list.updated_at.strftime("%FT%T%:z"), :title => build_list.updated_at.strftime("%F %T")} = build_list.updated_at.strftime "%F %T" - %td= link_to build_list.project.name_with_owner, build_list.project - %td= build_list_version_link(build_list) + - if build_list.project.present? + %td= link_to build_list.project.name_with_owner, build_list.project + %td= build_list_version_link(build_list) + - else + %td.centered{:colspan => 2}= t("layout.projects.unexisted_project") %td= link_to "#{build_list.save_to_platform.name}/#{build_list.save_to_repository.name}", [build_list.save_to_platform, build_list.save_to_repository] - %td= build_list.arch.name + %td= build_list.arch.try(:name) || t("layout.arches.unexisted_arch") %td= link_to build_list.user.try(:fullname), build_list.user diff --git a/config/locales/en.yml b/config/locales/en.yml index 9abd215e8..e4dd91088 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -164,7 +164,6 @@ en: can_have_less_or_equal: You cannot have more than %{count} projects. models: - arch: Arch private_user: Private user product_build_list: Product build list @@ -183,9 +182,3 @@ en: private_user: login: Login password: Password - - arch: - name: Name - created_at: Created - updated_at: Updated - diff --git a/config/locales/models/arch.en.yml b/config/locales/models/arch.en.yml new file mode 100644 index 000000000..56743ac7b --- /dev/null +++ b/config/locales/models/arch.en.yml @@ -0,0 +1,16 @@ +en: + layout: + arches: + unexisted_arch: Unexisted arch + + flash: + arches: + + activerecord: + models: + arch: Arch + attributes: + arch: + name: Name + created_at: Created + updated_at: Updated diff --git a/config/locales/models/arch.ru.yml b/config/locales/models/arch.ru.yml new file mode 100644 index 000000000..ad6663d08 --- /dev/null +++ b/config/locales/models/arch.ru.yml @@ -0,0 +1,16 @@ +ru: + layout: + arches: + unexisted_arch: Несуществующая архитектура + + flash: + arches: + + activerecord: + models: + arch: Архитектура + attributes: + arch: + name: Название + created_at: Создана + updated_at: Обновлена diff --git a/config/locales/models/project.en.yml b/config/locales/models/project.en.yml index ae36f87f0..9eed4155d 100644 --- a/config/locales/models/project.en.yml +++ b/config/locales/models/project.en.yml @@ -7,6 +7,7 @@ en: fork_to: Fork to %{to} fork_modal_header: Where do you want to fork this project? already_exists: Project already exists + unexisted_project: Project not exists list: List list_header: Projects edit_header: Edit project diff --git a/config/locales/models/project.ru.yml b/config/locales/models/project.ru.yml index acaea82e0..09f2f9350 100644 --- a/config/locales/models/project.ru.yml +++ b/config/locales/models/project.ru.yml @@ -7,6 +7,7 @@ ru: fork_to: Клонировать в %{to} fork_modal_header: Куда Вы хотите клонировать проект? already_exists: Проект уже существует + unexisted_project: Проект не существует list: Список list_header: Проекты edit_header: Редактировать проект diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 4b80c0c06..f2d16ea79 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -164,7 +164,6 @@ ru: can_have_less_or_equal: Нельзя иметь больше, чем %{count} проектов. models: - arch: Arch private_user: Приватный пользователь product_build_list: Сборочный лист продукта auto_build_list: Автоматическая пересборка пакетов @@ -184,9 +183,3 @@ ru: private_user: login: Логин password: Пароль - - arch: - name: Название - created_at: Создана - updated_at: Обновлена -