Project

General

Profile

Feature #3143 » 3143.patch

Dmitry Makurin , 2023-01-11 13:38

View differences:

app/views/issues/_action_menu.html.erb
1 1
<div class="contextual">
2
<%= link_to l(:button_add_notes), edit_issue_path(@issue),
3
            :onclick => 'showAndScrollToAddNotes(); return false;',
4
            :class => 'icon icon-add' if @issue.editable? %>
2 5
<%= link_to l(:button_edit), edit_issue_path(@issue),
3
            :onclick => 'showAndScrollTo("update", "issue_notes"); return false;',
6
            :onclick => 'showAndScrollToEditIssue("update", "issue_notes"); return false;',
4 7
            :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? %>
5 8
<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue),
6 9
            :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %>
app/views/issues/_edit.html.erb
3 3
    <%= render :partial => 'conflict' if @conflict %>
4 4
    <div class="box">
5 5
    <% if @issue.attributes_editable? %>
6
        <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend>
6
        <fieldset id="attributes" class="tabular"><legend><%= l(:label_change_properties) %></legend>
7 7
        <div id="all_attributes">
8 8
        <%= render :partial => 'form', :locals => {:f => f} %>
9 9
        </div>
config/locales/en.yml
1146 1146
  button_edit: Edit
1147 1147
  button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
1148 1148
  button_add: Add
1149
  button_add_notes: Add notes
1149 1150
  button_change: Change
1150 1151
  button_apply: Apply
1151 1152
  button_clear: Clear
public/javascripts/application.js
27 27
  $('html, body').animate({scrollTop: $('#'+id).offset().top}, 100);
28 28
}
29 29

  
30
function showAndScrollToEditIssue() {
31
  $('#update h3').show();
32
  $('#attributes').show();
33
  $('#log_time').show();
34
  showAndScrollTo('update', 'issue_notes');
35
}
36

  
37
function showAndScrollToAddNotes() {
38
  $('#update h3').hide();
39
  $('#attributes').hide();
40
  $('#log_time').hide();
41
  showAndScrollTo('update', 'issue_notes');
42
}
43

  
30 44
function toggleRowGroup(el) {
31 45
  var tr = $(el).parents('tr').first();
32 46
  var n = tr.next();
test/system/add_notes_button_test.rb
1
# frozen_string_literal: true
2

  
3
# Redmine - project management software
4
# Copyright (C) 2006-2023  Jean-Philippe Lang
5
#
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License
8
# as published by the Free Software Foundation; either version 2
9
# of the License, or (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19

  
20
require_relative '../application_system_test_case'
21

  
22
class AddNotesButtonTest < ApplicationSystemTestCase
23
  fixtures :issues, :users, :projects, :members, :member_roles, :roles, :enumerations, :trackers, :projects_trackers,
24
           :enabled_modules, :issue_statuses
25

  
26
  def test_add_notes_button
27
    log_user('jsmith', 'jsmith')
28
    visit 'issues/1'
29

  
30
    assert has_css? '.contextual .icon-edit'
31

  
32
    # Hidden by default
33
    assert has_css? '#update', visible: :hidden
34

  
35
    first('.contextual .icon-add').click
36

  
37
    # Issue attributes are hidden
38
    assert has_css? '#update', visible: :visible
39
    assert has_css? '#update h3', visible: :hidden
40
    assert has_css? 'fieldset:has(#all_attributes)', visible: :hidden
41
    assert has_css? '#update #log_time', visible: :hidden
42
    # Notes form is visible
43
    assert has_css? '#update #add_notes', visible: :visible
44
    assert has_css? '#update #add_attachments', visible: :visible
45

  
46
    first('.contextual .icon-edit').click
47

  
48
    assert has_css? '#update', visible: :visible
49
    assert has_css? '#update h3', visible: :visible
50
    assert has_css? 'fieldset:has(#all_attributes)', visible: :visible
51
    assert has_css? '#update #log_time', visible: :visible
52
  end
53
end
(13-13/13)