Bläddra i källkod

Ticket #3766 - Artificer template (part 3): Actions' counters.

AntonLV 4 år sedan
förälder
incheckning
5780039469
25 ändrade filer med 157 tillägg och 58 borttagningar
  1. 1 1
      modules/boonex/artificer/data/template/bx_timeline/repost_element_block.html
  2. 1 1
      modules/boonex/artificer/data/template/system/comment_counter.html
  3. 1 1
      modules/boonex/artificer/data/template/system/favorite_element_block.html
  4. 1 1
      modules/boonex/artificer/data/template/system/favorite_element_inline.html
  5. 1 1
      modules/boonex/artificer/data/template/system/report_element_block.html
  6. 1 1
      modules/boonex/artificer/data/template/system/report_element_inline.html
  7. 3 3
      modules/boonex/artificer/data/template/system/score_counter.html
  8. 6 1
      modules/boonex/artificer/data/template/system/view_counter.html
  9. 1 1
      modules/boonex/artificer/data/template/system/vote_counter.html
  10. 7 1
      modules/boonex/artificer/data/template/system/vote_counter_wrapper_reactions.html
  11. 2 2
      modules/boonex/english/data/langs/system/en.xml
  12. 2 2
      modules/boonex/russian/data/langs/system/ru.xml
  13. 1 0
      modules/boonex/timeline/classes/BxTimelineMenuItemActions.php
  14. 13 0
      plugins_public/tailwind/css/tailwind.css
  15. 0 0
      plugins_public/tailwind/css/tailwind.min.css
  16. 2 0
      plugins_public/tailwind/js/tailwind.config.js
  17. 12 3
      template/scripts/BxBaseCmts.php
  18. 5 0
      template/scripts/BxBaseCmtsMenuActions.php
  19. 24 14
      template/scripts/BxBaseFavorite.php
  20. 15 7
      template/scripts/BxBaseReport.php
  21. 11 3
      template/scripts/BxBaseScore.php
  22. 18 7
      template/scripts/BxBaseView.php
  23. 10 3
      template/scripts/BxBaseVote.php
  24. 4 1
      template/scripts/BxBaseVoteLikes.php
  25. 15 4
      template/scripts/BxBaseVoteReactions.php

+ 1 - 1
modules/boonex/artificer/data/template/bx_timeline/repost_element_block.html

@@ -1,7 +1,7 @@
 <div id="__html_id__" class="sys-action __style_prefix__-repost __class__ bx-def-margin-right-auto bx-def-valign-center bx-clearfix" bx_repost_data_count="__count__">
     <div class="sys-action-element-holder __style_prefix__-repost-element-holder">__do_repost__</div>
     <bx_if:show_counter>
-        <div class="sys-action-counter-holder __style_prefix__-repost-counter-holder bx-btn-border"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</div>
+        <div class="sys-action-counter-holder __style_prefix__-repost-counter-holder ml-2 first:ml-0"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</div>
     </bx_if:show_counter>
     __script__
 </div>

+ 1 - 1
modules/boonex/artificer/data/template/system/comment_counter.html

@@ -1,5 +1,5 @@
 <div id="__id__" class="__class__ sys-action-counter-iconset text-sm font-normal">
-    <a class="group flex items-center p-1 pl-2 border-none rounded-full text-gray-500 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600" href="__href__"<bx_if:show_onclick> onclick="__onclick__"</bx_if:show_onclick>>
+    <a class="sys-ac-link group p-1 pl-2" href="__href__"<bx_if:show_onclick> onclick="__onclick__"</bx_if:show_onclick>>
         <bx_repeat:profiles>__icon__</bx_repeat:profiles>
         <bx_if:show_icon>
             <div class="sys-action-counter-icon __sp__-counter-icon bx-def-icon-size flex items-center justify-center z-10 h-6 w-6 ring-1 ring-white dark:ring-gray-700 h-6 w-6 bg-gray-200 dark:bg-gray-700 rounded-full">__icon__</div>

+ 1 - 1
modules/boonex/artificer/data/template/system/favorite_element_block.html

@@ -1,7 +1,7 @@
 <div id="__html_id__" class="sys-action __style_prefix__ __class__ flex items-center whitespace-nowrap" bx_favorite_data_count="__count__">
     <div class="sys-action-element-holder __style_prefix__-element-holder">__do_favorite__</div>
     <bx_if:show_counter>
-        <div class="sys-action-counter-holder __style_prefix__-counter-holder bx-def-margin-sec-left bx-btn-border"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</div>
+        <div class="sys-action-counter-holder __style_prefix__-counter-holder ml-2 first:ml-0"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</div>
     </bx_if:show_counter>
     __script__
 </div>

