<commit_before>(ns noteServer.handler
  (:use ring.middleware.anti-forgery
        ring.util.anti-forgery)
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]
            [noteServer.database :as db]
            [noteServer.security :as security]
            [noteServer.html :as html]
            [noteServer.json :as json]
            [clojure.data.json :as j] ; TODO proper import names
            [hiccup.core :refer :all]
            [hiccup.page :refer :all]
            [other.call :refer :all]
            [clojure.string :as str]))

(defroutes app-routes
  (GET "/" [] "Hello World")
  (context "/note" []
           (route/resources "/")
           (GET "/" [id]
                ; since id can be nil
                (if id
                  (let [entries (db/query-notes (str/split id #","))]
                    (if (zero? (count entries))
                      (json/error-note)
                      (json/format-notes entries)))
                  (json/error-note)))

           ;; This is for debugging, at least for now
           (GET "/page" []
                (html5
                  {:lang "en"}
                  [:head
                   (include-js "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"
                               "frontend/script.js")
                   (include-css "frontend/style.css"
                                "frontend/svg-style.css")]
                  [:body
                   [:template#meta-control-template
                   ;[:template#module-adder-template
                    [:div.meta-module.module-adder-module {:role "module"}
                     [:div.button-spacer
                      [:button.module-btn.header-module-btn {:data-type "header"} "H"]
                      [:button.module-btn.text-module-btn   {:data-type "text"  } "T"]
                      [:button.module-btn.list-module-btn   {:data-type "list"  } "L"]
                      [:button.module-btn.image-module-btn  {:data-type "image" } "I"]]]
                   ;[:template#remove-confirm-template
                    [:div.meta-module.remove-confirm-module {:role "module"}
                     [:div.button-spacer
                     [:button.remove-confirm-btn {:name "confirm"} "Really Delete"]
                     [:button.remove-cancel-btn  {:name "cancel"} "Cancel"]]]
                   ;[:template#meta-control-template
                    ;; TODO call this module something better
                    [:div.meta-module.meta-control-module {:role "module"}
                     [:div.button-spacer
                      [:button.edit-module-btn   [:object { :type "image/svg+xml" :data "icons/edit.svg"}]]
                      [:button.new-module-btn    [:object { :type "image/svg+xml" :data "icons/new.svg"}]]
                      [:button.remove-module-btn [:object { :type "image/svg+xml" :data "icons/delete.svg"}]]]]
                    [:div.meta-module.edit-control-module {:role "module"}
                     [:div.button-spacer
                      [:button {:name "end-edit"} "End Edit"]]]]<commit_msg>changed order of meta modules, for consistency in animations<commit_after>(ns noteServer.handler
  (:use ring.middleware.anti-forgery
        ring.util.anti-forgery)
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]
            [noteServer.database :as db]
            [noteServer.security :as security]
            [noteServer.html :as html]
            [noteServer.json :as json]
            [clojure.data.json :as j] ; TODO proper import names
            [hiccup.core :refer :all]
            [hiccup.page :refer :all]
            [other.call :refer :all]
            [clojure.string :as str]))

(defroutes app-routes
  (GET "/" [] "Hello World")
  (context "/note" []
           (route/resources "/")
           (GET "/" [id]
                ; since id can be nil
                (if id
                  (let [entries (db/query-notes (str/split id #","))]
                    (if (zero? (count entries))
                      (json/error-note)
                      (json/format-notes entries)))
                  (json/error-note)))

           ;; This is for debugging, at least for now
           (GET "/page" []
                (html5
                  {:lang "en"}
                  [:head
                   (include-js "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"
                               "frontend/script.js")
                   (include-css "frontend/style.css"
                                "frontend/svg-style.css")]
                  [:body
                   [:template#meta-control-template
                   ;[:template#module-adder-template
                    [:div.meta-module.module-adder-module {:role "module"}
                     [:div.button-spacer
                      [:button.module-btn.header-module-btn {:data-type "header"} "H"]
                      [:button.module-btn.text-module-btn   {:data-type "text"  } "T"]
                      [:button.module-btn.list-module-btn   {:data-type "list"  } "L"]
                      [:button.module-btn.image-module-btn  {:data-type "image" } "I"]]]
                   ;[:template#remove-confirm-template
                    [:div.meta-module.remove-confirm-module {:role "module"}
                     [:div.button-spacer
                     [:button.remove-confirm-btn {:name "confirm"} "Really Delete"]
                     [:button.remove-cancel-btn  {:name "cancel"} "Cancel"]]]
                    [:div.meta-module.edit-control-module {:role "module"}
                     [:div.button-spacer
                      [:button {:name "end-edit"} "End Edit"]]]
                   ;[:template#meta-control-template
                    ;; TODO call this module something better
                    [:div.meta-module.meta-control-module {:role "module"}
                     [:div.button-spacer
                      [:button.edit-module-btn   [:object { :type "image/svg+xml" :data "icons/edit.svg"}]]
                      [:button.new-module-btn    [:object { :type "image/svg+xml" :data "icons/new.svg"}]]
                      [:button.remove-module-btn [:object { :type "image/svg+xml" :data "icons/delete.svg"}]]]]]
{'fraction_non_alphanumeric': 0.14352355776706577, 'fraction_numerical': 0.0012439744985227803, 'mean_word_length': 1.4244251790425932, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4981116', 'n_tokens_mistral': 1878, 'n_tokens_neox': 1736, 'n_words': 351}