Merged Pull request #302 - Thanks to @kpodemski

This commit is contained in:
vAugagneur
2013-04-16 11:48:17 +02:00
parent 621ca4a29b
commit e271524cc4
2 changed files with 52 additions and 1 deletions
@@ -321,6 +321,46 @@
catch(e){}
return false;
});
$('.toggle_favorite').live('click', function(event)
{
var el = $(this);
var value_pref = el.data('value');
var module_pref = el.data('module');
var action_pref = 'f';
try
{
resAjax = $.ajax({
type:"POST",
url : ajaxCurrentIndex,
async: true,
data : {
ajax : "1",
token : token,
controller : "AdminModules",
action : "saveFavoritePreferences",
action_pref : action_pref,
module_pref : module_pref,
value_pref : value_pref
},
success : function(data)
{
// res.status = cache or refresh
if (data == 'OK')
{
el.parent('div').find('.toggle_favorite').toggle();
}
},
error: function(res,textStatus,jqXHR)
{
//jAlert("TECHNICAL ERROR"+res);
}
});
}
catch(e){}
return false;
});
});
{/literal}
@@ -79,7 +79,18 @@
<p class="desc">{if isset($module->description) && $module->description ne ''}{l s='Description'} : {$module->description}{else}&nbsp;{/if}</p>
{if isset($module->message)}<div class="conf">{$module->message}</div>{/if}
<div class="row-actions-module">
{if !isset($module->not_on_disk)}{$module->optionsHtml}{else}&nbsp;{/if}
{if !isset($module->not_on_disk)}
{$module->optionsHtml}
{if isset($module->preferences) && $module->preferences['favorite'] == 1}
<a class="action_module action_unfavorite toggle_favorite" data-module="{$module->name}" data-value="0" href="#">{l s='Remove from Favorites'}</a>
<a class="action_module action_favorite toggle_favorite" data-module="{$module->name}" data-value="1" href="#" style="display: none;">{l s='Mark as Favorite'}</a>
{else}
<a class="action_module action_unfavorite toggle_favorite" data-module="{$module->name}" data-value="0" href="#" style="display: none;">{l s='Remove from Favorites'}</a>
<a class="action_module action_favorite toggle_favorite" data-module="{$module->name}" data-value="1" href="#">{l s='Mark as Favorite'}</a>
{/if}
{else}
&nbsp;
{/if}
</div>
</div>
</td>