diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index 642cef587..8320d1a20 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -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 diff --git a/app/views/projects/comments/_body.html.slim b/app/views/projects/comments/_body.html.slim index d85f5c9fc..ec98ffe5a 100644 --- a/app/views/projects/comments/_body.html.slim +++ b/app/views/projects/comments/_body.html.slim @@ -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') diff --git a/app/views/projects/pull_requests/_nav_tabs_new.html.slim b/app/views/projects/pull_requests/_nav_tabs_new.html.slim new file mode 100644 index 000000000..f963a116d --- /dev/null +++ b/app/views/projects/pull_requests/_nav_tabs_new.html.slim @@ -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})" diff --git a/app/views/projects/pull_requests/new.html.slim b/app/views/projects/pull_requests/new.html.slim index e9680dbb0..9df4d12e1 100644 --- a/app/views/projects/pull_requests/new.html.slim +++ b/app/views/projects/pull_requests/new.html.slim @@ -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 - = f.submit t('.submit'), class: 'btn btn-primary', id: 'create_pull', - data: {'disable-with' => t('layout.processing')} unless @pull.already? + .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' diff --git a/app/views/projects/pull_requests/show.html.slim b/app/views/projects/pull_requests/show.html.slim index bc240d08f..89262f022 100644 --- a/app/views/projects/pull_requests/show.html.slim +++ b/app/views/projects/pull_requests/show.html.slim @@ -2,39 +2,37 @@ == render 'submenu' == render "projects/comments/markdown_help" if current_user -div ng-controller = 'PullRequestController as pullCtrl' ng-cloak = true - .row - .col-lg-12 - h3.bpadding10 - - PullRequest::STATUSES.each do |status| - = pull_status_label status, 'ng-show' => "pullCtrl.pull.status == '#{status}'" - =< pull_header @pull +.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}'" + =< pull_header @pull - div role = 'tabpanel' - == render 'nav_tabs' + div role = 'tabpanel' + == render 'nav_tabs' - .tab-content - #discussion.tab-pane role = 'tabpanel' - div[ ng-controller = 'IssueController as issueCtrl' ng-cloak = true ] - == render 'projects/issues/header' - - ctrl_params = "{ kind: 'pull', id: #{@issue.serial_id} }" - div[ ng-controller = 'CommentsController as commentsCtrl' - ng-init = "commentsCtrl.init('#{@project.name_with_owner}', #{ctrl_params})" ] + .tab-content + #discussion.tab-pane role = 'tabpanel' + div[ ng-controller = 'IssueController as issueCtrl' ng-cloak = true ] + == render 'projects/issues/header' + - ctrl_params = "{ kind: 'pull', id: #{@issue.serial_id} }" + div[ ng-controller = 'CommentsController as commentsCtrl' + ng-init = "commentsCtrl.init('#{@project.name_with_owner}', #{ctrl_params})" ] - #pull-activity ng-hide = 'pullCtrl.processing' - i.fa.fa-spinner.fa-spin.fa-lg ng-show = 'pullCtrl.processing' - - if current_user - hr - == render 'projects/comments/add', project: @project, commentable: @issue - .pull_status.offset20== render 'status' + #pull-activity ng-hide = 'pullCtrl.processing' + i.fa.fa-spinner.fa-spin.fa-lg ng-show = 'pullCtrl.processing' + - if current_user + hr + == render 'projects/comments/add', project: @project, commentable: @issue + .pull_status.offset20== render 'status' - #diff.tab-pane - .offset20.content ng-hide = 'pullCtrl.processing' - i.fa.fa-spinner.fa-spin.fa-lg.offset20 ng-show = 'pullCtrl.processing' + #diff.tab-pane + .offset20.content ng-hide = 'pullCtrl.processing' + i.fa.fa-spinner.fa-spin.fa-lg.offset20 ng-show = 'pullCtrl.processing' - #commits.tab-pane - .offset20.content ng-hide = 'pullCtrl.processing' - i.fa.fa-spinner.fa-spin.fa-lg.offset20 ng-show = 'pullCtrl.processing' + #commits.tab-pane + .offset20.content ng-hide = 'pullCtrl.processing' + i.fa.fa-spinner.fa-spin.fa-lg.offset20 ng-show = 'pullCtrl.processing' div ng-non-bindable = true == render 'projects/comments/new_line' diff --git a/config/locales/models/pull_request.en.yml b/config/locales/models/pull_request.en.yml index 57a0f3a7a..4521c953a 100644 --- a/config/locales/models/pull_request.en.yml +++ b/config/locales/models/pull_request.en.yml @@ -48,7 +48,7 @@ en: models: pull_request: Pull Request attributes: - pull_requests: + pull_request: to_ref: Source from_ref: Receiver refs: 'branch · tag' diff --git a/config/locales/models/pull_request.ru.yml b/config/locales/models/pull_request.ru.yml index 2a9c64888..67fbbcae6 100644 --- a/config/locales/models/pull_request.ru.yml +++ b/config/locales/models/pull_request.ru.yml @@ -49,7 +49,7 @@ ru: models: pull_request: Пул реквест attributes: - pull_requests: + pull_request: to_ref: Приемник from_ref: Источник refs: 'ветка · тег'