Skip to content

Commit fb849c3

Browse files
committed
Added single-mode and typefilter to field-file asset select
1 parent 6b91810 commit fb849c3

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

modules/Cockpit/assets/components.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,14 +2373,12 @@ riot.tag2('field-file', '<div class="uk-panel uk-panel-box uk-panel-card "> <div
23732373
}.bind(this)
23742374

23752375
this.selectAsset = function() {
2376-
2377-
App.assets.select(function(assets){
2378-
2376+
App.assets.select(function (assets) {
23792377
if (Array.isArray(assets) && assets[0]) {
23802378
$this.refs.input.$setValue(ASSETS_URL.replace(SITE_URL+'/', '')+assets[0].path);
23812379
$this.update();
23822380
}
2383-
});
2381+
}, { typefilter: opts.typefilter, single: true });
23842382
}.bind(this)
23852383

23862384
this.shouldShowOpen = function() {

modules/Cockpit/assets/components/field-file.tag

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,12 @@
9696
}
9797

9898
selectAsset() {
99-
100-
App.assets.select(function(assets){
101-
99+
App.assets.select(function (assets) {
102100
if (Array.isArray(assets) && assets[0]) {
103101
$this.refs.input.$setValue(ASSETS_URL.replace(SITE_URL+'/', '')+assets[0].path);
104102
$this.update();
105103
}
106-
});
104+
}, { typefilter: opts.typefilter, single: true });
107105
}
108106

109107
shouldShowOpen() {

0 commit comments

Comments
 (0)