This commit is contained in:
邱博亞 2024-01-18 22:56:04 +08:00
parent 9d7c361132
commit 8768186242
4 changed files with 19 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# encoding: utf-8
class Admin::ApplicationFormsController < OrbitAdminController
Is_Rails5 = (Rails::VERSION::MAJOR >= 5)
require 'axlsx'
include Admin::ApplicationFormsHelper
helper Admin::ApplicationFormsFieldHelper
@ -603,7 +603,20 @@ class Admin::ApplicationFormsController < OrbitAdminController
@application_form.update_user_id = current_user.id
if @application_form.update_attributes(@application_form_params)
@application_form.application_form_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to params['referer_url'] and return
if params['referer_url'].blank?
fallback_location = admin_application_forms_path
if Is_Rails5
redirect_back(fallback_location: fallback_location) and return
else
begin
redirect_to :back and return
rescue
redirect_to fallback_location and return
end
end
else
redirect_to params['referer_url'] and return
end
else
flash.now[:error] = t('update.error.category')
render action: :edit and return

View File

@ -377,7 +377,6 @@
<!-- Form Actions -->
<div class="form-actions">
<%= get_referer_url[:application_formion] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), admin_application_forms_path, :class=>"btn" %>

View File

@ -25,7 +25,8 @@
<div class="form-actions">
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
<%= hidden_field_tag 'id', params[:id] if !params[:id].blank? %>
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</fieldset>

View File

@ -24,7 +24,8 @@
<div class="form-actions">
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
<%= hidden_field_tag 'id', params[:id] if !params[:id].blank? %>
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</fieldset>