You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by sb...@apache.org on 2015/08/15 22:11:14 UTC
svn commit: r1696091 - in /sling/trunk/contrib/explorers/resourceeditor: ./
src/main/less/
src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/
src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/properties/
...
Author: sboehme
Date: Sat Aug 15 20:11:13 2015
New Revision: 1696091
URL: http://svn.apache.org/r1696091
Log:
Changed resource editor to render content in the property area dependent on the resource type.
Added:
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp
- copied, changed from r1694052, sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/properties.jsp
Removed:
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/properties.jsp
Modified:
sling/trunk/contrib/explorers/resourceeditor/pom.xml
sling/trunk/contrib/explorers/resourceeditor/src/main/less/alerts.less
sling/trunk/contrib/explorers/resourceeditor/src/main/less/forms.less
sling/trunk/contrib/explorers/resourceeditor/src/main/less/glyphicons.less
sling/trunk/contrib/explorers/resourceeditor/src/main/less/navs.less
sling/trunk/contrib/explorers/resourceeditor/src/main/less/reseditor.less
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/properties/PropertyController.js
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp
sling/trunk/contrib/explorers/resourceeditor/src/test/javascript/e2e/spec/e2e_spec.js
Modified: sling/trunk/contrib/explorers/resourceeditor/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/pom.xml?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/pom.xml (original)
+++ sling/trunk/contrib/explorers/resourceeditor/pom.xml Sat Aug 15 20:11:13 2015
@@ -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>
Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/less/alerts.less
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/less/alerts.less?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/less/alerts.less (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/less/alerts.less Sat Aug 15 20:11:13 2015
@@ -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 {
Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/less/forms.less
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/less/forms.less?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/less/forms.less (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/less/forms.less Sat Aug 15 20:11:13 2015
@@ -56,6 +56,6 @@
}
-#properties fieldset {
+#node-content fieldset {
margin-bottom: 5px;
}
\ No newline at end of file
Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/less/glyphicons.less
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/less/glyphicons.less?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/less/glyphicons.less (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/less/glyphicons.less Sat Aug 15 20:11:13 2015
@@ -8,7 +8,7 @@
// <a href="#"><span class="glyphicon glyphicon-star"></span> Star</a>
-#properties .glyphicon {
+#node-content .glyphicon {
font-size: 16px;
color: @textColor;
}
Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/less/navs.less
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/less/navs.less?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/less/navs.less (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/less/navs.less Sat Aug 15 20:11:13 2015
@@ -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 {
Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/less/reseditor.less
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/less/reseditor.less?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/less/reseditor.less (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/less/reseditor.less Sat Aug 15 20:11:13 2015
@@ -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
Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js Sat Aug 15 20:11:13 2015
@@ -155,14 +155,16 @@ org.apache.sling.reseditor.MainControlle
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){
Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/properties/PropertyController.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/properties/PropertyController.js?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/properties/PropertyController.js (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/properties/PropertyController.js Sat Aug 15 20:11:13 2015
@@ -48,19 +48,19 @@ org.apache.sling.reseditor.PropertyContr
'</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.PropertyContr
});
$("#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.PropertyContr
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.PropertyContr
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({
Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp Sat Aug 15 20:11:13 2015
@@ -128,7 +128,7 @@ new org.apache.sling.reseditor.PropertyC
<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.PropertyC
</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.PropertyC
</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">
Copied: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp (from r1694052, sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/properties.jsp)
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp?p2=sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp&p1=sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/properties.jsp&r1=1694052&r2=1696091&rev=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/properties.jsp (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp Sat Aug 15 20:11:13 2015
@@ -1,114 +1,147 @@
+<%@ 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="properties" class="col-sm-8">
+ <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">
- <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 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>
- <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">
+ <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" %>
- </div>
- </fieldset>
+ </c:otherwise>
+ </c:choose>
</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 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>
Modified: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp Sat Aug 15 20:11:13 2015
@@ -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);
%>
{
Modified: sling/trunk/contrib/explorers/resourceeditor/src/test/javascript/e2e/spec/e2e_spec.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/test/javascript/e2e/spec/e2e_spec.js?rev=1696091&r1=1696090&r2=1696091&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/test/javascript/e2e/spec/e2e_spec.js (original)
+++ sling/trunk/contrib/explorers/resourceeditor/src/test/javascript/e2e/spec/e2e_spec.js Sat Aug 15 20:11:13 2015
@@ -171,7 +171,7 @@ describe('A user of the Apache Sling Res
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 Res
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 Res
.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 Res
});
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 Res
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 Res
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 Res
});
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 Res
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);
})