[jenkinscat-docs] master: Refactored out HTML rendering from the server module. (c0711f2)

immanetize at fedoraproject.org immanetize at fedoraproject.org
Fri Feb 6 07:40:50 UTC 2015


Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git

On branch  : master

>---------------------------------------------------------------

commit c0711f2254e66f04fec0f8c374350eae477c5fa2
Author: Pavel Tisnovsky <ptisnovs at redhat.com>
Date:   Thu Jan 15 09:56:03 2015 +0100

    Refactored out HTML rendering from the server module.


>---------------------------------------------------------------

 ChangeLog                 |    5 ++
 src/jenkinscat/server.clj |  113 ---------------------------------------------
 2 files changed, 5 insertions(+), 113 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d1031e4..7f1dc5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 2015-01-15  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/jenkinscat/server.clj:
+	Refactored out HTML rendering from the server module.
+
+2015-01-15  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/jenkinscat/server.clj:
 	GIT/SVN repos added.
 
 2015-01-15  Pavel Tisnovsky  <ptisnovs at redhat.com>
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index d08f8db..b294d55 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -336,119 +336,6 @@
     [output-data]
     (json/write-str output-data))
 
-(defn page-header
-    [subtitle]
-    [:head
-        [:title (str "Jenkinscat - " subtitle)]
-        [:meta {:name "Author"     :content "Pavel Tisnovsky"}]
-        [:meta {:name "Generator"  :content "Clojure"}]
-        [:meta {:http-equiv "Content-type" :content "text/html; charset=utf-8"}]
-        (page/include-css "css/bootstrap.min.css")
-        (page/include-css "css/Jenkinscat.css")
-        (page/include-js  "js/bootstrap.min.js")
-    ])
-
-(defn render-nav-bar
-    [title]
-    [:nav {:class "navbar navbar-inverse navbar-fixed-top" :role "navigation"}
-        [:div {:class "container-fluid"}
-            [:div {:class "navbar-header"}
-                [:button {:type "button" :class "navbar-toggle" :data-toggle "collapse"}
-                    [:span {:class "sr-only"} "Toggle navigation"]
-                    [:span {:class "icon-bar"}]
-                    [:span {:class "icon-bar"}]
-                    [:span {:class "icon-bar"}]
-                ]
-                [:img {:class "navbar-brand-" :style "float:left" :src "jenkinscat.png"}]
-                [:a {:href "/" :class "navbar-brand"} "&nbsp;&nbsp;Jenkinscat"]
-            ] ; ./navbar-header
-                [:div {:class "col-md-4"}
-                    [:form {:class "navbar-form navbar-left"}
-                        [:div {:class "form-group"}
-                        "<input disabled='disabled' autofocus='autofocus' size='40' type='text' class='form-control' ng-model='search' placeholder='' id='searchinput'>"
-                        ]
-                    ]
-                ] ; col ends
-                [:div {:class "col-md"}
-                    [:a {:href "/job-configurations" :class "navbar-brand"} "Job configurations"]
-                ] ; col ends
-                [:div {:class "col-md"}
-                    [:a {:href "/statistics" :class "navbar-brand"} "Statistics"]
-                ] ; col ends
-            ] ; row ends
-        ] ; /.container-fluid
-    ]
-)
-
-(defn render-statistics-page
-    "Render page with various statistics."
-    [statistics]
-    (page/xhtml
-        (page-header "statistics")
-        [:body
-            (render-nav-bar "Statistics")
-            [:table {:class "table table-striped table-condensed table-hover table-borderer" :style "width:800px"}
-                [:tr
-                    [:th "Summary"]
-                    [:th ""]
-                    [:th ""]
-                ]
-                [:tr
-                    [:td "Products:"]
-                    [:td (:product-count statistics)]
-                    [:th ""]
-                ]
-                [:tr
-                    [:td "Books:"]
-                    [:td (:book-count statistics)]
-                    [:th ""]
-                ]
-                [:tr
-                    [:td "Jobs:"]
-                    [:td (:job-count statistics)]
-                    [:th ""]
-                ]
-                [:tr [:td "&nbsp;"] [:td "&nbsp;"] [:td "&nbsp;"]]
-                [:tr
-                    [:th "Pages statistics"]
-                    [:th ""]
-                    [:th ""]
-                ]
-                [:tr
-                    [:td "Total pages:"]
-                    [:td (:total-pages statistics)]
-                    [:th ""]
-                ]
-                [:tr
-                    [:td "Average pages:"]
-                    [:td (int (/ (:total-pages statistics) (:book-count statistics))) " per book"]
-                    [:th ""]
-                ]
-                [:tr
-                    [:td "Book with max pages"]
-                    [:td (:max-pages statistics)]
-                    [:td (:max-pages-book-name statistics)]
-                ]
-                [:tr
-                    [:td "Book with min pages"]
-                    [:td (:min-pages statistics)]
-                    [:td (:min-pages-book-name statistics)]
-                ]
-]]))
-
-(defn generate-response-html
-    "Generate HTTP response for the given request."
-    [page-content session]
-    (-> (http-response/response page-content)
-        (http-response/content-type "text/html; charset=utf-8")
-        (assoc :session session)))
-
-(defn generate-response-json
-    "Generate HTTP response for the given request."
-    [page-content]
-    (-> (http-response/response page-content)
-        (http-response/content-type "application/json; charset=utf-8")))
-
 (defn update-job-name
     "Update job names - we don't need the postfix string."
     [dirname]



More information about the docs-commits mailing list