Skip to content

Commit

Permalink
Merge pull request #69 from PrestaShop/dev
Browse files Browse the repository at this point in the history
Release 2.3.1
  • Loading branch information
PierreRambaud authored Jul 5, 2019
2 parents 6f4c8fa + 9bc79d9 commit 0e06875
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 30 deletions.
20 changes: 15 additions & 5 deletions classes/GamificationTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ public static function parseMetaData($content)
$content = str_replace(array_keys($meta_data), array_values($meta_data), $content);

//replace meta data
$content = preg_replace_callback('#\{config\}([a-zA-Z0-9_-]*)\{/config\}#', create_function('$matches', 'return Configuration::get($matches[1]);'), $content);
$content = preg_replace_callback('#\{link\}(.*)\{/link\}#', create_function('$matches', 'return Context::getContext()->link->getAdminLink($matches[1]);'), $content);
$content = preg_replace_callback('#\{employee\}(.*)\{/employee\}#', create_function('$matches', 'return Context::getContext()->employee->$matches[1];'), $content);
$content = preg_replace_callback('#\{language\}(.*)\{/language\}#', create_function('$matches', 'return Context::getContext()->language->$matches[1];'), $content);
$content = preg_replace_callback('#\{country\}(.*)\{/country\}#', create_function('$matches', 'return Context::getContext()->country->$matches[1];'), $content);
$content = preg_replace_callback('#\{config\}([a-zA-Z0-9_-]*)\{/config\}#', function ($matches) {
return Configuration::get($matches[1]);
}, $content);
$content = preg_replace_callback('#\{link\}(.*)\{/link\}#', function ($matches) {
return Context::getContext()->link->getAdminLink($matches[1]);
}, $content);
$content = preg_replace_callback('#\{employee\}(.*)\{/employee\}#', function ($matches) {
return Context::getContext()->employee->$matches[1];
}, $content);
$content = preg_replace_callback('#\{language\}(.*)\{/language\}#', function ($matches) {
return Context::getContext()->language->$matches[1];
}, $content);
$content = preg_replace_callback('#\{country\}(.*)\{/country\}#', function ($matches) {
return Context::getContext()->country->$matches[1];
}, $content);

return $content;
}
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>gamification</name>
<displayName><![CDATA[Merchant Expertise]]></displayName>
<version><![CDATA[2.3.0]]></version>
<version><![CDATA[2.3.1]]></version>
<description><![CDATA[Become an e-commerce expert within the blink of an eye!]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[administration]]></tab>
Expand Down
2 changes: 1 addition & 1 deletion gamification.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct()
{
$this->name = 'gamification';
$this->tab = 'administration';
$this->version = '2.3.0';
$this->version = '2.3.1';
$this->author = 'PrestaShop';
$this->ps_versions_compliancy = array(
'min' => '1.6.1.0',
Expand Down
48 changes: 25 additions & 23 deletions views/js/gamification_bt.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
$(document).ready( function () {
gamificationTasks();
if (typeof admin_gamification_ajax_url !== 'undefined') {
gamificationTasks();
}
});

function gamificationTasks()
Expand Down Expand Up @@ -102,12 +104,12 @@ function initHeaderNotification(html)
{
$('#gamification_progressbar').progressbar({
change: function() {
if (current_level_percent)
$( ".gamification_progress-label" ).html( gamification_level+' '+current_level+' : '+$('#gamification_progressbar').progressbar( "value" ) + "%" );
else
$( ".gamification_progress-label" ).html('');
},
});
if (current_level_percent)
$( ".gamification_progress-label" ).html( gamification_level+' '+current_level+' : '+$('#gamification_progressbar').progressbar( "value" ) + "%" );
else
$( ".gamification_progress-label" ).html('');
},
});
$('#gamification_progressbar').progressbar("value", current_level_percent );
}
}
Expand All @@ -122,22 +124,22 @@ function initHeaderNotification(html)

function gamificationInsertOnBackOfficeDOM(html)
{
$('#gamification_notif').remove();
// Before PrestaShop 1.7
if (0 < $('#header_notifs_icon_wrapper').length) {
$('#header_notifs_icon_wrapper').append(html);
} else if (0 < $('#notification').length) {
// PrestaShop 1.7 - Default theme
$(html).insertAfter('#notification');
} else if (0 < $('.notification-center').length) {
// PrestaShop 1.7 - New theme
$('.gamification-component').remove();
html = '<div class="component pull-md-right gamification-component"><ul>'+html+'</ul></div>';

$(html).insertAfter($('.notification-center').closest('.component'));
} else {
console.error('Could not find proper place to add the gamification notification center. x_x');
}
$('#gamification_notif').remove();
// Before PrestaShop 1.7
if (0 < $('#header_notifs_icon_wrapper').length) {
$('#header_notifs_icon_wrapper').append(html);
} else if (0 < $('#notification').length) {
// PrestaShop 1.7 - Default theme
$(html).insertAfter('#notification');
} else if (0 < $('.notification-center').length) {
// PrestaShop 1.7 - New theme
$('.gamification-component').remove();
html = '<div class="component pull-md-right gamification-component"><ul>'+html+'</ul></div>';

$(html).insertAfter($('.notification-center').closest('.component'));
} else {
console.error('Could not find proper place to add the gamification notification center. x_x');
}
}

function disabledGamificationNotification()
Expand Down

0 comments on commit 0e06875

Please sign in to comment.