bugfix + unified link code
This commit is contained in:
@@ -96,12 +96,6 @@ public abstract class Action extends BaseClass {
|
||||
return new JSONObject().put(TYPE, getClass().getSimpleName());
|
||||
}
|
||||
|
||||
protected Tag link(Integer parentId, String context) {
|
||||
Map<String, String> props = Map.of(REALM,REALM_ACTIONS,ID,parentId+"/"+id,ACTION,ACTION_PROPS,CONTEXT,context);
|
||||
String action = "request("+(new JSONObject(props).toString().replace("\"", "'"))+")";
|
||||
return new Tag("span").content(toString()+NBSP).attr("onclick", action);
|
||||
}
|
||||
|
||||
public static List<Class<? extends Action>> list() {
|
||||
return List.of(
|
||||
ConditionalAction.class,
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
|
||||
import de.keawe.tools.translations.Translation;
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.Application;
|
||||
import de.srsoftware.web4rail.BaseClass;
|
||||
import de.srsoftware.web4rail.Constants;
|
||||
import de.srsoftware.web4rail.Plan;
|
||||
import de.srsoftware.web4rail.Window;
|
||||
@@ -87,7 +88,7 @@ public class ActionList extends Vector<Action> implements Constants{
|
||||
boolean first = true;
|
||||
for (Action action : this) {
|
||||
props.put(ID, id+"/"+action.id());
|
||||
Tag act = action.link(id,context).addTo(new Tag("li"));
|
||||
Tag act = BaseClass.link("span", Map.of(REALM,REALM_ACTIONS,ID,id+"/"+action.id(),ACTION,ACTION_PROPS,CONTEXT,context), this+NBSP).addTo(new Tag("li"));;
|
||||
if (!first) {
|
||||
props.put(ACTION, ACTION_MOVE);
|
||||
new Button("↑",props).addTo(act);
|
||||
|
||||
@@ -2,6 +2,7 @@ package de.srsoftware.web4rail.actions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@@ -37,7 +38,9 @@ public class ConditionalAction extends Action {
|
||||
|
||||
if (!conditions.isEmpty()) {
|
||||
Tag list = new Tag("ul");
|
||||
for (Condition condition : conditions) condition.link("li",params.get(CONTEXT)).addTo(list);
|
||||
for (Condition condition : conditions) {
|
||||
link("li", Map.of(REALM,REALM_CONDITION,ID,id,ACTION,ACTION_PROPS,CONTEXT,params.get(CONTEXT)), condition).addTo(list);
|
||||
}
|
||||
list.addTo(fieldset);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user