[*] BO : upgraded cover icon management in product > images

This commit is contained in:
Damien Metzger
2013-07-12 18:43:49 +02:00
parent 4919d6d81a
commit 22b73a7339
@@ -99,7 +99,7 @@
{/foreach} {/foreach}
{/if} {/if}
<td class="center cover"><a href="#"> <td class="center cover"><a href="#">
<img class="covered" src="../img/admin/blank.gif" alt="e" /></a> <i class="covered icon-check-empty"></i>
</td> </td>
<td class="center"> <td class="center">
<a href="#" class="btn btn-default delete_product_image" > <a href="#" class="btn btn-default delete_product_image" >
@@ -135,7 +135,7 @@
} }
else else
assoc = false; assoc = false;
imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}enabled{else}forbbiden{/if}", assoc); imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}icon-check-sign{else}icon-check-empty{/if}", assoc);
{/foreach} {/foreach}
{literal} {literal}
$("#imageTable").tableDnD( $("#imageTable").tableDnD(
@@ -189,9 +189,9 @@
} }
if (responseJSON.status == 'ok') if (responseJSON.status == 'ok')
{ {
cover = "forbbiden"; cover = "icon-check-empty";
if (responseJSON.cover == "1") if (responseJSON.cover == "1")
cover = "enabled"; cover = "icon-check-sign";
imageLine(responseJSON.id, responseJSON.path, responseJSON.position, cover, responseJSON.shops) imageLine(responseJSON.id, responseJSON.path, responseJSON.position, cover, responseJSON.shops)
$("#imageTable tr:last").after(responseJSON.html); $("#imageTable tr:last").after(responseJSON.html);
$("#countImage").html(parseInt($("#countImage").html()) + 1); $("#countImage").html(parseInt($("#countImage").html()) + 1);
@@ -220,19 +220,17 @@
{ {
cover = 0; cover = 0;
id = data.content.id; id = data.content.id;
if(data.status == 'ok') if (data.status == 'ok')
{ {
if ($("#" + id).find(".covered").attr("src") == "../img/admin/enabled.gif") if ($("#" + id + ' .covered').hasClass('icon-check-sign'))
cover = 1; cover = 1;
$("#" + id).remove(); $("#" + id).remove();
} }
if (cover) if (cover)
$("#imageTable tr").eq(1).find(".covered").attr("src", "../img/admin/enabled.gif"); $("#imageTable tr").eq(1).find(".covered").addClass('icon-check-sign');
$("#countImage").html(parseInt($("#countImage").html()) - 1); $("#countImage").html(parseInt($("#countImage").html()) - 1);
refreshImagePositions($("#imageTable")); refreshImagePositions($("#imageTable"));
showSuccessMessage(data.confirmations); showSuccessMessage(data.confirmations);
} }
} }
@@ -256,13 +254,13 @@
{ {
e.preventDefault(); e.preventDefault();
id = $(this).parent().parent().parent().attr('id'); id = $(this).parent().parent().parent().attr('id');
$("#imageList .cover img").each( function(i){ $("#imageList .cover i").each( function(i){
$(this).attr("src", $(this).attr("src").replace("enabled", "forbbiden")); $(this).removeClass('icon-check-sign').addClass('icon-check-empty');
}); });
$(this).attr("src", $(this).attr("src").replace("forbbiden", "enabled")); $(this).removeClass('icon-check-empty').addClass('icon-check-sign');
if (current_shop_id != 0) if (current_shop_id != 0)
$('#'+current_shop_id+id).attr('check', true); $('#' + current_shop_id + id).attr('check', true);
else else
$(this).parent().parent().parent().children('td input').attr('check', true); $(this).parent().parent().parent().children('td input').attr('check', true);
doAdminAjax({ doAdminAjax({
@@ -320,10 +318,10 @@
{ {
line = $("#lineType").html(); line = $("#lineType").html();
line = line.replace(/image_id/g, id); line = line.replace(/image_id/g, id);
line = line.replace(/en-default/g, path); line = line.replace(/en-default/g, path);
line = line.replace(/image_path/g, path); line = line.replace(/image_path/g, path);
line = line.replace(/image_position/g, position); line = line.replace(/image_position/g, position);
line = line.replace(/blank/g, cover); line = line.replace(/icon-check-empty/g, cover);
line = line.replace(/<tbody>/gi, ""); line = line.replace(/<tbody>/gi, "");
line = line.replace(/<\/tbody>/gi, ""); line = line.replace(/<\/tbody>/gi, "");
if (shops != false) if (shops != false)