Fix removing banner image, refactor
This commit is contained in:
parent
c713ef343b
commit
e5419408ce
4 changed files with 16 additions and 7 deletions
|
@ -20,7 +20,7 @@
|
|||
Upload <%= image_url ? 'Different Image' : '' %>
|
||||
</button>
|
||||
<a class='button--small red u-marginTop--10 u-width--full' <%= image_url ? '' : 'disabled' %>>
|
||||
<!--= on 'click' (confirm 'Are you sure?' remove_this_image -->
|
||||
<!--= on 'click' (confirm 'Are you sure?' remove_background_image -->
|
||||
Remove Image
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
Upload <%= image_url ? 'Different Image' : '' %>
|
||||
</button>
|
||||
<a class='button--small red u-marginTop--10 u-width--full' <%= image_url ? '' : 'disabled' %>>
|
||||
<!--= on 'click' (confirm 'Are you sure?' remove_this_image -->
|
||||
<!--= on 'click' (confirm 'Are you sure?' remove_banner_image ) -->
|
||||
Remove Image
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -34,8 +34,17 @@ editable($('#js-customReceipt'), {
|
|||
var path = '/nonprofits/' + app.nonprofit_id + '/campaigns/' + app.campaign_id
|
||||
|
||||
|
||||
appl.def('remove_this_image', function() {
|
||||
appl.remove_background_image(path, 'campaign')
|
||||
appl.def('remove_banner_image', function() {
|
||||
var url = '/nonprofits/' + app.nonprofit_id + '/campaigns/' + app.campaign_id
|
||||
var notification = 'Removing banner image...'
|
||||
var payload = {remove_banner_image : true}
|
||||
appl.remove_image(url, 'campaign', notification, payload)
|
||||
})
|
||||
|
||||
appl.def('remove_background_image', function(url, resource) {
|
||||
var notification = 'Removing background image...'
|
||||
var payload = {remove_background_image : true}
|
||||
appl.remove_image(url, resource, notification, payload)
|
||||
})
|
||||
|
||||
appl.def('count_story_words', function() {
|
||||
|
|
|
@ -17,10 +17,10 @@ $('.image-upload input').change(function(e) {
|
|||
}
|
||||
})
|
||||
|
||||
appl.def('remove_background_image', function(url, resource) {
|
||||
appl.def('remove_image', function(url, resource, notification, payload) {
|
||||
var data = {}
|
||||
data[resource] = {remove_background_image: true}
|
||||
appl.notify('Removing background image...')
|
||||
data[resource] = payload
|
||||
appl.notify(notification)
|
||||
appl.def('loading', true)
|
||||
$.ajax({
|
||||
type: 'put',
|
||||
|
|
Loading…
Reference in a new issue