If you change a campaign slug, we redirect to the proper page
This commit is contained in:
parent
a7b56c80ae
commit
43b80f13b3
2 changed files with 5 additions and 2 deletions
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
<%= render 'common/modal_header', title: 'Campaign Settings' %>
|
<%= render 'common/modal_header', title: 'Campaign Settings' %>
|
||||||
|
|
||||||
<form class='form--flatFields' autosubmit action='/nonprofits/<%=@nonprofit.id%>/campaigns/<%=@campaign.id%>' method='put' data-reload parsley-validate>
|
<form class='form--flatFields' autosubmit action='/nonprofits/<%=@nonprofit.id%>/campaigns/<%=@campaign.id%>' method='put' data-reload-with-slug parsley-validate>
|
||||||
|
|
||||||
<% if @campaign.child_campaign? %>
|
<% if @campaign.child_campaign? %>
|
||||||
<div class='modal-body'>
|
<div class='modal-body'>
|
||||||
<div class='u-margin--auto'>
|
<div class='u-margin--auto'>
|
||||||
|
|
|
@ -33,7 +33,9 @@ function submit_form(form_el, on_success) {
|
||||||
contentType: false
|
contentType: false
|
||||||
})
|
})
|
||||||
.done(function(d) {
|
.done(function(d) {
|
||||||
if(form_el.hasAttribute('data-reload'))
|
if(form_el.hasAttribute('data-reload-with-slug'))
|
||||||
|
window.location = d['url']
|
||||||
|
else if(form_el.hasAttribute('data-reload'))
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
else if(form_el.hasAttribute('data-redirect')) {
|
else if(form_el.hasAttribute('data-redirect')) {
|
||||||
var redirect = form_el.getAttribute('data-redirect')
|
var redirect = form_el.getAttribute('data-redirect')
|
||||||
|
|
Loading…
Reference in a new issue