From 0f8f1b234276514560e6df3bb6f6bac56fa9807d Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Wed, 24 Feb 2010 08:09:42 -0500 Subject: Commit template changes --- template/banner.st | 2 +- template/log.st | 2 +- template/logged_dump.st | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'template') diff --git a/template/banner.st b/template/banner.st index c67bafa..557a0e0 100755 --- a/template/banner.st +++ b/template/banner.st @@ -18,7 +18,7 @@
  • Image Search
  • $else$    - Register +
    Register
    $endif$ diff --git a/template/log.st b/template/log.st index 0a12550..425a0fb 100755 --- a/template/log.st +++ b/template/log.st @@ -1,6 +1,6 @@ - $roomname$ Log + dump.fm log $head()$
    -
    $dump.created_on$ -- by $dump.nick$
    +
    $dump.created_on$ -- by $dump.nick$
    $dump.content$

    -- cgit v1.2.3-70-g09d2 From c3a98fda15c707f3718e30cf1abb30c1ea042df8 Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Wed, 24 Feb 2010 09:55:06 -0500 Subject: Added edit-toggle to profile --- static/js/pichat.js | 51 +++++++++++++++++---------- template/profile.st | 99 +++++++++++++++++++++++++++-------------------------- 2 files changed, 83 insertions(+), 67 deletions(-) (limited to 'template') diff --git a/static/js/pichat.js b/static/js/pichat.js index 071e8e6..d348d93 100755 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -240,18 +240,12 @@ function initChat() { setTimeout(refresh, 1000); } -function initProfile() { - jQuery(".linkify").each(function() { - var text = jQuery(this).text(); - jQuery(this).html(linkify(text)); - }); - - - $('.logged-dump .content').each(function() { - var t = $(this); - t.html(buildMsgContent(t.text())); - }); +function makePlainText() { + var j = $(this); + j.text(j.text()); +} +function enableProfileEdit() { var onSubmit = function(attr, newVal, oldVal) { newVal = $.trim(newVal); if (newVal == oldVal) { return oldVal }; @@ -273,22 +267,43 @@ function initProfile() { return escapeHtml(newVal); }; + $('#avatar-editing').show(); + var avatarOpts = { 'default_text': 'Enter here!', 'callback': onSubmit, 'field_type': 'text', 'callbackShowErrors': false }; $('#avatar.editable').editInPlace(avatarOpts); + if ($('#upload').length > 0) { + setupUploadAvatar('upload'); + } + var textareaOpts = { 'default_text': 'Enter here!', 'callback': onSubmit, 'field_type': 'textarea', - 'callbackShowErrors': false }; - $('#contact.editable, #bio.editable').editInPlace(textareaOpts); + 'callbackShowErrors': false }; + $('#contact, #bio') + .addClass('editable') + .editInPlace(textareaOpts) + .each(makePlainText); + + var resetPage = function() { location.reload() }; + $('#edit-toggle a').text('--> Done editing <--').click(resetPage); +} - if ($('#upload').length > 0) { - setupUploadAvatar('upload'); - } +function initProfile() { + $(".linkify").each(function() { + var text = jQuery(this).text(); + jQuery(this).html(linkify(text)); + }); + $('#edit-toggle').click(enableProfileEdit); + + $('.logged-dump .content').each(function() { + var t = $(this); + t.html(buildMsgContent(t.text())); + }); }; function initLog() { @@ -331,9 +346,9 @@ function setupUploadAvatar(elementId) { var onComplete = function(file, resp) { $('#spinner').hide(); if (resp == 'INVALID_REQUEST') { - location.href = location.href; + location.reload(); } else if (resp == 'NOT_LOGGED_IN') { - location.href = location.href; + location.reload(); } else if (resp == 'INVALID_IMAGE') { alert("Sorry, dump.fm can't deal with your image. Pick another :("); return; diff --git a/template/profile.st b/template/profile.st index b5d3f38..52b745c 100755 --- a/template/profile.st +++ b/template/profile.st @@ -34,59 +34,60 @@ $dumps:{ d | $logged_dump(dump=d)$ }$ -
    - -

    $nick$

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

    contact info

    -
    $contact$
    - $elseif(contact)$ -

    contact info

    -
    $contact$
    - $else$ -

    -
    - $endif$ - - -
    - - $if(is_home)$ -

    bio

    -
    $bio$
    - $elseif(bio)$ -

    bio

    -
    $bio$
    - $else$ -
    - $endif$ - - -
    -
    -
    -
    +
    + +

    $nick$

    + $if(avatar)$ + + $else$ + + $endif$ + + $if(is_home)$ + + $endif$ + + $endif$ + +

    contact info

    + $if(contact)$ +
    $contact$
    + $else$ +

    +
    + $endif$ +
    + +

    bio

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

     

     

    -

     

     

     

    -

     

    -

    ☺✌ Welcome to dump.fm ✌☺

    +

     

    +

     

    +

     

    +
    +

    ☺✌ Welcome to dump.fm ✌☺



    -- cgit v1.2.3-70-g09d2 From 09adb55a01f9c752cf843dd4dc7163a2ea51cfb8 Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Thu, 25 Feb 2010 08:21:38 -0500 Subject: Added new templates --- template/about_us.st | 7 +++++ template/goodies.st | 8 ++++++ template/head.st | 4 +-- template/help.st | 7 +++++ template/privacy.st | 7 +++++ template/profile.st | 76 +++++++++++++++++++++++++--------------------------- template/terms.st | 7 +++++ 7 files changed, 75 insertions(+), 41 deletions(-) create mode 100644 template/about_us.st create mode 100644 template/goodies.st create mode 100644 template/help.st create mode 100644 template/privacy.st create mode 100644 template/terms.st (limited to 'template') diff --git a/template/about_us.st b/template/about_us.st new file mode 100644 index 0000000..b8ee9f9 --- /dev/null +++ b/template/about_us.st @@ -0,0 +1,7 @@ + + + About Us + $head()$ + + + diff --git a/template/goodies.st b/template/goodies.st new file mode 100644 index 0000000..a7c0824 --- /dev/null +++ b/template/goodies.st @@ -0,0 +1,8 @@ + + + Goodies + $head()$ + + + + \ No newline at end of file diff --git a/template/head.st b/template/head.st index 46ce6a5..e83e687 100755 --- a/template/head.st +++ b/template/head.st @@ -1,7 +1,7 @@ - - + + diff --git a/template/help.st b/template/help.st new file mode 100644 index 0000000..0d41e21 --- /dev/null +++ b/template/help.st @@ -0,0 +1,7 @@ + + + Help + $head()$ + + + diff --git a/template/privacy.st b/template/privacy.st new file mode 100644 index 0000000..513eca3 --- /dev/null +++ b/template/privacy.st @@ -0,0 +1,7 @@ + + + Privacy + $head()$ + + + \ No newline at end of file diff --git a/template/profile.st b/template/profile.st index 52b745c..26cb5a1 100755 --- a/template/profile.st +++ b/template/profile.st @@ -88,55 +88,53 @@

     

    ☺✌ Welcome to dump.fm ✌☺

    - -

    - -

    Step ❶

    -

    ☟ Find a sweet image for your avatar, paste the URL below ☟

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

    Step ❷

    -

    ☟ Enter some contact info below ☟

    -
    $contact$
    -
    - -

    Step ❸

    -

    ☟ Enter some personal info below ☟

    -
    $bio$
    -
    -

    Step ❹

    - -

    Join the ♣ and start posting pictures!

    -

     

    +

    + +

    Step ❶

    +

    ☟ Find a sweet image for your avatar, paste the URL below ☟

    + $if(avatar)$ + + $else$ + + $endif$ + + $if(is_home)$ +
    $avatar$
    + $endif$ + +

    Step ❷

    +

    ☟ Enter some contact info below ☟

    +
    $contact$
    +
    + +

    Step ❸

    +

    ☟ Enter some personal info below ☟

    +
    $bio$
    +
    +

    Step ❹

    + +

    Join the ♣ and start posting pictures!

    +

     

     

     

     

     

     

    $endif$ - +

     

    - $if(next)$ - - $endif$ - -   - $if(prev)$ - - $endif$ - + $if(next)$ + + $endif$ -

    +   + $if(prev)$ + + $endif$ + +

    $users: { u | -
    + diff --git a/template/log.st b/template/log.st index 7281e11..65f149e 100755 --- a/template/log.st +++ b/template/log.st @@ -2,7 +2,7 @@ dump.fm log $head()$ - + @@ -20,6 +20,9 @@
    +
    + +
    $if(dumps)$ $dumps: { d | $logged_dump(dump=d)$ }$ $else$ diff --git a/template/logged_dump.st b/template/logged_dump.st index c7cbbd2..86465e3 100755 --- a/template/logged_dump.st +++ b/template/logged_dump.st @@ -32,7 +32,7 @@ img{
    $dump.created_on$ -- by $dump.nick$
    - +
    $dump.content$

    diff --git a/template/profile.st b/template/profile.st index b5d3f38..9f085c6 100755 --- a/template/profile.st +++ b/template/profile.st @@ -32,8 +32,9 @@ $if(dumps)$ $dumps:{ d | $logged_dump(dump=d)$ }$ - - +
    + +

    $nick$

    @@ -45,8 +46,8 @@ $endif$ $if(is_home)$ -
    $avatar$
    - + + $endif$ -- cgit v1.2.3-70-g09d2 From 3c0aa312a9cb6dce05ec20b93191700e17b1a170 Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Thu, 25 Feb 2010 20:15:28 -0500 Subject: Fixed new-user profile --- template/profile.st | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'template') diff --git a/template/profile.st b/template/profile.st index e3f59ae..46e8cb4 100755 --- a/template/profile.st +++ b/template/profile.st @@ -11,12 +11,9 @@ - + jQuery(document).ready(initProfile); + @@ -28,7 +25,8 @@

    -
    +
    +
    $if(dumps)$ $dumps:{ d | $logged_dump(dump=d)$ }$ @@ -48,8 +46,6 @@
    $endif$ - - $endif$

    contact info

    $if(contact)$ @@ -72,7 +68,6 @@ $endif$ -
    @@ -98,7 +93,11 @@ $endif$ $if(is_home)$ -
    $avatar$
    +
    +
    $avatar$
    + + +
    $endif$

    Step ❷

    -- cgit v1.2.3-70-g09d2 From fa8c89b543bb6e23cc7cac5983cb61818a4e3139 Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Sat, 27 Feb 2010 18:28:06 -0500 Subject: in-progress topics --- src/site.clj | 36 +++++++++++++++++++++++++++++++++--- static/js/pichat.js | 40 ++++++++++++++++++++++++++++++++++++---- template/banner.st | 4 +++- 3 files changed, 72 insertions(+), 8 deletions(-) (limited to 'template') diff --git a/src/site.clj b/src/site.clj index cd2b82f..28dadcb 100755 --- a/src/site.clj +++ b/src/site.clj @@ -148,10 +148,11 @@ (map process-user (sort-by #(% :nick) (vals @(room :users))))) -(defn updates [room since] +(defn updates [room since] {"users" (prepare-user-list room) "messages" (map process-message-for-json - (new-messages room since))}) + (new-messages room since)) + "topic" @(room :topic)}) (def *dumps-per-page* 20) @@ -200,7 +201,9 @@ :name (room-db :name) :description (room-db :description) :users (ref {}) - :messages (ref (fetch-messages-by-room (room-db :room_id) false))}) + :messages (ref (fetch-messages-by-room (room-db :room_id) false)) + :topic (ref nil) + }) ;; Templates @@ -357,6 +360,32 @@ :else (do (update-user-db user-id attr val) (resp-success "OK"))))) +;; Topics + +(defn valid-topic? [topic] + topic) + +(defn valid-deadline? [deadline] + deadline) + +(defn set-topic! [room topic deadline maker] + (ref-set (room :topic) + {:topic topic + :deadline deadline + :maker maker})) + +(defn validate-set-topic [session params] + (let [room (@rooms (params :room)) + topic (params :topic) + deadline (params :deadline)] + (cond (not (session :is_admin)) (resp-error "NOT_VIP") + (not (valid-topic? topic)) (resp-error "INVALID_TOPIC") + (not (valid-deadline? deadline)) (resp-error "INVALID_DEADLINE") + (not room) (resp-error "INVALID_ROOM") + :else (do + (dosync (set-topic! room topic deadline (session :nick))) + (resp-success "OK"))))) + ;; Chat (defn validate-room-access [room-key session] @@ -620,6 +649,7 @@ (POST "/msg" (validated-msg session params)) (POST "/submit-registration" (register session params)) (POST "/update-profile" (update-profile session params)) + (POST "/set-topic" (validate-set-topic session params)) (GET "/about_us" (serve-template "about_us" session)) (GET "/goodies" (serve-template "goodies" session)) (GET "/help" (serve-template "help" session)) diff --git a/static/js/pichat.js b/static/js/pichat.js index b847f58..8917e7c 100755 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -1,8 +1,11 @@ var cache = {} -var pendingMessages = {} +var PendingMessages = {} var MaxImagePosts = 40 +// Utils + + function escapeHtml(txt) { if (!txt) { return ""; } else { return $("").text(txt).html(); } @@ -30,6 +33,8 @@ function linkReplace(url){ } } +// Message Handling + var ImageMsgCount = 0 function removeOldMessages(){ // don't count posts that are all text @@ -73,6 +78,8 @@ function buildUserDiv(user) { } } +// Growl + function buildGrowlDataAndPopDatShit(msg) { var nick = escapeHtml(msg.nick); nick = '' + nick + ':' @@ -95,11 +102,13 @@ function handleMsgError(resp) { } } +// Messages + function submitMessage() { var content = $.trim($('#msgInput').val()); $('#msgInput').val(''); if (content == '') { return; } - pendingMessages[content] = true; + PendingMessages[content] = true; var msg = { 'nick': Nick, 'content': content }; var div = addNewMessage(msg, true); @@ -173,14 +182,34 @@ function updateUI(msgs, users) { } function isDuplicateMessage(m) { - if (m.nick == Nick && m.content in pendingMessages) { - delete pendingMessages[m.content]; + if (m.nick == Nick && m.content in PendingMessages) { + delete PendingMessages[m.content]; return true; } else { return false; } } +var CurrentTopic = null; + +function isSameTopic(curTopic, newTopic) { + if (!!curTopic != !!newTopic) { return false; } + else if (!curTopic) { return false; } // => !newTopic also + else { + return curTopic.topic == newTopic.topic && + curTopic.deadline == newTopic.deadline && + curTopic.maker == newTopic.maker; + } +} + +function updateTopic(newTopic) { + if (isSameTopic(CurrentTopic, newTopic)) { return; } + alert('new topic'); + CurrentTopic = newTopic; + $('#topic').text(topic.topic); + +} + function refresh() { var onSuccess = function(json) { try { @@ -192,6 +221,9 @@ function refresh() { if (typeof UnseenMsgCounter !== 'undefined' && !HasFocus) { UnseenMsgCounter += messages.length; } + if (json.topic) { + updateTopic(json.topic); + } } catch(e) { if (IsAdmin && window.console) { console.error(e); diff --git a/template/banner.st b/template/banner.st index 557a0e0..dd7a7b3 100755 --- a/template/banner.st +++ b/template/banner.st @@ -28,7 +28,9 @@
    - + +
    + $if(isadmin)$
    ★ VIP ★ -- cgit v1.2.3-70-g09d2