Fork me on GitHub
#hoplon
<
2016-11-15
>
mynomoto01:11:02

@thedavidmeister seems like a small improvement using codox. Now we know that the public api is missing docstrings all over the place 😉

fiddlerwoaroof05:11:02

@mynomoto the biggest problems I always have when I'm starting a new language is figuring out how all the various include paths work and fit together.

fiddlerwoaroof05:11:56

So, for example, one difficulty I had was figuring out exactly where compojure/ring looked for the pages specified in the routing and how to setup the .hl file correctly so it could be found. I think I've figured that out well enough for now, but I'm still not exactly sure how to make use of the data parsed out of the path by compojure in a page template.

fiddlerwoaroof05:11:07

(to be clear, this scenario involves the castra template mentioned in hoplon's Getting Started wiki page)

mynomoto07:11:23

@fiddlerwoaroof yeah, serving from the classpath is not very intuitive. I will make a note to explain that on the tutorial, it's relevant even for client side only, thanks. About compojure params, what are you trying to do? I'm asking because castra doesn't use them.

fiddlerwoaroof08:11:08

@mynomoto basically, I wanted to write a little demo application with two different views: a list of links and a list of comments on the links. So, I started with this: https://github.com/tailrecursion/hoplon-castra-template/blob/master/src/leiningen/new/hoplon_castra/handler.clj and I modified it to look like this:

(defroutes app-routes
  (GET "/" req
       (-> "index.html"
           (resource-response)
           (content-type "text/html")))
  (resources "/" {:root ""})
  (GET "/comments/:idx" [idx]
       (println "Idx: " idx)
       (-> "comments.html"
           (resource-response)
           (content-type "text/html")))
  (not-found (or (io/resource "public/404.html")
                 "Oups! This page doesn't exist! (404 error)")))
The difficulty I'm having is figuring a good way to use the idx parameter.

fiddlerwoaroof08:11:25

Although, I'm beginning to suspect that this isn't really an intended way to use the framework.

mynomoto14:11:06

@fiddlerwoaroof I see the problem. So if you are using resource-response this only serves the file. If you want to generate html server-side there are a bunch of options in the "Template languages" section from http://www.clojure-toolbox.com/ A word of caution, that is not curated, once things get in there they tend to live forever even if the project is not maintained anymore. I think Hiccup and Selmer are the most used of the list but I haven't being doing server-side rendering in a while. I also know that Rum can be used that way too I played with it a bit some time ago. In the Hoplon/Castra way if you want more than one view you probably want to do client side routing. I don't think we have examples of that on demos, I will add an issue so this is not forgotten and hopefully I can provide one soon.

onetom14:11:38

@jumblerg holpon.ui/copy! thumbsup_all

onetom15:11:41

@mynomoto i just saw it last friday that FUOC was still an issue at exicon. prerendering is not an option because you can't prerender the logged in state.

onetom15:11:44

but i guess they will just leave with it until hoplon ui becomes more stable 😉

onetom15:11:58

we don't have any fuoc issues since we are using hoplon ui 😉

mynomoto15:11:53

@onetom If prerender is not an option what I usually do is manual loading and putting the css on the base html file. I still have to try ui.

onetom15:11:27

what do u mean by "manual loading"? at boot-task-runtime?

mynomoto15:11:29

No, so I have a html file that loads the css (not generated by hoplon):

mynomoto15:11:39

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="app.css" rel="stylesheet" type="text/css">
  </head>
  <body>
    <div id="app"></div>
    <script src="main.js" type="text/javascript"></script>
  </body>
</html>

mynomoto15:11:50

(defn mount-root []
  (js/jQuery #(.replaceWith (js/jQuery "#app") (home))))

(mount-root)

mynomoto15:11:22

Where home is the the hoplon element I want loaded.

mynomoto15:11:42

No fuoc this way in my experience.

onetom15:11:37

@mynomoto interesting trick... thanks!

mynomoto15:11:58

@onetom np! Are you still at exicon? Much hoplon going on there?

mynomoto15:11:32

@flyboarder someone needs to do it 😉 One of the first things I did when I was trying to contribute was a cleanup of issues for lighttable. That was crazy, I help to close 200 issues or something like that 😅

onetom15:11:41

@mynomoto no, im at https://github.com/addplus but exicon is 5 mins walk away and 2 of my ex-colleagues live on the same island as me so we ride the ferry often together either in the morning or the evening...

micha15:11:56

@onetom for http://app.adzerk.com we have a spinner that is shown while the app is loading, because you can't prerender logged in state and you don't want the user to see the actual app before their logged-in status is determined

micha15:11:10

especially if the user hits the refresh button

micha15:11:36

line 33 is where the spinner is loaded

micha15:11:48

so it's only loaded in prerendering

micha15:11:58

and the app is not loaded in prerendering

micha15:11:35

you can see there is no FOUC for http://app.adzerk.com

onetom16:11:03

@micha every time you show your index.cljs.hl it looks sexier than before 🙂

micha16:11:22

haha it's been shaved by many hands now

micha16:11:39

i haven't worked on it in a long time myself

onetom16:11:20

@laura @peterromfeld @ayaz @kenneth in case you want to take another stab at the FUOC issue, just look above! ^^^^ 🙂

micha16:11:53

the ui.app namespace generates the html that's prerendered: https://gist.github.com/e57a8b1bdabe78d748b6a9b0b486eeec

micha16:11:22

the main fn

onetom16:11:59

btw, im just trying the latest hoplon/ui demo.cljs with clojurescript 1.9.293 and i can just use ns instead of ns+ and it still works (if i remove the reference to markdown)

onetom16:11:37

so it seems the macro/function separation indeed has been blurred

onetom16:11:05

(just saying because i noticed the :include-macros true in your [ui.app :as app])

onetom16:11:04

ui.app is also beautifully crystallized

onetom16:11:12

hmm.. i didnt know about js/top and js/self...

micha16:11:36

that's to prevent someone loading the app in an iframe and clickjacking

micha16:11:52

like tricking the user into clicking on a button in the iframe by putting something on top of it for example

micha16:11:14

if you load the app in an iframe you just see the spinner forever, the app doesn't ever load

micha16:11:24

the set! part there doesn't actually work

micha16:11:32

but we don't care about breaking out of the iframe

micha16:11:41

so i never investigated why it doesn't work

onetom17:11:29

@micha there is no changelog file for hoplon, so i thought i would at least try github's release notes feature: https://github.com/hoplon/hoplon/releases/tag/6.0.0-alpha17 i just copied your merge-commit message. .i hope u don't mind.

onetom17:11:24

the best would be to follow http://keepachangelog.com/ but im too sleepy for that now

flyboarder22:11:36

@jumblerg: found some blocking issues for boot-electron, so I haven't been able to upload it yet

jumblerg22:11:41

no worries. i like how it drops into the build pipeline like the pom task. nicely done.

jumblerg23:11:50

@onetom: yeah... the browser really shouldn't be able to blow away someone's clipboard with copy!, but there is is. i haven't looked into paste! yet lol.

jumblerg23:11:37

but i think i'm going to pioneer a new, innovative genre in the advertising space: clipboard ads. customers embed this little script in their site, and next time a visitor pastes into an office doc, bam!. "little blue pills. $2.50".

jumblerg23:11:02

@micha: i'm selling. think james might be interested?

micha23:11:33

hahahahahah

micha23:11:04

how do we track impressions though?

jumblerg23:11:22

well, there's nothing that prevents us from putting a link in a clipboard.

micha23:11:35

if we could put executable code in there

micha23:11:38

and then execute it

micha23:11:42

then you might have something

jumblerg23:11:43

hmmm, can we inject vba scripts into office docs?

jumblerg23:11:11

i'm starting to think black hats have more fun.

jumblerg23:11:28

i'll look into it and get back to you guys.

jswart23:11:50

they do but only for a few months at a time

jswart23:11:06

although maybe that is the fun, new ways to overcome, and overcome, etc.

jswart23:11:08

with each patch

jumblerg23:11:08

lol, yeah, there's that.

flyboarder23:11:35

I am presenting for the ClojureToronto meetup soon, if anyone wants an invite to the hangout!