Fork me on GitHub
#hoplon
<
2016-07-11
>
mac00:07:57

Is there a way of embedding some raw html in a hoplon page? I have some nice html output from Google's diff-match-patch library that I would like to include in a page.

alandipert01:07:05

(with-let [d (div)] (.html (js/jQuery d) "<p>foo</p>")) is one way

eric.shao02:07:54

@mac (div :html "<p>hello world</p>") ;; string (div :html cell-containing-html-string) ;; micha [9:55 PM] thats the easiest way to do it in hoplon. the :html attribute expands to (.html (js/jQuery the-element) "<p>hello world</p>") [9:56] or in plain js, jQuery(the-element).html("<p>hello world</p>") [9:58] you can see all the custom attributes provided by hoplon here: https://github.com/hoplon/hoplon/blob/master/src/hoplon/core.cljs#L522-L586

mynomoto04:07:08

It's not as ambitious as hoplon-ui but has lots of useful elements. I will implement forms and autocomplete bound to cells next.

onetom07:07:17

@martinklepsch: @juhoteperi: @micha: im getting this error with boot-hoplon:0.2.2 using boot-reload:0.4.11:

"adzerk/boot_reload/init4776.cljs"
java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol
                                                           ...
                               clojure.core/first/invokeStatic         core.clj:   55
                                            clojure.core/first         core.clj:   55
                                           clojure.core/map/fn         core.clj: 2646
                                                           ...
                                 clojure.core/seq/invokeStatic         core.clj:  137
                                        clojure.core/filter/fn         core.clj: 2700
                                                           ...
                                 clojure.core/seq/invokeStatic         core.clj:  137
                                          clojure.core/keep/fn         core.clj: 7044
                                                           ...
                                 clojure.core/seq/invokeStatic         core.clj:  137
                clojure.core.protocols/seq-reduce/invokeStatic    protocols.clj:   24
                        clojure.core.protocols/fn/invokeStatic    protocols.clj:   75
                                     clojure.core.protocols/fn    protocols.clj:   75
                                   clojure.core.protocols/fn/G    protocols.clj:   13
                              clojure.core/reduce/invokeStatic         core.clj: 6545
                                clojure.core/into/invokeStatic         core.clj: 6610
                                             clojure.core/into         core.clj: 6604
           hoplon.boot-hoplon.refer/get-cljs-deps/invokeStatic        refer.clj:  148
                        hoplon.boot-hoplon.refer/get-cljs-deps        refer.clj:  137

onetom07:07:12

this line seems to expect a :require'd namespace to be in a sequence if i understand it correctly: https://github.com/hoplon/boot-hoplon/blob/master/src/hoplon/boot_hoplon/refer.clj#L143

onetom07:07:15

but boot-reload generates a simple namespace symbol (eg app.main):

(ns adzerk.boot-reload.init4779 (:require [adzerk.boot-reload.client :as client] app.main))

chark07:07:24

if i fix it like this:

(mapcat (comp (partial map #(if (symbol? %) % (first %))) (partial drop 1)))
so the list of namespaces for the reload namespace is correctly: (adzerk.boot-reload.client app.main) i get the following error in the browser on the 1st reload:
display.cljs:93 Uncaught TypeError: goog.dom.constHtmlToNode is not a function adzerk$boot_reload$display$construct_hud_node @ display.cljs:93
adzerk$boot_reload$display$insert_container_BANG_ @ display.cljs:104
(anonymous function) @ display.cljs:126
(anonymous function) @ core.cljs:4151
cljs.core.swap_BANG_.cljs$core$IFn$_invoke$arity$2 @ core.cljs
:4151cljs$core$swap_BANG_ @ core.cljs:4144
adzerk$boot_reload$display$display @ display.cljs:120
(anonymous function) @ client.cljs:42
G__11015__3 @ core.cljs:9888
G__11015 @ core.cljs:9997
(anonymous function) @ client.cljs:59
goog.events.EventTarget.fireListeners @ eventtarget.js:284
goog.events.EventTarget.dispatchEventInternal_ @ eventtarget.js:381
goog.events.EventTarget.dispatchEvent @ eventtarget.js:196
goog.net.WebSocket.onMessage_ @ websocket.js:426
reload.cljs:66 Reload

chark07:07:38

we are also using hoplon-ui not just hoplon on its own

chark08:07:27

okay, so i think it boils down't to my specific boot-reload configuration because im using the :on-jsload option to update the dom with the app.main/index function which calls the hoplon.ui/window function to rebuild the whole dom...:

> cat /Users/pair/.boot/cache/tmp/Users/pair/ap/fe//9d9/-6qen6r/adzerk/boot_reload/init4782.cljs
(ns adzerk.boot-reload.init4782 (:require [adzerk.boot-reload.client :as client] app.main))
(client/connect "" {:ws-host nil, :asset-host nil, :on-jsload (fn* [] (app.main/index))})⏎

mac08:07:42

@eric.shao: Thanks a lot.

thedavidmeister11:07:17

i added some documentation for pages and routes in the wiki

thedavidmeister11:07:00

@alandipert: would you be able to review it and update the @todo for how the page macro works?

alandipert15:07:27

@thedavidmeister: for sure, i'll give it a look today!

eric.shao15:07:17

I know Hoplon is usually used for enterprise software. But I want to ask: Is Hoplon friendly with SEO?

alandipert15:07:54

@eric.shao: not as friendly as a static content site, if SEO is important then it's probably a good idea to have separate content pages and app page

alandipert15:07:14

but there is the prerender task which can be used to get some level of search engine visibility

eric.shao15:07:29

@alandipert: Thank you for your reply.

alandipert15:07:02

@eric.shao: https://github.com/hashobject/perun looks like a really nice way to make static sites w/ boot+clojure

alandipert15:07:50

i haven't used it myself for anything. but it might be possible to combine it with the prerender task in order to make hoplon-based static sites, basically using hoplon as html

eric.shao15:07:15

It’s a small project. I’ll use your way : "separate content pages and app page”.

Tim19:07:38

that is great! ❤️ luminus

onetom20:07:30

flyboarder: where did this korks terminology come from?

flyboarder20:07:48

I adopted it from developing matchbox, @crisptrutski was using it there, im not sure what the correct name is but it is also used in the Om documentation: > korks is a key or sequence of keys

onetom20:07:45

ah, Key OR KeyS, got it

alandipert20:07:27

ha i remember it from original om source, great word

mynomoto20:07:53

Weak refs on javascript may become a thing https://github.com/tc39/proposal-weakrefs

alandipert20:07:17

the last time it came up it was rejected for security reasons

alandipert20:07:24

i will follow this, thx for pointer @mynomoto

flyboarder23:07:21

how can I get an attribute to update when a cell changes that isnt the incoming attr value?

flyboarder23:07:36

Ideally I would like some-other-cell to be an instance of route-cell