Skip to content
Snippets Groups Projects
Commit b68e3a9e authored by srosse's avatar srosse
Browse files

OO-1068: badge for the tree with absolute position

parent fae268c7
No related branches found
No related tags found
No related merge requests found
......@@ -424,19 +424,18 @@ public class MenuTreeRenderer extends DefaultComponentRenderer {
public void setDrop(boolean drop) {
this.drop = drop;
}
}
private void appendDecorators(TreeNode node, StringOutput sb) {
appendDecorator(node.getIconDecorator1CssClass(), sb);
appendDecorator(node.getIconDecorator2CssClass(), sb);
appendDecorator(node.getIconDecorator3CssClass(), sb);
appendDecorator(node.getIconDecorator4CssClass(), sb);
appendDecorator(node.getIconDecorator1CssClass(), sb, 1);
appendDecorator(node.getIconDecorator2CssClass(), sb, 2);
appendDecorator(node.getIconDecorator3CssClass(), sb, 3);
appendDecorator(node.getIconDecorator4CssClass(), sb, 4);
}
private void appendDecorator(String decorator, StringOutput sb) {
private void appendDecorator(String decorator, StringOutput sb, int num) {
if (decorator != null && decorator.length() > 0) {
sb.append("<span class='badge ").append(decorator).append("'><i class='o_icon ").append(decorator).append("'></i></span>");
sb.append("<span class='badge o_badge_").append(num).append(" ").append(decorator).append("'><i class='o_icon ").append(decorator).append("'></i></span>");
}
}
......
......@@ -25,11 +25,8 @@
package org.olat.course.tree;
import java.util.List;
import org.olat.core.gui.components.tree.GenericTreeNode;
import org.olat.core.util.nodes.INode;
import org.olat.course.condition.interpreter.ConditionExpression;
import org.olat.course.editor.StatusDescription;
import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.CourseNodeConfiguration;
......@@ -130,19 +127,21 @@ public class CourseEditorTreeNode extends GenericTreeNode {
CourseNodeConfiguration cnConfig = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(cn.getType());
return cnConfig.getIconCSSClass();
}
}
@Override
public String getIconDecorator2CssClass() {
public String getIconDecorator1CssClass() {
StatusDescription sd = cn.isConfigValid();
//this one is deleted
if (deleted) return "o_middel";
//errors!
if (sd.isError()) return "o_miderr";
//ready for publish
if (!sd.isError() && dirty) return "o_midpub";
return null;
String cssClass = null;
if (deleted) {
cssClass = "o_middel";
} else if (sd.isError()) {
cssClass = "o_miderr";
} else if (!sd.isError() && dirty) {
cssClass = "o_midpub";
}
return cssClass;
}
@Override
......@@ -157,13 +156,15 @@ public class CourseEditorTreeNode extends GenericTreeNode {
}
@Override
public String getIconDecorator4CssClass() {
public String getIconDecorator2CssClass() {
//do not show errors if marked for deletion
if(deleted) return null;
//
List<ConditionExpression> conditions = cn.getConditionExpressions();
if (conditions.size() > 0) return "o_midlock";
return null;
String cssClass = null;
if(deleted) {
cssClass = null;
} else if(cn.getConditionExpressions().size() > 0) {
cssClass = "o_midlock";
}
return cssClass;
}
/**
......
......@@ -61,11 +61,27 @@
}
li .badge {
float: right;
position: absolute;
font-size: 70%;
&:before {
content: none;
}
&.o_badge_1 {
top: 3px;
right:1px;
}
&.o_badge_2 {
bottom: 3px;
right:1px;
}
&.o_badge_3 {
top: 3px;
right:25px;
}
&.o_badge_4 {
bottom: 3px;
right:25px;
}
}
li div.o_dnd_sibling {
......
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