Commit a7c6b7db authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Workaround for having to click folder names twice to change folder after...

Workaround for having to click folder names twice to change folder after removing items from select list
parent 14f94bba
......@@ -91,6 +91,7 @@ function pieform_element_filebrowser(Pieform $form, $element) {
{$prefix}.filedata = {$fileliststr};";
if ($config['select']) {
$initjs .= "{$prefix}.selecteddata = {$selectedliststr};";
$initjs .= "forEach(getElementsByTagAndClassName('button', 'unselect', '{$prefix}_selectlist'), function (elem) { removeElementClass(elem, 'hidden'); });";
}
$initjs .= "addLoadEvent({$prefix}.init);";
......
......@@ -197,14 +197,6 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
this.edit_init = function () { augment_tags_control(self.id + '_edit_tags'); }
this.browse_submit = function (e) {
signal(self.form, 'onsubmit');
self.form.submit();
e.stop();
$(self.id + '_changefolder').value = '';
return false;
}
this.browse_init = function () {
if (self.config.edit) {
forEach(getElementsByTagAndClassName('button', null, 'filelist'), function (elem) {
......@@ -245,7 +237,11 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
var href = getNodeAttribute(this, 'href');
var params = parseQueryString(href.substring(href.indexOf('?')+1));
$(self.id + '_changefolder').value = params.folder;
self.browse_submit(e);
signal(self.form, 'onsubmit');
self.form.submit();
$(self.id + '_changefolder').value = '';
e.stop();
return false;
});
});
if ($(self.id + '_createfolder')) {
......
......@@ -19,7 +19,8 @@
<td>{$file->description}</td>
<td>{$file->tags}</td>
<td>
<button type="submit" class="button small unselect" name="{$prefix}_unselect[{$file->id}]" value="{$file->id}">{str tag=remove}</button>
<noscript><button type="submit" class="button small unselect" name="{$prefix}_unselect[{$file->id}]" value="{$file->id}">{str tag=remove}</button></noscript>
<button type="button" class="button small unselect hidden" name="{$prefix}_unselect[{$file->id}]" value="{$file->id}">{str tag=remove}</button>
<input type="hidden" name="{$prefix}_selected[{$file->id}]" value="{$file->id}">
</td>
</tr>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment