Skip to content

Commit

Permalink
report configuration html/css fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed May 21, 2014
1 parent 51d94cb commit 691fe23
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
Expand Up @@ -26,6 +26,7 @@
public class AceEditor extends TextArea<String> {

private IModel<Boolean> readonly = new Model(false);
private int minSize = 200;

public AceEditor(String id, IModel<String> model) {
super(id, model);
Expand All @@ -37,11 +38,22 @@ public void renderHead(IHeaderResponse response) {
super.renderHead(response);

StringBuilder sb = new StringBuilder();
sb.append("initEditor('").append(getMarkupId()).append("',").append(readonly.getObject()).append(");");
sb.append("initEditor('").append(getMarkupId());
sb.append("',").append(readonly.getObject());
sb.append(",").append(minSize);
sb.append(");");

response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
}

public int getMinSize() {
return minSize;
}

public void setMinSize(int minSize) {
this.minSize = minSize;
}

public void setReadonly(boolean readonly) {
this.readonly.setObject(readonly);
}
Expand Down
Expand Up @@ -28,19 +28,18 @@
<div class="form-group" wicket:id="name" />
<div class="form-group" wicket:id="description" />
</div>
<div class="col-md-6">

</div>
</div>

<div class="form-group">
<div class="col-lg-12">
<div class="col-md-10 col-md-offset-1">
<h3><wicket:message key="PageReport.jasperTemplate"/></h3>
<textarea wicket:id="templateEditor"></textarea>
</div>
</div>

<div class="form-group">
<div class="col-lg-12">
<div class="col-md-10 col-md-offset-1">
<h3><wicket:message key="PageReport.jasperTemplateStyle"/></h3>
<textarea wicket:id="templateStyleEditor"></textarea>
</div>
</div>
Expand Down
Expand Up @@ -118,10 +118,12 @@ private void initLayout() {

AceEditor templateEditor = new AceEditor(ID_TEMPLATE_EDITOR, new Base64Model(
new PrismPropertyModel<>(model, ReportType.F_TEMPLATE)));
templateEditor.setMinSize(450);
mainForm.add(templateEditor);

AceEditor templateStyleEditor = new AceEditor(ID_TEMPLATE_STYLE_EDITOR, new Base64Model(
new PrismPropertyModel<>(model, ReportType.F_TEMPLATE_STYLE)));
templateStyleEditor.setMinSize(450);
mainForm.add(templateStyleEditor);

// List<ITab> tabs = new ArrayList<ITab>();
Expand Down
Expand Up @@ -14,3 +14,5 @@
# limitations under the License.
#
page.title=Report configuration
PageReport.jasperTemplate=Jasper template
PageReport.jasperTemplateStyle=Jasper template style
6 changes: 3 additions & 3 deletions gui/admin-gui/src/main/webapp/js/midpoint/ace-editor.js
Expand Up @@ -18,7 +18,7 @@ var ACE_EDITOR_POSTFIX = "_editor";
var DISABLED_CLASS = "disabled";
$.aceEditors = {};

function initEditor(textAreaId, readonly) {
function initEditor(textAreaId, readonly, minSize) {
var jqTextArea = '#' + textAreaId;
var editorId = textAreaId + ACE_EDITOR_POSTFIX;
var jqEditor = '#' + editorId;
Expand Down Expand Up @@ -52,8 +52,8 @@ function initEditor(textAreaId, readonly) {
$(document).ready(function () {
//38 + 1 + 21 is menu outer height
var newHeight = $(document).innerHeight() - $('div.mainContainer').outerHeight(true) - 60;
if (newHeight < 200) {
newHeight = 200;
if (newHeight < minSize) {
newHeight = minSize;
}

$('#' + editorId).height(newHeight.toString() + "px");
Expand Down

0 comments on commit 691fe23

Please sign in to comment.