Guest User

Untitled

a guest
Mar 15th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; Root query
  2.   static om/IQuery
  3.   (query [this]
  4.     '[{:faces/list (om/get-query Face)}
  5.       {:colors/list (om/get-query Color)}])
  6.  
  7. ;; Colors Editor Query (passing the entire props from above to this component)
  8.   static om/IQuery
  9.   (query [this]
  10.     [{:colors/list (om/get-query Color)}])
  11.  
  12. ;; Color Ident and Query
  13.   static om/Ident
  14.   (ident [this {:keys [color/name]}]
  15.     [:colors/by-name name])
  16.  
  17.   static om/IQuery
  18.   (query [this]
  19.     [:db/id :color/name :color/rgb])
  20.  
  21. ;; Normalized Data
  22. {:faces/list [[:faces/by-name :default] [:faces/by-name :comment]],
  23.  :colors/list
  24.  [[:colors/by-name "yellow"]
  25.   [:colors/by-name "blue"]
  26.   [:colors/by-name "red"]
  27.   [:colors/by-name "green"]],
  28.  :colors/by-name
  29.  {"blue" {:db/id 201, :color/name "blue", :color/rgb "#1e90ff"},
  30.   "yellow" {:db/id 200, :color/name "yellow", :color/rgb "#Ffd700"},
  31.   "green" {:db/id 203, :color/name "green", :color/rgb "#2e8b57"},
  32.   "red" {:db/id 202, :color/name "red", :color/rgb "#Cd0000"}},
  33.  :faces/by-name
  34.  {:default
  35.   {:db/id 100,
  36.    :face/name :default,
  37.    :face/background [:colors/by-name "yellow"],
  38.    :face/foreground [:colors/by-name "blue"]},
  39.   :comment
  40.   {:db/id 101,
  41.    :face/name :comment,
  42.    :face/background [:colors/by-name "red"],
  43.    :face/foreground [:colors/by-name "green"]}}}
Add Comment
Please, Sign In to add comment