summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/controls/Comments
diff options
context:
space:
mode:
Diffstat (limited to 'demos/quickstart/protected/controls/Comments')
-rw-r--r--demos/quickstart/protected/controls/Comments/CommentBlock.tpl3
-rw-r--r--demos/quickstart/protected/controls/Comments/comments.css12
-rw-r--r--demos/quickstart/protected/controls/Comments/comments.js51
3 files changed, 49 insertions, 17 deletions
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 @@
<ul id="comment-nav">
<li><a href="#comment-list" style="display:none" id="show-comment-link" >View Comments</a></li>
<li><a href="#add-comment" class="active" id="add-comment-link">Add New Comment</a></li>
+ <li><a href="#comment-list" style="display:none" id="all-comments-link">View All Comments</a></li>
</ul>
<a href="javascript:;" class="right-tab" style="display:none" id="close-comments">Close</a>
<a href="#" class="right-tab" id="to-top">Top</a>
@@ -50,7 +51,7 @@
ControlToValidate="content"
ErrorMessage="*" />
</div>
- <com:TTextBox TextMode="MultiLine" ID="content" />
+ <com:TActiveTextBox TextMode="MultiLine" ID="content" />
<com:THiddenField ID="block_id" Value="top-content"/>
</div>
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); });
})();