Merge branch 'master' into frontend

This commit is contained in:
Manuel Raynaud
2013-12-16 15:45:04 +01:00
42 changed files with 541 additions and 64 deletions

View File

@@ -5,7 +5,7 @@ return array(
'Version %ver' => 'Version %ver',
'View site' => 'View site',
'View shop' => 'View shop',
'Profil' => 'Profil',
'Profil' => 'Profile',
'Close administation session' => 'Close administation session',
'Logout' => 'Logout',
'Home' => 'Home',

View File

@@ -222,8 +222,8 @@
<div class="container">
<p>{intl l='&copy; Thelia 2013'}
- <a href="http://www.openstudio.fr/" target="_blank">{intl l='Published by OpenStudio'}</a>
- <a href="http://forum.thelia.net/" target="_blank">{intl l='Thelia support forum'}</a>
- <a href="http://contrib.thelia.net/" target="_blank">{intl l='Thelia contributions'}</a>
- <a href="http://thelia.net/forum" target="_blank">{intl l='Thelia support forum'}</a>
- <a href="#" target="_blank">{intl l='Thelia contributions'}</a>
</p>
{module_include location='in_footer'}
@@ -269,4 +269,4 @@
{module_include location='footer_js'}
</body>
</html>
</html>

View File

@@ -6,9 +6,10 @@ $(function($){
// Remove image on click
// Remove document on click
$.documentUploadManager.initDocumentDropZone = function() {
$.documentUploadManager.onClickDeleteDocument();
$.documentUploadManager.sortDocument();
var documentDropzone = new Dropzone("#documents-dropzone", {
dictDefaultMessage : $('.btn-browse').html(),
@@ -64,10 +65,11 @@ $(function($){
data
);
$.documentUploadManager.onClickDeleteDocument();
$.documentUploadManager.sortDocument();
});
};
// Remove image on click
// Remove document on click
$.documentUploadManager.onClickDeleteDocument = function() {
$('.document-manager .document-delete-btn').on('click', function (e) {
e.preventDefault();
@@ -88,13 +90,66 @@ $(function($){
}
}
}).done(function(data) {
$parent.parents('tr').remove();
$parent.parents('li').remove();
$(".document-manager .message").html(
data
);
/* refresh position */
$( "#js-sort-document").children('li').each(function(position, element) {
$(element).find('.js-sorted-position').html(position + 1);
});
});
return false;
});
};
$.documentUploadManager.sortDocument = function() {
$( "#js-sort-document" ).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-document").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 documentId = ui.item.data('sort-id');
$.ajax({
type: "POST",
url: documentReorder,
data: {
document_id: documentId,
position: newPosition
},
statusCode: {
404: function() {
$(".document-manager .message").html(
documentReorderErrorMessage
);
}
}
}).done(function(data) {
$(".document-manager .message").html(
data
);
});
}
});
$( "#js-sort-document" ).disableSelection();
};
});

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();
};
});

File diff suppressed because one or more lines are too long

View File

@@ -428,4 +428,17 @@ table {
}
}
}
}
// document list style
ul.document-list {
> li {
padding: @table-condensed-cell-padding;
line-height: @line-height-base;
border-top: 1px solid @table-border-color;
&:nth-child(odd) {
background-color: @table-bg-accent;
}
}
}

View File

@@ -305,8 +305,9 @@
{javascripts file='assets/js/document-upload.js'}
<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

@@ -200,6 +200,9 @@ form_content = {$smarty.capture.delete_folder_dialog nofilter}
{javascripts file='assets/js/document-upload.js'}
<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>
$(function() {

View File

@@ -286,6 +286,9 @@
{javascripts file='assets/js/document-upload.js'}
<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>
$(function() {

View File

@@ -32,5 +32,7 @@ Parameters:
<script>
var documentDropZoneUrl = "{url path="/admin/document/type/$documentType/$parentId/save-ajax"}";
var documentListUrl = "{url path="/admin/document/type/$documentType/$parentId/list-ajax"}";
var documentReorder = "{url path="/admin/document/type/$documentType/$parentId/update-position"}";
var documentListErrorMessage = "{intl l='Can\'t load documents, please refresh this page.'}";
var documentReorderErrorMessage = "{intl l='Can\'t reorder documents, please refresh this page.'}";
</script>

View File

@@ -7,28 +7,27 @@ Parameters:
parentId = Document parent id, ex: category id
*}
{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}"}
<tr>
<td>
<a href="{$DOCUMENT_PATH}" title="{$TITLE}" class="" target="_blank">{$TITLE}</a>
</td>
<td>
<div class="btn-group">
<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>
<a class="document-delete-btn btn btn-default btn-xs" href="{url path="/admin/document/type/$documentType/delete/$ID"}" data-error-message="{intl l='Please retry'}">
<span class="glyphicon glyphicon-trash"></span>
</a>
</div>
<td>
</tr>
<ul id="js-sort-document" class="list-unstyled document-list">
{loop type="document" name="document" source="{$documentType}" order="manual" source_id="{$parentId}"}
<li class="clearfix ui-state-default" data-sort-id="{$ID}">
<a href="{$DOCUMENT_PATH}" title="{$TITLE}" class="pull-left" target="_blank">{$TITLE}</a>
<div class="btn-group pull-right">
<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>
<a class="document-delete-btn btn btn-default btn-xs" href="{url path="/admin/document/type/$documentType/delete/$ID"}" data-error-message="{intl l='Please retry'}">
<span class="glyphicon glyphicon-trash"></span>
</a>
</div>
</li>
{/loop}
</table>
</ul>
{/ifloop}
{elseloop rel="document"}
<div class="alert alert-info">{intl l='There is no documents attached to this %type.' type=$documentType}</div>
{/elseloop}

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

@@ -136,14 +136,15 @@
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src="{$asset_url}"></script>
{/javascripts}
{javascripts file='assets/js/jquery.typewatch.js'}
<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>