Make new/edit issue forms use containers on the page instead of adding their own

Fixes #1830
This commit is contained in:
Riyad Preukschas 2012-10-27 17:35:15 +02:00
parent 2f5e44a02d
commit 17cec05087
4 changed files with 10 additions and 12 deletions

View file

@ -1,6 +1,5 @@
function switchToNewIssue(form){
function switchToNewIssue(){
$(".issues_content").hide("fade", { direction: "left" }, 150, function(){
$(".issues_content").after(form);
$('select#issue_assignee_id').chosen();
$('select#issue_milestone_id').chosen();
$("#new_issue_dialog").show("fade", { direction: "right" }, 150);
@ -10,9 +9,8 @@ function switchToNewIssue(form){
});
}
function switchToEditIssue(form){
function switchToEditIssue(){
$(".issues_content").hide("fade", { direction: "left" }, 150, function(){
$(".issues_content").after(form);
$('select#issue_assignee_id').chosen();
$('select#issue_milestone_id').chosen();
$("#edit_issue_dialog").show("fade", { direction: "right" }, 150);
@ -33,8 +31,8 @@ function switchFromEditIssue(){
function backToIssues(){
$("#edit_issue_dialog, #new_issue_dialog").hide("fade", { direction: "right" }, 150, function(){
$(".issues_content").show("fade", { direction: "left" }, 150, function() {
$("#edit_issue_dialog").remove();
$("#new_issue_dialog").remove();
$("#edit_issue_dialog").html("");
$("#new_issue_dialog").html("");
$('.add_new').show();
});
});

View file

@ -1,5 +1,4 @@
:plain
var edit_issue_dialog = $("<div id='edit_issue_dialog'></div>");
edit_issue_dialog.html("#{escape_javascript(render('form'))}");
switchToEditIssue(edit_issue_dialog);
$("#edit_issue_dialog").html("#{escape_javascript(render('form'))}");
switchToEditIssue();

View file

@ -58,6 +58,8 @@
%ul#issues-table.unstyled.issues_table
= render "issues"
#new_issue_dialog
#edit_issue_dialog
:javascript
$(function(){

View file

@ -1,4 +1,3 @@
:plain
var new_issue_dialog = $("<div id='new_issue_dialog'></div>");
new_issue_dialog.html("#{escape_javascript(render('form'))}");
switchToNewIssue(new_issue_dialog);
$("#new_issue_dialog").html("#{escape_javascript(render('form'))}");
switchToNewIssue();