Skip to content

Commit

Permalink
* Opraven placeholder pro překlad.
Browse files Browse the repository at this point in the history
* Opraveno mazání nahraných souborů.
  • Loading branch information
JZechy committed Dec 29, 2017
1 parent 3f6fef6 commit 069e59c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/Model/UploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,7 @@ public function handleRemove() {
$cache->save($this->uploadControl->getTokenizedCacheName($token), $cacheFiles);
}
} else {
$files = $this->uploadControl->getDefaulltFiles();

Debugger::log("Výchozí soubory...");
Debugger::log($files);
$files = $this->uploadControl->getDefaultFiles();

foreach($files as $file) {
if($file->getIdentifier() == $id) {
Expand Down
4 changes: 3 additions & 1 deletion src/Template/js.latte
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@
*/
var controller = new FileUploadController(input, token, renderer, controllerConfig, messages);
{syntax off}
$("#" + input).click(function (event) {
if (!controller.canUploadNextFile()) {
event.preventDefault();
alert(controller.getMessages().maxFiles.replace("%maxFiles%", controllerConfig.maxFiles));
alert(controller.getMessages().maxFiles.replace("{maxFiles}", controllerConfig.maxFiles));
}
});
{/syntax}
// -----------------------------------------------------------------------
// FileUpload definition
Expand Down
10 changes: 8 additions & 2 deletions src/www/fileupload/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ Renderer.prototype = {

/**
* @param { number } id
* @param { FileUploadController } controller
*/
fileDone: function (id) {
fileDone: function (id, controller) {
var fileContainer = this.getFileContainer(id);

if (this.components.delete != null) {
Expand All @@ -274,6 +275,8 @@ Renderer.prototype = {
}).done(function () {
$(fileContainer).fadeOut(400, function () {
$(this).remove();
controller.uploaded -= 1;
controller.addedFiles -= 1;
});
});
});
Expand Down Expand Up @@ -434,12 +437,13 @@ FileUploadController.prototype = {
this.renderer.fileError(data.files[0], msg, id);
success = false;
} else {
this.renderer.fileDone(id);
this.renderer.fileDone(id, this);
}

if (success) {
this.uploaded++;
} else {
this.uploaded -= 1;
this.addedFiles -= 1;
}
},
Expand Down Expand Up @@ -473,6 +477,8 @@ FileUploadController.prototype = {
*/
addDefaultFiles: function(defaultFiles) {
for(var i = 0; i < defaultFiles.length; i++) {
this.uploaded++;
this.addedFiles++;
this.renderer.addDefaultFile(defaultFiles[i]);
}
}
Expand Down

0 comments on commit 069e59c

Please sign in to comment.