[refs #441] Some small fixes of locales and code

This commit is contained in:
konstantin.grabar 2012-07-16 13:58:33 +04:00
parent 3cf3546c2e
commit 70b2d62e52
6 changed files with 12 additions and 21 deletions

View File

@ -16,11 +16,7 @@ class KeyPair < ActiveRecord::Base
code, self.key_id = BuildServer.import_gpg_key_pair(public, secret)
if code.zero?
set_code = BuildServer.set_repository_key(repository_id, repository.platform_id, key_id)
if set_code.zero?
self.save
else
set_code
end
set_code.zero? ? self.save : set_code
else
code
end

View File

@ -4,7 +4,7 @@ class Repository < ActiveRecord::Base
has_many :project_to_repositories, :dependent => :destroy, :validate => true
has_many :projects, :through => :project_to_repositories
has_many :key_pairs
has_one :key_pair
validates :description, :presence => true
validates :name, :uniqueness => {:scope => :platform_id, :case_sensitive => false}, :presence => true, :format => {:with => /^[a-z0-9_\-]+$/}

View File

@ -1,21 +1,18 @@
%table#myTable.tablesorter.platform-repos{:cellspacing => "0", :cellpadding => "0"}
%thead
%tr
%th.th1= t("activerecord.attributes.key_pair.repository")
%th.th1= t("activerecord.attributes.key_pair.repository_id")
%th.th2= t("activerecord.attributes.key_pair.public")
%th.th3= t("activerecord.attributes.key_pair.user_id")
%th= t("layout.delete")
%tbody
- @platform.repositories.each do |repository|
- repository.key_pairs.each do |key_pair|
- if repository.key_pair
%tr{:class => cycle("odd", "even")}
%td
= key_pair.repository.name
%td
= key_pair.public
%td
= key_pair.user.name
%td= repository.name
%td= repository.key_pair.public
%td= repository.key_pair.user.name
%td.buttons
- if can? :destroy, key_pair
= link_to platform_key_pair_path(@platform, key_pair), :method => :delete, :confirm => t("layout.key_pairs.confirm_delete") do
- if can? :destroy, repository.key_pair
= link_to platform_key_pair_path(@platform, repository.key_pair), :method => :delete, :confirm => t("layout.key_pairs.confirm_delete") do
%span.delete &nbsp;

View File

@ -1,4 +1,2 @@
= render 'new' if can? :edit, @platform
= render 'list'#, :object => @key_pairs
=# will_paginate @key_pairs
= render 'list'

View File

@ -13,7 +13,7 @@ en:
save_error: Key pair save error
destroyed: Key pair succefully destroyed
destroy_error: Key pair destroy error
key_exists: Key pair already exists for this repository
key_exists: has one key pair already!
activerecord:
models:
key_pair: Key Pair

View File

@ -13,7 +13,7 @@ en:
save_error: Ошибка создания ключевой пары
destroyed: Ключевая пара удалена успешно
destroy_error: Ошибка удаления ключевой пары
key_exists: Ключ уже существует для данного репозитория!
key_exists: уже имеет одну ключевую пару!
activerecord:
models:
key_pair: Ключевая пара