This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-05
Channels
- # beginners (23)
- # boot (84)
- # braid-chat (2)
- # bristol-clojurians (1)
- # cider (53)
- # cljs-dev (34)
- # cljsrn (13)
- # clojure (138)
- # clojure-dusseldorf (5)
- # clojure-italy (1)
- # clojure-russia (164)
- # clojure-uk (41)
- # clojurescript (80)
- # clr (2)
- # core-async (6)
- # core-logic (25)
- # core-matrix (14)
- # cursive (10)
- # data-science (4)
- # datomic (4)
- # emacs (3)
- # funcool (6)
- # hoplon (127)
- # jobs-discuss (4)
- # keechma (36)
- # ldnclj (5)
- # lein-figwheel (5)
- # off-topic (5)
- # om (155)
- # onyx (72)
- # overtone (16)
- # parinfer (39)
- # planck (3)
- # protorepl (1)
- # re-frame (11)
- # reagent (5)
- # untangled (22)
@flyboarder: I don't know. Have you seen https://github.com/crisptrutski/matchbox The author of this library, @crisptrutski, even though I am not sure he knows hoplon, is really kind and could maybe help you...
@micha Did you get the chance to play around with the state machine tonight 😉
@leontalbot: i was playing with matchbox, but went for a homegrown approach instead 😕 playing with the firebase promises is working so far
@micha. Couldn't make the "state machine" work yet...
Good night
@leontalbot: i didn't have a chance to do it last night, did you make any progress on the lens approach?
@jumblerg: Was looking at https://github.com/hoplon/ui/blob/master/tst/hoplon/ui-test-app.cljs.hl to see an example of hoplon/ui. This is pretty cool!
ty! it’s buggy, atm, but i think the most annoying problems are solvable. at a minimum, i hope the ideas it introduces help to move things forward.
I love the simplicity of the definition of the routing
the idea is that the window component provides you everything you need to interface with the browser itself
cool stuff!
you can see the attributes the window accepts here: https://github.com/hoplon/ui/blob/master/src/hoplon/ui.cljs.hl#L517
i’m currently working on applying the same box model to the body elem returned by the window fn that all the other elements use. that will eliminate the need for the outer elem used in the test-app.
can I add custom html-meta
for instance og metas for social media?
should be able to accept meta attributes the same way link and script attributes are used to generate tags.
@leontalbot: could you paste me a list of the sample meta tags you’d normally add to your html?
these could be automated
(meta {:property "og:title", :content page-title})
(meta {:property "og:description", :content page-desc})
(meta {:property "og:type", :content "website"})
other possibility
(def metas-og
[(meta {:property "og:url", :content " "})
(meta {:name "image_src", :content ""})
(meta {:property "og:image", :content ""})
(meta {:property "og:image:width", :content "180"})
(meta {:property "og:image:height", :content "110"})
(meta {:property "og:image", :content ""})
(meta {:property "og:image:width", :content "250"})
(meta {:property "og:image:height", :content "250"})
(meta {:content "text/html; charset=UTF-8", :http-equiv "content-type"})])
og:url could also be automated and charset too. The rest would be add manually I guess
I haven't study the evolution of og tags since 2014 though...
May be outdated... not sure
@leontalbot: is the lens approach looking like it will work for you?
almost
the one thing i would probably do on the UI side is make an element that uses cond-tpl
or something to be polymorphic on the schema
cool, i had something like :
(form-group :css (let [x1 (path [:visible-if-id])
x2 (path [:visible-if-any])
x3 (path [:visible-if-none])
x4 (path [:visible-if-values])
x5 (path [:visible-unless-values])
v (path-cell n-questions [@x1 :answer])
h (path [:hide])]
((formula
#(cond
%7 hide
(empty? %1) show
%2 (if (empty? %6) hide show)
%3 (if (empty? %6) show hide)
%4 (if (some (into #{} %6) %4) show hide)
%5 (if (some (into #{} %6) %5) hide show)))
x1 x2 x3 x4 x5 v h))
(question (:question @item))
(sub-question (:sub-question @item))
(little-question (:little-question @item))
(p :css {:color "#777"} (:precisions @item))
(case @(path [:type])
"checkbox"
(form-list-buttons
:checkbox true
:cell (path [:answer])
:selected-color (:selected-color static-content)
(:choices @item))
"radio"
(form-list-buttons
:cell (path [:answer])
:selected-color (:selected-color static-content)
(:choices @item))
"textarea"
(vpc-input
:cell (path [:answer])
:type "textarea")
"select"
(form-select
:cell (path [:answer])
(:choices @item))
"input"
(vpc-input
:cell (path [:answer])
:type "text")
""))
is it where I should use cond-tpl?
oups sorry here is the complete fn :
(defelem vpc-question [{:keys [id] :as attrs}]
(let [item (path-cell n-questions [id])
path (fn [k-vec] (path-cell item k-vec))
show {:display "block"}
hide {:display "none"}]
(div
(form-group :css (let [x1 (path [:visible-if-id])
x2 (path [:visible-if-any])
x3 (path [:visible-if-none])
x4 (path [:visible-if-values])
x5 (path [:visible-unless-values])
v (path-cell n-questions [@x1 :answer])
h (path [:hide])]
((formula
#(cond
%7 hide
(empty? %1) show
%2 (if (empty? %6) hide show)
%3 (if (empty? %6) show hide)
%4 (if (some (into #{} %6) %4) show hide)
%5 (if (some (into #{} %6) %5) hide show)))
x1 x2 x3 x4 x5 v h))
(question (:question @item))
(sub-question (:sub-question @item))
(little-question (:little-question @item))
(p :css {:color "#777"} (:precisions @item))
(case @(path [:type])
"checkbox"
(form-list-buttons
:checkbox true
:cell (path [:answer])
:selected-color (:selected-color static-content)
(:choices @item))
"radio"
(form-list-buttons
:cell (path [:answer])
:selected-color (:selected-color static-content)
(:choices @item))
"textarea"
(vpc-input
:cell (path [:answer])
:type "textarea")
"select"
(form-select
:cell (path [:answer])
(:choices @item))
"input"
(vpc-input
:cell (path [:answer])
:type "text")
"")))))
n-question is the global state cell
updated
didn't know about case-tpl, is it the same
coool!
@leontalbot: i’m wondering if the open graph protocol should have it’s own attribute and representation. http://ogp.me/
yeah good idea
not sure yet, general metadata can be cleanly represented with a simple map, but the ogp uses custom “property” keys instead. i wonder how many other cases there are like this i’m not aware of.
eg (window :metadata {“image_src”, "
-> <meta name=“image_src” content=“http…”>
reading up on RDFa, which is used by OGP, Dublin Core, FOAF, and whatnot.
@micha regarding the "state machine" I am stuck here :
Uncaught Error: [object Object] is not ISeqable
at line 22
I get this when I toggle a checkbox.
basically your function (fn [c*] ...
there takes the value the user wants to set the cell to, and modifies it
the formula provides the value when you deref the lens or make a formula that depends onit
the callback is evaluated for side effects only, whenever the user calls swap!
or reset!
on the lens
that callback can do anything, and it gets one argument: the new value that the user wants to set the lens to
@micha: Thanks... I now getting No protocol method IDeref.-deref defined for type cljs.core/PersistentHashMap
actually I did @c* and not @c
where new-value
is a plain function that given c*
computes what c
should correctly be (i.e. adding the hide info)
ok, trying...
(let [c (cell 0)]
(defc= state {:value c :even? (even? c)}
(fn [c*] (reset! c (:value c*)))))
@state ;=> {:value 0 :even? true}
(swap! state update-in [:value] inc) ;=> {:value 1 :even? false}
the callback part of the lens is really just ignoring the parts of the input that will be recomputed in the formula
in other words, the c
cell contains all the actual data we need. the rest of the stuff in the map can be computed from that in a formula
if you have big state, will you call even
to every map of map?
@micha, ok I solve the problem. Thanks a lot for your advices and help.
For the record, here are the correct fns :
I feel really wasted and would need a 🍺 tonight before I can read back your last advice here https://clojurians.slack.com/archives/hoplon/p1459882504003536 and understand it correctly 😄
Thanks a lot @micha!