Commit 17190a62 authored by Liam Sharpe's avatar Liam Sharpe Committed by Robert Lyon
Browse files

Journal add file remove is now a button - Bug #1515398

- Fixed 'Remove' button for existing attachments
- Fixed reloading of modal popup for 'Add a file' if form reloads with
error

behatnotneeded

Change-Id: Ib68e6a33beb6f85701281fcdf337fafd079c9528
parent 53acaeb5
......@@ -771,7 +771,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
}
};
if (!existed) {
var remove = BUTTON({'class': 'btn-link text-small button submit unselect', 'type': 'submit', 'name': self.id+'_unselect[' + id + ']', 'title': get_string('remove')}, SPAN({'class': 'icon icon-times icon-lg text-danger left'}), SPAN(null, get_string('remove')));
var remove = BUTTON({'class': 'btn btn-default btn-xs text-small button submit unselect', 'type': 'submit', 'name': self.id+'_unselect[' + id + ']', 'title': get_string('remove')}, SPAN({'class': 'icon icon-times icon-lg text-danger left'}), SPAN(null, get_string('remove')));
connect(remove, 'onclick', self.unselect);
filelink = ''
......
......@@ -180,7 +180,13 @@ function pieform_element_filebrowser(Pieform $form, $element) {
$initjs .= "addLoadEvent({$prefix}.init);";
$initjs .= "upload_max_filesize = '" . get_real_size(ini_get('upload_max_filesize')) . "';";
if ($form->is_submitted() && $form->has_errors()) {
// need to reapply bootstrap file browser stuff
$initjs .= "jQuery('.js-filebrowser').each(function() {";
$initjs .= " jQuery(this).wrapInner('<div class=\"modal-dialog modal-lg\"><div class=\"modal-content modal-filebrowser\"></div></div>');";
$initjs .= " jQuery(this).modal('hide');";
$initjs .= "});";
}
$smarty->assign('initjs', $initjs);
$smarty->assign('querybase', $element['page'] . (strpos($element['page'], '?') === false ? '?' : '&'));
......
......@@ -25,7 +25,7 @@
{/if}
</td>
<td class="text-right s">
<button id="{$prefix}_unselect_{$file->id}" name="{$prefix}_unselect[{$file->id}]" class="btn-link text-small button submit unselect" title="{str tag=remove}">
<button id="{$prefix}_unselect_{$file->id}" name="{$prefix}_unselect[{$file->id}]" class="btn btn-default btn-xs text-small button submit unselect" title="{str tag=remove}">
<span class="icon icon-times icon-lg text-danger left" role="presentation" aria-hidden="true"></span>
<span>{str tag=remove}</span>
</button>
......
Supports Markdown
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