From 80d49de30e6c2b8c466abeeeddba2604b355c38e Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Tue, 26 Nov 2019 21:20:06 +0100 Subject: [PATCH] Hiding edit link on edit action --- app/views/quantities/_index.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/quantities/_index.html.erb b/app/views/quantities/_index.html.erb index ad3f448..45a5af3 100644 --- a/app/views/quantities/_index.html.erb +++ b/app/views/quantities/_index.html.erb @@ -51,7 +51,8 @@ <%= link_to l(:button_edit), edit_quantity_path(q), { remote: true, - class: "icon icon-edit" + class: "icon icon-edit", + style: (action_name == "edit") ? "visibility: hidden;" : "" } %> <%= delete_link quantity_path(q), {remote: true, data: {}} %> @@ -67,7 +68,8 @@ <%= render :partial => 'quantities/form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> <%= - link_to l(:button_cancel), "#", :onclick => '$("#edit-quantity").hide()' + link_to l(:button_cancel), "#", + onclick: '$(this).closest("tr").remove(); $("#quantities a.icon-edit").css("visibility", "visible"); ' %> <% end %>