<commit_before>(ns kixi.hecuba.menu
  (:require [ajax.core :refer (GET)]
            [om.core :as om :include-macros true]
            [kixi.hecuba.tabs.slugs :as slugs]
            [sablono.core :as html :refer-macros [html]]))


(enable-console-print!)

(def menu-model (atom {:menu [ {:pathname "/app" :text "Main"}
                               {:pathname "/search" :text "Search"}
                               {:pathname "/properties_comparison" :text "Compare"}
                               {:pathname "/property_map" :text "Property Map"}
                               ;; {:pathname "/user" :text "User Management" :only-roles [:kixi.hecuba.security/super-admin]}
                               {:pathname "/logout" :text "Logout"}
                               {:pathname "https://github.com/MastodonC/kixi.hecuba/blob/master/doc/documentation.md" :text "Documentation"}]
                       :whoami nil}))

(defn menu [{:keys [menu whoami]} owner]
  (reify
    om/IRenderState
    (render-state [_ {page-pathname :pathname}]
      (println "page-pathname:" page-pathname)
      (html
       [:div
        [:ul {:class "nav navbar-nav"}
         (for [{:keys [pathname text roles]} menu
               :let [href (if (= page-pathname pathname) "#" pathname)]]
           [:li [:a {:href href} text]])]
        [:div.pull-right {:id :whoami} (slugs/slugify-whoami whoami)]]))))


(when-let [hecuba-menu (.getElementById js/document "hecuba-menu")]
  (om/root menu
           menu-model
           {:target hecuba-menu
            :init-state {:pathname (-> js/window .-location .-pathname)}})
  (GET "/4/whoami"
       {:handler (fn [x] (println "X:" x) (swap! menu-model assoc :whoami x))
        :response-format :json
        :keywords? true}))<commit_msg>Remove printlns<commit_after>(ns kixi.hecuba.menu
  (:require [ajax.core :refer (GET)]
            [om.core :as om :include-macros true]
            [kixi.hecuba.tabs.slugs :as slugs]
            [sablono.core :as html :refer-macros [html]]))


(enable-console-print!)

(def menu-model (atom {:menu [ {:pathname "/app" :text "Main"}
                               {:pathname "/search" :text "Search"}
                               {:pathname "/properties_comparison" :text "Compare"}
                               {:pathname "/property_map" :text "Property Map"}
                               ;; {:pathname "/user" :text "User Management" :only-roles [:kixi.hecuba.security/super-admin]}
                               {:pathname "/logout" :text "Logout"}
                               {:pathname "https://github.com/MastodonC/kixi.hecuba/blob/master/doc/documentation.md" :text "Documentation"}]
                       :whoami nil}))

(defn menu [{:keys [menu whoami]} owner]
  (reify
    om/IRenderState
    (render-state [_ {page-pathname :pathname}]
      (html
       [:div
        [:ul {:class "nav navbar-nav"}
         (for [{:keys [pathname text roles]} menu
               :let [href (if (= page-pathname pathname) "#" pathname)]]
           [:li [:a {:href href} text]])]
        [:div.pull-right {:id :whoami} (slugs/slugify-whoami whoami)]]))))


(when-let [hecuba-menu (.getElementById js/document "hecuba-menu")]
  (om/root menu
           menu-model
           {:target hecuba-menu
            :init-state {:pathname (-> js/window .-location .-pathname)}})
  (GET "/4/whoami"
       {:handler (fn [x] (swap! menu-model assoc :whoami x))
        :response-format :json
        :keywords? true}))
{'fraction_non_alphanumeric': 0.15988538681948425, 'fraction_numerical': 0.0005730659025787965, 'mean_word_length': 1.9584745762711864, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3927015', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1101, 'n_words': 258}