From 5a34c0337eda45f2b1342771a937fd9a029cb319 Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 26 Jan 2007 02:06:46 +0000 Subject: add "view all comments" for quickstart comments. --- .../protected/controls/Comments/CommentBlock.tpl | 3 +- .../protected/controls/Comments/comments.css | 12 +++-- .../protected/controls/Comments/comments.js | 51 +++++++++++++++------ demos/quickstart/themes/PradoSoft/comment.gif | Bin 0 -> 330 bytes demos/quickstart/themes/PradoSoft/comment_add.gif | Bin 0 -> 361 bytes demos/quickstart/themes/PradoSoft/comments.gif | Bin 0 -> 367 bytes demos/quickstart/themes/PradoSoft/error.gif | Bin 0 -> 579 bytes demos/quickstart/themes/PradoSoft/information.gif | Bin 0 -> 606 bytes demos/quickstart/themes/PradoSoft/lightbulb.gif | Bin 0 -> 606 bytes demos/quickstart/themes/PradoSoft/style.css | 41 ++++++++++++++--- 10 files changed, 83 insertions(+), 24 deletions(-) create mode 100644 demos/quickstart/themes/PradoSoft/comment.gif create mode 100644 demos/quickstart/themes/PradoSoft/comment_add.gif create mode 100644 demos/quickstart/themes/PradoSoft/comments.gif create mode 100644 demos/quickstart/themes/PradoSoft/error.gif create mode 100644 demos/quickstart/themes/PradoSoft/information.gif create mode 100644 demos/quickstart/themes/PradoSoft/lightbulb.gif (limited to 'demos/quickstart') diff --git a/demos/quickstart/protected/controls/Comments/CommentBlock.tpl b/demos/quickstart/protected/controls/Comments/CommentBlock.tpl index 794e230c..56f5cb7a 100644 --- a/demos/quickstart/protected/controls/Comments/CommentBlock.tpl +++ b/demos/quickstart/protected/controls/Comments/CommentBlock.tpl @@ -9,6 +9,7 @@ Top @@ -50,7 +51,7 @@ ControlToValidate="content" ErrorMessage="*" /> - + diff --git a/demos/quickstart/protected/controls/Comments/comments.css b/demos/quickstart/protected/controls/Comments/comments.css index fb03951f..a7cf7f33 100644 --- a/demos/quickstart/protected/controls/Comments/comments.css +++ b/demos/quickstart/protected/controls/Comments/comments.css @@ -158,12 +158,12 @@ div.block-hover margin-top: -1.95em; } -#comment-list .comment +#comment-list .comment, #comment-list-edit .comment { margin-bottom: 2em; } -#comment-list .comment span +#comment-list .comment span, #comment-list-edit .comment span { font-size: 0.85em; border-bottom: 1px dotted #ccc; @@ -171,7 +171,7 @@ div.block-hover display: block; } -#comment-list .comment div +#comment-list .comment div, #comment-list-edit .comment div { padding: 0.5em; @@ -223,4 +223,10 @@ div.block-hover position: absolute; z-index: 0; filter: Alpha(Opacity=50); +} + +#comment-list .source-link, #comment-list-edit .source-link +{ + float: right; + margin-top: -1.5em; } \ No newline at end of file diff --git a/demos/quickstart/protected/controls/Comments/comments.js b/demos/quickstart/protected/controls/Comments/comments.js index 629694a5..46dd0a16 100644 --- a/demos/quickstart/protected/controls/Comments/comments.js +++ b/demos/quickstart/protected/controls/Comments/comments.js @@ -6,14 +6,28 @@ function show_comment_list() $('add-comment').hide(); $('show-comment-link').addClassName("active"); $('add-comment-link').removeClassName("active"); + $('all-comments-link').removeClassName("active"); + show_comments_in_list(currentCommentID); } +function show_all_comments() +{ + $('comment-list').show(); + $('add-comment').hide(); + $('show-comment-link').removeClassName("active"); + $('add-comment-link').removeClassName("active"); + $('all-comments-link').addClassName("active"); + show_comments_in_list(); +} + + function show_add_comment() { $('comment-list').hide(); $('add-comment').show(); $('show-comment-link').removeClassName("active"); $('add-comment-link').addClassName("active"); + $('all-comments-link').removeClassName("active"); } function hide_add_comment() @@ -24,18 +38,8 @@ function hide_add_comment() $(currentCommentID).style.zIndex = 0; } -function show_comments(block) +function show_comments_in_list(id) { - var id = block.id - currentCommentID = id; - $(hidden_block_id).value = id; - var commentBlock = $('user-comments'); - var pos = Position.cumulativeOffset(block); - var top = pos[1] + block.offsetHeight; - commentBlock.style.top = top+"px"; - commentBlock.style.width = (block.offsetWidth-22)+"px"; - - commentBlock.show(); var list = $('comment-list'); var count=0; for(var i=0, k=list.childNodes.length; i < k; i++) @@ -43,7 +47,7 @@ function show_comments(block) var node = list.childNodes[i]; if(node.nodeType == 1) //an element node { - if(node.className.indexOf(id) >= 0) + if(typeof(id) == "undefined" || node.className.indexOf(id) >= 0) { node.style.display="block" count++; @@ -52,8 +56,25 @@ function show_comments(block) node.style.display="none"; } } + return count; +} + +function show_comments(block) +{ + var id = block.id + currentCommentID = id; + $(hidden_block_id).value = id; + var commentBlock = $('user-comments'); + var pos = Position.cumulativeOffset(block); + var top = pos[1] + block.offsetHeight; + commentBlock.style.top = top+"px"; + commentBlock.style.width = (block.offsetWidth-22)+"px"; - list.show(); + commentBlock.show(); + + var count = show_comments_in_list(id); + + $('comment-list').show(); if(count > 0) show_comment_list(); else @@ -164,9 +185,12 @@ if(!Prado.Browser.ie) //not IE 4,5,6 $('show-comment-link').style.display=""; $('to-top').hide(); $('close-comments').show(); + $('all-comments-link').show(); userComments.hide(); $('comments-header').hide(); + $$('#comment-list .source-link').each(function(el){ el.hide(); }); + $$('#content .block-content').each(function(el) { Event.observe(el, 'mouseover', function(e){ if(typeof(show_block)!="undefined") show_block(Event.element(e)); }); @@ -176,6 +200,7 @@ if(!Prado.Browser.ie) //not IE 4,5,6 Event.observe($('show-comment-link'), "click", function(e) { show_comment_list(); Event.stop(e); }); Event.observe($('add-comment-link'), "click", function(e) { show_add_comment(); Event.stop(e); }); + Event.observe($('all-comments-link'), "click", function(e) { show_all_comments(); Event.stop(e); }); Event.observe($('close-comments'), "click", function(e) { hide_add_comment(); Event.stop(e); }); })(); diff --git a/demos/quickstart/themes/PradoSoft/comment.gif b/demos/quickstart/themes/PradoSoft/comment.gif new file mode 100644 index 00000000..413717ea Binary files /dev/null and b/demos/quickstart/themes/PradoSoft/comment.gif differ diff --git a/demos/quickstart/themes/PradoSoft/comment_add.gif b/demos/quickstart/themes/PradoSoft/comment_add.gif new file mode 100644 index 00000000..25ca1e8e Binary files /dev/null and b/demos/quickstart/themes/PradoSoft/comment_add.gif differ diff --git a/demos/quickstart/themes/PradoSoft/comments.gif b/demos/quickstart/themes/PradoSoft/comments.gif new file mode 100644 index 00000000..07852058 Binary files /dev/null and b/demos/quickstart/themes/PradoSoft/comments.gif differ diff --git a/demos/quickstart/themes/PradoSoft/error.gif b/demos/quickstart/themes/PradoSoft/error.gif new file mode 100644 index 00000000..b41ea452 Binary files /dev/null and b/demos/quickstart/themes/PradoSoft/error.gif differ diff --git a/demos/quickstart/themes/PradoSoft/information.gif b/demos/quickstart/themes/PradoSoft/information.gif new file mode 100644 index 00000000..3169faa4 Binary files /dev/null and b/demos/quickstart/themes/PradoSoft/information.gif differ diff --git a/demos/quickstart/themes/PradoSoft/lightbulb.gif b/demos/quickstart/themes/PradoSoft/lightbulb.gif new file mode 100644 index 00000000..f52e8592 Binary files /dev/null and b/demos/quickstart/themes/PradoSoft/lightbulb.gif differ diff --git a/demos/quickstart/themes/PradoSoft/style.css b/demos/quickstart/themes/PradoSoft/style.css index 799dbf36..9c3489d6 100644 --- a/demos/quickstart/themes/PradoSoft/style.css +++ b/demos/quickstart/themes/PradoSoft/style.css @@ -544,22 +544,29 @@ pre code div.tip, div.info, div.note { - border:1px solid #0cf; - padding:1em; + border-top:2px solid #0cf; + border-bottom:2px solid #0cf; + padding:1em 1em 1em 40px; margin: 1em 2em; - background-color: #eff; + border-color: #32CD32; + background-color: #EBFFCE; + background-repeat: no-repeat; + background-position: 10px 50%; + background-image: url(lightbulb.gif); } div.info { - border-color: #32CD32; - background-color: #EBFFCE; + border-color: #87CEFA; + background-color: #EEF9FD; + background-image: url(information.gif); } div.note { - border-color: Orange; + border-color: #FFD700; background-color: #FFF5E1; + background-image: url(error.gif); } div b.tip @@ -607,4 +614,24 @@ div.last-modified color: #999; margin-top: 5em; margin-bottom: -3em; -} \ No newline at end of file +} + +#comment-nav li a#show-comment-link, +#comment-nav li a#add-comment-link, +#comment-nav li a#all-comments-link +{ + background-image: url(comment.gif); + background-repeat: no-repeat; + background-position: 7px 50%; + padding-left: 30px; +} + +#comment-nav li a#add-comment-link +{ + background-image: url(comment_add.gif); +} + +#comment-nav li a#all-comments-link +{ + background-image: url(comments.gif); +} -- cgit v1.2.3