This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-12
Channels
- # admin-announcements (56)
- # beginners (67)
- # boot (159)
- # cider (5)
- # cljs-dev (16)
- # cljsjs (7)
- # clojure (142)
- # clojure-dev (15)
- # clojure-japan (1)
- # clojure-poland (1)
- # clojure-russia (33)
- # clojurebridge (2)
- # clojurecup (1)
- # clojurescript (56)
- # cursive (3)
- # datavis (2)
- # datomic (29)
- # devops (6)
- # editors (1)
- # emacs (3)
- # hoplon (95)
- # ldnclj (15)
- # leiningen (18)
- # off-topic (10)
- # om (12)
- # onyx (7)
- # parinfer (6)
- # proton (1)
- # spacemacs (3)
- # yada (2)
@micha: in one of your talks you mentioned a function that you called tabify
. Is there a snippet where you implemented that logic? Is it something you often use? Almost any application will have some tabs at some point
also, what is the reason for using defelem
in the todo-list
implementation on http://hoplon.io? To me it seems like (defn todo-list [title] ...)
would accomplish the same with less ceremony
https://github.com/hoplon/twitter-bootstrap/blob/master/src/hoplon/twitter/bootstrap.cljs.hl#L60-L67
you'd use it like this: https://github.com/hoplon/demos/blob/master/google-maps/src/index.cljs.hl#L69-L94
the parts are all open to extension, like you could make your own tab
function that customizes the tab trigger or the content area
that would allow you to change tabs via formula cell instead of or in addition to the user clicking on the tabs
the code is split into several smaller functions, so I'm working my way back through the functions
usually you have to just look at the examples from the getbootstrap website in your browser debugger to figure that out
so you don't need to know how to make the thing that looks like "tabs" in twitter bootstrap
like that requires making certain specific structural html, and then adding specific classes to various parts
(tabs
(tab :name "first tab"
(p "this is the first tab contents"))
(tab :name "second tab"
(p "this is the second tab contents")
(p "the second tab also says more things")))
https://github.com/hoplon/twitter-bootstrap/blob/master/src/hoplon/twitter/bootstrap.cljs.hl#L54
ok so tab
"returns" [a div]
and tabs
captures those, takes all the a
s and puts them in a ul
and the same with the div
s in a div
what I wrote right now was something like having links that on click change the contents of a cell which is rendered with a loop-tpl
which is more tedious as I'm writing out the :click
s. It's also a very different implementation though because you have a static content that gets shown with a css toggle while I wrote something that goes in and changes the DOM to match the current state
so you have everything dumped in the DOM with only something visible, I only have the active content in the DOM
with your model I need to think of the view and the internal representation separately
but the loot-tpl
implementation could be wrapped the same way. Or am I missing something, I haven't actually tried it yet
yeah I understand. I just remember the surprise when I first saw a page that had this implementation and I opened the source of that page. Everything dumped in the DOM but classes toggling their visibility.
from the usage perspective the tabs
element you showed is completely self-managed though, that's right. You can treat it as a black box
which is always good. I try to stay away from stuff that leaks nowadays. It's funny how easy it is to spot that
looking at the code I probably explained (and imagined) it wrong though, I'm using loop-tpl
to list stuff in a tab, which means it doesn't relate to the abstraction in any way. Still the implementation is different as I'm swapping out DOM nodes. Once I build the tabs abstraction though I will probably lose the loop-tpl
part because that will become a static component.