Fix backend referer.

This commit is contained in:
邱博亞 2024-08-11 10:16:31 +08:00
parent e1e9377b21
commit 184c1384c7
3 changed files with 5 additions and 4 deletions

View File

@ -190,7 +190,7 @@ class Admin::UniversalTablesController < OrbitAdminController
entry = TableEntry.find(params[:universal_table_id]) entry = TableEntry.find(params[:universal_table_id])
table = entry.u_table table = entry.u_table
entry.destroy entry.destroy
redirect_to admin_universal_table_path(table) redirect_to (request.referrer || admin_universal_table_path(table))
end end
def update_entry def update_entry
@ -198,7 +198,7 @@ class Admin::UniversalTablesController < OrbitAdminController
entry.update_attributes(table_entry_params) entry.update_attributes(table_entry_params)
entry.fix_have_data # when new column insert entry.fix_have_data # when new column insert
table = entry.u_table 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 end
def new def new

View File

@ -1,6 +1,7 @@
<%= form_for @entry, url: "/admin/universal_tables/update_entry", html: {class: "form-horizontal main-forms"} do |f| %> <%= form_for @entry, url: "/admin/universal_tables/update_entry", html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset> <fieldset>
<input value="<%= @entry.id %>" type="hidden" name="id"> <%= f.hidden_field_tag 'id', f.object.id %>
<%= f.hidden_field_tag 'page', params[:page] %>
<%= render :partial => "entry_form", :locals => {:f => f} %> <%= render :partial => "entry_form", :locals => {:f => f} %>
</fieldset> </fieldset>
<% end %> <% end %>

View File

@ -68,7 +68,7 @@
<% if index == 0 && can_edit %> <% if index == 0 && can_edit %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li><a href="<%= admin_universal_table_edit_entry_path(entry) %>"><%= t(:edit) %></a></li> <li><a href="<%= admin_universal_table_edit_entry_path(:universal_table_id=> entry.to_param, :page => params[:page]) %>"><%= t(:edit) %></a></li>
<li><a href="<%= admin_universal_table_delete_entry_path(entry.id) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li> <li><a href="<%= admin_universal_table_delete_entry_path(entry.id) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
</ul> </ul>
</div> </div>