Commit 26552051b7af709ad21497747405714006a14b68
1 parent
09263719
Exists in
master
and in
4 other branches
Pre-selected milestone implemented
Showing
4 changed files
with
24 additions
and
1 deletions
Show diff stats
app/assets/javascripts/issues.js
| @@ -80,6 +80,10 @@ function issuesPage(){ | @@ -80,6 +80,10 @@ function issuesPage(){ | ||
| 80 | $(this).closest("form").submit(); | 80 | $(this).closest("form").submit(); |
| 81 | }); | 81 | }); |
| 82 | 82 | ||
| 83 | + $("#new_issue_link").click(function(){ | ||
| 84 | + updateNewIssueURL(); | ||
| 85 | + }); | ||
| 86 | + | ||
| 83 | $('body').on('ajax:success', '.close_issue, .reopen_issue, #new_issue', function(){ | 87 | $('body').on('ajax:success', '.close_issue, .reopen_issue, #new_issue', function(){ |
| 84 | var t = $(this), | 88 | var t = $(this), |
| 85 | totalIssues, | 89 | totalIssues, |
| @@ -126,3 +130,20 @@ function issuesCheckChanged() { | @@ -126,3 +130,20 @@ function issuesCheckChanged() { | ||
| 126 | $('.issues_filters').show(); | 130 | $('.issues_filters').show(); |
| 127 | } | 131 | } |
| 128 | } | 132 | } |
| 133 | + | ||
| 134 | +function updateNewIssueURL(){ | ||
| 135 | + var new_issue_link = $("#new_issue_link"); | ||
| 136 | + var milestone_id = $("#milestone_id").val(); | ||
| 137 | + var assignee_id = $("#assignee_id").val(); | ||
| 138 | + var new_href = ""; | ||
| 139 | + if(milestone_id){ | ||
| 140 | + new_href = "milestone_id=" + milestone_id + "&"; | ||
| 141 | + } | ||
| 142 | + if(assignee_id){ | ||
| 143 | + new_href = new_href + "assignee_id=" + assignee_id; | ||
| 144 | + } | ||
| 145 | + if(new_href.length){ | ||
| 146 | + new_href = new_issue_link.attr("href") + "?" + new_href; | ||
| 147 | + new_issue_link.attr("href", new_href); | ||
| 148 | + } | ||
| 149 | +}; |
app/controllers/issues_controller.rb
| @@ -38,6 +38,7 @@ class IssuesController < ApplicationController | @@ -38,6 +38,7 @@ class IssuesController < ApplicationController | ||
| 38 | 38 | ||
| 39 | def new | 39 | def new |
| 40 | @issue = @project.issues.new | 40 | @issue = @project.issues.new |
| 41 | + @issue.milestone_id = params[:milestone_id] if params[:milestone_id].present? | ||
| 41 | respond_with(@issue) | 42 | respond_with(@issue) |
| 42 | end | 43 | end |
| 43 | 44 |
app/views/issues/index.html.haml
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | .right | 6 | .right |
| 7 | .span5 | 7 | .span5 |
| 8 | - if can? current_user, :write_issue, @project | 8 | - if can? current_user, :write_issue, @project |
| 9 | - = link_to new_project_issue_path(@project), class: "right btn", title: "New Issue", remote: true do | 9 | + = link_to new_project_issue_path(@project), class: "right btn", title: "New Issue", remote: true, id: "new_issue_link" do |
| 10 | %i.icon-plus | 10 | %i.icon-plus |
| 11 | New Issue | 11 | New Issue |
| 12 | = form_tag search_project_issues_path(@project), method: :get, remote: true, id: "issue_search_form", class: :right do | 12 | = form_tag search_project_issues_path(@project), method: :get, remote: true, id: "issue_search_form", class: :right do |
features/step_definitions/project/project_issues_steps.rb
| @@ -57,6 +57,7 @@ Given /^I fill in issue search with "(.*?)"$/ do |arg1| | @@ -57,6 +57,7 @@ Given /^I fill in issue search with "(.*?)"$/ do |arg1| | ||
| 57 | end | 57 | end |
| 58 | 58 | ||
| 59 | When /^I select milestone "(.*?)"$/ do |milestone_title| | 59 | When /^I select milestone "(.*?)"$/ do |milestone_title| |
| 60 | + #puts page.body | ||
| 60 | select milestone_title, from: "milestone_id" | 61 | select milestone_title, from: "milestone_id" |
| 61 | end | 62 | end |
| 62 | 63 |