diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb
index b535fae..2132c8c 100644
--- a/app/views/issues/_action_menu.html.erb
+++ b/app/views/issues/_action_menu.html.erb
@@ -1,5 +1,6 @@
-<%= link_to l(:button_edit), edit_issue_path(@issue), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? %>
+<%= link_to l(:button_add_notes), edit_issue_path(@issue), :onclick => 'showAndScrollTo("new-notes-form", "new_notes"); return false;', :class =>'icon icon-comment' if User.current.allowed_to?(:add_issue_notes, @project) %>
+<%= link_to l(:button_edit), edit_issue_path(@issue), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue), :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %>
<%= watcher_link(@issue, User.current) %>
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:copy_issues, @project) && Issue.allowed_target_projects.any? %>
diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb
index 2cbff32..7eb72f4 100644
--- a/app/views/issues/show.html.erb
+++ b/app/views/issues/show.html.erb
@@ -111,6 +111,16 @@ end %>
+<%= render :partial => 'action_menu' %>
+
+
+<% if @issue.editable? %>
+
+
<%= l(:button_edit) %>
+ <%= render :partial => 'edit' %>
+
+<% end %>
+
<% if @changesets.present? %>
<%=l(:label_associated_revisions)%>
@@ -125,16 +135,8 @@ end %>
<% end %>
-
-
-<%= render :partial => 'action_menu' %>
-
-
-<% if @issue.editable? %>
-
-
<%= l(:button_edit) %>
- <%= render :partial => 'edit' %>
-
+<% if @issue.editable? || User.current.allowed_to?(:add_issue_notes, @project) %>
+ <%= render :partial => 'journals/new_notes_form' %>
<% end %>
<% other_formats_links do |f| %>
diff --git a/app/views/journals/_new_notes_form.html.erb b/app/views/journals/_new_notes_form.html.erb
new file mode 100644
index 0000000..10bdbc8
--- /dev/null
+++ b/app/views/journals/_new_notes_form.html.erb
@@ -0,0 +1,27 @@
+
+
+ <%= labelled_form_for @issue, :html => {:id => 'new-notes-form', :multipart => true} do |f| %>
+
<%= l(:field_add_notes) %>
+
+
+
+
+
<%= submit_tag l(:button_submit) %>
+ <%= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue),
+ "new-notes-form",
+ "new_notes_preview" %>
+
+
+ <% end %>
+
diff --git a/app/views/journals/new.js.erb b/app/views/journals/new.js.erb
index cd6ab0d..30afc9b 100644
--- a/app/views/journals/new.js.erb
+++ b/app/views/journals/new.js.erb
@@ -1,10 +1,10 @@
-$('#issue_notes').val("<%= raw escape_javascript(@content) %>");
+$('#new_notes').val("<%= raw escape_javascript(@content) %>");
<%
# when quoting a private journal, check the private checkbox
if @journal && @journal.private_notes?
%>
-$('#issue_private_notes').prop('checked', true);
+$('#private_new_notes').prop('checked', true);
<% end %>
-showAndScrollTo("update", "notes");
-$('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight;
+showAndScrollTo("new-notes-form", "new_notes");
+$('#new_notes').scrollTop = $('#new_notes').scrollHeight - $('#new_notes').clientHeight;
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a6501c3..34d02b0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -268,6 +268,7 @@ en:
field_issue: Issue
field_status: Status
field_notes: Notes
+ field_add_notes: Add notes
field_is_closed: Issue closed
field_is_default: Default value
field_tracker: Tracker
@@ -1013,6 +1014,7 @@ en:
button_edit: Edit
button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
button_add: Add
+ button_add_notes: Add notes
button_change: Change
button_apply: Apply
button_clear: Clear
diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js
index f335245..75586ff 100644
--- a/public/javascripts/attachments.js
+++ b/public/javascripts/attachments.js
@@ -2,8 +2,8 @@
Copyright (C) 2006-2016 Jean-Philippe Lang */
function addFile(inputEl, file, eagerUpload) {
-
- if ($('#attachments_fields').children().length < 10) {
+ var attachmentsField = $(inputEl).parents('form').find('#attachments_fields')
+ if (attachmentsField.children().length < 10) {
var attachmentId = addFile.nextAttachmentId++;
@@ -13,7 +13,7 @@ function addFile(inputEl, file, eagerUpload) {
$('', { type: 'text', 'class': 'filename readonly', name: 'attachments[' + attachmentId + '][filename]', readonly: 'readonly'} ).val(file.name),
$('', { type: 'text', 'class': 'description', name: 'attachments[' + attachmentId + '][description]', maxlength: 255, placeholder: $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
$(' ').attr({ href: "#", 'class': 'remove-upload' }).click(removeFile).toggle(!eagerUpload)
- ).appendTo('#attachments_fields');
+ ).appendTo(attachmentsField);
if(eagerUpload) {
ajaxUpload(file, attachmentId, fileSpan, inputEl);
@@ -119,6 +119,7 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) {
function addInputFiles(inputEl) {
var clearedFileInput = $(inputEl).clone().val('');
+ var attachmentsField = $(inputEl).parents('form').find('#attachments_fields')
if ($.ajaxSettings.xhr().upload && inputEl.files) {
// upload files using ajax
@@ -134,7 +135,7 @@ function addInputFiles(inputEl) {
}
}
- clearedFileInput.insertAfter('#attachments_fields');
+ clearedFileInput.insertAfter(attachmentsField);
}
function uploadAndAttachFiles(files, inputEl) {
@@ -159,7 +160,7 @@ function handleFileDropEvent(e) {
blockEventPropagation(e);
if ($.inArray('Files', e.dataTransfer.types) > -1) {
- uploadAndAttachFiles(e.dataTransfer.files, $('input:file.file_selector'));
+ uploadAndAttachFiles(e.dataTransfer.files, $(this).find('input:file.file_selector'));
}
}
@@ -179,7 +180,7 @@ function setupFileDrop() {
$.event.fixHooks.drop = { props: [ 'dataTransfer' ] };
$('form div.box').has('input:file').each(function() {
- $(this).on({
+ $(this).off().on({
dragover: dragOverHandler,
dragleave: dragOutHandler,
drop: handleFileDropEvent
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 598939c..e9ae803 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -401,6 +401,10 @@ div.issue.overdue .due-date .value { color: #c22; }
#issue_tree td.checkbox, #relations td.checkbox {display:none;}
#relations td.buttons {padding:0;}
+#new-notes {margin-top: 5px; line-height: 1.4em;}
+#new-notes fieldset {margin-top: 5px; background-color: #f6f6f6;}
+#new-notes #new-notes-form {display: inline;}
+
fieldset.collapsible {border-width: 1px 0 0 0;}
fieldset.collapsible>legend { padding-left: 16px; background: url(../images/arrow_expanded.png) no-repeat 0% 40%; cursor:pointer; }
fieldset.collapsible.collapsed>legend { background-image: url(../images/arrow_collapsed.png); }