diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb index 1904f2171..b9712bd03 100644 --- a/app/views/issues/_action_menu.html.erb +++ b/app/views/issues/_action_menu.html.erb @@ -1,6 +1,9 @@
+<%= link_to l(:button_add_notes), edit_issue_path(@issue), + :onclick => 'showAndScrollToAddNotes(); return false;', + :class => 'icon icon-add' if @issue.editable? %> <%= link_to l(:button_edit), edit_issue_path(@issue), - :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', + :onclick => 'showAndScrollToEditIssue("update", "issue_notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? %> <%= 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) %> diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index 226b6f988..88d45cb5c 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -3,7 +3,7 @@ <%= render :partial => 'conflict' if @conflict %>
<% if @issue.attributes_editable? %> -
<%= l(:label_change_properties) %> +
<%= l(:label_change_properties) %>
<%= render :partial => 'form', :locals => {:f => f} %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index d12c54497..0d24c4b9c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1146,6 +1146,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/application.js b/public/javascripts/application.js index 7b2e7725e..d4e214aea 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -27,6 +27,20 @@ function showAndScrollTo(id, focus) { $('html, body').animate({scrollTop: $('#'+id).offset().top}, 100); } +function showAndScrollToEditIssue() { + $('#update h3').show(); + $('#attributes').show(); + $('#log_time').show(); + showAndScrollTo('update', 'issue_notes'); +} + +function showAndScrollToAddNotes() { + $('#update h3').hide(); + $('#attributes').hide(); + $('#log_time').hide(); + showAndScrollTo('update', 'issue_notes'); +} + function toggleRowGroup(el) { var tr = $(el).parents('tr').first(); var n = tr.next(); diff --git a/test/system/add_notes_button_test.rb b/test/system/add_notes_button_test.rb new file mode 100644 index 000000000..e548225a6 --- /dev/null +++ b/test/system/add_notes_button_test.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +# Redmine - project management software +# Copyright (C) 2006-2023 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +require_relative '../application_system_test_case' + +class AddNotesButtonTest < ApplicationSystemTestCase + fixtures :issues, :users, :projects, :members, :member_roles, :roles, :enumerations, :trackers, :projects_trackers, + :enabled_modules, :issue_statuses + + def test_add_notes_button + log_user('jsmith', 'jsmith') + visit 'issues/1' + + assert has_css? '.contextual .icon-edit' + + # Hidden by default + assert has_css? '#update', visible: :hidden + + first('.contextual .icon-add').click + + # Issue attributes are hidden + assert has_css? '#update', visible: :visible + assert has_css? '#update h3', visible: :hidden + assert has_css? 'fieldset:has(#all_attributes)', visible: :hidden + assert has_css? '#update #log_time', visible: :hidden + # Notes form is visible + assert has_css? '#update #add_notes', visible: :visible + assert has_css? '#update #add_attachments', visible: :visible + + first('.contextual .icon-edit').click + + assert has_css? '#update', visible: :visible + assert has_css? '#update h3', visible: :visible + assert has_css? 'fieldset:has(#all_attributes)', visible: :visible + assert has_css? '#update #log_time', visible: :visible + end +end