[refs #90] view merged status

This commit is contained in:
Alexander Machehin 2012-06-13 23:52:11 +06:00
parent 9af3d22153
commit 682f33a9bf
6 changed files with 21 additions and 12 deletions

View File

@ -27,7 +27,7 @@ class Projects::PullRequestsController < Projects::BaseController
end
def create
@pull = @project.pull_requests.new(params[:pull_request]) # FIXME need validation!
@pull = @project.pull_requests.new(params[:pull_request])
@pull.issue.user, @pull.issue.project = current_user, @pull.base_project
@pull.base_project, @pull.head_project = PullRequest.default_base_project(@project), @project

View File

@ -47,10 +47,10 @@ class Issue < ActiveRecord::Base
closed_by && closed_at && status == 'closed'
end
def set_close(closed_by)
self.closed_at = Time.now
def set_close(closed_by, status = 'closed')
self.closed_at = Time.now.utc
self.closer = closed_by
self.status = 'closed'
self.status = status
end
def set_open

View File

@ -95,6 +95,7 @@ class PullRequest < ActiveRecord::Base
merging
system("git push origin HEAD")
system("git reset --hard HEAD") # for diff maybe FIXME
issue.set_close who, 'merged'
end
end
end

View File

@ -30,9 +30,6 @@
.leftlist=t('activerecord.attributes.issue.body')
.rightlist.pull_body=@pull.issue.body
.both
.leftlist=t('activerecord.attributes.issue.status')
.rightlist=@pull.issue.status
.both
- if can? :update, @pull.issue
%br
=link_to t('layout.edit'), '#', :id => 'edit_pull_content', :class => 'button'
@ -49,9 +46,14 @@
= render "projects/comments/list", :list => @issue.comments, :project => @project, :commentable => @issue
%br
= render "projects/comments/add", :project => @project, :commentable => @issue if current_user
- if can? :merge, @pull
%br
=form_for PullRequest.new, :url => merge_project_pull_request_path(@project, @pull), :html => { :method => :put, :class => :form } do |f|
=f.submit t 'projects.pull_requests.merge'
-if can? :update, @issue
- if can? :merge, @pull
%br
=form_for PullRequest.new, :url => merge_project_pull_request_path(@project, @pull), :html => { :method => :put, :class => :form } do |f|
=f.submit t 'projects.pull_requests.merge'
-else
.flash
-message = t("projects.pull_requests.#{@pull.status}", :user => @issue.closer.uname, :base_ref => @pull.base_ref, :head_ref => @pull.head_ref, :time => @issue.closed_at)
.alert="#{t 'activerecord.attributes.issue.status'}: #{raw message}"
=render 'diff_commits_tabs' if @pull.status != 'already'

View File

@ -14,6 +14,9 @@ en:
duplicate: 'There is already a pull request for %{head_ref}'
up_to_date: 'The %{base_ref} branch is already up-to-date with %{head_ref}'
wrong_ref: Wrong tree-ish
block: This pull request cannot be automatically merged.
ready: This pull request can be automatically merged.
merged: '%{user} merged into %{base_ref} from %{head_ref} at %{time}'
pull_requests:
tabs:

View File

@ -10,10 +10,13 @@ ru:
head_project: Проект-источник
submit: Создать пул реквест
update: Обновить коммиты
merge: Merge
merge: Мерж
duplicate: 'Уже существует пул реквест %{head_ref}'
up_to_date: 'Ветка %{base_ref} на данный момент уже содержит последние изменения %{head_ref}'
wrong_ref: Неправильный tree-ish
block: Невозможно автоматически смержить данный пул реквест.
ready: Смержить данный пул реквест.
merged: '%{user} смержил %{base_ref} с %{head_ref} в %{time}'
pull_requests:
tabs: