Project

General

Profile

Feature #3143 » add_notes.diff

Patch from carloskar - C-O L, 2016-10-09 22:32

View differences:

app/views/issues/_action_menu.html.erb
1 1
<div class="contextual">
2
<%= 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? %>
2
<%= 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) %>
3
<%= 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) %>
3 4
<%= 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) %>
4 5
<%= watcher_link(@issue, User.current) %>
5 6
<%= 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? %>
app/views/issues/show.html.erb
111 111

  
112 112
</div>
113 113

  
114
<%= render :partial => 'action_menu' %>
115

  
116
<div style="clear: both;"></div>
117
<% if @issue.editable? %>
118
  <div id="update" style="display:none;">
119
  <h3><%= l(:button_edit) %></h3>
120
  <%= render :partial => 'edit' %>
121
  </div>
122
<% end %>
123

  
114 124
<% if @changesets.present? %>
115 125
<div id="issue-changesets">
116 126
<h3><%=l(:label_associated_revisions)%></h3>
......
125 135
</div>
126 136
<% end %>
127 137

  
128

  
129
<div style="clear: both;"></div>
130
<%= render :partial => 'action_menu' %>
131

  
132
<div style="clear: both;"></div>
133
<% if @issue.editable? %>
134
  <div id="update" style="display:none;">
135
  <h3><%= l(:button_edit) %></h3>
136
  <%= render :partial => 'edit' %>
137
  </div>
138
<% if @issue.editable? || User.current.allowed_to?(:add_issue_notes, @project) %>
139
  <%= render :partial => 'journals/new_notes_form' %>
138 140
<% end %>
139 141

  
140 142
<% other_formats_links do |f| %>
app/views/journals/_new_notes_form.html.erb
1
<div id="new-notes">
2
  <div style="clear: both"></div>
3
  <%= labelled_form_for @issue, :html => {:id => 'new-notes-form', :multipart => true} do |f| %>
4
    <h4><%= l(:field_add_notes) %></h4>
5
    <div class="box">
6
      <fieldset><legend><%= l(:field_notes) %></legend>
7
        <%= f.text_area :notes, :id => "new_notes", :class => 'wiki-edit', :rows => 10, :no_label => true %>
8
        <%= wikitoolbar_for "new_notes" %>	
9

  
10
        <% if @issue.safe_attribute? 'private_notes' %>
11
        <%= f.check_box :private_notes, :id => "private_new_notes", :no_label => true %>
12
          <label for="private_new_notes"><%= l(:field_private_notes) %>  </label>
13
        <% end %>
14
        <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %>
15
      </fieldset>
16
      <fieldset><legend><%= l(:label_attachment_plural) %></legend>
17
        <p><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p>
18
      </fieldset>
19
    </div>
20
    <p><%= submit_tag l(:button_submit) %>
21
    <%= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue),
22
                     "new-notes-form",
23
                     "new_notes_preview" %>
24

  
25
    <div id="new_notes_preview" class="wiki"></div>
26
  <% end %>
27
</div>
app/views/journals/new.js.erb
1
$('#issue_notes').val("<%= raw escape_javascript(@content) %>");
1
$('#new_notes').val("<%= raw escape_javascript(@content) %>");
2 2
<%
3 3
  # when quoting a private journal, check the private checkbox
4 4
  if @journal && @journal.private_notes? 
5 5
%>
6
$('#issue_private_notes').prop('checked', true);
6
$('#private_new_notes').prop('checked', true);
7 7
<% end %>
8 8

  
9
showAndScrollTo("update", "notes");
10
$('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight;
9
showAndScrollTo("new-notes-form", "new_notes");
10
$('#new_notes').scrollTop = $('#new_notes').scrollHeight - $('#new_notes').clientHeight;
config/locales/en.yml
268 268
  field_issue: Issue
269 269
  field_status: Status
270 270
  field_notes: Notes
271
  field_add_notes: Add notes
271 272
  field_is_closed: Issue closed
272 273
  field_is_default: Default value
273 274
  field_tracker: Tracker
......
1013 1014
  button_edit: Edit
1014 1015
  button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
1015 1016
  button_add: Add
1017
  button_add_notes: Add notes
1016 1018
  button_change: Change
1017 1019
  button_apply: Apply
1018 1020
  button_clear: Clear
public/javascripts/attachments.js
2 2
   Copyright (C) 2006-2016  Jean-Philippe Lang */
3 3

  
4 4
function addFile(inputEl, file, eagerUpload) {
5

  
6
  if ($('#attachments_fields').children().length < 10) {
5
  var attachmentsField = $(inputEl).parents('form').find('#attachments_fields')
6
  if (attachmentsField.children().length < 10) {
7 7

  
8 8
    var attachmentId = addFile.nextAttachmentId++;
9 9

  
......
13 13
        $('<input>', { type: 'text', 'class': 'filename readonly', name: 'attachments[' + attachmentId + '][filename]', readonly: 'readonly'} ).val(file.name),
14 14
        $('<input>', { type: 'text', 'class': 'description', name: 'attachments[' + attachmentId + '][description]', maxlength: 255, placeholder: $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
15 15
        $('<a>&nbsp</a>').attr({ href: "#", 'class': 'remove-upload' }).click(removeFile).toggle(!eagerUpload)
16
    ).appendTo('#attachments_fields');
16
    ).appendTo(attachmentsField);
17 17

  
18 18
    if(eagerUpload) {
19 19
      ajaxUpload(file, attachmentId, fileSpan, inputEl);
......
119 119

  
120 120
function addInputFiles(inputEl) {
121 121
  var clearedFileInput = $(inputEl).clone().val('');
122
  var attachmentsField = $(inputEl).parents('form').find('#attachments_fields')
122 123

  
123 124
  if ($.ajaxSettings.xhr().upload && inputEl.files) {
124 125
    // upload files using ajax
......
134 135
    }
135 136
  }
136 137

  
137
  clearedFileInput.insertAfter('#attachments_fields');
138
  clearedFileInput.insertAfter(attachmentsField);
138 139
}
139 140

  
140 141
function uploadAndAttachFiles(files, inputEl) {
......
159 160
  blockEventPropagation(e);
160 161

  
161 162
  if ($.inArray('Files', e.dataTransfer.types) > -1) {
162
    uploadAndAttachFiles(e.dataTransfer.files, $('input:file.file_selector'));
163
    uploadAndAttachFiles(e.dataTransfer.files, $(this).find('input:file.file_selector'));
163 164
  }
164 165
}
165 166

  
......
179 180
    $.event.fixHooks.drop = { props: [ 'dataTransfer' ] };
180 181

  
181 182
    $('form div.box').has('input:file').each(function() {
182
      $(this).on({
183
      $(this).off().on({
183 184
          dragover: dragOverHandler,
184 185
          dragleave: dragOutHandler,
185 186
          drop: handleFileDropEvent
public/stylesheets/application.css
401 401
#issue_tree td.checkbox, #relations td.checkbox {display:none;}
402 402
#relations td.buttons {padding:0;}
403 403

  
404
#new-notes {margin-top: 5px; line-height: 1.4em;}
405
#new-notes fieldset {margin-top: 5px; background-color: #f6f6f6;}
406
#new-notes #new-notes-form {display: inline;}
407

  
404 408
fieldset.collapsible {border-width: 1px 0 0 0;}
405 409
fieldset.collapsible>legend { padding-left: 16px; background: url(../images/arrow_expanded.png) no-repeat 0% 40%; cursor:pointer; }
406 410
fieldset.collapsible.collapsed>legend { background-image: url(../images/arrow_collapsed.png); }
(5-5/13)