Skip to content

Commit

Permalink
Ticket #2451
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Nov 12, 2019
1 parent 015379a commit 39eab84
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/boonex/ads/classes/BxAdsFormEntry.php
Expand Up @@ -84,8 +84,8 @@ public function __construct($aInfo, $oTemplate = false)

function getCode($bDynamicMode = false)
{
$this->_oModule->_oTemplate->addJs('entry.js');
return $this->_oModule->_oTemplate->getJsCode('entry') . parent::getCode($bDynamicMode);
$sInclude = $this->_oModule->_oTemplate->addJs(array('entry.js'), $bDynamicMode);
return ($bDynamicMode ? $sInclude : '') . $this->_oModule->_oTemplate->getJsCode('entry') . parent::getCode($bDynamicMode);
}

function initChecker ($aValues = array (), $aSpecificValues = array())
Expand Down
12 changes: 12 additions & 0 deletions modules/boonex/ads/classes/BxAdsModule.php
Expand Up @@ -26,6 +26,18 @@ function __construct(&$aModule)
));
}

public function actionGetCategoryForm()
{
if(bx_get('category') === false)
return echoJson(array());

return echoJson(array(
'content' => $this->serviceEntityCreate(array(
'dynamic_mode' => true
))
));
}

public function actionInterested()
{
$CNF = &$this->_oConfig->CNF;
Expand Down
24 changes: 23 additions & 1 deletion modules/boonex/ads/js/entry.js
Expand Up @@ -39,9 +39,31 @@ BxAdsEntry.prototype.interested = function(oElement, iContentId) {
};

BxAdsEntry.prototype.onChangeCategory = function(oElement) {
var $this = this;

this.loadingInBlock(oElement, true);

document.location = bx_append_url_params(document.location.href, {category: $(oElement).val()});
jQuery.get (
this._sActionsUrl + 'get_category_form',
{
category: $(oElement).val()
},
function(oData) {
if(oElement)
$this.loadingInBlock(oElement, false);

if(!oData || !oData.content && oData.content.length == 0)
return;

var oContent = $(oData.content);
var sFormId = oContent.filter('form').attr('id');
if(!sFormId)
return;

$('#' + sFormId).replaceWith(oContent);
},
'json'
);
};

BxAdsEntry.prototype.loadingInButton = function(e, bShow) {
Expand Down

0 comments on commit 39eab84

Please sign in to comment.