This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-editor.git
commit 1b95e962ac57ef59dda841d3808a3a051fdbefe1 Author: Sandro Boehme <[email protected]> AuthorDate: Sat Aug 15 20:11:13 2015 +0000 Changed resource editor to render content in the property area dependent on the resource type. git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1696091 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 7 +- src/main/less/alerts.less | 2 +- src/main/less/forms.less | 2 +- src/main/less/glyphicons.less | 2 +- src/main/less/navs.less | 8 +- src/main/less/reseditor.less | 40 +++-- .../js/MainController.js | 6 +- .../js/properties/PropertyController.js | 25 +-- .../SLING-INF/libs/sling/resource-editor/html.jsp | 11 +- .../libs/sling/resource-editor/node-content.jsp | 191 +++++++++++++++++++++ .../libs/sling/resource-editor/nodes.json.incl.jsp | 2 +- .../libs/sling/resource-editor/properties.jsp | 158 ----------------- src/test/javascript/e2e/spec/e2e_spec.js | 24 +-- 13 files changed, 265 insertions(+), 213 deletions(-) diff --git a/pom.xml b/pom.xml index 2779afb..1cf5c79 100644 --- a/pom.xml +++ b/pom.xml @@ -125,7 +125,12 @@ <exclude>src/main/resources/SLING-INF/libs/sling/resource-editor/servlet-nodes.json</exclude> </excludes> </configuration> - </plugin> + </plugin> + <plugin> + <groupId>org.apache.sling</groupId> + <artifactId>maven-sling-plugin</artifactId> + <version>2.1.1-SNAPSHOT</version> + </plugin> </plugins> <extensions> <extension> diff --git a/src/main/less/alerts.less b/src/main/less/alerts.less index fafb5ae..4122aec 100644 --- a/src/main/less/alerts.less +++ b/src/main/less/alerts.less @@ -21,7 +21,7 @@ text-shadow: 1px 1px 0 rgba(255,255,255,.5); .rounded(5px); .plate-box-shadow; - .plate-margin; + margin-top: 15px; } .alert-warning { diff --git a/src/main/less/forms.less b/src/main/less/forms.less index 3b6aa85..75afae1 100644 --- a/src/main/less/forms.less +++ b/src/main/less/forms.less @@ -56,6 +56,6 @@ } -#properties fieldset { +#node-content fieldset { margin-bottom: 5px; } \ No newline at end of file diff --git a/src/main/less/glyphicons.less b/src/main/less/glyphicons.less index 4650880..f0a6566 100644 --- a/src/main/less/glyphicons.less +++ b/src/main/less/glyphicons.less @@ -8,7 +8,7 @@ // <a href="#"><span class="glyphicon glyphicon-star"></span> Star</a> -#properties .glyphicon { +#node-content .glyphicon { font-size: 16px; color: @textColor; } diff --git a/src/main/less/navs.less b/src/main/less/navs.less index 0d880a8..f7f05bc 100644 --- a/src/main/less/navs.less +++ b/src/main/less/navs.less @@ -28,7 +28,6 @@ #login .tab-content { .border-radius(0, 7px, 7px, 0); - background-color: transparent; } #login .tab-pane.active { @@ -68,7 +67,12 @@ .plate-box-shadow; margin-right: 0px; padding: 0px 10px 5px 10px; - +} + +#content-tabs.nav-pills > li > a { + .border-radius(7px, 0px, 0px, 7px); + .plate-background; + padding: 3px 10px; } #login .nav-pills > li > a { diff --git a/src/main/less/reseditor.less b/src/main/less/reseditor.less index 18942d4..05239c7 100755 --- a/src/main/less/reseditor.less +++ b/src/main/less/reseditor.less @@ -70,16 +70,13 @@ body } .plate-background { - background: -moz-linear-gradient(-45deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.7) 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,rgba(0,0,0,0.4)), color-stop(100%,rgba(0,0,0,0.7))); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(-45deg, rgba(0,0,0,0.4) 0%,rgba(0,0,0,0.7) 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(-45deg, rgba(0,0,0,0.4) 0%,rgba(0,0,0,0.7) 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(-45deg, rgba(0,0,0,0.4) 0%,rgba(0,0,0,0.7) 100%); /* IE10+ */ - background: linear-gradient(-45deg, rgba(0,0,0,0.4) 0%,rgba(0,0,0,0.7) 100%); /* W3C */ + /* Fallback for web browsers that doesn't support RGBa */ + background: rgb(0, 0, 0) transparent; + /* RGBa with 0.6 opacity */ + background: rgba(0, 0, 0, 0.6); } .ie9filter-plate-div { - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a0000000', endColorstr='#c9000000',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */ height: 100%; } .plate-box-shadow { @@ -92,17 +89,24 @@ body .rounded(7px); } +.full-height { + height: 100%; +} + +#iframe_main { + padding-bottom: 40px; + .rounded; +} + @dark-gray: #303030; .plate-text-shadow { text-shadow: 1px 1px 0px @dark-gray, 0px 0px 0px black; } + .plate-selected-text-shadow { text-shadow: 1px 1px 0px black, 0px 0px 0px #202020; } -.plate-margin { - margin: 15px; -} .plate { .plate-background; @@ -111,9 +115,6 @@ body .plate-text-shadow; overflow: hidden; - - .plate-margin; - } /* .logo has to be defined after .plate to overwrite the font properties */ @@ -129,6 +130,13 @@ body top: 10px; } +#main-row { + margin-top: 15px; +} +#content-tabs { + margin-left: 10px; +} + .edition { font-size: 11px; font-weight: normal; @@ -166,7 +174,7 @@ body width: 100%; } #inner_content_margin { - margin: 10px; + margin: 0 10px; } #footer { @@ -358,11 +366,11 @@ input.jstree-rename-input{ text-shadow: none; } -#properties .ie9filter-plate-div { +#node-content .ie9filter-plate-div { overflow-y: auto; overflow-x: hidden; } #properties-info-icon { - margin-top: -4px; + margin-top: 5px; } \ No newline at end of file diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js index ac6e8b9..447abd7 100644 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js @@ -155,14 +155,16 @@ org.apache.sling.reseditor.MainController = (function() { var login_height = $("#login").outerHeight(true); var header_height = $("#header").outerHeight(true); var alert_height = $("#alerts").outerHeight(true); + var content_tab_height = $("#content-tabs").outerHeight(true); var footer_height = $("#footer").outerHeight(true); var sidebar_margin = $("#sidebar").outerHeight(true)-$("#sidebar").outerHeight(false); - var usable_height = $(window).height() - login_height - header_height - alert_height - sidebar_margin - 1; + var mainrow_margin = $("#main-row").outerHeight(true)-$("#main-row").outerHeight(false); + var usable_height = $(window).height() - login_height - header_height - alert_height - sidebar_margin - mainrow_margin - 15; // activate again if the footer is needed // var usable_height = $(window).height() - header_height - footer_height - sidebar_margin - 1; $("#sidebar").height( usable_height ); - $("#outer_content").height( usable_height ); + $("#outer_content").height( usable_height-content_tab_height ); } MainController.prototype.displayAlert = function(error, resourcePath){ diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/properties/PropertyController.js b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/properties/PropertyController.js index 19df319..16f2ae0 100644 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/properties/PropertyController.js +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/properties/PropertyController.js @@ -48,19 +48,19 @@ org.apache.sling.reseditor.PropertyController = (function() { '</div>' }); - $( "#properties" ).on( "click", ".dropdown-menu.add-property-menu li a", function() { + $( "#node-content" ).on( "click", ".dropdown-menu.add-property-menu li a", function() { var dataType = $(this).attr('data-property-type'); thisPropertyController.openAddPropertyDialog(dataType); }); $('#addPropertyDialog .submit').click(function(){ thisPropertyController.addProperty(); }); - $( "#properties" ).on( "click", ".property-icon.glyphicon-remove", function() { + $( "#node-content" ).on( "click", ".property-icon.glyphicon-remove", function() { var parentRow = $(this).parents(".row:first"); var propertyKey = parentRow.find(".proplabel").attr("for"); thisPropertyController.removeProperty(propertyKey, parentRow); }); - $( "#properties" ).on( "click", ".property-icon.glyphicon-save", function() { + $( "#node-content" ).on( "click", ".property-icon.glyphicon-save", function() { var parentRow = $(this).parents(".row:first"); var key, value; if (parentRow.hasClass('new-property')){ @@ -74,12 +74,12 @@ org.apache.sling.reseditor.PropertyController = (function() { }); $("#properties-info-icon").on("click", function(e, data) { - $('#properties .info-content-container').slideToggle(); + $('#node-content .info-content-container').slideToggle(); }); - $("#properties .info-content-container .close").on("click", function(e, data) { - $('#properties .info-content-container').slideToggle(); + $("#node-content .info-content-container .close").on("click", function(e, data) { + $('#node-content .info-content-container').slideToggle(); }); - $( "#properties" ).on( "keydown", function(event, data) { + $( "#node-content" ).on( "keydown", function(event, data) { // see http://www.javascripter.net/faq/keycodes.htm if (event.ctrlKey || event.metaKey) { var pressedKey = String.fromCharCode(event.which).toLowerCase(); @@ -102,7 +102,7 @@ org.apache.sling.reseditor.PropertyController = (function() { break; case n: event.preventDefault(); - $('#properties .add-property-menu-item.dropdown-toggle').dropdown('toggle'); + $('#node-content .add-property-menu-item.dropdown-toggle').dropdown('toggle'); break; } } @@ -147,13 +147,14 @@ org.apache.sling.reseditor.PropertyController = (function() { PropertyController.prototype.saveProperty = function(key, value){ var thisPropertyController = this; var data = {}; - data[key] = [value,value]; +// data[key] = [value,value]; + data[key] = value; data["_charset_"] = "utf-8"; $.ajax({ type: 'POST', - url: location.href+"?"+key+"="+value, - dataType: "json" -// ,data: data + url: location.href, + dataType: "json", + data: data }) .done(function() { $.notify({ diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp b/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp index 3d00033..be2241a 100644 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp @@ -128,7 +128,7 @@ new org.apache.sling.reseditor.PropertyController({}, mainController); <div id="login" class="row"> <div class="col-sm-12"> <div class="logo"> - The Sling Resource Editor <span class="edition">node-edit version</span> + The Sling Resource Editor <span class="edition">build with passion</span> </div> <div class="tabbable tabs-below"> <div id="login_tab_content" class="tab-content plate-background plate-box-shadow" style="display:none;"> @@ -191,8 +191,8 @@ new org.apache.sling.reseditor.PropertyController({}, mainController); </div> </div> </div> - <div class="row"> - <div class="col-sm-4"> + <div id="main-row" class="row"> + <div id="sidebar-col" class="col-sm-4"> <div id="sidebar" class="plate"> <div class="ie9filter-plate-div"> <div style="display:none;" class="info-content-container" > @@ -215,9 +215,8 @@ new org.apache.sling.reseditor.PropertyController({}, mainController); </div> </div> </div> - - <%@ include file="properties.jsp" %> - </div> + <%@ include file="node-content.jsp" %> + </div> <div class="row" style="visibility:hidden; display:none;"> <div class="col-sm-12"> <div id="footer" class="plate"> diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp b/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp new file mode 100644 index 0000000..40bc624 --- /dev/null +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp @@ -0,0 +1,191 @@ +<%@ taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling"%> + +<%@ page import="org.apache.sling.api.resource.*" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib prefix="re" uri="http://sling.apache.org/resource-editor"%> + +<sling:defineObjects /> + <div id="node-content" class="col-sm-8"> + <c:set var="scriptResource" scope="request" value="${sling:getResource(resourceResolver,sling:getResource(resourceResolver,resource.path).resourceType)}"/> + <% Resource theResource = (Resource) request.getAttribute("scriptResource");%> + <c:set var="isWebPage" value="<%=theResource != null ? theResource.isResourceType("sling/web-page") : false %>"/> + <c:if test="${isWebPage}"> + <ul id="content-tabs" class="nav nav-pills" role="tablist"> + <li role="presentation" class="active"><a href="#page-editor" aria-controls="page-editor" role="tab" data-toggle="pill">Web Page Editor</a></li> + <li role="presentation"><a href="#page-preview" aria-controls="page-preview" role="tab" data-toggle="pill">Page Preview</a></li> + <li role="presentation"><a href="#properties" aria-controls="properties" role="tab" data-toggle="pill">Properties</a></li> + </ul> + </c:if> + <div id="outer_content" class="plate"> + <div class="ie9filter-plate-div"> + <div id="inner_content_margin" class="full-height"> + <div class="row full-height" > + <div class="col-sm-12 full-height" > + <div class="tab-content full-height" > + <div role="tabpanel" class="tab-pane ${isWebPage ? 'active' : ''} full-height" id="page-editor"> + <a href="/pageeditor${resource.path}.main.html" target="_blank"> + <span id="open-new-window" class="glyphicon glyphicon-share-alt" aria-hidden="true"></span> + </a> + <c:if test="${isWebPage}"> + <div class="full-height"> + <sling:include path="/pageeditor${resource.path}.html"/> + </div> + </c:if> + </div> + <div role="tabpanel" class="tab-pane" id="page-preview"> + <a href="${resource.path}.html" target="_blank"> + <span id="open-new-window" class="glyphicon glyphicon-share-alt" aria-hidden="true"></span> + </a> + <iframe id="iframe" src="${resource.path}.html" allowtransparency="true" frameborder="0" height="100%" width="100%" style="height: 500px;background:none transparent;-webkit-border-radius:7px;-moz-border-radius: 7px;border-radius: 7px; border: 3px solid black"></iframe> + </div> + <div role="tabpanel" class="tab-pane ${!isWebPage ? 'active' : ''}" id="properties"> + <div style="display: none;" class="info-content-container" > + <div class="well well-sm info-content"> + <button type="button" class="close"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4>Cheat Sheet</h4> + <p>You can use</p> + <ul> + <li><kbd><kbd>ctrl</kbd> + <kbd>s</kbd></kbd> or <kbd><kbd>cmd</kbd> + <kbd>s</kbd></kbd> (for Mac) for saving a property.</li> + <li><kbd><kbd>ctrl</kbd> + <kbd>del</kbd></kbd> or <kbd><kbd>cmd</kbd> + <kbd>del</kbd></kbd> (for Mac) for removing a property.</li> + <li><kbd><kbd>ctrl</kbd> + <kbd>n</kbd></kbd> or <kbd><kbd>cmd</kbd> + <kbd>n</kbd></kbd> (for Mac) for opening the add property menu.</li> + </ul> + </div> + </div> + <span id="properties-info-icon" class="info-icon info-icon-lightgray pull-right clearfix" ></span> + <ul class="nav nav-pills"> + <li class="dropdown" role="presentation"> + <a class="add-property-menu-item dropdown-toggle" data-toggle="dropdown" href="#"><span class=""><span class="glyphicon glyphicon-plus"></span><span class="caret"></span></span> + </a> + <ul class="dropdown-menu add-property-menu" role="menu" aria-labelledby="propertyTypeMenu"> + <li><a tabindex="-1" href="#" data-property-type="String">String</a></li> + <li><a tabindex="-1" href="#" data-property-type="Date">Date</a></li> + <li><a tabindex="-1" href="#" data-property-type="Boolean">Boolean</a></li> + <li><a tabindex="-1" href="#" data-property-type="Long">Long</a></li> + <li><a tabindex="-1" href="#" data-property-type="Double">Double</a></li> + <li><a tabindex="-1" href="#" data-property-type="Decimal">Decimal</a></li> + <li><a tabindex="-1" href="#" data-property-type="Binary">Binary</a></li> + <li><a tabindex="-1" href="#" data-property-type="Name">Name</a></li> + <li><a tabindex="-1" href="#" data-property-type="Path">Path</a></li> + <li><a tabindex="-1" href="#" data-property-type="Reference">Reference</a></li> + <li><a tabindex="-1" href="#" data-property-type="Uri">URI</a></li> + </ul> + </li> + </ul> + <form action="not_configured_yet.change.properties" method="post"> + <c:set var="resourceIsNode" scope="request" value="<%=resource.adaptTo(Node.class) !=null %>"/> + <c:choose> + <c:when test="${resourceIsNode}" > + <%-- + For some reason I get the following exception when using the JSTL expression '${currentNode.properties}' + instead of the scriptlet code 'currentNode.getProperties()': + org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP: + org.apache.sling.scripting.jsp.jasper.el.JspValueExpression cannot be resolved to a type + see https://issues.apache.org/jira/browse/SLING-2455 + --%> + <c:forEach var="property" items="<%=currentNode.getProperties()%>" varStatus="propertyLoopStatus"> + <% Property property = (Property) pageContext.getAttribute("property");%> + <div id="property-${propertyLoopStatus.index}" class="row property-row" data-property-name="${fn:escapeXml(property.name)}" > + <fieldset> + <div class="col-sm-3"> + <label class="proplabel" for='${property.name}'>${property.name} [<%=PropertyType.nameFromValue(property.getType())%>${property.multiple ? ' multiple' : ''}]</label> + </div> + <div class="col-sm-7 property-col"> + <!-- geschachteltes div mit Zeilen pro multi value property --> + <!-- dann passen auch die Abst�nde (innerhalb des Properties und zwischen den Properties) --> + <%-- ${property.values} --%> + <c:choose> + <c:when test="${property.multiple}" > + <!-- <fieldset class="propmultival_fieldset"> --> + <c:forEach var="value" items="<%=property.getValues()%>" varStatus="multiPropertyLoopStatus"> + <div id="property-${propertyLoopStatus.index}-${multiPropertyLoopStatus.index}" class="row" data-property-name="${fn:escapeXml(property.name)}-${multiPropertyLoopStatus.index}" > + <fieldset> + <div class="col-sm-12"> + <%@ include file="property-editor.jsp" %> + </div> + </fieldset> + </div> + </c:forEach> + <!-- </fieldset> --> + </c:when> + <c:otherwise> + <%@ include file="property-editor.jsp" %> + </c:otherwise> + </c:choose> + </div> + <div class="col-sm-2"> + <span class="icon property-icon glyphicon glyphicon-plus" aria-hidden="true"></span> + <span class="icon property-icon glyphicon glyphicon-save" aria-hidden="true"></span> + <span class="icon property-icon glyphicon glyphicon-remove" aria-hidden="true"></span> + </div> + </fieldset> + </div> + </c:forEach> + </c:when> + <c:otherwise> + <c:forEach var="property" items="<%=resource.adaptTo(ValueMap.class)%>"> + <div class="row"> + <fieldset> + <div class="col-sm-3"> + <label class="proplabel" for='${property.key}'>${property.key}</label> + </div> + <div class="col-sm-7"> + <input class="propinput form-control" id="${property.key}" name="${property.key}" value="${property.value}"/> + </div> + </fieldset> + </div> + </c:forEach> + </c:otherwise> + </c:choose> + </form> + </div> <!-- End properties panel --> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + <div class="modal fade" id="addPropertyDialog" tabindex="-1" role="dialog" aria-labelledby="addPropertyDialogLabel" aria-hidden="true"> + <div class="modal-dialog modal-lg"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title" id="addPropertyDialogLabel">Add Property</h4> + </div> + <div class="modal-body"> + <div class="container-fluid"> + <div class="row new-property"> + <fieldset> + <div class="col-sm-1"> + <label class="proplabel" for='new-property-key'>Key</label> + </div> + <div class="col-sm-3"> + <input id="new-property-key" class="propinput form-control" name="newPropertyKey" /> + </div> + <div class="col-sm-1"> + <label class="proplabel" for='new-property-value'>Value</label> + </div> + <div class="col-sm-7"> + <fieldset> + <label class="sr-only" for='new-property-value'>Value</label> + <div class="property-editor" data-property-type="Path"> +<%-- <sling:include resource="${resource}" resourceType="sling/resource-editor/property-editor" addSelectors="path-editor"/> --%> + <re:path-editor value="" component_id="property-path-editor-new"></re:path-editor> + </div> + <div class="property-editor" data-property-type="String"> + <re:string-editor rows="4"></re:string-editor> + </div> + </fieldset> + </div> + </fieldset> + </div> + </div> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + <button type="button" class="btn btn-primary submit">Save changes</button> + </div> + </div> + </div> + </div> \ No newline at end of file diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp b/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp index 72cb589..ceef02a 100644 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp @@ -23,7 +23,7 @@ <c:if test="${theResource.path != '/reseditor'}"> <% Resource theResource = (Resource) pageContext.getAttribute("theResource"); Node node = theResource.adaptTo(Node.class); - String nodeType = (node !=null) ? node.getPrimaryNodeType().getName() : ""; + String nodeType = (node !=null) ? node.getPrimaryNodeType().getName() : "nt:unstructured"; pageContext.setAttribute("nodeType", nodeType); %> { diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor/properties.jsp b/src/main/resources/SLING-INF/libs/sling/resource-editor/properties.jsp deleted file mode 100644 index 1cb60fb..0000000 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor/properties.jsp +++ /dev/null @@ -1,158 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> -<%@ taglib prefix="re" uri="http://sling.apache.org/resource-editor"%> - -<sling:defineObjects /> - - <div id="properties" class="col-sm-8"> - <div id="outer_content" class="plate"> - <div class="ie9filter-plate-div"> - <div id="inner_content_margin"> - <div class="row"> - <div class="col-sm-12"> - <div style="display: none;" class="info-content-container" > - <div class="well well-sm info-content"> - <button type="button" class="close"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> - <h4>Cheat Sheet</h4> - <p>You can use</p> - <ul> - <li><kbd><kbd>ctrl</kbd> + <kbd>s</kbd></kbd> or <kbd><kbd>cmd</kbd> + <kbd>s</kbd></kbd> (for Mac) for saving a property.</li> - <li><kbd><kbd>ctrl</kbd> + <kbd>del</kbd></kbd> or <kbd><kbd>cmd</kbd> + <kbd>del</kbd></kbd> (for Mac) for removing a property.</li> - <li><kbd><kbd>ctrl</kbd> + <kbd>n</kbd></kbd> or <kbd><kbd>cmd</kbd> + <kbd>n</kbd></kbd> (for Mac) for opening the add property menu.</li> - </ul> - </div> - </div> - <span id="properties-info-icon" class="info-icon info-icon-lightgray pull-right clearfix" ></span> - <ul class="nav nav-pills"> - <li class="dropdown" role="presentation"> - <a class="add-property-menu-item dropdown-toggle" data-toggle="dropdown" href="#"><span class=""><span class="glyphicon glyphicon-plus"></span><span class="caret"></span></span> - </a> - <ul class="dropdown-menu add-property-menu" role="menu" aria-labelledby="propertyTypeMenu"> - <li><a tabindex="-1" href="#" data-property-type="String">String</a></li> - <li><a tabindex="-1" href="#" data-property-type="Date">Date</a></li> - <li><a tabindex="-1" href="#" data-property-type="Boolean">Boolean</a></li> - <li><a tabindex="-1" href="#" data-property-type="Long">Long</a></li> - <li><a tabindex="-1" href="#" data-property-type="Double">Double</a></li> - <li><a tabindex="-1" href="#" data-property-type="Decimal">Decimal</a></li> - <li><a tabindex="-1" href="#" data-property-type="Binary">Binary</a></li> - <li><a tabindex="-1" href="#" data-property-type="Name">Name</a></li> - <li><a tabindex="-1" href="#" data-property-type="Path">Path</a></li> - <li><a tabindex="-1" href="#" data-property-type="Reference">Reference</a></li> - <li><a tabindex="-1" href="#" data-property-type="Uri">URI</a></li> - </ul> - </li> - </ul> - </div> - </div> - <form action="not_configured_yet.change.properties" method="post"> - <c:set var="resourceIsNode" scope="request" value="<%=resource.adaptTo(Node.class) !=null %>"/> - <c:choose> - <c:when test="${resourceIsNode}" > - <%-- - For some reason I get the following exception when using the JSTL expression '${currentNode.properties}' - instead of the scriptlet code 'currentNode.getProperties()': - org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP: - org.apache.sling.scripting.jsp.jasper.el.JspValueExpression cannot be resolved to a type - see https://issues.apache.org/jira/browse/SLING-2455 - --%> - <c:forEach var="property" items="<%=currentNode.getProperties()%>" varStatus="propertyLoopStatus"> - <% Property property = (Property) pageContext.getAttribute("property");%> - <div id="property-${propertyLoopStatus.index}" class="row property-row" data-property-name="${fn:escapeXml(property.name)}" > - <fieldset> - <div class="col-sm-3"> - <label class="proplabel" for='${property.name}'>${property.name} [<%=PropertyType.nameFromValue(property.getType())%>${property.multiple ? ' multiple' : ''}]</label> - </div> - <div class="col-sm-7 property-col"> -<!-- geschachteltes div mit Zeilen pro multi value property --> -<!-- dann passen auch die Abst�nde (innerhalb des Properties und zwischen den Properties) --> -<%-- ${property.values} --%> - <c:choose> - <c:when test="${property.multiple}" > -<!-- <fieldset class="propmultival_fieldset"> --> - <c:forEach var="value" items="<%=property.getValues()%>" varStatus="multiPropertyLoopStatus"> - <div id="property-${propertyLoopStatus.index}-${multiPropertyLoopStatus.index}" class="row" data-property-name="${fn:escapeXml(property.name)}-${multiPropertyLoopStatus.index}" > - <fieldset> - <div class="col-sm-12"> - <%@ include file="property-editor.jsp" %> - </div> - </fieldset> - </div> - </c:forEach> -<!-- </fieldset> --> - </c:when> - <c:otherwise> - <%@ include file="property-editor.jsp" %> - </c:otherwise> - </c:choose> - </div> - <div class="col-sm-2"> - <span class="icon property-icon glyphicon glyphicon-plus" aria-hidden="true"></span> - <span class="icon property-icon glyphicon glyphicon-save" aria-hidden="true"></span> - <span class="icon property-icon glyphicon glyphicon-remove" aria-hidden="true"></span> - </div> - </fieldset> - </div> - </c:forEach> - </c:when> - <c:otherwise> - <c:forEach var="property" items="<%=resource.adaptTo(ValueMap.class)%>"> - <div class="row"> - <fieldset> - <div class="col-sm-3"> - <label class="proplabel" for='${property.key}'>${property.key}</label> - </div> - <div class="col-sm-7"> - <input class="propinput form-control" id="${property.key}" name="${property.key}" value="${property.value}"/> - </div> - </fieldset> - </div> - </c:forEach> - </c:otherwise> - </c:choose> - </form> - </div> - </div> - </div> - </div> - <div class="modal fade" id="addPropertyDialog" tabindex="-1" role="dialog" aria-labelledby="addPropertyDialogLabel" aria-hidden="true"> - <div class="modal-dialog modal-lg"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> - <h4 class="modal-title" id="addPropertyDialogLabel">Add Property</h4> - </div> - <div class="modal-body"> - <div class="container-fluid"> - <div class="row new-property"> - <fieldset> - <div class="col-sm-1"> - <label class="proplabel" for='new-property-key'>Key</label> - </div> - <div class="col-sm-3"> - <input id="new-property-key" class="propinput form-control" name="newPropertyKey" /> - </div> - <div class="col-sm-1"> - <label class="proplabel" for='new-property-value'>Value</label> - </div> - <div class="col-sm-7"> - <fieldset> - <label class="sr-only" for='new-property-value'>Value</label> - <div class="property-editor" data-property-type="Path"> -<%-- <sling:include resource="${resource}" resourceType="sling/resource-editor/property-editor" addSelectors="path-editor"/> --%> - <re:path-editor value="" component_id="property-path-editor-new"></re:path-editor> - </div> - <div class="property-editor" data-property-type="String"> - <re:string-editor rows="4"></re:string-editor> - </div> - </fieldset> - </div> - </fieldset> - </div> - </div> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> - <button type="button" class="btn btn-primary submit">Save changes</button> - </div> - </div> - </div> - </div> \ No newline at end of file diff --git a/src/test/javascript/e2e/spec/e2e_spec.js b/src/test/javascript/e2e/spec/e2e_spec.js index 90957ea..2d1781a 100644 --- a/src/test/javascript/e2e/spec/e2e_spec.js +++ b/src/test/javascript/e2e/spec/e2e_spec.js @@ -171,7 +171,7 @@ describe('A user of the Apache Sling Resource Editor', function() { client = client.url(homeURL); client .waitForExist('#last-element').click("#root li[nodename=\"aTestNode\"] i.add-icon") - .waitForVisible('#addNodeDialog.add-node-finished', 1000).addValue('#select2-drop .select2-input', 'Return').click('#addNodeDialog .btn.btn-primary.submit') + .waitForVisible('#addNodeDialog.add-node-finished', 2000).addValue('#select2-drop .select2-input', 'Return').click('#addNodeDialog .btn.btn-primary.submit') // The open node animation will take longer than 500ms thus setting 2000ms as max. .waitForExist('#root li[nodename="aTestNode"].opened', 2000).elements('#root li[nodename="aTestNode"].opened li a .jstree-themeicon', function(err, res) { client @@ -225,13 +225,13 @@ describe('A user of the Apache Sling Resource Editor', function() { function addProperty(type, editorTagName){ var encodedNodeNameSelector = '#root li[nodename="aTestNode"].opened li[nodename="a node with a resource type"]'; var encodedNodeNameOpenSelector = encodedNodeNameSelector +' i.open-icon'; - var addPropertyMenuItemSelector = "#properties .add-property-menu [data-property-type='"+type+"']"; + var addPropertyMenuItemSelector = "#node-content .add-property-menu [data-property-type='"+type+"']"; var key="a"+type+"Key"; var value="a "+type+" value"; var propValueEditorSelector = "#addPropertyDialog div[data-property-type='"+type+"'] "+editorTagName; client.url(homeURL).waitForExist('#last-element') - .click("#root li[nodename=\"aTestNode\"] i.open-icon").waitForExist("#properties .add-property-menu-item", 1000) - .click("#properties .add-property-menu-item").waitForExist(addPropertyMenuItemSelector, 1000) + .click("#root li[nodename=\"aTestNode\"] i.open-icon").waitForExist("#node-content .add-property-menu-item", 1000) + .click("#node-content .add-property-menu-item").waitForExist(addPropertyMenuItemSelector, 1000) .click(addPropertyMenuItemSelector).waitForVisible('#new-property-key', 1000) /* * The value is not always set completely the first time for some strange reason so I set it twice. @@ -245,7 +245,7 @@ describe('A user of the Apache Sling Resource Editor', function() { .click("#addPropertyDialog .btn-primary.submit").waitForExist("label.proplabel[for='"+key+"']", 1000, function(err, existed) { assert(typeof err === "undefined" || err === null); assert(existed === true); - client.getValue("#properties div[data-property-name='"+key+"'].row .propinput.property-value", function(err, resultingValue) { + client.getValue("#node-content div[data-property-name='"+key+"'].row .propinput.property-value", function(err, resultingValue) { assert(typeof err === "undefined" || err === null); assert(value === resultingValue); }); @@ -255,12 +255,12 @@ describe('A user of the Apache Sling Resource Editor', function() { }); describe('can save a String property', function(){ - var inputElementSelector = "#properties div[data-property-name='aStringKey'].row .propinput.property-value"; + var inputElementSelector = "#node-content div[data-property-name='aStringKey'].row .propinput.property-value"; it('with the icon', function(done) { var stringValue = "new String value"; setStringFieldValue(client, stringValue); - client.click("#properties div[data-property-name='aStringKey'].row .property-icon.glyphicon-save").waitForExist("div.alert-success.growl-notify", 1000).refresh(); + client.click("#node-content div[data-property-name='aStringKey'].row .property-icon.glyphicon-save").waitForExist("div.alert-success.growl-notify", 1000).refresh(); testStringFieldValue(client, stringValue); client.call(done); }); @@ -285,8 +285,8 @@ describe('A user of the Apache Sling Resource Editor', function() { function setStringFieldValue(client, value){ client.url(homeURL).waitForExist('#last-element') - .click("#root li[nodename=\"aTestNode\"] i.open-icon").waitForExist("#properties label.proplabel[for='aStringKey']", 1000) - .setValue("#properties div[data-property-name='aStringKey'].row .propinput.property-value", value); + .click("#root li[nodename=\"aTestNode\"] i.open-icon").waitForExist("#node-content label.proplabel[for='aStringKey']", 1000) + .setValue("#node-content div[data-property-name='aStringKey'].row .propinput.property-value", value); } function testStringFieldValue(client, value){ @@ -304,7 +304,7 @@ describe('A user of the Apache Sling Resource Editor', function() { var value= "aStringKey"; focusInputField(client, value); client - .click("#properties div[data-property-name='"+value+"'].row .property-icon.glyphicon-remove"); + .click("#node-content div[data-property-name='"+value+"'].row .property-icon.glyphicon-remove"); testRemoval(client, value); client.call(done); }); @@ -329,7 +329,7 @@ describe('A user of the Apache Sling Resource Editor', function() { }); function focusInputField(client, value){ - var stringPropertyInputFieldSelector = "#properties div[data-property-name='"+value+"'].row .propinput.property-value"; + var stringPropertyInputFieldSelector = "#node-content div[data-property-name='"+value+"'].row .propinput.property-value"; client.url(homeURL).waitForExist('#last-element') .click("#root li[nodename=\"aTestNode\"] i.open-icon").waitForExist(stringPropertyInputFieldSelector, 1000) .click(stringPropertyInputFieldSelector); @@ -339,7 +339,7 @@ describe('A user of the Apache Sling Resource Editor', function() { client .waitForVisible("div.bootbox-confirm .btn-primary", 1000) .click("div.bootbox-confirm .btn-primary").waitForExist("div.alert-success.growl-notify", 1000).refresh() - .waitForExist("#properties div[data-property-name='"+value+"'].row", true/*reverse*/, function(err, existed) { + .waitForExist("#node-content div[data-property-name='"+value+"'].row", true/*reverse*/, function(err, existed) { assert(typeof err === "undefined" || err === null); assert(existed === false); }) -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
