<commit_before>(ns hsm.views
  (:require
    [clojure.string     :as s]
    [clojure.tools.logging :as log]
    [hiccup.core        :refer [html ]]
    [hiccup.page        :refer [doctype include-css include-js html5]]
    [hiccup.def         :refer [defhtml ]]
    [hsm.dev            :refer [is-dev?]]
    [hsm.conf           :refer [languages]]))

(defhtml row-fluid
  [& content]
  [:div.row-fluid
   content])

(defhtml container-fluid
  [& content]
  [:div.container-fluid
    content])

(defhtml panelx
  ([header footer body-css & content ]
    (let [panel-body-css (s/join " " 
                            (conj (set body-css) "panel-body"))]
      [:div.panel.panel-default 
        [:div.panel-heading header]
        [:div {:class panel-body-css} 
          content]
        [:div.panel-footer footer]])))

(defhtml panel
  [header & content]
    (panelx header "" ["panel-body"] content))

(defhtml left-menu
  [host platform page]
  [:div.bs-callout.bs-callout-success ;{:style "background-color:#f4f4f4;" }
  ; (panelx "Social" "" ""
    [:a.btn.btn-success {:href "#mc_embed_signup" :data-toggle :modal} "Subscribe"]
    [:hr]
    [:p "Join " [:b 926] " others"]
    [:p "No spamming. I promise!"]
    [:hr]
    [:a.twitter-share-button {:href "https://twitter.com/share" 
      :data-text (format "Top %s Projects" platform)
      :data-via "pythonhackers" :data-url (format "%s/%s" host page) :data-size :large
      :data-hashtags "python,hackers,github"
      } "Tell your friends"]
    [:a.twitter-follow-button {:href "https://twitter.com/pythonhackers" :data-show-count true :data-size :small }]
    [:div.fb-like {:data-href (format "http://%s/top-%s-projects" host platform)}]
    [:hr]
    [:script#_carbonads_js {:type "text/javascript" :src "//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=pythonhackerscom" }]
    ])

(defhtml languages-pane
  []
  [:table.table
  (for [lang languages]
    [:tr [:td
    [:a {:href (format "/%s/top-projects" lang)} lang]]])])

(def propert-ids 
  { "hackersome.com" "UA-57973731-1"
    "sweet.io" "UA-33058338-1"
    "pythonhackers.com" "UA-57973731-4"
    "clojurehackers.com" "UA-57973731-3"
    "dev.hackersome.com" "UA-57973731-1" })

(defhtml render-user
  [x & {:keys [show-followers] :or {show-followers false}}]
  (log/warn x)
  [:div.user-card
    [:a {:href (format "/user2/%s" (:login x)) :title (:name x)}
      [:img.img-rounded {:src (:image x) :style "width:36px;height:36px;"}]
      [:span.name (:login x)]]
    (when show-followers
      [:span.followers.pull-right (:followers x)])
    ])

(defhtml layout
  [website & content]
  (let [property-id (get propert-ids website)]
    (html5
      {:lang "en-US"}
      [:head
        [:meta {:charset "UTF-8"}]
        ; [:meta {:name "robots" :content "noindex"}]
        [:meta {:name "viewport" :content "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"}]
        [:meta {:content "IE=edge,chrome=1"
                :http-equiv "X-UA-Compatible"}]
        [:title (str website  " Hackersome")]
        (include-css "//maxcdn.bootstrapcdn.com/bootswatch/3.3.1/lumen/bootstrap.min.css")
        (include-css "//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css")  
        (include-css "/css/style.css")]
       [:body
         [:div.nav.navbar-default
          [:div.container
             [:div.navbar-header
                [:a.navbar-brand {:href (format "http://%s" website)} "Hackersome"]]
                [:div.navbar-collapse.collapse
                 [:ul.nav.navbar-nav
                  [:li [:a {:href "/users"} "Users"]]
                  [:li [:a {:href "/collections"} "Collections"]]
                  [:li [:a {:href "/discussions"} "Discussions"]]
                   [:li.dropdown
                     [:a.dropdown-toggle {:data-toggle "dropdown" :href "#"} "Platforms" [:span.caret]]
                     [:ul.dropdown-menu
                       (for [lang languages]
                         [:li [:a {:href (format "/%s/index" lang) } lang]])]]]
                  [:form.navbar-form.navbar-left {:method "GET" :action "/p/"}
                    [:div.form-group 
                      [:input.form-control.typeahead.input-xs {:type "text" :name "project"}]]
                      [:button.btn.btn-default.btn-xs {:type "Submit" :onclick "window.location='/p/'+ $(this).parents('form').find('input').val();return false;"} "Go"]]
                  [:ul.nav.navbar-nav.navbar-right [:li [:a "Hello"] ]]]]]
        [:div.container-fluid
          ; [:div.col-lg-1.left-panel ""]
          [:div.col-lg-10.col-lg-offset-1
            [:div.row {:style "padding-top:20px;"}
              content]]
          [:div.col-lg-1]
         ]
        [:div#mc_embed_signup.modal.fade
          [:div.modal-dialog
            [:div.modal-content
              [:form#mc-embedded-subscribe-form.form-inline {:novalidate "novalidate", :target "_blank", :name "mc-embedded-subscribe-form", :method "post", :action "http://pythonarticles.us7.list-manage.com/subscribe/post?u=ec40ca305ad5132552f8666a7&id=d588dd7362"}
              [:div.modal-header [:button.close {:aria-hidden "true", :data-dismiss "modal", :type "button"} "×"] [:h4.modal-title "Newsletter Subscription"]]<commit_msg>hide collections<commit_after>(ns hsm.views
  (:require
    [clojure.string     :as s]
    [clojure.tools.logging :as log]
    [hiccup.core        :refer [html ]]
    [hiccup.page        :refer [doctype include-css include-js html5]]
    [hiccup.def         :refer [defhtml ]]
    [hsm.dev            :refer [is-dev?]]
    [hsm.conf           :refer [languages]]))

(defhtml row-fluid
  [& content]
  [:div.row-fluid
   content])

(defhtml container-fluid
  [& content]
  [:div.container-fluid
    content])

(defhtml panelx
  ([header footer body-css & content ]
    (let [panel-body-css (s/join " " 
                            (conj (set body-css) "panel-body"))]
      [:div.panel.panel-default 
        [:div.panel-heading header]
        [:div {:class panel-body-css} 
          content]
        [:div.panel-footer footer]])))

(defhtml panel
  [header & content]
    (panelx header "" ["panel-body"] content))

(defhtml left-menu
  [host platform page]
  [:div.bs-callout.bs-callout-success ;{:style "background-color:#f4f4f4;" }
  ; (panelx "Social" "" ""
    [:a.btn.btn-success {:href "#mc_embed_signup" :data-toggle :modal} "Subscribe"]
    [:hr]
    [:p "Join " [:b 926] " others"]
    [:p "No spamming. I promise!"]
    [:hr]
    [:a.twitter-share-button {:href "https://twitter.com/share" 
      :data-text (format "Top %s Projects" platform)
      :data-via "pythonhackers" :data-url (format "%s/%s" host page) :data-size :large
      :data-hashtags "python,hackers,github"
      } "Tell your friends"]
    [:a.twitter-follow-button {:href "https://twitter.com/pythonhackers" :data-show-count true :data-size :small }]
    [:div.fb-like {:data-href (format "http://%s/top-%s-projects" host platform)}]
    [:hr]
    [:script#_carbonads_js {:type "text/javascript" :src "//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=pythonhackerscom" }]
    ])

(defhtml languages-pane
  []
  [:table.table
  (for [lang languages]
    [:tr [:td
    [:a {:href (format "/%s/top-projects" lang)} lang]]])])

(def propert-ids 
  { "hackersome.com" "UA-57973731-1"
    "sweet.io" "UA-33058338-1"
    "pythonhackers.com" "UA-57973731-4"
    "clojurehackers.com" "UA-57973731-3"
    "dev.hackersome.com" "UA-57973731-1" })

(defhtml render-user
  [x & {:keys [show-followers] :or {show-followers false}}]
  (log/warn x)
  [:div.user-card
    [:a {:href (format "/user2/%s" (:login x)) :title (:name x)}
      [:img.img-rounded {:src (:image x) :style "width:36px;height:36px;"}]
      [:span.name (:login x)]]
    (when show-followers
      [:span.followers.pull-right (:followers x)])
    ])

(defhtml layout
  [website & content]
  (let [property-id (get propert-ids website)]
    (html5
      {:lang "en-US"}
      [:head
        [:meta {:charset "UTF-8"}]
        ; [:meta {:name "robots" :content "noindex"}]
        [:meta {:name "viewport" :content "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"}]
        [:meta {:content "IE=edge,chrome=1"
                :http-equiv "X-UA-Compatible"}]
        [:title (str website  " Hackersome")]
        (include-css "//maxcdn.bootstrapcdn.com/bootswatch/3.3.1/lumen/bootstrap.min.css")
        (include-css "//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css")  
        (include-css "/css/style.css")]
       [:body
         [:div.nav.navbar-default
          [:div.container
             [:div.navbar-header
                [:a.navbar-brand {:href (format "http://%s" website)} "Hackersome"]]
                [:div.navbar-collapse.collapse
                 [:ul.nav.navbar-nav
                  [:li [:a {:href "/users"} "Users"]]
                  ; [:li [:a {:href "/collections"} "Collections"]]
                  [:li [:a {:href "/discussions"} "Discussions"]]
                   [:li.dropdown
                     [:a.dropdown-toggle {:data-toggle "dropdown" :href "#"} "Platforms" [:span.caret]]
                     [:ul.dropdown-menu
                       (for [lang languages]
                         [:li [:a {:href (format "/%s/index" lang) } lang]])]]]
                  [:form.navbar-form.navbar-left {:method "GET" :action "/p/"}
                    [:div.form-group 
                      [:input.form-control.typeahead.input-xs {:type "text" :name "project"}]]
                      [:button.btn.btn-default.btn-xs {:type "Submit" :onclick "window.location='/p/'+ $(this).parents('form').find('input').val();return false;"} "Go"]]
                  [:ul.nav.navbar-nav.navbar-right [:li [:a "Hello"] ]]]]]
        [:div.container-fluid
          ; [:div.col-lg-1.left-panel ""]
          [:div.col-lg-10.col-lg-offset-1
            [:div.row {:style "padding-top:20px;"}
              content]]
          [:div.col-lg-1]
         ]
        [:div#mc_embed_signup.modal.fade
          [:div.modal-dialog
            [:div.modal-content
              [:form#mc-embedded-subscribe-form.form-inline {:novalidate "novalidate", :target "_blank", :name "mc-embedded-subscribe-form", :method "post", :action "http://pythonarticles.us7.list-manage.com/subscribe/post?u=ec40ca305ad5132552f8666a7&id=d588dd7362"}
              [:div.modal-header [:button.close {:aria-hidden "true", :data-dismiss "modal", :type "button"} "×"] [:h4.modal-title "Newsletter Subscription"]]
{'fraction_non_alphanumeric': 0.18724571861103226, 'fraction_numerical': 0.020626360109754945, 'mean_word_length': 2.3824, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5248141', 'n_tokens_mistral': 4014, 'n_tokens_neox': 3633, 'n_words': 686}