Merge pull request #465 from warpc/461-rename_is_rpm_to_is_package

[refs #461] rename is_rpm to is_package
This commit is contained in:
Vladimir Sharshov 2012-05-17 14:16:04 -07:00
commit 4a457b2298
8 changed files with 28 additions and 15 deletions

View File

@ -64,7 +64,7 @@ class Ability
can [:read, :related], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
can [:read, :related], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
can(:read, BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
can([:create, :update], BuildList) {|build_list| build_list.project.is_rpm && can?(:write, build_list.project)}
can([:create, :update], BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project)}
can(:publish, BuildList) do |build_list|
build_list.can_publish? and build_list.save_to_platform.released ? local_admin?(build_list.save_to_platform) : can?(:write, build_list.project)

View File

@ -28,7 +28,7 @@ class Project < ActiveRecord::Base
validates_attachment_size :srpm, :less_than => 500.megabytes
validates_attachment_content_type :srpm, :content_type => ['application/octet-stream', "application/x-rpm", "application/x-redhat-package-manager"], :message => I18n.t('layout.invalid_content_type')
attr_accessible :name, :description, :visibility, :srpm, :is_rpm, :default_branch, :has_issues, :has_wiki
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki
attr_readonly :name
scope :recent, order("name ASC")

View File

@ -7,7 +7,7 @@
%ul
%li= link_to t("project_menu.project"), project_path(@project), :class => (act.in?([:show, :edit]) && contr.in?([:trees, :blobs]) ? 'active' : nil)
%li= link_to t("project_menu.commits"), commits_path(@project), :class => (act.in?([:index, :show]) && contr == :commits ? 'active' : nil)
- if @project.is_rpm and can?(:read, @project => BuildList)
- if @project.is_package and can?(:read, @project => BuildList)
%li= link_to t("project_menu.builds"), project_build_lists_path(@project), :class => (contr == :build_lists ? 'active' : nil)
- if @project.has_issues
%li= link_to t("project_menu.tracker"), project_issues_path(@project), :class => (contr == :issues ? 'active' : nil)

View File

@ -42,8 +42,8 @@
\ 
.rightlist
.check
%span#niceCheckbox1.niceCheck-main= f.check_box :is_rpm#, :class => 'niceCheckbox1'
.forcheck= t("activerecord.attributes.project.is_rpm")
%span#niceCheckbox1.niceCheck-main= f.check_box :is_package#, :class => 'niceCheckbox1'
.forcheck= t("activerecord.attributes.project.is_package")
.both
.both
- if [:new, :create].include? act

View File

@ -87,7 +87,7 @@ en:
me: Myself
group: Group
default_branch: Default branch
is_rpm: Project is a packet
is_package: Project is a package
errors:
project:
uname: The name can only use lower case Latin letters (a-z), numbers (0-9) and underscore (_)

View File

@ -87,7 +87,7 @@ ru:
me: Я
group: Группа
default_branch: Ветка по умолчанию
is_rpm: Проект является пакетом
is_package: Проект является пакетом
errors:
project:
uname: В имени можно использовать только строчные символы латинского алфавита (a-z), цифры (0-9) и символ нижнего подчеркивания (_)

View File

@ -0,0 +1,11 @@
class RenameIsRpmToIsPackageInProjects < ActiveRecord::Migration
def up
rename_column :projects, :is_rpm, :is_package
change_column :projects, :is_package, :boolean, :default => true, :null => false
end
def down
rename_column :projects, :is_package, :is_rpm
change_column :projects, :is_package, :boolean, :default => true
end
end

View File

@ -11,14 +11,14 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120512102707) do
ActiveRecord::Schema.define(:version => 20120515095324) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
t.string "kind"
t.text "data"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "advisories", :force => true do |t|
@ -293,13 +293,13 @@ ActiveRecord::Schema.define(:version => 20120512102707) do
t.text "description"
t.string "ancestry"
t.boolean "has_issues", :default => true
t.boolean "has_wiki", :default => false
t.string "srpm_file_name"
t.string "srpm_content_type"
t.integer "srpm_file_size"
t.datetime "srpm_updated_at"
t.boolean "has_wiki", :default => false
t.string "default_branch", :default => "master"
t.boolean "is_rpm", :default => true
t.boolean "is_package", :default => true, :null => false
t.integer "average_build_time", :default => 0, :null => false
t.integer "build_count", :default => 0, :null => false
end
@ -367,6 +367,7 @@ ActiveRecord::Schema.define(:version => 20120512102707) do
t.string "name"
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "password_salt", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
@ -376,7 +377,11 @@ ActiveRecord::Schema.define(:version => 20120512102707) do
t.string "uname"
t.string "role"
t.string "language", :default => "en"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.integer "own_projects_count", :default => 0, :null => false
t.datetime "reset_password_sent_at"
t.text "professional_experience"
t.string "site"
t.string "company"
@ -388,9 +393,6 @@ ActiveRecord::Schema.define(:version => 20120512102707) do
t.integer "failed_attempts", :default => 0
t.string "unlock_token"
t.datetime "locked_at"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "authentication_token"
t.integer "build_priority", :default => 50
end