[-] BO : FixBug #PSCSX-122 Live module favorite

This commit is contained in:
Jerome Nadaud
2013-12-11 12:33:33 +01:00
parent 0af76e01fb
commit a918c468ec
2 changed files with 9 additions and 1 deletions
@@ -315,6 +315,8 @@
var value_pref = el.data('value'); var value_pref = el.data('value');
var module_pref = el.data('module'); var module_pref = el.data('module');
var action_pref = 'f'; var action_pref = 'f';
var total_favorites = parseInt($('#favorite-count').html());
try try
{ {
resAjax = $.ajax({ resAjax = $.ajax({
@@ -336,6 +338,12 @@
if (data == 'OK') if (data == 'OK')
{ {
el.parent('li').find('.toggle_favorite').toggle(); el.parent('li').find('.toggle_favorite').toggle();
if (value_pref)
$('#favorite-count').html(total_favorites+1);
else
$('#favorite-count').html(total_favorites-1);
} }
}, },
@@ -95,7 +95,7 @@
</div> </div>
</form> </form>
<a class="categoryModuleFilterLink list-group-item {if isset($categoryFiltered.favorites)}active{/if}" href="{$currentIndex}&token={$token}&filterCategory=favorites"> <a class="categoryModuleFilterLink list-group-item {if isset($categoryFiltered.favorites)}active{/if}" href="{$currentIndex}&token={$token}&filterCategory=favorites">
{l s='Favorites'} <span class="badge pull-right">{$nb_modules_favorites}</span> {l s='Favorites'} <span id="favorite-count" class="badge pull-right">{$nb_modules_favorites}</span>
</a> </a>
<a class="categoryModuleFilterLink list-group-item {if count($categoryFiltered) lte 0}active{/if}" href="{$currentIndex}&token={$token}&unfilterCategory=yes"> <a class="categoryModuleFilterLink list-group-item {if count($categoryFiltered) lte 0}active{/if}" href="{$currentIndex}&token={$token}&unfilterCategory=yes">
{l s='All'} <span class="badge pull-right">{$nb_modules}</span> {l s='All'} <span class="badge pull-right">{$nb_modules}</span>