hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
opyate 2017-11-17T16:26:22.000180Z

Happy Friday, all. I had a look at the "special cases" doc, but wasn't enlightened. I have a formula cell foo which just evaluates to a String, which I'm using like this:

(cond-tpl 
  foo (td :class foo (span foo))
  :else
  (etc))
But the class attribute ends up being multi-valued (i.e. some other things in the outer-level collection being looped)

opyate 2017-11-17T16:29:53.000096Z

Changing it to :class (cell= {foo true}) loops fewer of the outer-loop stuff, although it is accurate on the class attribute

2017-11-17T16:30:48.000786Z

ah yes, this is a thing that pops up from time to time

2017-11-17T16:31:04.000496Z

the problem is that :class doesn't remove previously added classes, only adds them

2017-11-17T16:33:18.000168Z

hm, actually, it appears to toggle: https://github.com/hoplon/hoplon/blob/master/src/hoplon/jquery.cljs#L79-L83

2017-11-17T16:34:08.000177Z

but you can experiment with it by making your own attribute and doing the jquery you want inside it

opyate 2017-11-17T16:34:19.000781Z

will do, thanks for the reply

2017-11-17T16:35:01.000680Z

opyate are you familiar w/ mulimethods or do!/on! in particular?

opyate 2017-11-17T16:36:33.000754Z

multimethods, yes - haven't looked at implementations of do!/on!

opyate 2017-11-17T16:37:26.000115Z

your link is my first time looking at the code

2017-11-17T16:39:30.000202Z

cool. there's not a whole lot to know, but when you know it you know like 50% of hoplon underbelly

2017-11-17T16:40:21.000235Z

basically do! is a multimethod for implementing ways for cells to influence elements, and on! is the way to attach events from elements to cljs functions (:click, :hover etc)

2017-11-17T16:41:58.000288Z

adding your own is a dimension on which you can specialize your app to a particular target platform (mobile) or to build your own layout language atop html

opyate 2017-11-17T16:47:59.000194Z

ok, I'll try and figure out why toggleClass has baggage for a brand new element

flyboarder 2017-11-17T18:22:42.000359Z

@opyate I’m not sure exactly what your issue is with the hash-map version of :class, also which version are you using?