Merge pull request #484 from abf/rosa-build:483-update-maintainers-page
#483: Update /maintainers page
This commit is contained in:
commit
761d1064a7
|
@ -4,10 +4,10 @@ class Platforms::MaintainersController < Platforms::BaseController
|
|||
|
||||
def index
|
||||
@maintainer = BuildList::Package.new(build_list_package_params)
|
||||
@maintainers = BuildList::Package.includes(:project).
|
||||
actual.by_platform(@platform).
|
||||
like_name(@maintainer.name).
|
||||
paginate(page: params[:page])
|
||||
@packages = @platform.packages.actual.like_name(@maintainer.name)
|
||||
@projects = @platform.projects.joins(:packages).merge( @packages ).
|
||||
includes(:maintainer).group('projects.id').reorder(:name).paginate(page: params[:page])
|
||||
@packages = @packages.where(project_id: @projects.map(&:id)).group_by(&:project_id)
|
||||
end
|
||||
|
||||
def build_list_package_params
|
||||
|
|
|
@ -30,6 +30,7 @@ class Platform < ActiveRecord::Base
|
|||
|
||||
has_many :repositories, dependent: :destroy
|
||||
has_many :key_pairs, through: :repositories
|
||||
has_many :projects, through: :repositories
|
||||
|
||||
has_many :products, dependent: :destroy
|
||||
has_many :tokens, as: :subject, dependent: :destroy
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
class MaintainerPresenter < ApplicationPresenter
|
||||
|
||||
attr_reader :package, :package_link, :package_name, :package_type,
|
||||
:package_version, :package_release, :package_version_release,
|
||||
:package_updated_at
|
||||
attr_reader :maintainer, :maintainer_fullname, :maintainer_email,
|
||||
:maintainer_link, :maintainer_mail_link
|
||||
delegate :package_type, to: :package
|
||||
|
||||
[:name, :version, :release, :updated_at].each do |meth|
|
||||
define_method "package_#{meth}" do
|
||||
@package.send meth
|
||||
end
|
||||
end
|
||||
|
||||
[:fullname, :email].each do |meth|
|
||||
define_method "maintainer_#{meth}" do
|
||||
@maintainer.send meth
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(package, opts = {})
|
||||
@package = package
|
||||
@maintainer = package.try(:assignee)
|
||||
end
|
||||
|
||||
def package_link
|
||||
link_to @package.name, @package.project
|
||||
end
|
||||
|
||||
def package_version_release
|
||||
"#{@package.version}-#{@package.release}"
|
||||
end
|
||||
|
||||
def maintainer_link
|
||||
link_to @maintainer.fullname, @maintainer
|
||||
end
|
||||
|
||||
def maintainer_email_link
|
||||
mail_to @maintainer.email, @maintainer.email, encode: "javascript"
|
||||
end
|
||||
|
||||
end
|
|
@ -10,21 +10,29 @@
|
|||
|
||||
|
||||
hr
|
||||
table.table.table-striped
|
||||
|
||||
table.table.table-condensed
|
||||
thead
|
||||
tr
|
||||
th.text-center= t("activerecord.attributes.maintainer.package_name")
|
||||
th.text-center= t("activerecord.attributes.maintainer.package_type")
|
||||
th.text-center= t("activerecord.attributes.maintainer.version")
|
||||
th.text-center colspan=2
|
||||
= t("activerecord.models.maintainer")
|
||||
th.text-center= t("activerecord.attributes.maintainer.updated_at")
|
||||
th.col-md-1.text-center= t('.project')
|
||||
th.col-md-4.text-center= t('.packages')
|
||||
th.col-md-2.text-center= t('.version')
|
||||
th.col-md-3.text-center= t('.maintainer')
|
||||
th.col-md-2.text-center= t('.updated_at')
|
||||
tbody
|
||||
- MaintainerPresenter.present_collection(@maintainers) do |pr|
|
||||
- @projects.each do |project|
|
||||
- packages = @packages[project.id]
|
||||
tr
|
||||
td= pr.package_link
|
||||
td= pr.package_type
|
||||
td= pr.package_version_release
|
||||
td= pr.maintainer_link
|
||||
td= pr.maintainer_email_link.html_safe
|
||||
td= pr.package_updated_at
|
||||
td= link_to project.name, project_path(project)
|
||||
td= packages.map(&:name).uniq.sort * ', '
|
||||
td.text-center
|
||||
= packages.map{ |p| "#{p.version}-#{p.release}" }.uniq * '; '
|
||||
- if project.maintainer
|
||||
td
|
||||
=> link_to project.maintainer.fullname, project.maintainer
|
||||
= mail_to project.maintainer.email, project.maintainer.email, encode: 'javascript'
|
||||
- else
|
||||
td
|
||||
td.text-center= packages.map(&:updated_at).max
|
||||
|
||||
= will_paginate @projects
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
= render 'platforms/base/submenu'
|
||||
.col-xs-12.col-md-10.col-md-offset-1
|
||||
.row
|
||||
= render partial: 'list', object: @maintainers
|
||||
= will_paginate @maintainers
|
||||
|
||||
/ = render partial: 'list', object: @maintainers
|
||||
/ = will_paginate @maintainers
|
||||
= render partial: 'list'
|
||||
|
|
|
@ -29,3 +29,12 @@ en:
|
|||
placeholders:
|
||||
build_list_package:
|
||||
name: Enter the package name here.
|
||||
|
||||
platforms:
|
||||
maintainers:
|
||||
list:
|
||||
project: Project
|
||||
packages: Packages
|
||||
version: Version-Release
|
||||
maintainer: Maintainer
|
||||
updated_at: Last Update
|
||||
|
|
|
@ -29,3 +29,12 @@ ru:
|
|||
placeholders:
|
||||
build_list_package:
|
||||
name: Введите имя пакета здесь.
|
||||
|
||||
platforms:
|
||||
maintainers:
|
||||
list:
|
||||
project: Проект
|
||||
packages: Пакеты
|
||||
version: Версия-Релиз
|
||||
maintainer: Майнтейнер
|
||||
updated_at: Обновлен
|
||||
|
|
Loading…
Reference in New Issue