Defect #34998

Cannot open journal dropdown menu after editing note

Added by Mizuki ISHIKAWA 16 days ago. Updated 11 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:UI
Target version:4.2.1
Resolution:Fixed Affected version:4.2.0

Description

After rewriting the journal note, clicking the journal dropdown does not open the menu. Reloading will fix the menu to open.

Updating the journal note runs the following code to redraw the journal actions. The problem is that the .drdn-trigger click event is not set in the dropdown that was redrawn at that time.

  // https://www.redmine.org/projects/redmine/repository/revisions/20875/entry/trunk/app/views/journals/update.js.erb#L5
  $("#change-<%= @journal.id %> .journal-actions").html('<%= escape_javascript(render_journal_actions(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))) %>');

Related to #34714.

screenshot-2021-04-01-9.00.30.png (25.5 KB) Mizuki ISHIKAWA, 2021-04-01 02:08

Associated revisions

Revision 20917
Added by Go MAEDA 11 days ago

Cannot open journal dropdown menu after editing note (#34998).

Patch by Mizuki ISHIKAWA.

Revision 20918
Added by Go MAEDA 11 days ago

Merged r20917 from trunk to 4.2-stable (#34998).

History

#1 Updated by Mizuki ISHIKAWA 16 days ago

The following changes will resolve the issue.

diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index e60425cae..4bb9d9551 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -722,7 +722,7 @@ $(document).ready(function(){

   // This variable is used to focus selected project
   var selected;
-  $(".drdn-trigger").click(function(e){
+  $('#content, #header').on('click', '.drdn-trigger', function(e){
     var drdn = $(this).closest(".drdn");
     if (drdn.hasClass("expanded")) {
       drdn.removeClass("expanded");

#2 Updated by Marius BALTEANU 16 days ago

Mizuki, one question, why not binding directly on document?

#3 Updated by Marius BALTEANU 16 days ago

  • Target version set to 4.2.1

#4 Updated by Mizuki ISHIKAWA 11 days ago

Marius BALTEANU wrote:

Mizuki, one question, why not binding directly on document?

I used "#content, #header" because I thought it was better to narrow down the selector as much as possible.
However, since $("#content, #header") contains almost all elements of Redmine, I think it makes no difference to change $("#content, #header") to $(document).

diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index e60425cae..1bc228236 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -722,7 +722,7 @@ $(document).ready(function(){

   // This variable is used to focus selected project
   var selected;
-  $(".drdn-trigger").click(function(e){
+  $(document).on('click', '.drdn-trigger', function(e){
     var drdn = $(this).closest(".drdn");
     if (drdn.hasClass("expanded")) {
       drdn.removeClass("expanded");

#5 Updated by Go MAEDA 11 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix. Thank you.

Also available in: Atom PDF