#456: add default_branch to Group

This commit is contained in:
Vokhmin Alexey V 2015-02-19 02:34:07 +03:00
parent 921e12e7cb
commit 1a09d0fead
7 changed files with 25 additions and 6 deletions

View File

@ -0,0 +1,11 @@
module DefaultBranchable
extend ActiveSupport::Concern
included do
validates :default_branch,
length: { maximum: 100 }
attr_accessible :default_branch
end
end

View File

@ -1,6 +1,7 @@
class Group < Avatar class Group < Avatar
include ActsLikeMember include ActsLikeMember
include PersonalRepository include PersonalRepository
include DefaultBranchable
belongs_to :owner, class_name: 'User' belongs_to :owner, class_name: 'User'

View File

@ -7,6 +7,7 @@ class Platform < ActiveRecord::Base
include Owner include Owner
include EventLoggable include EventLoggable
include EmptyMetadata include EmptyMetadata
include DefaultBranchable
self.per_page = 20 self.per_page = 20
@ -68,8 +69,7 @@ class Platform < ActiveRecord::Base
length: { maximum: 100 } length: { maximum: 100 }
validates :default_branch, validates :default_branch,
presence: true, presence: true
length: { maximum: 100 }
validates :distrib_type, validates :distrib_type,
presence: true, presence: true,
@ -118,8 +118,7 @@ class Platform < ActiveRecord::Base
:platform_arch_settings_attributes, :platform_arch_settings_attributes,
:automatic_metadata_regeneration, :automatic_metadata_regeneration,
:admin_id, :admin_id,
:term, :term
:default_branch
attr_accessor :admin_id, :term attr_accessor :admin_id, :term

View File

@ -7,6 +7,7 @@ class Project < ActiveRecord::Base
include Wiki include Wiki
include UrlHelper include UrlHelper
include EventLoggable include EventLoggable
include DefaultBranchable
VISIBILITIES = ['open', 'hidden'] VISIBILITIES = ['open', 'hidden']
MAX_OWN_PROJECTS = 32000 MAX_OWN_PROJECTS = 32000
@ -61,7 +62,7 @@ class Project < ActiveRecord::Base
errors.delete :project_to_repositories errors.delete :project_to_repositories
end end
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, attr_accessible :name, :description, :visibility, :srpm, :is_package,
:has_issues, :has_wiki, :maintainer_id, :publish_i686_into_x86_64, :has_issues, :has_wiki, :maintainer_id, :publish_i686_into_x86_64,
:url, :srpms_list, :mass_import, :add_to_repository_id, :architecture_dependent, :url, :srpms_list, :mass_import, :add_to_repository_id, :architecture_dependent,
:autostart_status :autostart_status

View File

@ -2,5 +2,6 @@
- if [:new, :create].include? act - if [:new, :create].include? act
= f.input :uname = f.input :uname
= f.input :description, as: :text = f.input :description, as: :text
= f.input :default_branch
= render 'shared/avatar_form', subject: @group, f: f = render 'shared/avatar_form', subject: @group, f: f
= submit_button_tag = submit_button_tag

View File

@ -0,0 +1,5 @@
class AddDefaultBranchToGroups < ActiveRecord::Migration
def change
add_column :groups, :default_branch, :string
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150217215529) do ActiveRecord::Schema.define(version: 20150218231015) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -246,6 +246,7 @@ ActiveRecord::Schema.define(version: 20150217215529) do
t.string "avatar_content_type" t.string "avatar_content_type"
t.integer "avatar_file_size" t.integer "avatar_file_size"
t.datetime "avatar_updated_at" t.datetime "avatar_updated_at"
t.string "default_branch"
end end
create_table "hooks", force: true do |t| create_table "hooks", force: true do |t|