AntonLV há 8 anos atrás
pai
commit
aee4ec80c1

+ 11 - 10
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -228,22 +228,23 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         ));
 
         if(empty($iId)) {
-	        echoJson(array('code' => 4, 'message' => _t('_bx_timeline_txt_err_cannot_repost')));        
-	        return;
+            echoJson(array('code' => 4, 'message' => _t('_bx_timeline_txt_err_cannot_repost')));        
+            return;
         }
 
         $this->onRepost($iId, $aReposted);
 
         $aReposted = $this->_oDb->getReposted($aContent['type'], $aContent['action'], $aContent['object_id']);
-		$sCounter = $this->_oTemplate->getRepostCounter($aReposted);
+        $sCounter = $this->_oTemplate->getRepostCounter($aReposted);
 
-		echoJson(array(
-			'code' => 0, 
-			'message' => _t('_bx_timeline_txt_msg_success_repost'), 
-			'count' => $aReposted['reposts'], 
-			'counter' => $sCounter,
-			'disabled' => !$bReposted
-		));
+        echoJson(array(
+            'code' => 0, 
+            'message' => _t('_bx_timeline_txt_msg_success_repost'), 
+            'count' => $aReposted['reposts'], 
+            'countf' => (int)$aReposted['reposts'] > 0 ? $this->_oTemplate->getRepostCounterLabel($aReposted['reposts']) : '',
+            'counter' => $sCounter,
+            'disabled' => !$bReposted
+        ));
     }
 
     function actionGetPost()

+ 9 - 4
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -696,14 +696,19 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         if($bShowDoRepostAsButton)
             $sClass .= ' bx-btn-height';
 
-        return $this->parseLink('javascript:void(0)', !empty($aEvent['reposts']) && (int)$aEvent['reposts'] > 0 ? $aEvent['reposts'] : '', array(
-        	'id' => $this->_oConfig->getHtmlIds('repost', 'counter') . $aEvent['id'],
-        	'class' => $sClass,
+        return $this->parseLink('javascript:void(0)', !empty($aEvent['reposts']) && (int)$aEvent['reposts'] > 0 ? $this->getRepostCounterLabel($aEvent['reposts']) : '', array(
+            'id' => $this->_oConfig->getHtmlIds('repost', 'counter') . $aEvent['id'],
+            'class' => $sClass,
             'title' => _t('_bx_timeline_txt_reposted_by'),
-        	'onclick' => 'javascript:' . $sJsObject . '.toggleByPopup(this, ' . $aEvent['id'] . ')'
+            'onclick' => 'javascript:' . $sJsObject . '.toggleByPopup(this, ' . $aEvent['id'] . ')'
         ));
     }
 
+    public function getRepostCounterLabel($iCount)
+    {
+        return $iCount;
+    }
+
     public function getRepostedBy($iId)
     {
         $aTmplUsers = array();

+ 6 - 7
modules/boonex/timeline/js/repost.js

@@ -47,15 +47,14 @@ BxTimelineRepost.prototype.repostItem = function(oLink, iOwnerId, sType, sAction
         	var oCounter = $this._getCounter(oLink);
         	var bCounter = oCounter && oCounter.length > 0;
         	var fContinue = function() {
-        		if(oData && oData.counter != undefined && bCounter) {
-            		var oCounterHolder = oCounter.parents('.' + $this.sSP + '-repost-counter-holder:first');
+                    if(oData && oData.count != undefined && bCounter) {
+                        oCounter.html(oData.countf);
 
-            		oCounter.replaceWith(oData.counter);
-            		oCounterHolder.bx_anim(oData.count > 0 ? 'show' : 'hide');
-            	}
+                        oCounter.parents('.' + $this.sSP + '-repost-counter-holder:first').bx_anim(oData.count > 0 ? 'show' : 'hide');
+                    }
 
-            	if(oData && oData.disabled)
-        			$(oLink).removeAttr('onclick').addClass($(oLink).hasClass('bx-btn') ? 'bx-btn-disabled' : $this.sSP + '-repost-disabled');
+                    if(oData && oData.disabled)
+                        $(oLink).removeAttr('onclick').addClass($(oLink).hasClass('bx-btn') ? 'bx-btn-disabled' : $this.sSP + '-repost-disabled');
         	};
 
         	if(oData && oData.message != undefined && oData.message.length > 0 && !bCounter)