Skip to content

Commit

Permalink
Merge pull request #9 from sircovsw/add-title
Browse files Browse the repository at this point in the history
add titleAttribute
  • Loading branch information
sircovsw authored Nov 18, 2020
2 parents d46bf5f + 4b74103 commit 0c84844
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ For multiple files
'typeAttribute' => 'type',
'sizeAttribute' => 'size',
'nameAttribute' => 'name',
'titleAttribute' => 'title',
'descriptionsAttribute' => [
'description_ru',
'description_en'
Expand Down
5 changes: 5 additions & 0 deletions src/behaviors/UploadBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class UploadBehavior extends Behavior
* @var string
*/
public $nameAttribute;
/**
* @var string
*/
public $titleAttribute;
/**
* @var array
*/
Expand Down Expand Up @@ -140,6 +144,7 @@ public function fields()
'type' => $this->typeAttribute,
'size' => $this->sizeAttribute,
'name' => $this->nameAttribute,
'title' => $this->titleAttribute,
'order' => $this->orderAttribute
];

Expand Down
3 changes: 2 additions & 1 deletion src/widget/assets/js/upload-kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
var item = $('<li>', {"class": "upload-kit-item done", value: index})
.append($('<input/>', {"name": name + '[' + options.pathAttributeName + ']', "value": file[options.pathAttribute], "type":"hidden"}))
.append($('<input/>', {"name": name + '[name]', "value": file.name, "type": (options.editFilename === true) ? "text" : "hidden"}))
.append($('<input/>', {"name": name + '[title]', "value": file.title, "type":"hidden"}))
.append($('<input/>', {"name": name + '[size]', "value": file.size, "type":"hidden"}))
.append($('<input/>', {"name": name + '[type]', "value": file.type, "type":"hidden"}))
.append($('<input/>', {"name": name + '[order]', "value": file.order, "type":"hidden", "data-role": "order"}))
Expand Down Expand Up @@ -195,7 +196,7 @@
item.removeClass('image').addClass('not-image');
item.css('backgroundImage', '');
}
item.find('span.name').text(file.name);
item.find('span.name').text(file.title);
return item;
},
checkInputVisibility: function(){
Expand Down
2 changes: 1 addition & 1 deletion src/widget/assets/js/upload-kit.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0c84844

Please sign in to comment.