Skip to content

Commit

Permalink
remove ramda from events (incomplete)
Browse files Browse the repository at this point in the history
  • Loading branch information
hejkal committed Dec 19, 2024
1 parent 90e9499 commit d850b05
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion client/js/events/discounts/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// License: LGPL-3.0-or-later
var request = require('../../common/client')
var R = require('ramda')

appl.def('discounts.url', '/nonprofits/' + app.nonprofit_id + '/events/' + appl.event_id + '/event_discounts')

Expand Down
5 changes: 2 additions & 3 deletions client/js/events/discounts/manage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// License: LGPL-3.0-or-later
var R = require('ramda')
var request = require('../../common/client')
var format = require('../../common/format')

Expand Down Expand Up @@ -81,8 +80,8 @@ function validate(form_obj){
appl.notify("Percentage can't be more than 100")
return false
}
var codes = R.pluck('code', R.reject(function(x){ return x['id'] === Number(form_obj.id)}, appl.discounts.data))
var hasDupeCodes = R.contains(form_obj.code, codes)
var codes = appl.discounts.data.filter(x => x['id'] !== Number(form_obj.id)).map(i => i.code)
var hasDupeCodes = codes.includes(form_obj.code)

if (hasDupeCodes){
appl.notify("That code is already being used for this event. Please type another code.")
Expand Down
3 changes: 1 addition & 2 deletions client/js/events/listings/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// License: LGPL-3.0-or-later
const R = require('ramda')
const h = require('snabbdom/h')
const flyd = require('flyd')
const render = require('ff-core/render')
Expand Down Expand Up @@ -34,7 +33,7 @@ module.exports = pathPrefix => {
return mixin([h('p.u-padding--15', 'Loading...')])
if(!resp$().body.length)
return mixin([h('p.u-padding--15', `No ${key} events`)])
return mixin(R.map(listing, resp$().body))
return mixin(resp$().body.map(listing));
}

const view = state =>
Expand Down
5 changes: 2 additions & 3 deletions client/js/events/show/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const donateWiz = require('../../nonprofits/donate/wizard')
const snabbdom = require('snabbdom')
const h = require('snabbdom/h')
const flyd = require('flyd')
const R = require('ramda')
const render = require('ff-core/render')
const modal = require('ff-core/modal')

Expand All @@ -27,8 +26,8 @@ function init() {
var state = { }
const startWiz$ = flyd.stream()
const donateButtons = document.querySelectorAll('.js-openDonationModal')
R.map(x => x.addEventListener('click', createClickListener(startWiz$)), donateButtons)
state.modalID$ = flyd.map(R.always('donationModal'), startWiz$)
donateButtons.map((x) => x.addEventListener('click', createClickListener(startWiz$)));
state.modalID$ = flyd.map(() => 'donationModal', startWiz$)
state.donateWiz = donateWiz.init(flyd.stream({event_id: app.event_id, hide_cover_fees_option: app.hide_cover_fees_option}))
return state
}
Expand Down

0 comments on commit d850b05

Please sign in to comment.