AntonLV 13 лет назад
Родитель
Сommit
7e01a5597a

+ 23 - 11
template/css/vote.css

@@ -10,19 +10,37 @@ div.bx-vote-by-list div.bx-persons-unit {
 	margin-right: 0px;
 	margin-bottom: 0px;
 }
-    
+
+/*--- Vote Element Styles ---*/
+div.bx-vote div.bx-vote-element-holder,
+div.bx-vote div.bx-vote-counter-holder {
+	position: relative;
+	float: left;
+}
+
 /*--- Likes based Element Styles ---*/
 .bx-vote-likes .bx-vote-element-holder,
 .bx-vote-likes .bx-vote-counter-holder {
+	line-height: 20px;
+	line-height: 1.25rem;
+}
+
+.bx-vote-likes-button .bx-vote-element-holder,
+.bx-vote-likes-button .bx-vote-counter-holder {
 	line-height: 36px;
 	line-height: 2.2rem;
 }
-div.bx-vote-likes div.bx-vote-element-holder,
-div.bx-vote-likes div.bx-vote-counter-holder {
-	position: relative;
-	float: left;
+
+.bx-vote-likes-button-small .bx-vote-element-holder,
+.bx-vote-likes-button-small .bx-vote-counter-holder {
+	line-height: 24px;
+	line-height: 1.6rem;
 }
 
+.bx-vote-likes-button .bx-vote-counter-holder,
+.bx-vote-likes-button-small .bx-vote-counter-holder {
+	font-size: 1.5rem;
+}
 
 /*--- Stars based Element Styles ---*/
 .bx-vote-stars .bx-vote-element-holder,
@@ -31,12 +49,6 @@ div.bx-vote-likes div.bx-vote-counter-holder {
 	line-height: 1rem;
 }
 
-div.bx-vote-stars div.bx-vote-element-holder,
-div.bx-vote-stars div.bx-vote-counter-holder {
-	position: relative;
-	float: left;
-}
-
 /*--- Stars Styles ---*/
 div.bx-vote-element {
 	position: relative;

+ 11 - 6
template/scripts/BxBaseVoteView.php

@@ -47,6 +47,7 @@ class BxBaseVoteView extends BxDolVote
 	        ),
 	        'likes' => array(
 	        	'show_do_vote_as_button' => false,
+	        	'show_do_vote_as_button_small' => false,
 	        	'show_do_vote_icon' => true,
 	        	'show_do_vote_label' => false,
         		'show_counter' => true
@@ -127,7 +128,11 @@ class BxBaseVoteView extends BxDolVote
 
 	public function getElement($aParams = array())
     {
-    	$sType = $this->isLikeMode() ? BX_DOL_VOTE_TYPE_LIKES : BX_DOL_VOTE_TYPE_STARS;
+    	$bLike =  $this->isLikeMode();
+    	$sType = $bLike ? BX_DOL_VOTE_TYPE_LIKES : BX_DOL_VOTE_TYPE_STARS;
+
+    	$bShowDoVoteAsButtonSmall = $bLike && isset($aParams['show_do_vote_as_button_small']) && $aParams['show_do_vote_as_button_small'] == true;
+		$bShowDoVoteAsButton = $bLike && !$bShowDoVoteAsButtonSmall && isset($aParams['show_do_vote_as_button']) && $aParams['show_do_vote_as_button'] == true;
 
     	$sMethodDoVote = '_getDoVote' . ucfirst($sType);
     	if(!method_exists($this, $sMethodDoVote))
@@ -140,7 +145,7 @@ class BxBaseVoteView extends BxDolVote
     	return BxDolTemplate::getInstance()->parseHtmlByName($sTmplName, array(
     		'style_prefix' => $this->_sStylePrefix,
     		'html_id' => $this->_aHtmlIds['main_' . $sType],
-    		'type' => $sType,
+    		'class' => $this->_sStylePrefix . '-' . $sType . ($bShowDoVoteAsButton ? '-button' : '') . ($bShowDoVoteAsButtonSmall ? '-button-small' : ''),
     		'rate' => $aVote['rate'],
     		'count' => $aVote['count'],
     		'do_vote' => $this->$sMethodDoVote($aParams),
@@ -203,13 +208,13 @@ class BxBaseVoteView extends BxDolVote
 
     protected function _getDoVoteLikes($aParams = array())
     {
+    	$bShowDoVoteAsButtonSmall = isset($aParams['show_do_vote_as_button_small']) && $aParams['show_do_vote_as_button_small'] == true;
+		$bShowDoVoteAsButton = !$bShowDoVoteAsButtonSmall && isset($aParams['show_do_vote_as_button']) && $aParams['show_do_vote_as_button'] == true;
+
     	return BxDolTemplate::getInstance()->parseHtmlByName($this->_sTmplNameDoVoteLikes, array(
     		'style_prefix' => $this->_sStylePrefix,
     		'js_object' => $this->getJsObjectName(),
-    		'bx_if:show_as_button' => array(
-    			'condition' => isset($aParams['show_as_button']) && $aParams['show_as_button'] === true,
-    			'content' => array()
-    		),
+    		'class' => ($bShowDoVoteAsButton ? 'bx-btn' : '') . ($bShowDoVoteAsButtonSmall ? 'bx-btn bx-btn-small' : ''),
     		'value' => $this->getMinValue(),
     		'do_vote' => $this->_getLabelDoLike($aParams),
     	));

+ 1 - 1
template/vote_do_vote_likes.html

@@ -1 +1 @@
-<a class="__style_prefix__-do-vote<bx_if:show_as_button> bx-btn</bx_if:show_as_button>" href="javascript:void(0)" onclick="javascript:__js_object__.vote(this, __value__)">__do_vote__</a>
+<a class="__style_prefix__-do-vote __class__" href="javascript:void(0)" onclick="javascript:__js_object__.vote(this, __value__)">__do_vote__</a>

+ 1 - 1
template/vote_element_block.html

@@ -1,4 +1,4 @@
-<div id="__html_id__" class="__style_prefix__ __style_prefix__-__type__ bx-clearfix" bx_vote_data_rate="__rate__" bx_vote_data_count="__count__">
+<div id="__html_id__" class="__style_prefix__ __class__ bx-clearfix" bx_vote_data_rate="__rate__" bx_vote_data_count="__count__">
 	<div class="__style_prefix__-element-holder">__do_vote__</div>
 	<bx_if:show_counter>
 		<div class="__style_prefix__-counter-holder bx-def-margin-sec-left">__counter__</div>

+ 1 - 1
template/vote_element_inline.html

@@ -1,4 +1,4 @@
-<span id="__html_id__" class="__style_prefix__ __style_prefix__-__type__" bx_vote_data_rate="__rate__" bx_vote_data_count="__count__">
+<span id="__html_id__" class="__style_prefix__ __class__" bx_vote_data_rate="__rate__" bx_vote_data_count="__count__">
 	<span class="__style_prefix__-element-holder">__do_vote__</span><bx_if:show_counter><span class="__style_prefix__-counter-holder bx-def-margin-sec-left">__counter__</span></bx_if:show_counter>
 </span>
 __script__