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