houdini/app/javascript/legacy/nonprofits/supporters/new/page.js
2020-04-23 14:09:14 -05:00

24 lines
654 B
JavaScript

// License: LGPL-3.0-or-later
var restful_resource = require('../../../common/restful_resource')
appl.def('supporter', {
path_prefix: '/nonprofits/' + app.nonprofit_id + '/',
resource_name: 'supporters',
after_create_failure: function(resp) {
appl.def('error', resp).def('loading', false)
},
before_create: function(obj) {
obj.tags_attributes = [{
parent_id: app.nonprofit_id,
parent_type: 'Nonprofit',
name: 'volunteer'
}]
appl.def('error', '').def('loading', true)
},
after_create: function(resp, node){
appl.def('loading', false)
appl.notify("Volunteer created!")
appl.redirect('/nonprofits/' + app.nonprofit_id)
}
})