Merge pull request #153 from houdiniproject/data_reload_campaign_fix
If you change a campaign slug, we redirect to the proper page
This commit is contained in:
commit
3094a64f6e
2 changed files with 5 additions and 2 deletions
|
@ -3,7 +3,8 @@
|
|||
|
||||
<%= 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? %>
|
||||
<div class='modal-body'>
|
||||
<div class='u-margin--auto'>
|
||||
|
|
|
@ -33,7 +33,9 @@ function submit_form(form_el, on_success) {
|
|||
contentType: false
|
||||
})
|
||||
.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()
|
||||
else if(form_el.hasAttribute('data-redirect')) {
|
||||
var redirect = form_el.getAttribute('data-redirect')
|
||||
|
|
Loading…
Reference in a new issue