#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
include ActsLikeMember
include PersonalRepository
include DefaultBranchable
belongs_to :owner, class_name: 'User'

View File

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

View File

@ -7,6 +7,7 @@ class Project < ActiveRecord::Base
include Wiki
include UrlHelper
include EventLoggable
include DefaultBranchable
VISIBILITIES = ['open', 'hidden']
MAX_OWN_PROJECTS = 32000
@ -61,7 +62,7 @@ class Project < ActiveRecord::Base
errors.delete :project_to_repositories
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,
:url, :srpms_list, :mass_import, :add_to_repository_id, :architecture_dependent,
:autostart_status

View File

@ -2,5 +2,6 @@
- if [:new, :create].include? act
= f.input :uname
= f.input :description, as: :text
= f.input :default_branch
= render 'shared/avatar_form', subject: @group, f: f
= 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.
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
enable_extension "plpgsql"
@ -246,6 +246,7 @@ ActiveRecord::Schema.define(version: 20150217215529) do
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.datetime "avatar_updated_at"
t.string "default_branch"
end
create_table "hooks", force: true do |t|