Merge branch 'catalog'
This commit is contained in:
@@ -85,7 +85,7 @@ $(function($){
|
||||
couponManager.createOrUpdateRuleAjax();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
};
|
||||
couponManager.onClickSaveRule();
|
||||
@@ -96,6 +96,7 @@ $(function($){
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
couponManager.removeRuleAjax($this.attr('data-int'));
|
||||
return false;
|
||||
});
|
||||
};
|
||||
couponManager.onClickDeleteRule();
|
||||
@@ -109,6 +110,7 @@ $(function($){
|
||||
|
||||
// Hide row being updated
|
||||
$this.parent().parent().remove();
|
||||
return false;
|
||||
});
|
||||
};
|
||||
couponManager.onClickUpdateRule();
|
||||
|
||||
100
templates/admin/default/assets/js/document-upload.js
Normal file
100
templates/admin/default/assets/js/document-upload.js
Normal file
@@ -0,0 +1,100 @@
|
||||
$(function($){
|
||||
// Manage document upload
|
||||
$.documentUploadManager = {};
|
||||
|
||||
Dropzone.autoDiscover = false;
|
||||
|
||||
|
||||
|
||||
// Remove image on click
|
||||
$.documentUploadManager.initDocumentDropZone = function() {
|
||||
$.documentUploadManager.onClickDeleteDocument();
|
||||
|
||||
var documentDropzone = new Dropzone("#documents-dropzone", {
|
||||
dictDefaultMessage : $('.btn-browse').html(),
|
||||
uploadMultiple: false,
|
||||
maxFilesize: 8
|
||||
});
|
||||
|
||||
var totalFiles = 0,
|
||||
completedFiles = 0;
|
||||
|
||||
documentDropzone.on("addedfile", function(file){
|
||||
totalFiles += 1;
|
||||
|
||||
if(totalFiles == 1){
|
||||
$('.dz-message').hide();
|
||||
}
|
||||
});
|
||||
|
||||
documentDropzone.on("complete", function(file){
|
||||
completedFiles += 1;
|
||||
|
||||
if (completedFiles === totalFiles){
|
||||
$('.dz-message').slideDown();
|
||||
}
|
||||
});
|
||||
|
||||
documentDropzone.on("success", function(file) {
|
||||
documentDropzone.removeFile(file);
|
||||
$.documentUploadManager.updateDocumentListAjax();
|
||||
$.documentUploadManager.onClickDeleteDocument();
|
||||
});
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
// Update picture list via AJAX call
|
||||
$.documentUploadManager.updateDocumentListAjax = function() {
|
||||
var $documentListArea = $(".document-manager .existing-document");
|
||||
$documentListArea.html('<div class="loading" ></div>');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: documentListUrl,
|
||||
statusCode: {
|
||||
404: function() {
|
||||
$documentListArea.html(
|
||||
documentListErrorMessage
|
||||
);
|
||||
}
|
||||
}
|
||||
}).done(function(data) {
|
||||
$documentListArea.html(
|
||||
data
|
||||
);
|
||||
$.documentUploadManager.onClickDeleteDocument();
|
||||
});
|
||||
};
|
||||
|
||||
// Remove image on click
|
||||
$.documentUploadManager.onClickDeleteDocument = function() {
|
||||
$('.document-manager .document-delete-btn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
var $parent = $this.parent();
|
||||
$parent.find('a').remove();
|
||||
$parent.append('<div class="loading" ></div>');
|
||||
var $url = $this.attr("href");
|
||||
var errorMessage = $this.attr("data-error-message");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: $url,
|
||||
statusCode: {
|
||||
404: function() {
|
||||
$(".document-manager .message").html(
|
||||
errorMessage
|
||||
);
|
||||
}
|
||||
}
|
||||
}).done(function(data) {
|
||||
$parent.parents('tr').remove();
|
||||
|
||||
$(".document-manager .message").html(
|
||||
data
|
||||
);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
};
|
||||
});
|
||||
1758
templates/admin/default/assets/js/dropzone.js
Normal file
1758
templates/admin/default/assets/js/dropzone.js
Normal file
File diff suppressed because it is too large
Load Diff
102
templates/admin/default/assets/js/image-upload.js
Normal file
102
templates/admin/default/assets/js/image-upload.js
Normal file
@@ -0,0 +1,102 @@
|
||||
$(function($){
|
||||
// Manage picture upload
|
||||
$.imageUploadManager = {};
|
||||
|
||||
Dropzone.autoDiscover = false;
|
||||
|
||||
|
||||
|
||||
// Remove image on click
|
||||
$.imageUploadManager.initImageDropZone = function() {
|
||||
$.imageUploadManager.onClickDeleteImage();
|
||||
|
||||
var imageDropzone = new Dropzone("#images-dropzone", {
|
||||
dictDefaultMessage : $('.btn-browse').html(),
|
||||
uploadMultiple: false,
|
||||
maxFilesize: 8,
|
||||
acceptedFiles: 'image/png, image/gif, image/jpeg'
|
||||
});
|
||||
|
||||
var totalFiles = 0,
|
||||
completedFiles = 0;
|
||||
|
||||
imageDropzone.on("addedfile", function(file){
|
||||
totalFiles += 1;
|
||||
|
||||
if(totalFiles == 1){
|
||||
$('.dz-message').hide();
|
||||
}
|
||||
});
|
||||
|
||||
imageDropzone.on("complete", function(file){
|
||||
completedFiles += 1;
|
||||
|
||||
if (completedFiles === totalFiles){
|
||||
$('.dz-message').slideDown();
|
||||
}
|
||||
});
|
||||
|
||||
imageDropzone.on("success", function(file) {
|
||||
imageDropzone.removeFile(file);
|
||||
$.imageUploadManager.updateImageListAjax();
|
||||
$.imageUploadManager.onClickDeleteImage();
|
||||
});
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
// Update picture list via AJAX call
|
||||
$.imageUploadManager.updateImageListAjax = function() {
|
||||
var $imageListArea = $(".image-manager .existing-image");
|
||||
$imageListArea.html('<div class="loading" ></div>');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: imageListUrl,
|
||||
statusCode: {
|
||||
404: function() {
|
||||
$imageListArea.html(
|
||||
imageListErrorMessage
|
||||
);
|
||||
}
|
||||
}
|
||||
}).done(function(data) {
|
||||
$imageListArea.html(
|
||||
data
|
||||
);
|
||||
$.imageUploadManager.onClickDeleteImage();
|
||||
});
|
||||
};
|
||||
|
||||
// Remove image on click
|
||||
$.imageUploadManager.onClickDeleteImage = function() {
|
||||
$('.image-manager .image-delete-btn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
var $parent = $this.parent();
|
||||
var $greatParent = $parent.parent();
|
||||
|
||||
$greatParent.append('<div class="loading" ></div>');
|
||||
$greatParent.find('.btn-group').remove();
|
||||
var $url = $this.attr("href");
|
||||
var errorMessage = $this.attr("data-error-message");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: $url,
|
||||
statusCode: {
|
||||
404: function() {
|
||||
$(".image-manager .message").html(
|
||||
errorMessage
|
||||
);
|
||||
}
|
||||
}
|
||||
}).done(function(data) {
|
||||
$greatParent.remove();
|
||||
$(".image-manager .message").html(
|
||||
data
|
||||
);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
};
|
||||
});
|
||||
160
templates/admin/default/assets/less/thelia/dropzone.less
Normal file
160
templates/admin/default/assets/less/thelia/dropzone.less
Normal file
@@ -0,0 +1,160 @@
|
||||
.dropzone{
|
||||
cursor: pointer;
|
||||
border: 4px dashed @gray-lighter;
|
||||
padding: 70px;
|
||||
margin: 20px 0;
|
||||
|
||||
&.dz-drag-hover{
|
||||
border-color: @brand-primary;
|
||||
}
|
||||
|
||||
.dz-message {
|
||||
text-align: center;
|
||||
|
||||
span{
|
||||
font-size: @font-size-large;
|
||||
display: block;
|
||||
color: @gray;
|
||||
|
||||
span{
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
margin: 10px 0;
|
||||
font-size: @font-size-small;
|
||||
}
|
||||
|
||||
button{
|
||||
span{
|
||||
display: inline-block;
|
||||
font-size: @font-size-base;
|
||||
margin: 0;
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dz-error{
|
||||
.alert();
|
||||
.alert-danger();
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.dz-preview,
|
||||
.dropzone-previews .dz-preview {
|
||||
background: rgba(255,255,255,0.8);
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
margin: 17px;
|
||||
vertical-align: top;
|
||||
border: 1px solid #acacac;
|
||||
padding: 6px 6px 6px 6px;
|
||||
}
|
||||
.dz-preview.dz-file-preview [data-dz-thumbnail],
|
||||
.dropzone-previews .dz-preview.dz-file-preview [data-dz-thumbnail] {
|
||||
display: none;
|
||||
}
|
||||
.dz-preview .dz-details,
|
||||
.dropzone-previews .dz-preview .dz-details {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
position: relative;
|
||||
background: #ebebeb;
|
||||
padding: 5px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
.dz-preview .dz-details .dz-filename,
|
||||
.dropzone-previews .dz-preview .dz-details .dz-filename {
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
.dz-preview .dz-details img,
|
||||
.dropzone-previews .dz-preview .dz-details img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
.dz-preview .dz-details .dz-size,
|
||||
.dropzone-previews .dz-preview .dz-details .dz-size {
|
||||
position: absolute;
|
||||
bottom: -28px;
|
||||
left: 3px;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
}
|
||||
.dz-preview.dz-error .dz-error-mark,
|
||||
.dropzone-previews .dz-preview.dz-error .dz-error-mark {
|
||||
display: block;
|
||||
}
|
||||
.dz-preview.dz-success .dz-success-mark,
|
||||
.dropzone-previews .dz-preview.dz-success .dz-success-mark {
|
||||
display: block;
|
||||
}
|
||||
.dz-preview:hover .dz-details img,
|
||||
.dropzone-previews .dz-preview:hover .dz-details img {
|
||||
display: none;
|
||||
}
|
||||
.dz-preview .dz-success-mark,
|
||||
.dropzone-previews .dz-preview .dz-success-mark,
|
||||
.dz-preview .dz-error-mark,
|
||||
.dropzone-previews .dz-preview .dz-error-mark {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
font-size: 30px;
|
||||
text-align: center;
|
||||
right: -10px;
|
||||
top: -10px;
|
||||
}
|
||||
.dz-preview .dz-success-mark,
|
||||
.dropzone-previews .dz-preview .dz-success-mark {
|
||||
color: #8cc657;
|
||||
}
|
||||
.dz-preview .dz-error-mark,
|
||||
.dropzone-previews .dz-preview .dz-error-mark {
|
||||
color: #ee162d;
|
||||
}
|
||||
.dz-preview .dz-progress,
|
||||
.dropzone-previews .dz-preview .dz-progress {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 6px;
|
||||
right: 6px;
|
||||
height: 6px;
|
||||
background: #d7d7d7;
|
||||
display: none;
|
||||
}
|
||||
.dz-preview .dz-progress .dz-upload,
|
||||
.dropzone-previews .dz-preview .dz-progress .dz-upload {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 0%;
|
||||
background-color: #8cc657;
|
||||
}
|
||||
.dz-preview.dz-processing .dz-progress,
|
||||
.dropzone-previews .dz-preview.dz-processing .dz-progress {
|
||||
display: block;
|
||||
}
|
||||
.dz-preview .dz-error-message,
|
||||
.dropzone-previews .dz-preview .dz-error-message {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
left: -20px;
|
||||
background: rgba(245,245,245,0.8);
|
||||
padding: 8px 10px;
|
||||
color: #800;
|
||||
min-width: 140px;
|
||||
max-width: 500px;
|
||||
z-index: 500;
|
||||
}
|
||||
.dz-preview:hover.dz-error .dz-error-message,
|
||||
.dropzone-previews .dz-preview:hover.dz-error .dz-error-message {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
@import "bootstrap-switch.less";
|
||||
@import "bootstrap-select.less";
|
||||
@import "jqplot.less";
|
||||
@import "dropzone.less";
|
||||
|
||||
// -- Base styling ------------------------------------------------------------
|
||||
|
||||
@@ -226,6 +227,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
.tab-content {
|
||||
// Center loading indicator
|
||||
.loading {
|
||||
margin: 8em auto;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
// The overall form container
|
||||
.form-container {
|
||||
|
||||
@@ -275,5 +284,33 @@
|
||||
.loading{
|
||||
background: url("@{imgDir}/ajax-loader.gif") no-repeat;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
}
|
||||
display: inline-block;
|
||||
line-height: 30px;
|
||||
padding-left: 40px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
|
||||
.existing-image .col-sm-6{
|
||||
position: relative;
|
||||
margin-bottom: 30px;
|
||||
|
||||
.btn-group{
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.loading{
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
right: 20px;
|
||||
display: block;
|
||||
line-height: 1;
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
z-index: 2;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user