Fix bug.
This commit is contained in:
parent
9d7c361132
commit
8768186242
|
@ -1,6 +1,6 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
class Admin::ApplicationFormsController < OrbitAdminController
|
class Admin::ApplicationFormsController < OrbitAdminController
|
||||||
|
Is_Rails5 = (Rails::VERSION::MAJOR >= 5)
|
||||||
require 'axlsx'
|
require 'axlsx'
|
||||||
include Admin::ApplicationFormsHelper
|
include Admin::ApplicationFormsHelper
|
||||||
helper Admin::ApplicationFormsFieldHelper
|
helper Admin::ApplicationFormsFieldHelper
|
||||||
|
@ -603,7 +603,20 @@ class Admin::ApplicationFormsController < OrbitAdminController
|
||||||
@application_form.update_user_id = current_user.id
|
@application_form.update_user_id = current_user.id
|
||||||
if @application_form.update_attributes(@application_form_params)
|
if @application_form.update_attributes(@application_form_params)
|
||||||
@application_form.application_form_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
|
@application_form.application_form_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
|
||||||
|
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
|
redirect_to params['referer_url'] and return
|
||||||
|
end
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('update.error.category')
|
flash.now[:error] = t('update.error.category')
|
||||||
render action: :edit and return
|
render action: :edit and return
|
||||||
|
|
|
@ -377,7 +377,6 @@
|
||||||
|
|
||||||
<!-- Form Actions -->
|
<!-- Form Actions -->
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= get_referer_url[:application_formion] rescue "" %>
|
|
||||||
<%= 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 %>">
|
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
||||||
<%= link_to t('cancel'), admin_application_forms_path, :class=>"btn" %>
|
<%= link_to t('cancel'), admin_application_forms_path, :class=>"btn" %>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
||||||
<%= hidden_field_tag 'id', params[:id] if !params[:id].blank? %>
|
<%= 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" %>
|
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
||||||
<%= hidden_field_tag 'id', params[:id] if !params[:id].blank? %>
|
<%= 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" %>
|
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
Loading…
Reference in New Issue