summaryrefslogtreecommitdiff
path: root/src/index.cljs.hl
blob: 24726490ddaa66a3d46231d225e058b77a6d4bae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(page "index.html"
  (:require [app.rpc :as rpc]
            [Blockly]))

(def toolbox
  "<xml>
    <block type=\"controls_if\"></block>
    <block type=\"logic_compare\"></block>
    <block type=\"controls_repeat_ext\"></block>
    <block type=\"math_number\"></block>
    <block type=\"math_arithmetic\"></block>
    <block type=\"text\"></block>
    <block type=\"text_print\"></block>
  </xml>")

(defelem blockly-workspace
         [{:keys [options] :as attr} kids]
         (let [elem (div (dissoc attr :options) kids)]
           (with-init!
             (set! (.-workspace elem)
                   (.inject js/Blockly elem (clj->js options))))
           elem))


(html
  (head
    (link :rel "stylesheet" :type "text/css" :href "css/semantic.min.css")
    (script :src "blocks_compressed.js")
    (script :src "en.js")
    (title "Tankputer"))
  (body
    (h1 "Tankputer")
    (blockly-workspace :css {:height "480px" :width "600px"}
                       :options {:media "media/" :toolbox toolbox})))

;; vim: set expandtab ts=2 sw=2 filetype=clojure :