+ 1 - 1
modules/boonex/artificer/data/template/system/favorite_element_inline.html

@@ -1,3 +1,3 @@
 <span id="__html_id__" class="sys-action __style_prefix__ __class__ inline-flex items-center whitespace-nowrap" bx_favorite_data_count="__count__">
-    <span class="sys-action-element-holder __style_prefix__-element-holder">__do_favorite__</span><bx_if:show_counter><span class="sys-action-counter-holder __style_prefix__-counter-holder bx-def-margin-thd-left bx-btn-border"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</span></bx_if:show_counter>__script__
+    <span class="sys-action-element-holder __style_prefix__-element-holder">__do_favorite__</span><bx_if:show_counter><span class="sys-action-counter-holder __style_prefix__-counter-holder ml-2 first:ml-0"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</span></bx_if:show_counter>__script__
 </span>

+ 1 - 1
modules/boonex/artificer/data/template/system/report_element_block.html

@@ -1,7 +1,7 @@
 <div id="__html_id__" class="sys-action __style_prefix__ __class__ flex items-center whitespace-nowrap" bx_report_data_count="__count__">
     <div class="sys-action-element-holder __style_prefix__-element-holder">__do_report__</div>
     <bx_if:show_counter>
-        <div class="sys-action-counter-holder __style_prefix__-counter-holder bx-def-margin-sec-left bx-btn-border"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</div>
+        <div class="sys-action-counter-holder __style_prefix__-counter-holder ml-2 first:ml-0"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</div>
     </bx_if:show_counter>
     __script__
 </div>

+ 1 - 1
modules/boonex/artificer/data/template/system/report_element_inline.html

@@ -1,3 +1,3 @@
 <span id="__html_id__" class="sys-action __style_prefix__ __class__ flex items-center whitespace-nowrap" bx_report_data_count="__count__">
-    <span class="sys-action-element-holder __style_prefix__-element-holder group flex items-center p-1 px-2 space-x-1">__do_report__</span><bx_if:show_counter><span class="sys-action-counter-holder __style_prefix__-counter-holder bx-def-margin-thd-left bx-btn-border"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</span></bx_if:show_counter>__script__
+    <span class="sys-action-element-holder __style_prefix__-element-holder group flex items-center p-1 px-2 space-x-1">__do_report__</span><bx_if:show_counter><span class="sys-action-counter-holder __style_prefix__-counter-holder ml-2 first:ml-0"<bx_if:show_hidden> style="display:none"</bx_if:show_hidden>>__counter__</span></bx_if:show_counter>__script__
 </span>

+ 3 - 3
modules/boonex/artificer/data/template/system/score_counter.html

@@ -1,7 +1,7 @@
-<bx_if:show_link>
-    <a id="__id__" class="__class__ group flex items-center border-none rounded-full text-gray-500 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600 box-border" href="javascript:void(0)" onclick="__onclick__" title="__title__">__content__</a>
-</bx_if:show_link>
 <bx_if:show_text>
     <span id="__id__" class="__class__ bx-def-font-grayed">__content__</span>
 </bx_if:show_text>
+<bx_if:show_link>
+    <a id="__id__" class="__class__ sys-ac-link group box-border" href="javascript:void(0)" onclick="__onclick__" title="__title__">__content__</a>
+</bx_if:show_link>
 __script__

+ 6 - 1
modules/boonex/artificer/data/template/system/view_counter.html

@@ -1,2 +1,7 @@
-<bx_if:show_text><span class="__class__" <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs>>__content__</span></bx_if:show_text><bx_if:show_link><a class="__class__ group flex items-center border-none rounded-full text-gray-500 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600" <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs>>__content__</a></bx_if:show_link>
+<bx_if:show_text>
+    <span class="__class__" <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs>>__content__</span>
+</bx_if:show_text>
+<bx_if:show_link>
+    <a class="__class__ sys-ac-link group" <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs>>__content__</a>
+</bx_if:show_link>
 __script__

+ 1 - 1
modules/boonex/artificer/data/template/system/vote_counter.html

@@ -2,6 +2,6 @@
     <span class="__class__" <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs>>__content__</span>
 </bx_if:show_text>
 <bx_if:show_link>
-    <a class="__class__ group flex items-center border-none rounded-full text-gray-500 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600" <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs>>__content__</a>
+    <a class="__class__ sys-ac-link group" <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs>>__content__</a>
 </bx_if:show_link>
 __script__

+ 7 - 1
modules/boonex/artificer/data/template/system/vote_counter_wrapper_reactions.html

@@ -1,3 +1,9 @@
 <div id="__html_id__" class="__style_prefix__-counter-wrapper __style_prefix__-counter-wrapper-__type__ __style_prefix__-counter-wrapper-__type__-__style__ __class__">
-    <div class="__style_prefix__-counter-wrapper-cnt flex items-center"><bx_if:show_link><a class="group flex items-center p-1 pl-3 border-none rounded-full text-gray-500 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-600" href="__href__" onclick="__onclick__" title="__title__">__counter__</a></bx_if:show_link><bx_if:show_text>__counter__</bx_if:show_text>__script__</div>
+    <div class="__style_prefix__-counter-wrapper-cnt flex items-center">
+        <bx_if:show_text>__counter__</bx_if:show_text>
+        <bx_if:show_link>
+            <a class="sys-ac-link group p-1 pl-3" href="__href__" onclick="__onclick__" title="__title__">__counter__</a>
+        </bx_if:show_link>
+        __script__
+    </div>
 </div>

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

@@ -3362,8 +3362,8 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_request_method_not_found_cnt"><![CDATA[Method({0}) was not found in module({1})]]></string>
 	<string name="_sys_score_counter"><![CDATA[{0}]]></string>
 	<string name="_sys_score_counter_empty"><![CDATA[Vote]]></string>
-	<string name="_sys_score_do_up"><![CDATA[Up vote]]></string>
-	<string name="_sys_score_do_down"><![CDATA[Down vote]]></string>
+	<string name="_sys_score_do_up"><![CDATA[Up]]></string>
+	<string name="_sys_score_do_down"><![CDATA[Down]]></string>
 	<string name="_sys_score_do_by"><![CDATA[Voted by]]></string>
 	<string name="_sys_score_err_not_enabled"><![CDATA[The feature is not available right now. Please, try again later.]]></string>
     <string name="_sys_score_err_duplicate_vote"><![CDATA[Duplicate vote]]></string>

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

@@ -3328,8 +3328,8 @@
     <string name="_sys_request_method_not_found_cnt"><![CDATA[Метод ({0}) не найден в модуле ({1})]]></string>
     <string name="_sys_score_counter"><![CDATA[{0}]]></string>
     <string name="_sys_score_counter_empty"><![CDATA[Проголосовать]]></string>
-    <string name="_sys_score_do_up"><![CDATA[Проголосовать за]]></string>
-    <string name="_sys_score_do_down"><![CDATA[Проголосовать против]]></string>
+    <string name="_sys_score_do_up"><![CDATA[За]]></string>
+    <string name="_sys_score_do_down"><![CDATA[Против]]></string>
     <string name="_sys_score_do_by"><![CDATA[Проголосовали]]></string>
     <string name="_sys_score_err_not_enabled"><![CDATA[Ваш голос не может быть принят в данный момент. Пожалуйста, попробуйте позднее.]]></string>
     <string name="_sys_score_err_duplicate_vote"><![CDATA[Повторный голос]]></string>

+ 1 - 0
modules/boonex/timeline/classes/BxTimelineMenuItemActions.php

@@ -29,6 +29,7 @@ class BxTimelineMenuItemActions extends BxTemplMenuCustom
     protected $_sMode;
     protected $_bShowTitles;
     protected $_bShowCounters;
+    protected $_bShowCountersEmpty;
     protected $_bShowCountersIcons;
 
     protected $_sTmplNameItem;

+ 13 - 0
plugins_public/tailwind/css/tailwind.css

@@ -921,6 +921,19 @@
         @apply truncate;
     }
 
+    /* Common elements: All Actions */
+    .bx-artificer .sys-action-counter.sys-ac-link,
+    .bx-artificer .sys-action-counter .sys-ac-link {
+        @apply flex items-center;
+        @apply border-none;
+        @apply text-gray-500 dark:text-gray-500 hover:text-gray-700 dark:hover:text-gray-300;
+        @apply rounded-full;
+    }
+    .bx-artificer .sys-action-counter.sys-ac-only.sys-ac-link,
+    .bx-artificer .sys-action-counter.sys-ac-only .sys-ac-link {
+        @apply hover:bg-gray-100 dark:hover:bg-gray-600;
+    }
+
     /* Common elements: Comments */
     .bx-artificer .cmt .bx-base-general-unit-meta-username {
         @apply text-gray-700 dark:text-gray-200 hover:text-gray-900 dark:hover:text-white;

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
plugins_public/tailwind/css/tailwind.min.css


+ 2 - 0
plugins_public/tailwind/js/tailwind.config.js

@@ -75,6 +75,8 @@ module.exports = {
 
     'bx-informer-msg-info', 'bx-informer-msg-alert', 'bx-informer-msg-error',
 
+    'sys-action-counter', 'sys-ac-only', 'sys-ac-link',
+
     'bx-base-general-unit-meta-username',
 
     'bx-tl-overflow',

+ 12 - 3
template/scripts/BxBaseCmts.php

@@ -57,6 +57,7 @@ class BxBaseCmts extends BxDolCmts
             'show_do_comment_icon' => true,
             'show_do_comment_label' => false,
             'show_counter' => true,
+            'show_counter_only' => true,
             'show_counter_empty' => false
         );
 
@@ -691,7 +692,9 @@ class BxBaseCmts extends BxDolCmts
                     'condition' => !$bShowCounterEmpty && !$bCount,
                     'content' => array()
                 ),
-                'counter' => $this->getCounter($aParams)
+                'counter' => $this->getCounter(array_merge($aParams, [
+                    'show_counter_only' => false
+                ]))
             );
 
         if(!$bTmplVarsDoComment && !$bTmplVarsCounter)
@@ -720,8 +723,10 @@ class BxBaseCmts extends BxDolCmts
         return $this->_oQuery->getCommentsBy(array('type' => 'object_id', 'object_id' => $this->getId(), 'order_way' => 'desc', 'start' => $iCmtsStart, 'per_page' => $iCmtsLimit * 4));
     }
     
-    public function getCounter($aParams = array())
+    public function getCounter($aParams = [])
     {
+        $aParams = array_merge($this->_aElementDefaults, $aParams);
+
         $bShowEmpty = isset($aParams['show_counter_empty']) && $aParams['show_counter_empty'] == true;
         $bShowDoCommentAsButtonSmall = isset($aParams['show_do_comment_as_button_small']) && $aParams['show_do_comment_as_button_small'] == true;
         $bShowDoCommentAsButton = !$bShowDoCommentAsButtonSmall && isset($aParams['show_do_comment_as_button']) && $aParams['show_do_comment_as_button'] == true;
@@ -730,7 +735,11 @@ class BxBaseCmts extends BxDolCmts
         if($iCount == 0 && !$bShowEmpty)
             return '';
 
-        $sClass = $this->_sStylePrefix . '-counter';
+        $sClass = 'sys-action-counter';
+        if(isset($aParams['show_counter_only']) && (bool)$aParams['show_counter_only'] === true)
+            $sClass .= ' sys-ac-only';
+
+        $sClass .= ' ' . $this->_sStylePrefix . '-counter';
         if($bShowDoCommentAsButtonSmall)
             $sClass .= ' bx-btn-small-height';
         if($bShowDoCommentAsButton)

+ 5 - 0
template/scripts/BxBaseCmtsMenuActions.php

@@ -24,6 +24,7 @@ class BxBaseCmtsMenuActions extends BxTemplMenuCustom
     protected $_sMode;
     protected $_bShowTitles;
     protected $_bShowCounters;
+    protected $_bShowCountersEmpty;
     protected $_bShowCountersIcons;
 
     public function __construct ($aObject, $oTemplate)
@@ -36,6 +37,7 @@ class BxBaseCmtsMenuActions extends BxTemplMenuCustom
         $this->_sMode = strpos($this->_sObject, '_actions') !== false ? self::$_sModeActions : self::$_sModeCounters;
         $this->_bShowTitles = true;
         $this->_bShowCounters = false;
+        $this->_bShowCountersEmpty = false;
         $this->_bShowCountersIcons = true;
     }
 
@@ -88,6 +90,7 @@ class BxBaseCmtsMenuActions extends BxTemplMenuCustom
             'dynamic_mode' => $this->_bDynamicMode,
             'show_do_vote_label' => $this->_bShowTitles,
             'show_counter' => $this->_bShowCounters,
+            'show_counter_empty' => $this->_bShowCountersEmpty,
             'show_counter_label_icon' => $this->_bShowCountersIcons,
         ];
 
@@ -114,6 +117,7 @@ class BxBaseCmtsMenuActions extends BxTemplMenuCustom
             'dynamic_mode' => $this->_bDynamicMode,
             'show_do_vote_label' => $this->_bShowTitles,
             'show_counter' => $this->_bShowCounters,
+            'show_counter_empty' => $this->_bShowCountersEmpty,
             'show_counter_style' => 'compound',
             'show_counter_label_icon' => $this->_bShowCountersIcons,
         ];
@@ -141,6 +145,7 @@ class BxBaseCmtsMenuActions extends BxTemplMenuCustom
             'dynamic_mode' => $this->_bDynamicMode,
             'show_do_vote_label' => $this->_bShowTitles,
             'show_counter' => $this->_bShowCounters,
+            'show_counter_empty' => $this->_bShowCountersEmpty,
             'show_counter_label_icon' => $this->_bShowCountersIcons,
         );
 

+ 24 - 14
template/scripts/BxBaseFavorite.php

@@ -47,7 +47,8 @@ class BxBaseFavorite extends BxDolFavorite
             'show_do_favorite_as_button_small' => false,
             'show_do_favorite_icon' => true,
             'show_do_favorite_label' => false,
-            'show_counter' => true
+            'show_counter' => true,
+            'show_counter_only' => true
         );
 
         $this->_sTmplContentElementBlock = $this->_oTemplate->getHtml('favorite_element_block.html');
@@ -81,13 +82,20 @@ class BxBaseFavorite extends BxDolFavorite
         return $this->getJsObjectName() . '.favorite(this)';
     }
 
-    public function getCounter($aParams = array())
+    public function getCounter($aParams = [])
     {
+        $aParams = array_merge($this->_aElementDefaults, $aParams);
+
         $bShowDoFavoriteAsButtonSmall = isset($aParams['show_do_favorite_as_button_small']) && $aParams['show_do_favorite_as_button_small'] == true;
         $bShowDoFavoriteAsButton = !$bShowDoFavoriteAsButtonSmall && isset($aParams['show_do_favorite_as_button']) && $aParams['show_do_favorite_as_button'] == true;
 
         $aFavorite = $this->_oQuery->getFavorite($this->getId());
-        $sClass = $this->_sStylePrefix . '-counter';
+
+        $sClass = 'sys-action-counter';
+        if(isset($aParams['show_counter_only']) && (bool)$aParams['show_counter_only'] === true)
+            $sClass .= ' sys-ac-only';
+
+        $sClass .= ' ' . $this->_sStylePrefix . '-counter';
         if($bShowDoFavoriteAsButtonSmall)
             $sClass .= ' bx-btn-small-height';
         if($bShowDoFavoriteAsButton)
@@ -95,9 +103,9 @@ class BxBaseFavorite extends BxDolFavorite
 
         return $this->_oTemplate->parseLink('javascript:void(0)', (int)$aFavorite['count'] > 0 ? $this->_getCounterLabel($aFavorite['count']) : '', array(
             'title' => _t('_favorite_do_favorite_by'),
-        	'id' => $this->_aHtmlIds['counter'],
-        	'class' => $sClass,
-        	'onclick' => 'javascript:' . $this->getJsObjectName() . '.toggleByPopup(this)'
+            'id' => $this->_aHtmlIds['counter'],
+            'class' => $sClass,
+            'onclick' => 'javascript:' . $this->getJsObjectName() . '.toggleByPopup(this)'
         ));
     }
 
@@ -122,10 +130,10 @@ class BxBaseFavorite extends BxDolFavorite
 
         $bShowDoFavoriteAsButtonSmall = isset($aParams['show_do_favorite_as_button_small']) && $aParams['show_do_favorite_as_button_small'] == true;
         $bShowDoFavoriteAsButton = !$bShowDoFavoriteAsButtonSmall && isset($aParams['show_do_favorite_as_button']) && $aParams['show_do_favorite_as_button'] == true;
-		$bShowCounter = isset($aParams['show_counter']) && $aParams['show_counter'] === true && $this->isAllowedFavoriteView();
+        $bShowCounter = isset($aParams['show_counter']) && $aParams['show_counter'] === true && $this->isAllowedFavoriteView();
 
-		$iObjectId = $this->getId();
-		$iAuthorId = $this->_getAuthorId();
+        $iObjectId = $this->getId();
+        $iAuthorId = $this->_getAuthorId();
         $aFavorite = $this->_oQuery->getFavorite($iObjectId);
         $bCount = (int)$aFavorite['count'] != 0;
 
@@ -146,11 +154,13 @@ class BxBaseFavorite extends BxDolFavorite
                 'condition' => $bShowCounter,
                 'content' => array(
                     'style_prefix' => $this->_sStylePrefix,
-        			'bx_if:show_hidden' => array(
-        				'condition' => !$bCount,
-        				'content' => array()
-        			),
-                    'counter' => $this->getCounter($aParams)
+                    'bx_if:show_hidden' => array(
+                        'condition' => !$bCount,
+                        'content' => array()
+                    ),
+                    'counter' => $this->getCounter(array_merge($aParams, [
+                        'show_counter_only' => false
+                    ]))
                 )
             ),
             'script' => $this->getJsScript($bDynamicMode)

+ 15 - 7
template/scripts/BxBaseReport.php

@@ -47,7 +47,8 @@ class BxBaseReport extends BxDolReport
             'show_do_report_as_button_small' => false,
             'show_do_report_icon' => true,
             'show_do_report_label' => false,
-            'show_counter' => true
+            'show_counter' => true,
+            'show_counter_only' => true
         );
 
         $this->_sTmplContentElementBlock = $this->_oTemplate->getHtml('report_element_block.html');
@@ -83,15 +84,20 @@ class BxBaseReport extends BxDolReport
         return $this->getJsObjectName() . '.report(this)';
     }
 
-    public function getCounter($aParams = array())
+    public function getCounter($aParams = [])
     {
-        $sJsObject = $this->getJsObjectName();
+        $aParams = array_merge($this->_aElementDefaults, $aParams);
 
         $bShowDoReportAsButtonSmall = isset($aParams['show_do_report_as_button_small']) && $aParams['show_do_report_as_button_small'] == true;
         $bShowDoReportAsButton = !$bShowDoReportAsButtonSmall && isset($aParams['show_do_report_as_button']) && $aParams['show_do_report_as_button'] == true;
 
         $aReport = $this->_oQuery->getReport($this->getId());
-        $sClass = $this->_sStylePrefix . '-counter';
+
+        $sClass = 'sys-action-counter';
+        if(isset($aParams['show_counter_only']) && (bool)$aParams['show_counter_only'] === true)
+            $sClass .= ' sys-ac-only';
+
+        $sClass .= ' ' . $this->_sStylePrefix . '-counter';
         if($bShowDoReportAsButtonSmall)
             $sClass .= ' bx-btn-small-height';
         if($bShowDoReportAsButton)
@@ -100,8 +106,8 @@ class BxBaseReport extends BxDolReport
         return $this->_oTemplate->parseLink('javascript:void(0)',  (int)$aReport['count'] > 0 ? $this->_getCounterLabel($aReport['count']) : '', array(
             'id' => $this->_aHtmlIds['counter'],
             'class' => $sClass, 
-        	'title' => _t('_report_do_report_by'),
-            'onclick' => 'javascript:' . $sJsObject . '.toggleByPopup(this)' 
+            'title' => _t('_report_do_report_by'),
+            'onclick' => 'javascript:' . $this->getJsObjectName() . '.toggleByPopup(this)' 
         ));
     }
 
@@ -152,7 +158,9 @@ class BxBaseReport extends BxDolReport
                         'condition' => (int)$aReport['count'] == 0,
                         'content' => array()
                     ),
-                    'counter' => $this->getCounter($aParams)
+                    'counter' => $this->getCounter(array_merge($aParams, [
+                        'show_counter_only' => false
+                    ]))
                 )
             ),
             'script' => $this->getJsScript($bDynamicMode)

+ 11 - 3
template/scripts/BxBaseScore.php

@@ -46,6 +46,7 @@ class BxBaseScore extends BxDolScore
             'show_do_vote_icon' => true,
             'show_do_vote_label' => false,
             'show_counter' => true,
+            'show_counter_only' => true,
             'show_counter_empty' => true,
             'show_counter_label_icon' => false,
             'show_counter_label_text' => true,
@@ -98,7 +99,7 @@ class BxBaseScore extends BxDolScore
         return $this->getJsObjectName() . '.toggleByPopup(this)';
     }
 
-    public function getCounter($aParams = array())
+    public function getCounter($aParams = [])
     {
         $aParams = array_merge($this->_aElementDefaults, $aParams);
 
@@ -116,7 +117,11 @@ class BxBaseScore extends BxDolScore
         $iCdown = (int)(int)$aScore['count_down'];
         $bEmpty = $iCup == 0 && $iCdown == 0;
 
-        $sClass = $this->_sStylePrefix . '-counter';
+        $sClass = 'sys-action-counter';
+        if(isset($aParams['show_counter_only']) && (bool)$aParams['show_counter_only'] === true)
+            $sClass .= ' sys-ac-only';
+
+        $sClass .= ' ' . $this->_sStylePrefix . '-counter';
         if($bShowDoVoteAsButtonSmall)
             $sClass .= ' bx-btn-small-height';
         if($bShowDoVoteAsButton)
@@ -229,7 +234,10 @@ class BxBaseScore extends BxDolScore
                     'condition' => !$bShowCounterEmpty && !$bCount,
                     'content' => array()
                 ),
-                'counter' => $this->getCounter(array_merge($aParams, array('show_script' => false)))
+                'counter' => $this->getCounter(array_merge($aParams, [
+                    'show_counter_only' => false,
+                    'show_script' => false
+                ]))
             );
 
         //--- Legend

+ 18 - 7
template/scripts/BxBaseView.php

@@ -44,6 +44,7 @@ class BxBaseView extends BxDolView
             'show_do_view_icon' => true,
             'show_do_view_label' => false,
             'show_counter' => true,
+            'show_counter_only' => true,
             'show_counter_label_icon' => false,
             'show_counter_label_text' => true,
             'show_script' => true
@@ -80,9 +81,9 @@ class BxBaseView extends BxDolView
         return $this->_oTemplate->_wrapInTagJsCode($sCode);
     }
 
-    public function getCounter($aParams = array())
+    public function getCounter($aParams = [])
     {
-        $sJsObject = $this->getJsObjectName();
+        $aParams = array_merge($this->_aElementDefaults, $aParams);
 
         $bDynamicMode = isset($aParams['dynamic_mode']) && $aParams['dynamic_mode'] === true;
         $bShowDoViewAsButtonSmall = isset($aParams['show_do_view_as_button_small']) && $aParams['show_do_view_as_button_small'] == true;
@@ -91,14 +92,21 @@ class BxBaseView extends BxDolView
 
         $bAllowedViewViewViewers = $this->isAllowedViewViewViewers();
 
-        $aView = $this->_oQuery->getView($this->getId());
-        $sClass = $this->_sStylePrefix . '-counter';
+        $sClass = 'sys-action-counter';
+        if(isset($aParams['show_counter_only']) && (bool)$aParams['show_counter_only'] === true)
+            $sClass .= ' sys-ac-only';
+
+        $sClass .= ' ' . $this->_sStylePrefix . '-counter';
         if($bShowDoViewAsButtonSmall)
             $sClass .= ' bx-btn-small-height';
         if($bShowDoViewAsButton)
             $sClass .= ' bx-btn-height';
 
-        $sContent = (int)$aView['count'] > 0 ? $this->_getCounterLabel($aView['count'], $aParams) : '';
+        $sContent = '';
+        $aView = $this->_oQuery->getView($this->getId());
+        if((int)$aView['count'] > 0)
+            $sContent = $this->_getCounterLabel($aView['count'], $aParams);
+
         return $this->_oTemplate->parseHtmlByContent($this->_getTmplContentCounter(), array(
             'html_id' => $this->_aHtmlIds['counter'],
             'style_prefix' => $this->_sStylePrefix,
@@ -119,7 +127,7 @@ class BxBaseView extends BxDolView
                     'bx_repeat:attrs' => array(
                         array('key' => 'id', 'value' => $this->_aHtmlIds['counter']),
                         array('key' => 'href', 'value' => 'javascript:void(0)'),
-                        array('key' => 'onclick', 'value' => 'javascript:' . $sJsObject . '.toggleByPopup(this)'),
+                        array('key' => 'onclick', 'value' => 'javascript:' . $this->getJsObjectName() . '.toggleByPopup(this)'),
                         array('key' => 'title', 'value' => _t('_view_do_view_by'))
                     ),
                     'content' => $sContent
@@ -183,7 +191,10 @@ class BxBaseView extends BxDolView
                     'condition' => !$bCount,
                     'content' => array()
                 ),
-                'counter' => $this->getCounter(array_merge($aParams, array('show_script' => false)))
+                'counter' => $this->getCounter(array_merge($aParams, [
+                    'show_counter_only' => false,
+                    'show_script' => false
+                ]))
             );
 
         if(!$bTmplVarsDoView && !$bTmplVarsCounter)

+ 10 - 3
template/scripts/BxBaseVote.php

@@ -83,7 +83,7 @@ class BxBaseVote extends BxDolVote
         return $this->getJsObjectName() . '.toggleByPopup(this)';
     }
 
-    public function getCounter($aParams = array())
+    public function getCounter($aParams = [])
     {
         $aParams = array_merge($this->_aElementDefaults, $aParams);
 
@@ -92,7 +92,11 @@ class BxBaseVote extends BxDolVote
         $bShowActive = $this->isAllowedVoteViewVoters() && (!isset($aParams['show_counter_active']) || (bool)$aParams['show_counter_active'] === true);
         $bShowScript = !isset($aParams['show_script']) || (bool)$aParams['show_script'] === true;
 
-        $sClass = $this->_sStylePrefix . '-counter ' . $this->_sStylePrefix . '-counter-' . $this->_sType;
+        $sClass = 'sys-action-counter';
+        if(isset($aParams['show_counter_only']) && (bool)$aParams['show_counter_only'] === true)
+            $sClass .= ' sys-ac-only';
+
+        $sClass .= ' ' .$this->_sStylePrefix . '-counter ' . $this->_sStylePrefix . '-counter-' . $this->_sType;
         if(!empty($aParams['class_counter']))
             $sClass .= $aParams['class_counter'];
 
@@ -218,7 +222,10 @@ class BxBaseVote extends BxDolVote
                     'condition' => !$bCount && !$bShowCounterEmpty,
                     'content' => array()
                 ),
-                'counter' => $this->getCounter(array_merge($aParams, array('show_script' => false)))
+                'counter' => $this->getCounter(array_merge($aParams, [
+                    'show_counter_only' => false, 
+                    'show_script' => false
+                ]))
             );
 
         //--- Legend

+ 4 - 1
template/scripts/BxBaseVoteLikes.php

@@ -29,6 +29,7 @@ class BxBaseVoteLikes extends BxDolVoteLikes
             'show_do_vote_icon' => true,
             'show_do_vote_label' => false,
             'show_counter' => true,
+            'show_counter_only' => true,
             'show_counter_empty' => false,
             'show_counter_label_icon' => false,
             'show_counter_label_text' => true,
@@ -48,8 +49,10 @@ class BxBaseVoteLikes extends BxDolVoteLikes
         return parent::getJsClick($iValue);
     }
 
-    public function getCounter($aParams = array())
+    public function getCounter($aParams = [])
     {
+        $aParams = array_merge($this->_aElementDefaults, $aParams);
+
         $sClass = '';
         if(isset($aParams['show_do_vote_as_button_small']) && (bool)$aParams['show_do_vote_as_button_small'] === true)
             $sClass = 'bx-btn-small-height';

+ 15 - 4
template/scripts/BxBaseVoteReactions.php

@@ -34,6 +34,7 @@ class BxBaseVoteReactions extends BxDolVoteReactions
             'show_do_vote_icon' => true,
             'show_do_vote_label' => false,
             'show_counter' => false,
+            'show_counter_only' => true,
             'show_counter_empty' => true,
             'show_counter_style' => self::$_sCounterStyleDivided, //--- Alloved styles are 'simple', 'divided' and 'compound'
             'show_legend' => false,
@@ -82,9 +83,11 @@ class BxBaseVoteReactions extends BxDolVoteReactions
         return $sJsObject . '.' . $sJsMethod . '(this, \'' . $sReaction . '\')';
     }
 
-    public function getCounter($aParams = array())
+    public function getCounter($aParams = [])
     {
-        $sDefault = $this->_aElementDefaults['show_counter_style'];
+        $aParams = array_merge($this->_aElementDefaults, $aParams);
+
+        $sDefault = $aParams['show_counter_style'];
         $sCounterStyle = !empty($aParams['show_counter_style']) ? $aParams['show_counter_style'] : $sDefault;
 
         $sMethodPrefix = '_getCounter';
@@ -247,7 +250,9 @@ class BxBaseVoteReactions extends BxDolVoteReactions
 
             $iResultC += $iCount;
             $iResultS += (int)$aVote['sum_' . $sName];
-            $sResult .= trim(parent::getCounter(array_merge($aParams, array('show_script' => false))));
+            $sResult .= trim(parent::getCounter(array_merge($aParams, [
+                'show_script' => false
+            ])));
         }
 
         $aParams = array_merge($aParams, array(
@@ -264,10 +269,16 @@ class BxBaseVoteReactions extends BxDolVoteReactions
         ));
         $sResult .= parent::getCounter(array_merge($aParams, array('show_script' => false)));
 
+        $sClassWrapper = 'sys-action-counter';
+        if(isset($aParams['show_counter_only']) && (bool)$aParams['show_counter_only'] === true)
+            $sClassWrapper .= ' sys-ac-only';
+
+        $sClassWrapper .= ' ' . $this->_aHtmlIds['counter'] . (!$bVote && !$bShowCounterEmpty ? ' bx-vc-hidden' : '');
+
         return $this->_oTemplate->parseHtmlByContent($this->_getTmplContentCounterWrapper(), array(
             'html_id' => $this->_aHtmlIds['counter'],
             'style_prefix' => $this->_sStylePrefix,
-            'class' => $this->_aHtmlIds['counter'] . (!$bVote && !$bShowCounterEmpty ? ' bx-vc-hidden' : ''),
+            'class' => $sClassWrapper,
             'type' => $this->_sType,
             'style' => self::$_sCounterStyleCompound,
             'bx_if:show_link' => array(

Vissa filer visades inte eftersom för många filer har ändrats