From 184c1384c77b6ac1b167a39f3ef5cb9c185a60a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sun, 11 Aug 2024 10:16:31 +0800 Subject: [PATCH] Fix backend referer. --- app/controllers/admin/universal_tables_controller.rb | 4 ++-- app/views/admin/universal_tables/edit_entry.html.erb | 3 ++- app/views/admin/universal_tables/show.html.erb | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/universal_tables_controller.rb b/app/controllers/admin/universal_tables_controller.rb index ab85b43..42b19dc 100644 --- a/app/controllers/admin/universal_tables_controller.rb +++ b/app/controllers/admin/universal_tables_controller.rb @@ -190,7 +190,7 @@ class Admin::UniversalTablesController < OrbitAdminController entry = TableEntry.find(params[:universal_table_id]) table = entry.u_table entry.destroy - redirect_to admin_universal_table_path(table) + redirect_to (request.referrer || admin_universal_table_path(table)) end def update_entry @@ -198,7 +198,7 @@ class Admin::UniversalTablesController < OrbitAdminController entry.update_attributes(table_entry_params) entry.fix_have_data # when new column insert table = entry.u_table - redirect_to admin_universal_table_path(table) + redirect_to admin_universal_table_path(:id=> table.to_param, :page => params[:page]) end def new diff --git a/app/views/admin/universal_tables/edit_entry.html.erb b/app/views/admin/universal_tables/edit_entry.html.erb index 03fbbd8..76b866f 100644 --- a/app/views/admin/universal_tables/edit_entry.html.erb +++ b/app/views/admin/universal_tables/edit_entry.html.erb @@ -1,6 +1,7 @@ <%= form_for @entry, url: "/admin/universal_tables/update_entry", html: {class: "form-horizontal main-forms"} do |f| %>
- + <%= f.hidden_field_tag 'id', f.object.id %> + <%= f.hidden_field_tag 'page', params[:page] %> <%= render :partial => "entry_form", :locals => {:f => f} %>
<% end %> \ No newline at end of file diff --git a/app/views/admin/universal_tables/show.html.erb b/app/views/admin/universal_tables/show.html.erb index acd439f..2710e73 100644 --- a/app/views/admin/universal_tables/show.html.erb +++ b/app/views/admin/universal_tables/show.html.erb @@ -68,7 +68,7 @@ <% if index == 0 && can_edit %>