Merge branch 'public_submission_milestones_for_mr' of https://github.com/piffio/gitlabhq into piffio-public_submission_milestones_for_mr

Conflicts:
	app/views/merge_requests/_form.html.haml
This commit is contained in:
randx 2012-10-29 21:37:46 +02:00
commit ecdf778e80
14 changed files with 124 additions and 23 deletions

View file

@ -4,11 +4,13 @@ class MergeRequest < ActiveRecord::Base
include IssueCommonality
include Votes
attr_accessible :title, :assignee_id, :closed, :target_branch, :source_branch,
attr_accessible :title, :assignee_id, :closed, :target_branch, :source_branch, :milestone_id,
:author_id_of_changes
attr_accessor :should_remove_source_branch
belongs_to :milestone
BROKEN_DIFF = "--broken-diff"
UNCHECKED = 1
@ -26,6 +28,10 @@ class MergeRequest < ActiveRecord::Base
where("source_branch LIKE :branch OR target_branch LIKE :branch", branch: branch_name)
end
def self.find_all_by_milestone(milestone)
where("milestone_id = :milestone_id", milestone_id: milestone)
end
def human_state
states = {
CAN_BE_MERGED => "can_be_merged",
@ -212,5 +218,6 @@ end
# st_diffs :text(4294967295
# merged :boolean default(FALSE), not null
# state :integer default(1), not null
# milestone_id :integer
#

View file

@ -3,6 +3,7 @@ class Milestone < ActiveRecord::Base
belongs_to :project
has_many :issues
has_many :merge_requests
validates :title, presence: true
validates :project, presence: true