From 40bae6c943753ff681c8275fbc674418243d3a9b Mon Sep 17 00:00:00 2001 From: Akihiro MATOBA Date: Sat, 15 Jan 2022 07:02:36 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A5=E3=81=AE=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=BC=E3=83=A0=E3=81=AB=E3=81=99=E3=82=8B=E3=81=93=E3=81=A8?= =?UTF-8?q?=E3=81=A7=E5=AE=9F=E7=8F=BE=E3=81=97=E3=81=A6=E3=81=BF=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mizuki Ishikawa Nori_Takahashii --- app/views/issues/_action_menu.html.erb | 2 +- app/views/issues/_action_menu_edit.html.erb | 25 +++++++++++++++++++++ app/views/issues/_edit.html.erb | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb index 1904f21711..498585021e 100644 --- a/app/views/issues/_action_menu.html.erb +++ b/app/views/issues/_action_menu.html.erb @@ -1,6 +1,6 @@
<%= link_to l(:button_edit), edit_issue_path(@issue), - :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', + :onclick => '$("#issue-notes-form").hide(); showAndScrollTo("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/_action_menu_edit.html.erb b/app/views/issues/_action_menu_edit.html.erb index a189d7c453..5cf7f9edf3 100644 --- a/app/views/issues/_action_menu_edit.html.erb +++ b/app/views/issues/_action_menu_edit.html.erb @@ -8,3 +8,28 @@ <%= render :partial => 'edit' %>
<% end %> + +<%= labelled_form_for @issue, :html => {:id => 'issue-notes-form', :multipart => true} do |f| %> + <%= render :partial => 'conflict' if @conflict %> +
+ <% if @issue.notes_addable? %> +
<%= l(:field_notes) %> + <%= f.text_area :notes, :cols => 60, :rows => 4, :class => 'wiki-edit', + :data => { + :auto_complete => true + }, + :no_label => true, :id => 'only-issue-notes' %> + <%= wikitoolbar_for 'only-issue-notes', preview_issue_path(:project_id => @project, :issue_id => @issue) %> + + <% if @issue.safe_attribute? 'private_notes' %> + <%= f.check_box :private_notes, :no_label => true %> + <% end %> + + <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %> +
+ + <% end %> +
+ + <%= submit_tag l(:button_submit) %> +<% end %> diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index d816ff6fc5..7fdc1b75ba 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -75,7 +75,7 @@ <%= submit_tag l(:button_submit) %> <%= link_to( l(:button_cancel), issue_path(id: @issue.id), - :onclick => params[:action] == 'show' ? "$('#update').hide(); return false;" : '' + :onclick => params[:action] == 'show' ? "$('#update').hide(); $('#issue-notes-form').show(); return false;" : '' ) %> <%= hidden_field_tag 'prev_issue_id', @prev_issue_id if @prev_issue_id %> <%= hidden_field_tag 'next_issue_id', @next_issue_id if @next_issue_id %> From a8311617e097c5d320122c5fc91e7bd69ed173f0 Mon Sep 17 00:00:00 2001 From: Akihiro MATOBA Date: Sat, 15 Jan 2022 07:42:14 +0000 Subject: [PATCH 2/2] add some guards --- app/views/issues/_action_menu.html.erb | 2 +- app/views/issues/_action_menu_edit.html.erb | 37 ++++++++++----------- app/views/issues/_edit.html.erb | 2 +- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb index 498585021e..7f5d4886dd 100644 --- a/app/views/issues/_action_menu.html.erb +++ b/app/views/issues/_action_menu.html.erb @@ -1,6 +1,6 @@
<%= link_to l(:button_edit), edit_issue_path(@issue), - :onclick => '$("#issue-notes-form").hide(); showAndScrollTo("update", "issue_notes"); return false;', + :onclick => 'showAndScrollTo("update", "issue_notes"); if ($("#issue-notes-form").length) {$("#issue-notes-form").hide();}; 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/_action_menu_edit.html.erb b/app/views/issues/_action_menu_edit.html.erb index 5cf7f9edf3..22d01051c2 100644 --- a/app/views/issues/_action_menu_edit.html.erb +++ b/app/views/issues/_action_menu_edit.html.erb @@ -9,27 +9,26 @@
<% end %> -<%= labelled_form_for @issue, :html => {:id => 'issue-notes-form', :multipart => true} do |f| %> - <%= render :partial => 'conflict' if @conflict %> -
- <% if @issue.notes_addable? %> -
<%= l(:field_notes) %> - <%= f.text_area :notes, :cols => 60, :rows => 4, :class => 'wiki-edit', - :data => { - :auto_complete => true - }, - :no_label => true, :id => 'only-issue-notes' %> - <%= wikitoolbar_for 'only-issue-notes', preview_issue_path(:project_id => @project, :issue_id => @issue) %> +<% if @issue.notes_addable? %> + <%= labelled_form_for @issue, :html => {:id => 'issue-notes-form', :multipart => true} do |f| %> + <%= render :partial => 'conflict' if @conflict %> +
+
<%= l(:field_notes) %> + <%= f.text_area :notes, :cols => 60, :rows => 4, :class => 'wiki-edit', + :data => { + :auto_complete => true + }, + :no_label => true, :id => 'only-issue-notes' %> + <%= wikitoolbar_for 'only-issue-notes', preview_issue_path(:project_id => @project, :issue_id => @issue) %> - <% if @issue.safe_attribute? 'private_notes' %> - <%= f.check_box :private_notes, :no_label => true %> - <% end %> + <% if @issue.safe_attribute? 'private_notes' %> + <%= f.check_box :private_notes, :no_label => true %> + <% end %> - <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %> -
+ <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %> +
+
+ <%= submit_tag l(:button_submit) %> <% end %> - - - <%= submit_tag l(:button_submit) %> <% end %> diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index 7fdc1b75ba..11d5d7fd29 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -75,7 +75,7 @@ <%= submit_tag l(:button_submit) %> <%= link_to( l(:button_cancel), issue_path(id: @issue.id), - :onclick => params[:action] == 'show' ? "$('#update').hide(); $('#issue-notes-form').show(); return false;" : '' + :onclick => params[:action] == 'show' ? "$('#update').hide(); if($('#issue-notes-form').length) {$('#issue-notes-form').show();}; return false;" : '' ) %> <%= hidden_field_tag 'prev_issue_id', @prev_issue_id if @prev_issue_id %> <%= hidden_field_tag 'next_issue_id', @next_issue_id if @next_issue_id %>