diff --git a/app/views/components/_upload_background_image.html.erb b/app/views/components/_upload_background_image.html.erb index a552df56..d997c1ca 100644 --- a/app/views/components/_upload_background_image.html.erb +++ b/app/views/components/_upload_background_image.html.erb @@ -20,7 +20,7 @@ Upload <%= image_url ? 'Different Image' : '' %> > - + Remove Image diff --git a/app/views/components/_upload_banner_image.html.erb b/app/views/components/_upload_banner_image.html.erb index b21bb7d2..2f9fd633 100644 --- a/app/views/components/_upload_banner_image.html.erb +++ b/app/views/components/_upload_banner_image.html.erb @@ -20,7 +20,7 @@ Upload <%= image_url ? 'Different Image' : '' %> > - + Remove Image diff --git a/client/js/campaigns/show/admin.js b/client/js/campaigns/show/admin.js index 818a2216..3d8cd877 100644 --- a/client/js/campaigns/show/admin.js +++ b/client/js/campaigns/show/admin.js @@ -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() { diff --git a/client/js/common/image_uploader.js b/client/js/common/image_uploader.js index 089df177..7bec14a4 100644 --- a/client/js/common/image_uploader.js +++ b/client/js/common/image_uploader.js @@ -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',