Project

General

Profile

Feature #3143 » add_notes_button.patch

Marius BĂLTEANU, 2016-04-16 19:20

View differences:

app/views/issues/show.html.erb
128 128

  
129 129
<div style="clear: both;"></div>
130 130
<%= render :partial => 'action_menu' %>
131
<% if @issue.editable? || User.current.allowed_to?(:add_issue_notes, @project) %>
132
  <%= render :partial => 'journals/notes_new_form' %>
133
<% end %>
131 134

  
132 135
<div style="clear: both;"></div>
133 136
<% if @issue.editable? %>
app/views/journals/_notes_new_form.html.erb
1
<div id="quick-note">
2
  <%= link_to l('button_add_notes'), {}, :id => "add-note", :class => "icon icon-comment", :onclick => "showAddNotesForm(); return false;"%>
3

  
4
  <div style="clear: both"></div>
5
  <%= labelled_form_for @issue, :html => {:id => 'journal-new-form', :multipart => true} do |f| %>
6
    <fieldset>
7
    <legend><%= l(:field_notes) %></legend>
8
    <%= f.text_area :notes, :id => "journal_new_notes", :class => 'wiki-edit', :rows => 10, :no_label => true %>
9

  
10
    <% if @issue.safe_attribute? 'private_notes' %>
11
    <%= f.check_box :private_notes, :no_label => true %>
12
      <label for="issue_private_notes"><%= l(:field_private_notes) %>  </label>
13
    <% end %>
14
    <%= call_hook(:view_journals_notes_form_after_notes, { :issue => @issue}) %>
15

  
16
    <p><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p>
17
    </fieldset>
18
    <p><%= submit_tag l(:button_submit) %>
19
    <%= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue),
20
                     "journal-new-form",
21
                     "journal_new_preview" %> |
22
    <%= link_to l(:button_cancel), '#', :onclick => "hideAddNotesForm(); return false;" %></p>
23

  
24
    <div id="journal_new_preview" class="wiki"></div>
25
<% end %>
26
<%= wikitoolbar_for "journal_new_notes" %>
27
</div>
config/locales/en.yml
1042 1042
  button_close: Close
1043 1043
  button_reopen: Reopen
1044 1044
  button_import: Import
1045
  button_add_notes: Add notes
1045 1046

  
1046 1047
  status_active: active
1047 1048
  status_registered: registered
public/javascripts/application.js
680 680
function toggleDisabledInit() {
681 681
  $('input[data-disables], input[data-enables]').each(toggleDisabledOnChange);
682 682
}
683

  
684
function showAddNotesForm(){
685
  $('#journal-new-form').show().find('#journal_new_notes').focus();
686
  $("a#add-note").hide();
687
}
688
function hideAddNotesForm(){
689
  $('#journal-new-form').hide();
690
  $('#add-note').show();
691
}
692

  
683 693
$(document).ready(function(){
684 694
  $('#content').on('change', 'input[data-disables], input[data-enables]', toggleDisabledOnChange);
685 695
  toggleDisabledInit();
public/stylesheets/application.css
380 380
#issue_tree td.checkbox, #relations td.checkbox {display:none;}
381 381
#relations td.buttons {padding:0;}
382 382

  
383
#quick-note {margin-top: 5px; line-height: 1.4em;}
384
#quick-note fieldset {margin-top: 5px; background-color: #f6f6f6;}
385
#quick-note #journal-new-form {display: none;}
386

  
383 387
fieldset.collapsible {border-width: 1px 0 0 0;}
384 388
fieldset.collapsible>legend { padding-left: 16px; background: url(../images/arrow_expanded.png) no-repeat 0% 40%; cursor:pointer; }
385 389
fieldset.collapsible.collapsed>legend { background-image: url(../images/arrow_collapsed.png); }
(3-3/13)