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
<div style="clear: both;"></div>
<%= render :partial => 'action_menu' %>
<% if @issue.editable? || User.current.allowed_to?(:add_issue_notes, @project) %>
<%= render :partial => 'journals/notes_new_form' %>
<% end %>
<div style="clear: both;"></div>
<% if @issue.editable? %>
app/views/journals/_notes_new_form.html.erb
<div id="quick-note">
<%= link_to l('button_add_notes'), {}, :id => "add-note", :class => "icon icon-comment", :onclick => "showAddNotesForm(); return false;"%>
<div style="clear: both"></div>
<%= labelled_form_for @issue, :html => {:id => 'journal-new-form', :multipart => true} do |f| %>
<fieldset>
<legend><%= l(:field_notes) %></legend>
<%= f.text_area :notes, :id => "journal_new_notes", :class => 'wiki-edit', :rows => 10, :no_label => true %>
<% if @issue.safe_attribute? 'private_notes' %>
<%= f.check_box :private_notes, :no_label => true %>
<label for="issue_private_notes"><%= l(:field_private_notes) %> </label>
<% end %>
<%= call_hook(:view_journals_notes_form_after_notes, { :issue => @issue}) %>
<p><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p>
</fieldset>
<p><%= submit_tag l(:button_submit) %>
<%= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue),
"journal-new-form",
"journal_new_preview" %> |
<%= link_to l(:button_cancel), '#', :onclick => "hideAddNotesForm(); return false;" %></p>
<div id="journal_new_preview" class="wiki"></div>
<% end %>
<%= wikitoolbar_for "journal_new_notes" %>
</div>
config/locales/en.yml
button_close: Close
button_reopen: Reopen
button_import: Import
button_add_notes: Add notes
status_active: active
status_registered: registered
public/javascripts/application.js
function toggleDisabledInit() {
$('input[data-disables], input[data-enables]').each(toggleDisabledOnChange);
}
function showAddNotesForm(){
$('#journal-new-form').show().find('#journal_new_notes').focus();
$("a#add-note").hide();
}
function hideAddNotesForm(){
$('#journal-new-form').hide();
$('#add-note').show();
}
$(document).ready(function(){
$('#content').on('change', 'input[data-disables], input[data-enables]', toggleDisabledOnChange);
toggleDisabledInit();
public/stylesheets/application.css
#issue_tree td.checkbox, #relations td.checkbox {display:none;}
#relations td.buttons {padding:0;}
#quick-note {margin-top: 5px; line-height: 1.4em;}
#quick-note fieldset {margin-top: 5px; background-color: #f6f6f6;}
#quick-note #journal-new-form {display: none;}
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); }
(3-3/14)