Commit 26552051 authored by Alex Denisov's avatar Alex Denisov

Pre-selected milestone implemented

parent 09263719
No related merge requests found
......@@ -80,6 +80,10 @@ function issuesPage(){
$(this).closest("form").submit();
});
$("#new_issue_link").click(function(){
updateNewIssueURL();
});
$('body').on('ajax:success', '.close_issue, .reopen_issue, #new_issue', function(){
var t = $(this),
totalIssues,
......@@ -126,3 +130,20 @@ function issuesCheckChanged() {
$('.issues_filters').show();
}
}
function updateNewIssueURL(){
var new_issue_link = $("#new_issue_link");
var milestone_id = $("#milestone_id").val();
var assignee_id = $("#assignee_id").val();
var new_href = "";
if(milestone_id){
new_href = "milestone_id=" + milestone_id + "&";
}
if(assignee_id){
new_href = new_href + "assignee_id=" + assignee_id;
}
if(new_href.length){
new_href = new_issue_link.attr("href") + "?" + new_href;
new_issue_link.attr("href", new_href);
}
};
......@@ -38,6 +38,7 @@ class IssuesController < ApplicationController
def new
@issue = @project.issues.new
@issue.milestone_id = params[:milestone_id] if params[:milestone_id].present?
respond_with(@issue)
end
......
......@@ -6,7 +6,7 @@
.right
.span5
- if can? current_user, :write_issue, @project
= link_to new_project_issue_path(@project), class: "right btn", title: "New Issue", remote: true do
= link_to new_project_issue_path(@project), class: "right btn", title: "New Issue", remote: true, id: "new_issue_link" do
%i.icon-plus
New Issue
= form_tag search_project_issues_path(@project), method: :get, remote: true, id: "issue_search_form", class: :right do
......
......@@ -57,6 +57,7 @@ Given /^I fill in issue search with "(.*?)"$/ do |arg1|
end
When /^I select milestone "(.*?)"$/ do |milestone_title|
#puts page.body
select milestone_title, from: "milestone_id"
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment