Просмотр исходного кода

Ticket #5184 - Add pissibility to use another iconset.

AntonLV 11 месяцев назад
Родитель
Сommit
563719df7d

+ 59 - 60
inc/js/classes/BxDolFavorite.js

@@ -108,94 +108,93 @@ BxDolFavorite.prototype.onEditFavoriteList = function (oData, oElement) {
 
 BxDolFavorite.prototype.onFavorite = function(oData, oElement)
 {
-	var $this = this;
-	var fContinue = function() {
-            if(oData && oData.code != 0)
-	        return;
+    var $this = this;
+    var fContinue = function() {
+        if(oData && oData.code != 0)
+            return;
 
-            if(oData && oData.label_icon)
-                $(oElement).find('.sys-action-do-icon .sys-icon').attr('class', 'sys-icon ' + oData.label_icon);
+        if(oData && oData.label_icon)
+            $(oElement).find('.sys-action-do-icon .sys-icon').attr('class', 'sys-icon ' + oData.label_icon);
 
-            if(oData && oData.label_title) {
-                $(oElement).attr('title', oData.label_title);
-                $(oElement).find('.sys-action-do-text').html(oData.label_title);
-            }
+        if(oData && oData.label_title) {
+            $(oElement).attr('title', oData.label_title);
+            $(oElement).find('.sys-action-do-text').html(oData.label_title);
+        }
 
-            if(oData && oData.disabled)
-                $(oElement).removeAttr('onclick').addClass($(oElement).hasClass('bx-btn') ? 'bx-btn-disabled' : 'bx-favorite-disabled');
+        if(oData && oData.disabled)
+            $(oElement).removeAttr('onclick').addClass($(oElement).hasClass('bx-btn') ? 'bx-btn-disabled' : 'bx-favorite-disabled');
 
-	    var oCounter = $this._getCounter(oElement);
-	    if(oCounter && oCounter.length > 0) {
-	    	oCounter.html(oData.countf);
+        var oCounter = $this._getCounter(oElement);
+        if(oCounter && oCounter.length > 0) {
+            oCounter.html(oData.countf);
 
-	    	oCounter.parents('.' + $this._sSP + '-counter-holder:first').bx_anim(oData.count > 0 ? 'show' : 'hide');
-	    }
-	};
+            oCounter.parents('.' + $this._sSP + '-counter-holder:first').bx_anim(oData.count > 0 ? 'show' : 'hide');
+        }
+    };
 
-	if(oData && oData.msg != undefined && oData.msg.length > 0)
+    if(oData && oData.msg != undefined && oData.msg.length > 0)
         bx_alert(oData.msg, fContinue);
-	else
-		fContinue();
+    else
+        fContinue();
 };
 
 BxDolFavorite.prototype.processJson = function (oData, oElement)
 {
-	oElement = oElement != undefined ? oElement : this._oParent;
-	var $this = this;
+    oElement = oElement != undefined ? oElement : this._oParent;
+    var $this = this;
 
-	var fContinue = function() {
-		//--- Show Popup
-	    if(oData && oData.popup != undefined) {
-	        $('.' + $this._sSP + '-do-form').parents(".bx-popup-wrapper").remove();
-	        $(oData.popup).hide().prependTo('body').dolPopup({
-	    		pointer: {
-	    			el: oElement
-	    		},
-	            fog: {
-					color: '#fff',
-					opacity: .7
-	            }
-	        });
-	    }
-
-	    //--- Evaluate JS code
-	    if (oData && oData.eval != undefined)
-	        eval(oData.eval);
-	};
+    var fContinue = function() {
+        //--- Show Popup
+        if(oData && oData.popup != undefined) {
+            $('.' + $this._sSP + '-do-form').parents(".bx-popup-wrapper").remove();
+            $(oData.popup).hide().prependTo('body').bxProcessHtml().dolPopup({
+                pointer: {
+                    el: oElement
+                },
+                fog: {
+                    color: '#fff',
+                    opacity: .7
+                }
+            });
+        }
+
+        //--- Evaluate JS code
+        if (oData && oData.eval != undefined)
+            eval(oData.eval);
+    };
 
     //--- Show Message
     if(oData && oData.message != undefined)
         bx_alert(oData.message, fContinue);
-	else
-        if (oData && oData.redirect != undefined)
-            document.location = oData.redirect;
-        else
-    	    fContinue();
+    else if (oData && oData.redirect != undefined)
+        document.location = oData.redirect;
+    else
+        fContinue();
 };
 
 BxDolFavorite.prototype._getButtons = function(oElement) {
-	if($(oElement).hasClass(this._sSP))
-		return $(oElement).find('.' + this._sSP + '-button');
-	else
-		return $(oElement).parents('.' + this._sSP + ':first').find('.' + this._sSP + '-button');
+    if($(oElement).hasClass(this._sSP))
+        return $(oElement).find('.' + this._sSP + '-button');
+    else
+        return $(oElement).parents('.' + this._sSP + ':first').find('.' + this._sSP + '-button');
 };
 
 BxDolFavorite.prototype._getCounter = function(oElement) {
-	if($(oElement).hasClass(this._sSP))
-		return $(oElement).find('.' + this._sSP + '-counter');
-	else 
-		return $(oElement).parents('.' + this._sSP + ':first').find('.' + this._sSP + '-counter');
+    if($(oElement).hasClass(this._sSP))
+        return $(oElement).find('.' + this._sSP + '-counter');
+    else 
+        return $(oElement).parents('.' + this._sSP + ':first').find('.' + this._sSP + '-counter');
 };
 
 BxDolFavorite.prototype._loadingInButton = function(e, bShow) {
-	if($(e).length)
-		bx_loading_btn($(e), bShow);
-	else
-		bx_loading($('body'), bShow);	
+    if($(e).length)
+        bx_loading_btn($(e), bShow);
+    else
+        bx_loading($('body'), bShow);	
 };
 
 BxDolFavorite.prototype._getDefaultParams = function() {
-	var oDate = new Date();
+    var oDate = new Date();
     return {
         sys: this._sSystem,
         object_id: this._iObjId,

+ 1 - 0
template/favorite_do_favorite_privacy_item.html

@@ -0,0 +1 @@
+<span class="flex items-center">__title__ <i class="sys-icon __icon__ ml-2"></i></span>

+ 0 - 1
template/privacy_icon.html

@@ -1 +0,0 @@
- <i class="sys-icon __icon__"></i>

+ 7 - 4
template/scripts/BxBaseFavorite.php

@@ -317,11 +317,14 @@ class BxBaseFavorite extends BxDolFavorite
 
         $oForm->aInputs['action']['value'] = 'Favorite';
         
-        $aListsValues = array();
+        $aListsValues = [];
         $aLists = $this->_oQuery->getList(array('type' => 'all', 'author_id' => $iAuthorId, 'need_default' => true));
-        foreach($aLists as $aList) {
-            $aListsValues[$aList['id']] = $aList['title'] . $this->_oTemplate->parseHtmlByName('privacy_icon.html', array('icon' => BxDolPrivacy::getIcon($aList['allow_view_favorite_list_to'])));
-        }
+        foreach($aLists as $aList)
+            $aListsValues[$aList['id']] = $this->_oTemplate->parseHtmlByName('favorite_do_favorite_privacy_item.html', [
+                'title' => $aList['title'],
+                'icon' => BxDolPrivacy::getIcon($aList['allow_view_favorite_list_to'])
+            ]);
+
         $oForm->aInputs['list']['values'] = $aListsValues;
         $oForm->aInputs['list']['value'] = $this->_oQuery->getList(array('type' => 'object_and_author', 'object_id' => $iObjectId, 'author_id' => $iAuthorId));
         $oForm->aInputs['list']['label_as_html'] = true;