summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/issues/edit.js.erb15
-rw-r--r--public/javascripts/application.js9
-rw-r--r--test/system/issues_test.rb20
3 files changed, 36 insertions, 8 deletions
diff --git a/app/views/issues/edit.js.erb b/app/views/issues/edit.js.erb
index ed8fc3ca8..e95336824 100644
--- a/app/views/issues/edit.js.erb
+++ b/app/views/issues/edit.js.erb
@@ -1 +1,14 @@
-replaceIssueFormWith('<%= escape_javascript(render :partial => 'edit') %>');
+replaceIssueFormWith('<%= escape_javascript(render :partial => 'form') %>');
+<% if User.current.allowed_to?(:log_time, @issue.project) %>
+ $('#log_time').show();
+<% else %>
+ $('#log_time').hide();
+<% end %>
+
+<% if @issue.notes_addable? %>
+ $('#add_notes').show();
+ $('#add_attachments').show();
+<% else %>
+ $('#add_notes').hide();
+ $('#add_attachments').hide();
+<% end %> \ No newline at end of file
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index efff38da7..91da19229 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -622,13 +622,8 @@ function replaceIssueFormWith(html){
replacement.find('#'+object_id).val($(this).val());
}
});
-
- if ($('form.new_issue').length > 0) {
- $('#all_attributes').empty();
- $('#all_attributes').prepend(replacement);
- } else {
- $('#issue-form').replaceWith(replacement);
- }
+ $('#all_attributes').empty();
+ $('#all_attributes').prepend(replacement);
}
function updateBulkEditFrom(url) {
diff --git a/test/system/issues_test.rb b/test/system/issues_test.rb
index 2476dc43e..5179c6e80 100644
--- a/test/system/issues_test.rb
+++ b/test/system/issues_test.rb
@@ -256,6 +256,26 @@ class IssuesSystemTest < ApplicationSystemTestCase
assert_equal 5, issue.reload.status.id
end
+ def test_update_issue_with_form_update_should_keep_newly_added_attachments
+ set_tmp_attachments_directory
+ log_user('jsmith', 'jsmith')
+
+ visit '/issues/2'
+ page.first(:link, 'Edit').click
+ attach_file 'attachments[dummy][file]', Rails.root.join('test/fixtures/files/testfile.txt')
+
+ assert page.has_css?('span#attachments_1')
+
+ page.find("#issue_status_id").select("Closed")
+
+ # check that attachment still exists on the page
+ assert page.has_css?('span#attachments_1')
+
+ click_on 'Submit'
+
+ assert_equal 1, Issue.find(2).attachments.count
+ end
+
test "removing issue shows confirm dialog" do
log_user('jsmith', 'jsmith')
visit '/issues/1'