From 7db4f66dc4510ea11c0b0f09569d8477c9fac90f Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Tue, 22 Jun 2010 17:57:01 -0400 Subject: Added recent dumps to profile --- src/site.clj | 10 ++- template/banner.st | 219 +++++++++++++--------------------------------- template/form_login.st | 28 ++---- template/profile.st | 138 +++++++++++++---------------- template/search_script.st | 98 +++++++++++++++++++++ 5 files changed, 239 insertions(+), 254 deletions(-) create mode 100644 template/search_script.st diff --git a/src/site.clj b/src/site.clj index 00729fc..347100a 100644 --- a/src/site.clj +++ b/src/site.clj @@ -419,7 +419,13 @@ FROM users u has-avatar (non-empty-string? (user-info :avatar)) dump-cnt (count-dumps-posted profile-nick) fav-from-cnt (count-dumps-user-faved profile-nick) - score (lookup-score profile-nick)] + score (lookup-score profile-nick) + raw-dumps (logger tags/fetch-dumps-by-nick + :nick profile-nick + :amount 5) + dumps (map tags/add-favorited-flag (take 5 raw-dumps) (repeat session)) + dumps (map tags/remove-tags-for-output dumps) + dumps (logger doall (map process-message-for-output dumps))] (do (.setAttribute st "is_home" is-home) (doseq [a [:nick :avatar :contact :bio]] @@ -430,6 +436,8 @@ FROM users u (.setAttribute st "score_ent" (score-to-entity score)) (.setAttribute st "dump_cnt" (comma-format dump-cnt)) (.setAttribute st "dumps_user_faved_cnt" (comma-format fav-from-cnt)) + (if (not (empty? dumps)) + (.setAttribute st "dumps" dumps)) (.setAttribute st "debug_log_items" (logger)) (.toString st))) (resp-error "NO_USER")))) diff --git a/template/banner.st b/template/banner.st index 88ac21f..f94971f 100644 --- a/template/banner.st +++ b/template/banner.st @@ -1,171 +1,74 @@
-
-
-
- - - - -
-
-
- -
- -$if(isadmin)$ - -$endif$ - + $if(isadmin)$ + + $endif$
-
- $if(user_nick)$ - - - want a room? contact us! - checkout the image vortex!! $else$ Talk with pictures! - checkout the nifty dump fm image vortex! $endif$ $if(isadmin)$ - - news - gossip - art - gif - design - fashion - - +
+ $if(user_nick)$ + want a room? contact us! - checkout the image vortex!! $else$ Talk with pictures! - checkout the nifty dump fm image vortex! $endif$ $if(isadmin)$ + - news - gossip - art - gif - design - fashion - VIP PIMP DEN (GIRLS BOYS ARE COOL) - $endif$ + $endif$ +
+ $if(user_nick)$ +
+
+ Logout +
+ $else$ +
+ $form_login()$
-$if(user_nick)$ -
- $else$
$form_login()$
$endif$ -
- + $endif$ +

-
-$if(isadmin)$ - - $endif$ \ No newline at end of file +$if(isadmin)$ + +$endif$ diff --git a/template/form_login.st b/template/form_login.st index 4d78b20..0ca2107 100644 --- a/template/form_login.st +++ b/template/form_login.st @@ -2,29 +2,19 @@
-

-

-


-

- - - +
-

- - + +

- - -


- -

- + +

+

diff --git a/template/profile.st b/template/profile.st index 5278e77..ea554ab 100644 --- a/template/profile.st +++ b/template/profile.st @@ -10,92 +10,78 @@ - $if(avatar)$ -
- $else$ + $if(avatar)$ +
+ $else$
$endif$ $banner()$ - -
-
- $if(avatar)$ -
-
- $else$ - - - $endif$ + +
+
+ $if(avatar)$ +
+ +
+ $else$ + + + $endif$ - $if(isadmin)$ - - $endif$ + $if(isadmin)$ + + $endif$ - - - - $if(is_home)$ - - $endif$ -
-

- $nick$$if(score_ent)$$score_ent$$endif$

- -

contact info

- $if(contact)$ -
$contact$
- $else$ - - $endif$ + $if(is_home)$ + + $endif$ +
+

+ $nick$$if(score_ent)$$score_ent$$endif$

+ +

contact info

+ $if(contact)$ +
$contact$
+ $else$ + + $endif$
-

bio

- $if(bio)$ -
$bio$
- $else$ - - $endif$ - -
- - - $if(is_home)$ - - - $endif$ -
- -
- - -

$dump_cnt$ dumps ➡

-
- +

bio

+ $if(bio)$ +
$bio$
+ $else$ + + $endif$ +
+ $if(is_home)$ + + + $endif$ +
- -

$dumps_user_faved_cnt$ dumps Faved ➡

-
-

$if(score_ent)$ $score$ $else$ 0 $endif$ of $if(is_home)$ your $else$ $nick$'s$endif$ dumps Faved

-
- -
-
- $footer()$ -
+ $dumps: { d | $log_dump(dump=d)$ }$ +
+
+
+ $footer()$ +
- + diff --git a/template/search_script.st b/template/search_script.st new file mode 100644 index 0000000..94461b3 --- /dev/null +++ b/template/search_script.st @@ -0,0 +1,98 @@ +var term = "" +var imagesPerPage = 25; +var images = [] +function addScript(term) { + jQuery("#search-script").remove() + jQuery("head").append("") +} + +function setContent(x){ + jQuery("#searchresults").html(x) +} + +function setMessage(x){ + jQuery("#message").html(x) +} + +function searchError(error){ + setContent("") + setMessage(error) +} + +function renderPage(num){ + if (images.length > 0) + setMessage("page " + (num + 1)); + var contentString = '' + var start = num * imagesPerPage + var imageCounter = 0 + for(var i = start; i < images.length; i++){ + if(imageCounter > imagesPerPage) break; + contentString += '' + imageCounter += 1 + } + contentString += '

' + if(num > 0) + contentString += '

previous

' + if (images.length > start + imageCounter) + contentString += '

next

' + setContent(contentString) +} + +function searchResult(results){ + images = [] + var alreadyGot = {} + if(results === null || results.length == 0) { + setContent("") + setMessage("no results found") + } else { + for(var r = 0; r") continue; // skip html posts + var imageUrls = getImagesAsArray(content); + for (var i=0; i 2) + tokens.push(rawTokens[t]) + } + if (tokens.length == 0) { + setMessage("search query too small") + } else { + setMessage("searching for '"+tokens.join(" and ")+"'") + addScript(tokens.join("+")) + } +} + +// only search every 800ms while someone is typing +function keyHandler(){ + if (keyHandler.timeout) clearTimeout(keyHandler.timeout); + keyHandler.timeout = setTimeout(doSearch, 800) +} + +jQuery("#search-query").keyup(keyHandler) \ No newline at end of file -- cgit v1.2.3-70-g09d2