[issue #428] Added advisories list. Added translations.

This commit is contained in:
George Vinogradov 2012-05-05 21:18:29 +04:00
parent 6fe0e5b530
commit 05ef799fa4
21 changed files with 139 additions and 11 deletions

View File

@ -456,6 +456,18 @@ table.tablesorter.platforms .th2 {
width: 280px;
}
table.tablesorter.advisories .th1 {
width: 120px;
}
table.tablesorter.advisories .th2 {
width: 250px;
}
table.tablesorter.advisories .th3 {
width: auto;
}
table.tablesorter tr td.buttons {
text-align: center;
}
@ -921,3 +933,13 @@ div#git_help_data p {
.dropdown.open .dropdown-toggle {
background: none repeat scroll 0 0;
}
.rightlist p {
padding-bottom: 1em;
}
.leftlist span.hint {
padding-top: 1em;
display: block;
font-size: 0.9em;
}

View File

@ -1,10 +1,11 @@
# -*- encoding : utf-8 -*-
class Platforms::AdvisoriesController < Platforms::BaseController
class Advisories::AdvisoriesController < Advisories::BaseController
before_filter :authenticate_user!
before_filter :find_advisory, :only => [:show]
load_and_authorize_resource
def index
@advisories = @advisories.paginate(:page => params[:page])
end
def show

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
class Advisories::BaseController < ApplicationController
end

View File

@ -0,0 +1,12 @@
# -*- encoding : utf-8 -*-
module AdvisoriesHelper
def construct_ref_link(ref)
ref = sanitize(ref)
url = if ref =~ %r[^http(s?)://*]
ref
else
'http://' << ref
end
link_to url, url
end
end

View File

@ -73,6 +73,8 @@ class Ability
end
can(:cancel, BuildList) {|build_list| build_list.can_cancel? && can?(:write, build_list.project)}
can [:read], Advisory
can [:read, :members], Platform, :visibility => 'open'
can [:read, :owned, :related, :members], Platform, :owner_type => 'User', :owner_id => user.id
can [:read, :related, :members], Platform, :owner_type => 'Group', :owner_id => user.group_ids

View File

@ -0,0 +1,8 @@
%table#myTable.tablesorter.advisories{:cellspacing => "0", :cellpadding => "0"}
%thead
%tr
%th.th1= t("activerecord.attributes.advisory.advisory_id")
%th.th2= t("layout.advisories.affected_versions")
%th.th3= t("activerecord.attributes.advisory.description")
%tbody
= render :partial => 'list_item', :collection => list, :as => :advisory

View File

@ -0,0 +1,7 @@
%tr{:class => cycle("odd", "even")}
%td= link_to advisory.advisory_id, advisory_path(advisory)
%td
- advisory.platforms.each do |platform|
= link_to platfrom_printed_name(platform), platform_path(platform)
%br
%td= truncate(advisory.description, :length => 50)

View File

@ -0,0 +1,4 @@
- set_meta_tags :title => t('layout.advisories.list_header')
- render :partial => 'submenu'
= render :partial => 'list', :object => @advisories
= will_paginate @advisories

View File

@ -1,11 +1,13 @@
-#set_meta_tags :title => [title_object(@build_list.project), t('activerecord.models.build_list')]
- render :partial => 'submenu'
%h3= "#{t("activerecord.models.advisory")} #{@advisory.advisory_id}".html_safe
.leftlist= "#{t("layout.advisories.project_name")}:".html_safe
.rightlist= @advisory.project.name
.rightlist= link_to @advisory.project.name, project_path(@advisory.project)
.both
.leftlist= "#{t("layout.advisories.creation_date")}:".html_safe
.leftlist= "#{t("activerecord.attributes.advisory.created_at")}:".html_safe
.rightlist= @advisory.created_at
.both
@ -16,18 +18,18 @@
.leftlist= "#{t("layout.advisories.affected_versions")}:".html_safe
.rightlist
- @advisory.platforms.each do |platform|
= link_to platform.name, platform_path(platform)
= link_to platform_printed_name(platform), platform_path(platform)
%br
.both
.leftlist= "#{t("activerecord.attributes.advisory.description")}:".html_safe
.rightlist= @advisory.description
.rightlist= simple_format @advisory.description
.both
.leftlist= "#{t("activerecord.attributes.advisories.references")}:".html_safe
.leftlist= "#{t("activerecord.attributes.advisory.references")}:".html_safe
.rightlist
- sanitize(@advisory.references).gsub("\r", '').split("\n").each do |ref|
= link_to ref
- @advisory.references.gsub(/\r| /, '').split("\n").each do |ref|
= construct_ref_link(ref)
%br
.both

View File

@ -0,0 +1,7 @@
- content_for :submenu do
- act = action_name.to_sym; contr = controller_name.to_sym
.left
= @advisory.advisory_id if @advisory.present?
%nav
%ul
%li= link_to t('layout.list'), advisories_path, :class => act.in?([:index]) ? 'active' : nil

View File

@ -56,7 +56,7 @@
.both
- if @build_list.advisory.present?
.leftlist= t("layout.build_lists.connected_advisory")
.leftlist= t("layout.build_lists.attached_advisory")
.rightlist= link_to @build_list.advisory.advisory_id, advisory_path(@build_list.advisory)
.both
- if !@build_list.in_work? && @build_list.started_at
@ -76,7 +76,7 @@
.rightlist= check_box_tag :create_advisory, 1, false
.both
= f.fields_for @build_list.build_advisory do |f|
= render :partial => 'advisories/form', :locals => {:f => f}
= render :partial => 'advisories/advisories/form', :locals => {:f => f}
=# link_to t("layout.publish"), publish_build_list_path(@build_list), :method => "put", :confirm => t("layout.confirm"), :class => "button tmargin10" if @build_list.can_publish? and can?(:publish, @build_list)
=# link_to t("layout.reject_publish"), reject_publish_build_list_path(@build_list), :method => "put", :confirm => t("layout.confirm"), :class => "button tmargin10" if @build_list.can_reject_publish? and can?(:reject_publish, @build_list)

View File

@ -4,6 +4,8 @@ en:
turned_on: on
turned_off: off
list: List
year: year
enter_commit_message: Commit message

View File

@ -4,6 +4,8 @@ ru:
turned_on: включены
turned_off: выключены
list: Список
year: год
enter_commit_message: Сопровождающее сообщение

View File

@ -8,6 +8,7 @@ en:
projects: Projects
build_lists: Task monitoring
groups: Groups
advisories: Advisories
bottom_menu:
copyright: ROSA Lab © 2012
about: About the company

View File

@ -8,6 +8,7 @@ ru:
projects: Проекты
build_lists: Мониторинг задач
groups: Группы
advisories: Бюллетени
bottom_menu:
copyright: ROSA Лаб. © 2012
about: О компании

View File

@ -0,0 +1,22 @@
en:
layout:
advisories:
list_header: Advisories
form_header: New advisory
project_name: Project
affected_versions: Affected versions
ref_comment: Add links one by row
flash:
advisories:
activerecord:
models:
advisory: Advisory
attributes:
advisory:
created_at: Creation date
advisory_id: Identifier
description: Description
references: References

View File

@ -0,0 +1,22 @@
ru:
layout:
advisories:
list_header: Бюллетени
form_header: Новый бюллетень
project_name: Проект
affected_versions: Применен в версиях
ref_comment: Вставляйте ссылки по одной на строку
flash:
advisories:
activerecord:
models:
advisory: Бюллетень
attributes:
advisory:
created_at: Дата создания
advisory_id: Идентификатор
description: Описание проблемы
references: Ссылки

View File

@ -62,9 +62,13 @@ en:
action: Action
new_header: New build
main_data: Main data
human_current_duration: Build currently takes %{hours} h. %{minutes} min.
human_duration: Builded in %{hours} h. %{minutes} min.
attached_advisory: Attached advisory
create_advisory: Create new advisory
ownership:
header: Build list ownership
owned: My

View File

@ -65,6 +65,9 @@ ru:
human_current_duration: Сборка длится уже %{hours} ч. %{minutes} мин.
human_duration: Собрано за %{hours} ч. %{minutes} мин.
attached_advisory: Связанный бюллетень
create_advisory: Создать новый бюллетень
ownership:
header: Принадлежность заданий
owned: Мне

View File

@ -34,6 +34,10 @@ Rosa::Application.routes.draw do
resources :event_logs, :only => :index
end
scope :module => 'advisories' do
resources :advisories, :only => [:index, :show]
end
scope :module => 'platforms' do
resources :platforms do
resources :private_users, :except => [:show, :destroy, :update]
@ -60,7 +64,6 @@ Rosa::Application.routes.draw do
end
match '/private/:platform_name/*file_path' => 'privates#show'
resources :advisories, :only => [:index, :show]
resources :product_build_lists, :only => [:index]
end