Merge branch 'cleanmaster' into modules

This commit is contained in:
Etienne Roudeix
2013-12-12 15:45:45 +01:00
19 changed files with 290 additions and 23 deletions

View File

@@ -4,11 +4,11 @@ $(function($){
Dropzone.autoDiscover = false;
// Remove image on click
$.imageUploadManager.initImageDropZone = function() {
$.imageUploadManager.onClickDeleteImage();
$.imageUploadManager.sortImage();
var imageDropzone = new Dropzone("#images-dropzone", {
dictDefaultMessage : $('.btn-browse').html(),
@@ -65,6 +65,7 @@ $(function($){
data
);
$.imageUploadManager.onClickDeleteImage();
$.imageUploadManager.sortImage();
});
};
@@ -95,8 +96,61 @@ $(function($){
$(".image-manager .message").html(
data
);
/* refresh position */
$( "#js-sort-image").children('li').each(function(position, element) {
$(element).find('.js-sorted-position').html(position + 1);
});
});
return false;
});
};
$.imageUploadManager.sortImage = function() {
$( "#js-sort-image" ).sortable({
placeholder: "ui-sortable-placeholder col-sm-6 col-md-3",
change: function( event, ui ) {
/* refresh position */
var pickedElement = ui.item;
var position = 0;
$( "#js-sort-image").children('li').each(function(k, element) {
if($(element).data('sort-id') == pickedElement.data('sort-id')) {
return true;
}
position++;
if($(element).is('.ui-sortable-placeholder')) {
pickedElement.find('.js-sorted-position').html(position);
} else {
$(element).find('.js-sorted-position').html(position);
}
});
},
stop: function( event, ui ) {
/* update */
var newPosition = ui.item.find('.js-sorted-position').html();
var imageId = ui.item.data('sort-id');
$.ajax({
type: "POST",
url: imageReorder,
data: {
image_id: imageId,
position: newPosition
},
statusCode: {
404: function() {
$(".image-manager .message").html(
imageReorderErrorMessage
);
}
}
}).done(function(data) {
$(".image-manager .message").html(
data
);
});
}
});
$( "#js-sort-image" ).disableSelection();
};
});

View File

@@ -10,13 +10,14 @@ Parameters:
{ifloop rel="document"}
<table class="table table-striped table-condensed table-left-aligned">
{loop type="document" name="document" source="{$documentType}" order="manual-reverse" source_id="{$parentId}"}
{loop type="document" name="document" source="{$documentType}" order="manual" source_id="{$parentId}"}
<tr>
<td>
<a href="{$DOCUMENT_PATH}" title="{$TITLE}" class="" target="_blank">{$TITLE}</a>
</td>
<td>
<div class="btn-group">
<a class="image-update-btn btn btn-default btn-xs disabled js-sorted-position" href="#">{$POSITION}</a>
<a class="document-update-btn btn btn-default btn-xs" href="{url path="/admin/document/type/$documentType/$ID/update"}" data-error-message="{intl l='Please retry'}">
<span class="glyphicon glyphicon-edit"></span>
</a>

View File

@@ -32,5 +32,7 @@ Parameters:
<script>
var imageDropZoneUrl = "{url path="/admin/image/type/$imageType/$parentId/save-ajax"}";
var imageListUrl = "{url path="/admin/image/type/$imageType/$parentId/list-ajax"}";
var imageReorder = "{url path="/admin/image/type/$imageType/$parentId/update-position"}";
var imageListErrorMessage = "{intl l='Can\'t load images, please refresh this page.'}";
var imageReorderErrorMessage = "{intl l='Can\'t reorder images, please refresh this page.'}";
</script>

View File

@@ -9,14 +9,15 @@ Parameters:
*}
{ifloop rel="image"}
<div class="row">
{loop type="image" name="image" source="{$imageType}" order="manual-reverse" source_id="{$parentId}" width="200" height="100" resize_mode="borders"}
<div class="col-sm-6 col-md-3" >
<ul id="js-sort-image" class="row list-unstyled">
{loop type="image" name="image" source="{$imageType}" order="manual" source_id="{$parentId}" width="200" height="100" resize_mode="borders"}
<li class="col-sm-6 col-md-3 ui-state-default" data-sort-id="{$ID}">
<a href="{url path="/admin/image/type/$imageType/$ID/update"}" alt="{intl l='Update this image'}" class="thumbnail">
<img src="{$IMAGE_URL}" alt="{$TITLE}">
</a>
<div class="btn-group" >
<a class="image-update-btn btn btn-default btn-xs disabled js-sorted-position" href="#">{$POSITION}</a>
<a class="image-update-btn btn btn-default btn-xs" href="{url path="/admin/image/type/$imageType/$ID/update"}" data-error-message="{intl l='Please retry'}">
<span class="glyphicon glyphicon-edit"></span>
</a>
@@ -24,9 +25,9 @@ Parameters:
<span class="glyphicon glyphicon-trash"></span>
</a>
</div>
</div>
</li>
{/loop}
</div>
</ul>
{/ifloop}
{elseloop rel="image"}
<div class="alert alert-info">{intl l='There is no images attached to this %type.' type=$imageType}</div>

View File

@@ -144,6 +144,10 @@
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/jquery-ui-1.10.3.custom.min.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script src="{url file='/tinymce/tinymce.min.js'}"></script>
<script>

View File

@@ -58,6 +58,7 @@ return array(
'Email address' => 'Adresse e-mail',
'Email Address' => 'Adresse e-mail',
'Follow us' => 'Suivez-nous',
'Follow us introduction' => 'Sur les réseaux :',
'Forgot your Password?' => 'Mot de passe oublié ?',
'Free shipping' => 'Livraison gratuite',
'Go home' => 'Retour à l\'accueil',
@@ -81,7 +82,7 @@ return array(
'Main Navigation' => 'Navigation principale',
'Minimum 2 characters.' => '2 caractères minimum.',
'missing or invalid data' => 'Information éronnée ou incomplète',
'Multi-payment plateform' => 'Plateforme multipaiement',// bizarre ?
'Multi-payment platform' => 'Plateforme de paiement en ligne',// bizarre ?
'My Account' => 'Mon compte',
'My Address book' => 'Mon carnet d\'adresses',
'My Address Books' => 'Mes carnets d\'adresses',
@@ -98,6 +99,7 @@ return array(
'Next' => 'Suivant',
'Next' => 'Suivant',
'No articles currently' => 'Actuellement aucun article',
'No, I am a new customer.' => 'Non, je suis un nouveau client.',
'No products available in this category' => 'Aucun produit dans cette catégorie.',
'No results found' => 'Aucun résultat',
'No' => 'Non',
@@ -129,7 +131,8 @@ return array(
'Placeholder lastname' => 'Nom de famille',
'Placeholder phone' => 'Téléphone',
'Placeholder zipcode' => 'Code postal',
'Please enter your email address below.' => 'Veuillez saisir votre adresse e-amil ci-dessous.',
'Please enter your email address' => 'Veuillez saisir votre adresse e-mail',
'Please enter your email address below.' => 'Veuillez saisir votre adresse e-mail ci-dessous.',
'Position' => 'Position',
'Previous product' => 'Produits précédents',
'Previous' => 'Précédent',
@@ -201,6 +204,7 @@ return array(
'View' => 'Voir',
'Warning' => 'Attention',
'Yes' => 'Oui',
'Yes, I have a password :' => 'Oui, j\'ai déjà un mot de passe',
'You are here:' => 'Vous êtes ici :',
'You choose to pay by' => 'Vous avez choisi de payer par',
'You don\'t have orders yet.' => 'Vous n\'avez pas encore de commande.',