Fork me on GitHub
#hoplon
<
2016-01-20
>
laforge4901:01:58

@micha: Any problems using hoplon with clojure 8?

micha01:01:59

i haven't heard anything yet

leontalbot14:01:20

Hello, How do I write this in hlisp?

<!--[if lte IE 9]>
    <script src="assets/jquery-placeholder/jquery.placeholder.min.js"></script>
  <![endif]-->
Thanks!

micha14:01:14

i think you probably want to do that a different way

micha14:01:30

in hlisp you can check in js if it's ie9

micha14:01:43

and either use the jquery plugin or not

micha14:01:11

i don't think you need conditional html, because you're running in a full javascript environment

micha14:01:45

generally you want to include jquery plugins via cljsjs

micha14:01:08

or by making a deps.cljs file and adding the plugin to your resource paths

leontalbot15:01:23

I have a bug with I guess IDEREF

leontalbot15:01:41

This code causes conflict in IE 8 or IE 11 metro

leontalbot15:01:04

maybe I do it worng?

micha15:01:21

conflict?

micha15:01:10

what's the error you are getting?

micha15:01:44

ah i see one possible issue

micha15:01:55

the @% on line 21

micha15:01:10

yeah that makes sense

micha15:01:20

so IDeref is implemented like this:

micha15:01:26

(-deref [this] (-> this .-target js/jQuery .val))

micha15:01:48

that will only work on an element that has a value, like an <input> etc

micha15:01:13

it's just a shortcut for getting the value of the element that fired the event

micha15:01:21

cause you need to do that very often

micha15:01:46

we could make it smarter though

micha15:01:01

like for an anchor element maybe it should return the href

leontalbot15:01:05

is there a quick fix you could suggest?

micha15:01:39

what did you want the set #{@%} on line 21 to contain?

leontalbot15:01:38

strs that represent "checkbox" vals

leontalbot15:01:37

if I click on a link, it gets selected, if I click again, it gets deselected

micha15:01:08

what is item there?

micha15:01:19

does that contain the thing you want to add to the cell set?

micha15:01:54

like maybe instead of @% you want (:id @item)

micha15:01:57

or something like that?

micha15:01:54

oh i see now

micha15:01:15

so the selected state is identified by that item being an element in the cell set

micha15:01:24

so you probably want to do like

leontalbot15:01:39

data would be ["choice a" "choice b" "choice c"]

leontalbot15:01:05

yes, cell vector

micha15:01:07

:click #(let [c @cell, i @item]
  (if (some #{i} c)
    (reset! cell (vec (remove #{i} c)))
    (reset! cell (vec (conj c i)))))

micha15:01:54

you have a reference to the item cell in there, so you don't need any information from the event object really

leontalbot15:01:19

IT WORKS!! Thanks a lot @micha!

jjttjj19:01:21

what's the quickest way to have a file automatically eval'd in boot, like how lein loads user.clj from the root of the source path? I tried setting --init-ns to a file/ns in the root of a source-path but I think I'm missing something

micha19:01:03

that should work if you're using the repl

micha19:01:37

the build.boot file is automatically evaled

micha19:01:47

that's definitely the quickest way

micha19:01:01

just put code in there

micha19:01:17

you can also use the clojure.core/load-file function

micha19:01:27

(load-file "user.clj")

jjttjj19:01:32

ok cool thanks!

micha19:01:33

in your build.boot

alandipert19:01:16

load-file is handy when you're dev-ing on a build.boot itself. boot repl and then (load-file "build.boot")... then (boot (sometask)) at the repl after reloading