Permalink
Browse files

Merge branch 'develop' of https://github.com/darrenaustin/4clojure in…

…to feature/style
  • Loading branch information...
amcnamara committed Sep 30, 2011
2 parents 98c5e46 + adbd030 commit 5ad419ab7e2aff8b14d024f6fb8aeb49c13e0c71
Showing with 17 additions and 21 deletions.
  1. +12 −15 resources/public/css/style.css
  2. +2 −2 resources/public/script/foreclojure.js
  3. +3 −4 src/foreclojure/users.clj
@@ -217,30 +217,27 @@ a.novisited {color: #00e;}
padding: 15px;
}
+
/*
- * If the user has javascript turned on, show the
- * "following" checkboxes and turn off the "following"
- * text labels.
+ * By default only show the text label for the "Following" column on
+ * the users page. If they have javascript turned on (detected
+ * via. the js-enabled class set by our page's javascript) then turn
+ * off the text label and turn on the checkbox.
*/
-#user-table input.following, {
- display: inline;
+#user-table input.following {
+ display: none;
}
#user-table span.following {
- display: none;
+ display: inline;
}
-/*
- * If the user has javascript disabled, hide the
- * "following" checkboxes and fallback to showing
- * the "following" text labels.
- */
-#user-table.javascript-disabled input.following {
- display: none;
+#user-table.js-enabled input.following {
+ display: inline;
}
-#user-table.javascript-disabled span.following {
- display: inline;
+#user-table.js-enabled span.following {
+ display: none;
}
@@ -39,9 +39,9 @@ $(document).ready(function() {
return false;
});
- $("#user-table").removeClass('javascript-disabled');
+ $("#user-table").addClass("js-enabled");
- $("form input.following").live("click", function(e) {
+ $("#user-table input.following").live("click", function(e) {
e.preventDefault();
var $checkbox = $(this)
var $form = $checkbox.parents("form")
@@ -83,10 +83,9 @@
(defn following-checkbox [current-user-id following user-id user]
(when (and current-user-id (not= current-user-id user-id))
- (let [following? (following user-id)]
+ (let [following? (contains? following user-id)]
(form-to [:post (follow-url user (not following?))]
- [:input.following {:type "checkbox" :name "following"
- :checked following? :value following?}]
+ [:input.following {:type "checkbox" :checked following?}]
[:span.following (when following? "yes")]))))
(defn generate-user-list [user-set]
@@ -96,7 +95,7 @@
[_id (set following)]))]
(list
[:br]
- [:table#user-table.my-table.javascript-disabled
+ [:table#user-table.my-table
[:thead
[:tr
[:th {:style "width: 40px;" } "Rank"]

0 comments on commit 5ad419a

Please sign in to comment.