Pārlūkot izejas kodu

Ticket #351 - Fixes and improvements in Start based votes.

AntonLV 10 gadi atpakaļ
vecāks
revīzija
923a328314

+ 2 - 1
inc/js/classes/BxDolVote.js

@@ -134,7 +134,8 @@ BxDolVote.prototype._getSliderLegend = function(oElement) {
 };
 BxDolVote.prototype._getSlider = function(oElement, sParent) {
 	var sSlider = (sParent.length > 0 ? sParent + ' ' : '') + '.' + this._sSP + '-slider';
-
+	console.log(oElement);
+	console.log(sSlider);
 	if($(oElement).hasClass(this._sSP))
 		return $(oElement).find(sSlider);
 	else

+ 6 - 0
template/css/default.less

@@ -163,6 +163,12 @@
 .bx-def-margin-thd-left {
     .margin-left(@bx-margin-thd);
 }
+.bx-def-margin-thd-left-auto {
+    .margin-left(@bx-margin-thd);
+    &:first-child {
+        .margin-left(0);
+    }
+}
 
 /* paddings */
 .bx-def-padding {

+ 6 - 7
template/scripts/BxBaseVote.php

@@ -210,12 +210,10 @@ class BxBaseVote extends BxDolVote
 
 		$iObjectId = $this->getId();
 		$iAuthorId = $this->_getAuthorId();
-        $aVote = $this->_oQuery->getVote($iObjectId);
+		$aVote = $this->_oQuery->getVote($iObjectId);
+        $bCount = (int)$aVote['count'] != 0;
 
         $isAllowedVote = $this->isAllowedVote();
-        if(!$isAllowedVote && (int)$aVote['count'] == 0)
-            return '';
-
         $aParams['is_voted'] = $this->_oQuery->isPerformed($iObjectId, $iAuthorId) ? true : false;
 
         //--- Do Vote
@@ -228,12 +226,13 @@ class BxBaseVote extends BxDolVote
 			);
 
         //--- Counter
+        $bTmplVarsCounter = $bShowCounter && ($bCount || $isAllowedVote);
         $aTmplVarsCounter = array();
-        if($bShowCounter)
+        if($bTmplVarsCounter)
         	$aTmplVarsCounter = array(
 				'style_prefix' => $this->_sStylePrefix,
 				'bx_if:show_hidden' => array(
-					'condition' => (int)$aVote['count'] == 0,
+					'condition' => !$bCount,
 					'content' => array()
 				),
 				'counter' => $this->getCounter($aParams)
@@ -258,7 +257,7 @@ class BxBaseVote extends BxDolVote
         		'content' => $aTmplVarsDoVote
         	),
         	'bx_if:show_counter' => array(
-				'condition' => $bShowCounter,
+				'condition' => $bTmplVarsCounter,
 				'content' => $aTmplVarsCounter
 			),
             'bx_if:show_legend' => array(

+ 1 - 1
template/vote_element_inline.html

@@ -1,4 +1,4 @@
 <span id="__html_id__" class="__style_prefix__ __class__ bx-def-margin-right-auto bx-def-margin-thd-topbottom" bx_vote_data_rate="__rate__" bx_vote_data_count="__count__">
-	<bx_if:show_do_vote><span class="__style_prefix__-element-holder">__do_vote__</span></bx_if:show_do_vote><bx_if:show_counter><span class="__style_prefix__-counter-holder bx-def-margin-thd-left-auto"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</span></bx_if:show_counter>
+	<span class="__style_prefix__-do"><bx_if:show_do_vote><span class="__style_prefix__-element-holder">__do_vote__</span></bx_if:show_do_vote><bx_if:show_counter><span class="__style_prefix__-counter-holder bx-def-margin-thd-left-auto"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</span></bx_if:show_counter></span>
 </span>
 __script__