Skip to content
Snippets Groups Projects
Commit 586a7982 authored by gnaegi's avatar gnaegi
Browse files

OO-2933 make delete buttons in contact form for attachments work

parent 0dd878e2
No related branches found
No related tags found
No related merge requests found
Showing
with 28 additions and 18 deletions
......@@ -46,6 +46,7 @@ import org.olat.core.gui.components.form.flexible.impl.Form;
import org.olat.core.gui.components.form.flexible.impl.FormBasicController;
import org.olat.core.gui.components.form.flexible.impl.FormEvent;
import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.components.form.flexible.impl.elements.FileElementEvent;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event;
......@@ -53,6 +54,7 @@ import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.util.CSSHelper;
import org.olat.core.id.Identity;
import org.olat.core.util.FileUtils;
import org.olat.core.util.Formatter;
import org.olat.core.util.StringHelper;
import org.olat.core.util.Util;
import org.olat.core.util.filter.FilterFactory;
......@@ -351,12 +353,13 @@ public class ContactForm extends FormBasicController {
}
attachmentEl.reset();
attachmentSize += size;
FormLink removeFile = uifactory.addFormLink(attachment.getName(), "delete", null, uploadCont, Link.BUTTON_SMALL);
FormLink removeFile = uifactory.addFormLink(attachment.getName(), "delete", null, uploadCont, Link.BUTTON_XSMALL);
removeFile.setIconLeftCSS("o_icon o_icon-fw o_icon_delete");
removeFile.setUserObject(attachment);
attachmentLinks.add(removeFile);
//pretty labels
uploadCont.setLabel(NLS_CONTACT_ATTACHMENT, null);
attachmentNames.put(attachment.getName(), filename);
attachmentNames.put(attachment.getName(), filename + " <span class='text-muted'>(" + Formatter.formatBytes(size) + ")</span>");
attachmentCss.put(attachment.getName(), CSSHelper.createFiletypeIconCssClassFor(filename));
uploadCont.contextPut("attachments", attachmentLinks);
uploadCont.contextPut("attachmentNames", attachmentNames);
......@@ -430,6 +433,7 @@ public class ContactForm extends FormBasicController {
}
}
@Override
protected void doDispose() {
cleanUpAttachments();
......
<ul class="list-unstyled form-control-static">
#foreach ($attachment in $attachments)
<li>
<i class="o_icon o_icon-fw $r.getFiletypeIconCss($attachment.getName())"> </i>${attachmentNames.get($attachment.getName())}
<li class='clearfix o_highlight_on_hover'>
<span class="pull-right">$r.render("$attachment.getName()")</span>
<i class="o_icon o_icon-fw $r.getFiletypeIconCss($attachment.getName())"> </i>${attachmentNames.get($attachment.getName())}
</li>
#end
</ul>
......
This diff is collapsed.
This diff is collapsed.
......@@ -256,6 +256,11 @@
.o_deleted, %o_deleted {
text-decoration: line-through;
}
/* highlight a row on hover event */
.o_highlight_on_hover:hover {
background-color: $table-bg-hover;
}
/* clickable elements that should indicate this with a cursor change */
.o_clickable, %o_clickable {
cursor: pointer;
......
This diff is collapsed.
This diff is collapsed.
source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment