瀏覽代碼

Ticket #1317 - Comments.

AntonLV 8 年之前
父節點
當前提交
02c51e2e5f

+ 7 - 2
inc/js/classes/BxDolCmts.js

@@ -417,7 +417,7 @@ BxDolCmts.prototype.showLiveUpdate = function(oData)
 	 * Note. oData.count_old and oData.count_new are also available and can be checked or used in notification popup.  
 	 */
 	if(!oData.code)
-		return;
+            return;
 
 	var $this = this;
 
@@ -435,8 +435,13 @@ BxDolCmts.prototype.showLiveUpdate = function(oData)
     	},
     	onBeforeHide: function() {
     	},
+        onShow: function() {
+            setTimeout(function() {
+                $('.bx-popup-chain.bx-popup-applied:visible:first').dolPopupHide();
+            }, 5000);
+        },
     	onHide: function() {
-    		$this.resumeLiveUpdates();
+            $this.resumeLiveUpdates();
     	}
     });
 };

+ 1 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -1548,6 +1548,7 @@
 	<string name="_cmt_load_more_replies_popular"><![CDATA[See more replies...]]></string>
 	<string name="_cmt_txt_link_show"><![CDATA[Show]]></string>
 	<string name="_cmt_txt_link_reply"><![CDATA[Reply]]></string>
+        <string name="_cmt_txt_added_sample"><![CDATA[added a new comment]]></string>
 	<string name="_cmt_txt_or"><![CDATA[or]]></string>
 	<string name="_cmt_txt_sample_comment_single"><![CDATA[comment]]></string>
 	<string name="_cmt_txt_sample_reply_to"><![CDATA[reply to comment]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -1546,6 +1546,7 @@
 	<string name="_cmt_load_more_replies_popular"><![CDATA[Увидеть ещё ответы...]]></string>
 	<string name="_cmt_txt_link_show"><![CDATA[Прочитать]]></string>
 	<string name="_cmt_txt_link_reply"><![CDATA[Ответить]]></string>
+        <string name="_cmt_txt_added_sample"><![CDATA[добавил новый комментарий]]></string>
 	<string name="_cmt_txt_or"><![CDATA[или]]></string>
 	<string name="_cmt_txt_sample_comment_single"><![CDATA[комментарий]]></string>
 	<string name="_cmt_txt_sample_reply_to"><![CDATA[ответ на комментарий]]></string>

+ 1 - 0
template/comment.html

@@ -1,4 +1,5 @@
 <li id="cmt__id__" class="__style_prefix____class__ bx-def-padding-top bx-def-margin-bottom">
+    <a id="__anchor__" class="__style_prefix__-anchor"></a>
     <div class="__style_prefix__-cnt__class_cnt__">
         <div class="__style_prefix__-blink-plate"></div>
         <div class="__style_prefix__-avatar bx-def-thumb-size">__author_unit__</div>

+ 8 - 22
template/comments_notification.html

@@ -1,24 +1,10 @@
 <div class="__style_prefix__-notif-comment">
-	<div class="__style_prefix__-notif-avatar bx-def-thumb bx-def-thumb-size">
-		<bx_if:show_icon>
-			<img class="bx-def-thumb bx-def-thumb-size" src="__author_icon__" />
-		</bx_if:show_icon>
-		<bx_if:show_icon_empty>
-			<i class="sys-icon user"></i>
-		</bx_if:show_icon_empty>
-	</div>
-	<div class="__style_prefix__-notif-info bx-def-thumb-size-min-height bx-def-thumb-size-left-indent bx-def-font-small">
-		<div class="__style_prefix__-notifi-username">
-			<b class="__style_prefix__-notifi-username">
-				<bx_if:show_author_link><a href="__author_link__" title="__author_title__">__author_name__</a>: </bx_if:show_author_link>
-				<bx_if:show_author_text>__author_name__: </bx_if:show_author_text>
-			</b>
-			__text__
-		</div>
-		<div class="__style_prefix__-notifi-actions">
-			<a href="javascript:void(0)" onclick="__onclick_show__"><bx_text:_cmt_txt_link_show /></a>
-			<bx_text:_cmt_txt_or />
-			<a href="javascript:void(0)" onclick="__onclick_reply__"><bx_text:_cmt_txt_link_reply /></a>
-		</div>
-	</div>
+    <a class="__style_prefix__-notif-comment bx-def-padding" href="javascript:void(0)" onclick="__onclick_show__" title="<bx_text_attribute:_cmt_txt_link_show />">
+        <div class="__style_prefix__-notif-cnt">
+            <div class="__style_prefix__-notif-avatar bx-def-thumb-size">__author_unit__</div>
+            <div class="__style_prefix__-notif-info bx-def-thumb-size-min-height bx-def-thumb-size-left-indent bx-def-font-small">
+                <div class="__style_prefix__-notifi-username"><b class="__style_prefix__-notifi-username bx-def-font-color">__author_name__</b>: <span class="bx-def-font-small bx-def-font-grayed">__text__</span></div>
+            </div>
+        </div>
+    </a>
 </div>

+ 22 - 21
template/css/cmts.css

@@ -266,30 +266,31 @@
     }
 
     /*--- Comment Styles in Live Update Notification ---*/
-	div.cmt-notif-comment {
-		position: relative;
-	}
-	div.cmt-notif-avatar {
-		position: absolute;
-		top: 0px;
-		left: 0px;
-    	text-align: center;
+    .cmt-notif-comment {
+        position: relative;
+        display: block;
     }
-    div.cmt-notif-avatar .sys-icon {
-    	font-size: 60px;
-		font-size: 3.75rem;
+    div.cmt-notif-cnt {
+        position: relative;
+    }
+    div.cmt-notif-avatar {
+        position: absolute;
+        top: 0px;
+        left: 0px;
+        text-align: center;
     }
     div.cmt-notif-info {
-    	position: realtive;
-	}
-	div.cmt-notifi-username {
-		line-height: 24px;
-		line-height: 1.5rem;
-
-		white-space: nowrap;
-		text-overflow: ellipsis;
-		overflow: hidden;
-	}
+        position: realtive;
+        display: -webkit-flex;
+        display: flex;
+        -webkit-align-items: center;
+        align-items: center;
+    }
+    div.cmt-notifi-username {
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        overflow: hidden;
+    }
         
 /*--- Comment Element Styles ---*/
 div.cmt div.cmt-element-holder,

+ 59 - 43
template/scripts/BxBaseCmts.php

@@ -376,50 +376,66 @@ class BxBaseCmts extends BxDolCmts
 
     function getNotification($iCountOld = 0, $iCountNew = 0)
     {
-    	$iCount = (int)$iCountNew - (int)$iCountOld;
-    	if($iCount < 0)
-    	    return '';
-
-		$aComments = $this->_oQuery->getCommentsBy(array('type' => 'latest', 'object_id' => $this->_iId, 'author' => $this->_getAuthorId(), 'others' => 1, 'start' => '0', 'per_page' => $iCount));
-		if(empty($aComments) || !is_array($aComments))
-			return '';
-
-		$sJsObject = $this->getJsObjectName();
-
-		$aComments = array_reverse($aComments);
-		$iComments = count($aComments);
-
-		$aTmplVarsNotifs = array();
-		foreach($aComments as $iIndex => $aComment) {
-			$iCommentId = $aComment['cmt_id'];
-
-			$sShowOnClick = "javascript:" . $sJsObject . ".goTo(this, '" . $this->_sSystem . $iCommentId . "', '" . $iCommentId . "');";
-			$sReplyOnClick = "javascript:" . $sJsObject . ".goToAndReply(this, '" . $this->_sSystem . $iCommentId . "', '" . $iCommentId . "');";
-
-	    	$aTmplVarsNotifs[] = array(
-	    		'bx_if:show_as_hidden' => array(
-	    			'condition' => $iIndex < ($iComments - 1),
-	    			'content' => array(),
-	    		),
-	    		'item' => $this->_oTemplate->parseHtmlByName('comments_notification.html', array_merge(array(
-	    			'style_prefix' => $this->_sStylePrefix,
-	    			'onclick_show' => $sShowOnClick,
-	    			'onclick_reply' => $sReplyOnClick,
-	    		), $this->_getTmplVarsAuthor($aComment), $this->_getTmplVarsText($aComment))),
-	    		'bx_if:show_previous' => array(
-	    			'condition' => $iIndex > 0,
-	    			'content' => array(
-	    				'onclick_previous' => $sJsObject . '.previousLiveUpdate(this)'
-	    			)
-	    		),
-	    		'onclick_close' => $sJsObject . '.hideLiveUpdate(this)'
-			);
-		}
+        $bShowAll = true;
+        $bShowActions = false;
+
+        $iCount = (int)$iCountNew - (int)$iCountOld;
+        if($iCount < 0)
+            return '';
+
+        $aComments = $this->_oQuery->getCommentsBy(array('type' => 'latest', 'object_id' => $this->_iId, 'author' => $this->_getAuthorId(), 'others' => 1, 'start' => '0', 'per_page' => $iCount));
+        if(empty($aComments) || !is_array($aComments))
+            return '';
+
+        $sJsObject = $this->getJsObjectName();
 
-		return $this->_oTemplate->parseHtmlByName('popup_chain.html', array(
-			'html_id' => $this->getNotificationId(),
-			'bx_repeat:items' => $aTmplVarsNotifs
-		));
+        $aComments = array_reverse($aComments);
+        $iComments = count($aComments);
+
+        $aTmplVarsNotifs = array();
+        foreach($aComments as $iIndex => $aComment) {
+            $iCommentId = $aComment['cmt_id'];
+
+            $sShowOnClick = "javascript:" . $sJsObject . ".goTo(this, '" .  $this->getItemAnchor($iCommentId) . "', '" . $iCommentId . "');";
+            $sReplyOnClick = "javascript:" . $sJsObject . ".goToAndReply(this, '" . $this->getItemAnchor($iCommentId) . "', '" . $iCommentId . "');";
+
+            $oAuthor = $this->_getAuthorObject($aComment['cmt_author_id']);
+            $sAuthorName = $oAuthor->getDisplayName();
+
+            $aTmplVarsNotifs[] = array(
+                'bx_if:show_as_hidden' => array(
+                    'condition' => !$bShowAll && $iIndex < ($iComments - 1),
+                    'content' => array(),
+                ),
+                'item' => $this->_oTemplate->parseHtmlByName('comments_notification.html', array(
+                    'style_prefix' => $this->_sStylePrefix,
+                    'onclick_show' => $sShowOnClick,
+                    'onclick_reply' => $sReplyOnClick,
+                    'author_link' => $oAuthor->getUrl(), 
+                    'author_title' => bx_html_attribute($sAuthorName),
+                    'author_name' => $sAuthorName,
+                    'author_unit' => $oAuthor->getUnit(0, array('template' => 'unit_wo_info_links')), 
+                    'text' => _t('_cmt_txt_added_sample')
+                )),
+                'bx_if:show_previous' => array(
+                    'condition' => $bShowActions && $iIndex > 0,
+                    'content' => array(
+                        'onclick_previous' => $sJsObject . '.previousLiveUpdate(this)'
+                    )
+                ),
+                'bx_if:show_close' => array(
+                    'condition' => $bShowActions,
+                    'content' => array(
+                        'onclick_close' => $sJsObject . '.hideLiveUpdate(this)'
+                    )
+                )
+            );
+        }
+
+        return $this->_oTemplate->parseHtmlByName('popup_chain.html', array(
+            'html_id' => $this->getNotificationId(),
+            'bx_repeat:items' => $aTmplVarsNotifs
+        ));
     }
 
     public function getElementBlock($aParams = array())