diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-08 15:52:59 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-08 15:52:59 +0300 |
commit | 2da289cf22995d14e275b7c908b7e6014a11c7d9 (patch) | |
tree | 4645fadbda91b4dc1c43de3bdc870a3d31c44e0a /app | |
parent | ee3cd06f4cdf0c150801b1268d806b8a252960f5 (diff) | |
download | gitlab-ce-2da289cf22995d14e275b7c908b7e6014a11c7d9.tar.gz |
Add assignee and milestone to 2nd step
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/project_users_select.js.coffee | 2 | ||||
-rw-r--r-- | app/helpers/issues_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/selects_helper.rb | 4 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_form.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_new_submit.html.haml | 22 |
5 files changed, 30 insertions, 4 deletions
diff --git a/app/assets/javascripts/project_users_select.js.coffee b/app/assets/javascripts/project_users_select.js.coffee index 03fad41c490..b0e39610feb 100644 --- a/app/assets/javascripts/project_users_select.js.coffee +++ b/app/assets/javascripts/project_users_select.js.coffee @@ -1,7 +1,7 @@ @projectUsersSelect = init: -> $('.ajax-project-users-select').each (i, select) -> - project_id = $('body').data('project-id') + project_id = $(select).data('project-id') || $('body').data('project-id') $(select).select2 placeholder: $(select).data('placeholder') || "Search for a user" diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 95f0eff58b1..7c58908165c 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -82,7 +82,7 @@ module IssuesHelper end def milestone_options object - options_from_collection_for_select(@project.milestones.active, 'id', 'title', object.milestone_id) + options_from_collection_for_select(object.project.milestones.active, 'id', 'title', object.milestone_id) end def issue_box_class(item) diff --git a/app/helpers/selects_helper.rb b/app/helpers/selects_helper.rb index a1fe4488ae9..ab24367c455 100644 --- a/app/helpers/selects_helper.rb +++ b/app/helpers/selects_helper.rb @@ -14,7 +14,7 @@ module SelectsHelper css_class << (opts[:class] || '') value = opts[:selected] || '' placeholder = opts[:placeholder] || 'Select user' - - hidden_field_tag(id, value, class: css_class, 'data-placeholder' => placeholder) + project_id = opts[:project_id] || @project.id + hidden_field_tag(id, value, class: css_class, 'data-placeholder' => placeholder, 'data-project-id' => project_id) end end diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml index 58994e012f9..ddff3dbead8 100644 --- a/app/views/projects/merge_requests/_form.html.haml +++ b/app/views/projects/merge_requests/_form.html.haml @@ -56,3 +56,7 @@ :javascript disableButtonIfEmptyField("#merge_request_title", ".btn-save"); + $('.assign-to-me-link').on('click', function(e){ + $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change"); + e.preventDefault(); + }); diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index ea79b78e76c..e6e0db55d92 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -25,6 +25,21 @@ = f.label :description, "Description" = f.text_area :description, class: "form-control js-gfm-input", rows: 10 %p.hint Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. + .form-group + .issue-assignee + = f.label :assignee_id do + %i.icon-user + Assign to + %div + = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id, project_id: @merge_request.target_project_id) + + = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' + .form-group + .issue-milestone + = f.label :milestone_id do + %i.icon-time + Milestone + %div= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'}) .panel-footer - if @target_repo.contribution_guide - contribution_guide_url = project_blob_path(@target_project, tree_join(@target_repo.root_ref, @target_repo.contribution_guide.name)) @@ -58,3 +73,10 @@ .bs-callout.bs-callout-danger %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits. %p To preserve performance the line changes are not shown. + + +:javascript + $('.assign-to-me-link').on('click', function(e){ + $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change"); + e.preventDefault(); + }); |