Pre-selected milestone implemented

This commit is contained in:
Alex Denisov 2012-09-07 16:35:59 +03:00
parent 09263719d5
commit 26552051b7
4 changed files with 24 additions and 1 deletions

View file

@ -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);
}
};

View file

@ -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

View file

@ -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

View file

@ -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