Merge branch 'master' of https://github.com/thelia/thelia into coupon

# By gmorel (24) and others
# Via gmorel (12) and others
* 'master' of https://github.com/thelia/thelia: (43 commits)
  Working : upload file/image : fix sanitizeFileName
  Working : images : enhance display
  Working : Fix : Unit test
  Working : Fix : Unit test
  Working : Fix : Image Management + Document Management
  Working : FileManager :Add some more unit tests
  Working : Add a link on documents
  Working : fix url document + refactor : naming conventions
  Working : refactor : naming conventions
  Working : upload : fix unit test
  WIP : upload documents : add action, ctrl, event
  Finished product combination basic function
  WIP : upload document : add forms
  Working : upload image : fix return URL to images tab
  Working : upload image : fix fallback and delete links on refresh
  Formatted combination table
  Impemented combination creation
  Working : Upload image : Fix upload validation
  - Image format allowed - manual-reverse order on image loop
  Upload allow only for images
  ...

Conflicts:
	core/lib/Thelia/Model/Base/AttributeTemplate.php
	core/lib/Thelia/Model/Base/AttributeTemplateQuery.php
	core/lib/Thelia/Model/Map/AttributeTemplateTableMap.php
	install/faker.php
	install/thelia.sql
	local/config/schema.xml
	templates/admin/default/assets/js/coupon.js
	tests/functionnal/casperjs/exe/00_parameters.js
	tests/functionnal/casperjs/exe/31_coupons_rule.js
This commit is contained in:
gmorel
2013-09-27 10:37:09 +02:00
127 changed files with 11206 additions and 1128 deletions

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

File diff suppressed because it is too large Load Diff

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