Skip to content
Snippets Groups Projects
Commit 7cbbf3e4 authored by uhensler's avatar uhensler
Browse files

OO-3939: Add Back button to the editor

parent 27a5a9a8
No related branches found
No related tags found
No related merge requests found
Showing
with 58 additions and 31 deletions
...@@ -54,6 +54,7 @@ public class VFSLeafConfigController extends BasicController implements Activate ...@@ -54,6 +54,7 @@ public class VFSLeafConfigController extends BasicController implements Activate
private static final String GUIPREF_KEY_EDITOR = "editor"; private static final String GUIPREF_KEY_EDITOR = "editor";
private Dropdown editorDropdown; private Dropdown editorDropdown;
private Link backButton;
private final String guiEditorKey; private final String guiEditorKey;
private final List<VFSLeafEditor> editors; private final List<VFSLeafEditor> editors;
...@@ -69,6 +70,10 @@ public class VFSLeafConfigController extends BasicController implements Activate ...@@ -69,6 +70,10 @@ public class VFSLeafConfigController extends BasicController implements Activate
VelocityContainer mainVC = createVelocityContainer("editor_config"); VelocityContainer mainVC = createVelocityContainer("editor_config");
if (secCallback.canClose()) {
backButton = LinkFactory.createLinkBack(mainVC, this);
}
if (editors.size() > 1) { if (editors.size() > 1) {
editorDropdown = new Dropdown("editor.selection", null, false, getTranslator()); editorDropdown = new Dropdown("editor.selection", null, false, getTranslator());
editorDropdown.setTranslatedLabel(editors.get(0).getDisplayName(getLocale())); editorDropdown.setTranslatedLabel(editors.get(0).getDisplayName(getLocale()));
...@@ -106,7 +111,9 @@ public class VFSLeafConfigController extends BasicController implements Activate ...@@ -106,7 +111,9 @@ public class VFSLeafConfigController extends BasicController implements Activate
@Override @Override
protected void event(UserRequest ureq, Component source, Event event) { protected void event(UserRequest ureq, Component source, Event event) {
if (source instanceof Link) { if (source == backButton) {
fireEvent(ureq, Event.DONE_EVENT);
} else if (source instanceof Link) {
Link link = (Link)source; Link link = (Link)source;
VFSLeafEditor editor = (VFSLeafEditor) link.getUserObject(); VFSLeafEditor editor = (VFSLeafEditor) link.getUserObject();
doSelectEditor(ureq, editor); doSelectEditor(ureq, editor);
......
...@@ -24,8 +24,6 @@ import org.olat.core.commons.services.vfs.VFSLeafEditor; ...@@ -24,8 +24,6 @@ import org.olat.core.commons.services.vfs.VFSLeafEditor;
import org.olat.core.commons.services.vfs.VFSLeafEditorSecurityCallback; import org.olat.core.commons.services.vfs.VFSLeafEditorSecurityCallback;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event; import org.olat.core.gui.control.Event;
...@@ -42,7 +40,6 @@ import org.olat.core.util.vfs.VFSLeaf; ...@@ -42,7 +40,6 @@ import org.olat.core.util.vfs.VFSLeaf;
public class VFSLeafEditorController extends BasicController { public class VFSLeafEditorController extends BasicController {
private VelocityContainer mainVC; private VelocityContainer mainVC;
private Link closeButton;
private VFSLeafConfigController configCtrl; private VFSLeafConfigController configCtrl;
private Controller editorCtrl; private Controller editorCtrl;
...@@ -64,10 +61,6 @@ public class VFSLeafEditorController extends BasicController { ...@@ -64,10 +61,6 @@ public class VFSLeafEditorController extends BasicController {
mainVC.put("config", configCtrl.getInitialComponent()); mainVC.put("config", configCtrl.getInitialComponent());
configCtrl.activate(ureq, null, null); configCtrl.activate(ureq, null, null);
if (secCallback.canClose()) {
closeButton = LinkFactory.createButton("editor.close", mainVC, this);
}
putInitialPanel(mainVC); putInitialPanel(mainVC);
} }
...@@ -78,6 +71,8 @@ public class VFSLeafEditorController extends BasicController { ...@@ -78,6 +71,8 @@ public class VFSLeafEditorController extends BasicController {
VFSEditorSelectionEvent esEvent = (VFSEditorSelectionEvent) event; VFSEditorSelectionEvent esEvent = (VFSEditorSelectionEvent) event;
VFSLeafEditor editor = esEvent.getEditor(); VFSLeafEditor editor = esEvent.getEditor();
doOpenEditor(ureq, editor); doOpenEditor(ureq, editor);
} else if (event == Event.DONE_EVENT) {
fireEvent(ureq, event);
} }
} else if (source == editorCtrl) { } else if (source == editorCtrl) {
fireEvent(ureq, event); fireEvent(ureq, event);
...@@ -96,9 +91,7 @@ public class VFSLeafEditorController extends BasicController { ...@@ -96,9 +91,7 @@ public class VFSLeafEditorController extends BasicController {
@Override @Override
protected void event(UserRequest ureq, Component source, Event event) { protected void event(UserRequest ureq, Component source, Event event) {
if (source == closeButton) { //
fireEvent(ureq, Event.DONE_EVENT);
}
} }
@Override @Override
......
<div class="o_vfseditor_config"> <div class="o_vfseditor_config">
#if($r.available("editor.selection")) <div class="navbar-collapse">
<ul class="nav navbar-nav navbar-right""> #if($r.available("backLink"))
<li> <ul class="nav navbar-nav navbar-left">
$r.render("editor.selection") <li>
</li> $r.render("backLink")
</ul> </li>
#end </ul>
#end
#if($r.available("editor.selection"))
<ul class="nav navbar-nav navbar-right">
<li>
$r.render("editor.selection")
</li>
</ul>
#end
</div>
</div> </div>
\ No newline at end of file
...@@ -6,8 +6,5 @@ ...@@ -6,8 +6,5 @@
<div class="o_warning"> <div class="o_warning">
$r.translate("error.no.editor") $r.translate("error.no.editor")
</div> </div>
#if($r.available("editor.close"))
<div class="o_button_group">$r.render("editor.close")</div>
#end
#end #end
</div> </div>
\ No newline at end of file
editor.close=Schliessen
error.no.editor=Die Datei kann nicht angezeigt werden. error.no.editor=Die Datei kann nicht angezeigt werden.
editor.close=Close
error.no.editor=The content of the document cannot be displayed. error.no.editor=The content of the document cannot be displayed.
...@@ -105,6 +105,7 @@ public class WebDocumentRunController extends BasicController { ...@@ -105,6 +105,7 @@ public class WebDocumentRunController extends BasicController {
} else if (vfsService.hasEditor(extension)) { } else if (vfsService.hasEditor(extension)) {
VFSLeafEditorSecurityCallback secCallback = VFSLeafEditorSecurityCallbackBuilder.builder() VFSLeafEditorSecurityCallback secCallback = VFSLeafEditorSecurityCallbackBuilder.builder()
.canEdit(reSecurity.isOwner() || reSecurity.isCoach()) .canEdit(reSecurity.isOwner() || reSecurity.isCoach())
.canClose(false)
.build(); .build();
List<VFSLeafEditor> editors = vfsService.getEditors(document); List<VFSLeafEditor> editors = vfsService.getEditors(document);
if (editors.size() >= 1) { if (editors.size() >= 1) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.o_collabora { .o_collabora {
iframe { iframe {
width: 100%; width: 100%;
height: calc(100vh - 160px); height: calc(100vh - 183px);
margin-top: 10px; margin-top: 10px;
margin-bottom: 20px; margin-bottom: 20px;
border-width: 1px; border-width: 1px;
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
.o_collabora { .o_collabora {
iframe { iframe {
width: 100%; width: 100%;
height: calc(100vh - 340px); height: calc(100vh - 355px); // 387px would be good to avoid scroll bars if editor selection is shown
margin-top: 10px; margin-top: 10px;
margin-bottom: 20px; margin-bottom: 20px;
border-width: 1px; border-width: 1px;
......
...@@ -199,10 +199,32 @@ ul.o_dropdown { ...@@ -199,10 +199,32 @@ ul.o_dropdown {
margin-top: 10px; margin-top: 10px;
.o_vfseditor_config { .o_vfseditor_config {
.navbar-right { .nav {
margin-right: 0px; button {
margin-top: 8px;
}
} }
} }
// Avoid collapsing the navbar on small devices
.navbar-collapse.collapse {
display: block!important;
}
.navbar-nav>li, .navbar-nav {
float: left !important;
}
.navbar-nav.navbar-right:last-child {
margin-right: -15px !important;
}
.navbar-right {
float: right!important;
}
.navbar-nav > li > .dropdown-menu {
background-color: $navbar-default-bg;
border-color: $navbar-default-border;
position: absolute;
}
} }
.o_web_content { .o_web_content {
......
This diff is collapsed.
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