[#369] pull request: new page

This commit is contained in:
Alexander Machehin 2015-02-02 20:44:57 +05:00
parent 0692c026f1
commit cf39b3911c
7 changed files with 67 additions and 44 deletions

View File

@ -30,7 +30,6 @@ class Projects::PullRequestsController < Projects::BaseController
def create
unless pull_params
raise 'expect pull_request params' # for debug
redirect :back
end
to_project = find_destination_project

View File

@ -2,11 +2,11 @@ tabset
tab.active heading = t('layout.edit')
.offset10
- if defined?(ang_model)
= f.input :body, label: false,
= f.input :body, label: false, as: :text,
input_html: { rows: 10, id: "#{id}-body",
'ng-model' => "#{ctrl}.#{ang_model}", 'ng-value' => "#{ctrl}.#{ang_model}" }
- else
= f.input :body, label: false,
= f.input :body, label: false, as: :text,
input_html: { rows: 10, id: "#{id}-body" }
tab[ heading = t('layout.preview')

View File

@ -0,0 +1,20 @@
ul.nav.nav-tabs#pull_tabs role = 'tablist'
li role = 'presentation' class = 'active'
a[ data-toggle = 'tab'
role = 'tab'
aria-controls = 'discussion'
href = '#discussion' ]= t 'pull_requests.tabs.discussion'
-if @stats
li role = 'presentation'
a[ data-toggle = 'tab'
role = 'tab'
aria-controls = 'diff'
href = "#diff" ]= "#{t'pull_requests.tabs.diff'} (#{@stats.count})"
-if @commits
- commits_message = @commits.count.to_s
- commits_message << '+' if @total_commits > @commits.count
li role = 'presentation'
a[ data-toggle = 'tab'
role = 'tab'
aria-controls = 'commits'
href = '#commits' ]= "#{t'pull_requests.tabs.commits'} (#{commits_message})"

View File

@ -1,4 +1,4 @@
-ar = 'activerecord.attributes.pull_requests'
-ar = 'activerecord.attributes.pull_request'
-set_meta_tags title: [title_object(@project), t('.title')]
== render 'submenu'
== render "projects/comments/markdown_help" if current_user
@ -8,13 +8,13 @@
.row
.col-lg-12
div role = 'tabpanel'
== render 'nav_tabs'
== render 'nav_tabs_new'
.tab-content
#discussion.tab-pane.active
=hidden_field_tag :update_action, new_project_pull_request_path
= simple_form_for @pull, url: (@pull.already? ? new_project_pull_request_path : project_pull_requests_path),
html: {class: 'form-horizontal', method: (@pull.already? ? :get : :post)} do |f|
html: {method: (@pull.already? ? :get : :post)} do |f|
.form-group.offset20
= f.label :from_project, t("#{ar}.from_project"), class: 'col-sm-2 control-label'
@ -23,6 +23,7 @@
.col-sm-5
= text_field_tag :from_project, @pull.from_project.name_with_owner, readonly: :readonly, style: 'background-color: #DDD;', class: 'form-control col-sm-5'
.col-sm-5== render 'ref_select', kind: 'from', project: @pull.from_project, current: @pull.from_ref
.clearfix.boffset5
.form-group
= f.label :to_project, t("#{ar}.to_project"), class: 'col-sm-2 control-label'
.col-sm-10
@ -32,6 +33,7 @@
id_element: 'pull_request_to_project_id', name: 'to_project',
class: 'form-control col-sm-5'
.col-sm-5== render 'ref_select', kind: 'to', project: @pull.to_project, current: @pull.to_ref
.clearfix
.form-group
.col-sm-offset-2.col-sm-10
@ -40,18 +42,22 @@
id: 'update_pull', data: {'disable-with' => t('layout.processing')}
-unless @pull.already?
.row[ ng-controller = 'IssueController as issueCtrl' ng-cloak = true ]
.col-md-9.col-sm-8== render 'projects/issues/form', f: f
.clearfix
.offset20 ng-controller = 'IssueController as issueCtrl' ng-cloak = true
= f.fields_for :issue do |issue|
== render 'projects/issues/form', f: issue
.form-group
.col-sm-offset-2.col-sm-10
= f.submit t('.submit'), class: 'btn btn-primary', id: 'create_pull',
data: {'disable-with' => t('layout.processing')} unless @pull.already?
- if !@pull.already? && @stats != nil
#diff.tab-pane
.offset20.content ng-hide = 'pullCtrl.processing'
i.fa.fa-spinner.fa-spin.fa-lg.offset20 ng-show = 'pullCtrl.processing'
.offset20.content
== render 'diff_tab'
#commits.tab-pane
.offset20.content ng-hide = 'pullCtrl.processing'
i.fa.fa-spinner.fa-spin.fa-lg.offset20 ng-show = 'pullCtrl.processing'
.offset20.content
== render 'commits_tab'
- content_for :additional_scripts do
== render 'projects/issues/init_service.js.erb'

View File

@ -2,9 +2,7 @@
== render 'submenu'
== render "projects/comments/markdown_help" if current_user
div ng-controller = 'PullRequestController as pullCtrl' ng-cloak = true
.row
.col-lg-12
.col-xs-12.col-md-10.col-md-offset-1 ng-controller = 'PullRequestController as pullCtrl' ng-cloak = true
h3.bpadding10
- PullRequest::STATUSES.each do |status|
= pull_status_label status, 'ng-show' => "pullCtrl.pull.status == '#{status}'"

View File

@ -48,7 +48,7 @@ en:
models:
pull_request: Pull Request
attributes:
pull_requests:
pull_request:
to_ref: Source
from_ref: Receiver
refs: 'branch · tag'

View File

@ -49,7 +49,7 @@ ru:
models:
pull_request: Пул реквест
attributes:
pull_requests:
pull_request:
to_ref: Приемник
from_ref: Источник
refs: 'ветка · тег'