aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2011-11-22 16:00:05 -0800
committerfriendica <info@friendica.com>2011-11-22 16:00:05 -0800
commit53590d216691a572ede5e30dbc631a6cd0669c41 (patch)
tree420bd55497f265b5f43931d262f598d81fbb3d6a
parentc568493f572bdc88cae288d5c43e9fb55361ce07 (diff)
downloadvolse-hubzilla-53590d216691a572ede5e30dbc631a6cd0669c41.tar.gz
volse-hubzilla-53590d216691a572ede5e30dbc631a6cd0669c41.tar.bz2
volse-hubzilla-53590d216691a572ede5e30dbc631a6cd0669c41.zip
rework show/hide comments
-rw-r--r--boot.php6
-rw-r--r--include/conversation.php17
-rw-r--r--view/head.tpl12
-rw-r--r--view/hide_comments.tpl4
-rw-r--r--view/theme/duepuntozero/style.css4
5 files changed, 37 insertions, 6 deletions
diff --git a/boot.php b/boot.php
index 6050e6b05..4ccdff7ac 100644
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php');
define ( 'FRIENDIKA_PLATFORM', 'Friendica');
-define ( 'FRIENDIKA_VERSION', '2.3.1172' );
+define ( 'FRIENDIKA_VERSION', '2.3.1173' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
define ( 'DB_UPDATE_VERSION', 1105 );
@@ -417,7 +417,9 @@ class App {
'$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!!
'$generator' => 'Friendika' . ' ' . FRIENDIKA_VERSION,
'$delitem' => t('Delete this item?'),
- '$comment' => t('Comment')
+ '$comment' => t('Comment'),
+ '$showmore' => t('show more'),
+ '$showfewer' => t('show fewer')
));
}
diff --git a/include/conversation.php b/include/conversation.php
index 9ac251e46..d8adb27c3 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -172,6 +172,7 @@ function conversation(&$a, $items, $mode, $update) {
$cmnt_tpl = get_markup_template('comment_item.tpl');
$tpl = get_markup_template('wall_item.tpl');
$wallwall = get_markup_template('wallwall_item.tpl');
+ $hide_comments_tpl = get_markup_template('hide_comments.tpl');
$alike = array();
$dlike = array();
@@ -385,12 +386,20 @@ function conversation(&$a, $items, $mode, $update) {
$override_comment_box = ((($page_writeable) && ($item_writeable)) ? true : false);
$show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
+
if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
if(! $comments_collapsed) {
- $threads[$threadsid] .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent']
- . '" onclick="openClose(' . '\'ccollapse-' . $item['parent'] . '\'); $(\'#ccollapse-wrapper-' . $item['parent'] . '\').hide();" >'
- . sprintf( t('See all %d comments'), $comments[$item['parent']]) . '</div>'
- . '<div class="ccollapse" id="ccollapse-' . $item['parent'] . '" style="display: none;" >';
+
+ // IMPORTANT: the closing </div> in the hide_comments template
+ // is supplied below in code.
+
+ $threads[$threadsid] .= replace_macros($hide_comments_tpl,array(
+ '$id' => $item['parent'],
+ '$num_comments' => sprintf( tt('%d comment','%d comments',$comments[$item['parent']]),
+ $comments[$item['parent']]),
+ '$display' => 'none',
+ '$hide_text' => t('show more')
+ ));
$comments_collapsed = true;
}
}
diff --git a/view/head.tpl b/view/head.tpl
index 752915b14..055c3cef5 100644
--- a/view/head.tpl
+++ b/view/head.tpl
@@ -44,6 +44,18 @@
}
}
+ function showHideComments(id) {
+ if( $('#collapsed-comments-' + id).is(':visible')) {
+ $('#collapsed-comments-' + id).hide();
+ $('#hide-comments-' + id).html('$showmore');
+ }
+ else {
+ $('#collapsed-comments-' + id).show();
+ $('#hide-comments-' + id).html('$showfewer');
+ }
+ }
+
+
</script>
diff --git a/view/hide_comments.tpl b/view/hide_comments.tpl
new file mode 100644
index 000000000..123546bcc
--- /dev/null
+++ b/view/hide_comments.tpl
@@ -0,0 +1,4 @@
+<div class="hide-comments-outer">
+$num_comments <span id="hide-comments-$id" class="hide-comments fakelink" onclick="showHideComments($id);">$hide_text</span>
+</div>
+<div id="collapsed-comments-$id" class="collapsed-comments" style="display: $display;">
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css
index 662518d43..d678876dc 100644
--- a/view/theme/duepuntozero/style.css
+++ b/view/theme/duepuntozero/style.css
@@ -61,6 +61,10 @@ blockquote {
padding: 5px;
}
+.hide-comments {
+ margin-left: 15px;
+}
+
#panel {
background-color: ivory;
position: absolute;