Commit 76cde0a9 authored by Arthur Bogaart's avatar Arthur Bogaart

HSTCONFIGEDIT-174: Added SVG icons to TemplateEditor containers widget

- fix width of nested fieldset as used for template editor containers
parent 55860406
......@@ -43,7 +43,7 @@ public class Template extends EditorBean implements Descriptive {
public Template(JcrNodeModel model, Descriptive desc) {
super(model);
descriptive = desc;
containers = new ArrayList<String>();
containers = new ArrayList<>();
}
public Template(JcrNodeModel model) {
......
......@@ -17,16 +17,24 @@
<html xmlns:wicket="http://wicket.apache.org/">
<wicket:panel>
<wicket:extend>
<p><wicket:message key="intro">Intro</wicket:message></p>
<p>
<wicket:message key="intro">Intro</wicket:message>
</p>
<fieldset>
<legend><wicket:message key="fieldset.legend">Details</wicket:message></legend>
<legend>
<wicket:message key="fieldset.legend">Details</wicket:message>
</legend>
<div>
<label for="renderPath"><wicket:message key="renderPath.label">RenderPath label</wicket:message></label>
<label for="renderPath">
<wicket:message key="renderPath.label">RenderPath label</wicket:message>
</label>
<input type="text" wicket:id="renderPath" name="renderPath"/>
<br/><br/>
</div>
<div>
<label for="ftlScript"><wicket:message key="ftlScript.label">ftlScript label</wicket:message></label>
<label for="ftlScript">
<wicket:message key="ftlScript.label">ftlScript label</wicket:message>
</label>
</div>
<div>
<fieldset id="script" class="script">
......@@ -34,21 +42,37 @@
</fieldset>
</div>
<div>
<label for="containers"><wicket::message key="containers.label">Containers</wicket::message></label>
<a href="#" wicket:id="addContainer" class="btn btn-default btn-sm">
<wicket::message key="containers.add.label">add name of container specified in template</wicket::message>
</a>
</div>
<div>
<wicket:enclosure child="containers">
<table class="parameters">
<tr><th>name&nbsp;</th><th>delete&nbsp;</th></tr>
<tr wicket:id="containers">
<td><input type="text" wicket:id="containerName" class="container-value" /></td>
<td class="remove"><a wicket:id="removeContainer"><em>X</em></a></td>
</tr>
</table>
</wicket:enclosure>
<fieldset>
<legend>
<wicket::message key="containers.label">Containers</wicket::message>
</legend>
<wicket:enclosure child="containers">
<div>
<table class="parameters containers">
<tr>
<th>name&nbsp;</th>
<th>delete&nbsp;</th>
</tr>
<tr wicket:id="containers">
<td>
<input type="text" wicket:id="containerName" class="container-value"/>
</td>
<td class="remove">
<a wicket:id="removeContainer">
<span wicket:id="icon"/>
</a>
</td>
</tr>
</table>
</div>
</wicket:enclosure>
<div>
<a href="#" wicket:id="addContainer" class="btn btn-default btn-sm">
<span wicket:id="icon">[Icon]</span>
<wicket::message key="containers.add.label">add name of container specified in template</wicket::message>
</a>
</div>
</fieldset>
</div>
</fieldset>
<div wicket:id="description">[ Template description ]</div>
......
/*
* Copyright 2008-2013 Hippo B.V. (http://www.onehippo.com)
*
* Copyright 2008-2015 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
......@@ -30,6 +30,8 @@ import org.hippoecm.frontend.dialog.IDialogService.Dialog;
import org.hippoecm.frontend.model.JcrNodeModel;
import org.hippoecm.frontend.plugin.IPluginContext;
import org.hippoecm.frontend.plugin.config.IPluginConfig;
import org.hippoecm.frontend.plugins.standards.icon.HippoIcon;
import org.hippoecm.frontend.skin.Icon;
import org.hippoecm.hst.plugins.frontend.editor.BasicEditorPlugin;
import org.hippoecm.hst.plugins.frontend.editor.context.HstContext;
import org.hippoecm.hst.plugins.frontend.editor.dao.EditorDAO;
......@@ -40,15 +42,16 @@ import org.hippoecm.hst.plugins.frontend.editor.validators.CombinedRequiredValid
public class TemplateEditorPlugin extends BasicEditorPlugin<Template> {
private static final long serialVersionUID = 1L;
public TemplateEditorPlugin(IPluginContext context, IPluginConfig config) {
super(context, config);
form.add(new DescriptionPanel("description", form.getInnermostModel(), context, config).setEnabled(!getLockInfo().isLocked()));
final DescriptionPanel description = new DescriptionPanel("description", form.getInnermostModel(), context, config);
description.setEnabled(!getLockInfo().isLocked());
description.setRenderBodyOnly(true);
form.add(description);
//Render path widget
FormComponent<String> renderPathComponent = new TextField<String>("renderPath");
FormComponent<String> renderPathComponent = new TextField<>("renderPath");
renderPathComponent.setOutputMarkupId(true).setEnabled(!getLockInfo().isLocked());
form.add(renderPathComponent);
......@@ -61,15 +64,12 @@ public class TemplateEditorPlugin extends BasicEditorPlugin<Template> {
//Containers widget
ListView containers = new ListView("containers") {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem item) {
RequiredTextField rtf = new RequiredTextField("containerName", item.getModel());
rtf.setOutputMarkupId(true);
rtf.add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
......@@ -77,8 +77,6 @@ public class TemplateEditorPlugin extends BasicEditorPlugin<Template> {
item.add(rtf);
AjaxSubmitLink remove = new AjaxSubmitLink("removeContainer") {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
getBean().removeContainer(item.getIndex());
......@@ -87,6 +85,8 @@ public class TemplateEditorPlugin extends BasicEditorPlugin<Template> {
};
remove.setDefaultFormProcessing(false);
item.add(remove);
remove.add(HippoIcon.fromSprite("icon", Icon.TIMES_CIRCLE));
}
@Override
......@@ -98,17 +98,17 @@ public class TemplateEditorPlugin extends BasicEditorPlugin<Template> {
containers.setOutputMarkupId(true).setEnabled(!getLockInfo().isLocked());
form.add(containers);
AjaxSubmitLink add = new AjaxSubmitLink("addContainer") {
private static final long serialVersionUID = 1L;
AjaxSubmitLink addContainer = new AjaxSubmitLink("addContainer") {
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
getBean().addContainer();
redraw();
}
};
add.setDefaultFormProcessing(false).setEnabled(!getLockInfo().isLocked());
form.add(add);
addContainer.setDefaultFormProcessing(false).setEnabled(!getLockInfo().isLocked());
form.add(addContainer);
addContainer.add(HippoIcon.fromSprite("icon", Icon.PLUS));
}
@Override
......
......@@ -186,6 +186,11 @@ div.hst-editor-form fieldset > div > div {
align-items: center;
}
.hst-editor-form fieldset > div > fieldset {
min-width: 100%;
width: 100%;
}
div.hst-editor-form fieldset div ul {
margin-left: 105px;
}
......@@ -198,6 +203,10 @@ div.hst-editor-form fieldset div ul {
width: 100%;
}
.parameters.containers {
width: 50%;
}
table.parameters > tbody > tr > th {
padding-bottom: 4px;
}
......
Markdown is supported
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