Permalink
Browse files

Adding JQuery data tables

  • Loading branch information...
1 parent 6f93112 commit 68048d6ee7ffffebf3f62ab1102216d570450131 Carin Meier committed Apr 21, 2011
Showing with 31 additions and 22 deletions.
  1. +1 −0 .gitignore
  2. +4 −1 resources/public/style.css
  3. +7 −5 src/foreclojure/problems.clj
  4. +19 −16 src/foreclojure/utils.clj
View
1 .gitignore
@@ -7,3 +7,4 @@ pom.xml
*~
*#
.cake
+.DS_Store
View
5 resources/public/style.css
@@ -90,7 +90,10 @@ h3 {
float: left;
}
-
+#problem-table{
+ float: left;
+ width: 90%
+}
span.error, div.error {
color: red;
View
12 src/foreclojure/problems.clj
@@ -113,11 +113,13 @@
(def-page problem-page []
[:div.congrats (session/flash-get :message)]
- [:table.mytable {:width "90%"}
- [:th "Title"]
- [:th "Tags"]
- [:th "Count"]
- [:th "Solved?"]
+ [:table#problem-table.mytable {:width "90%"}
+ [:thead
+ [:tr
+ [:th "Title"]
+ [:th "Tags"]
+ [:th "Count"]
+ [:th "Solved?"]]]
(let [solved (get-solved (session/session-get :user))
problems (get-problem-list)]
(map-indexed
View
35 src/foreclojure/utils.clj
@@ -1,6 +1,6 @@
(ns foreclojure.utils
(:use (hiccup [core :only [html]]
- [page-helpers :only [doctype include-css javascript-tag]])
+ [page-helpers :only [doctype include-css javascript-tag include-js]])
[amalloy.utils.transform :only [transform-if]])
(:require [sandbar.stateful-session :as session]
(ring.util [response :as response])
@@ -52,19 +52,10 @@
[:html
[:head
[:title "4Clojure"]
- (include-css "/style.css")
- (javascript-tag
- " var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-22844856-1']);
- _gaq.push(['_trackPageview']);
-
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
-"
- )]
+ (include-js "/script/jquery-1.5.2.min.js" "/script/jquery.dataTables.min.js")
+ (include-js "/script/foreclojure.js")
+ (include-css "/style.css" "demo_table.css")
+ ]
[:body
[:div#top [:img#logo {:src "/logo.png"}]]
[:div#content
@@ -76,10 +67,22 @@
[:span#user-info
(if-let [user (session/session-get :user)]
[:div
- [:span {:id "username"} (str "Logged in as " user )]
+ [:span#username (str "Logged in as " user )]
[:a#logout {:href "/logout"} "Logout"]]
[:div
[:a#login {:href "/login"} "Login"]
[:a#register {:href "/register"} "Register"]])]]
[:div#content body]
- [:div#footer "The content on 4clojure.com is available under the EPL v 1.0 license." ]]]]))
+ [:div#footer "The content on 4clojure.com is available under the EPL v 1.0 license." ]
+ (javascript-tag
+ " var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-22844856-1']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+"
+ )]]]))

0 comments on commit 68048d6

Please sign in to comment.