Author: cziegeler
Date: Wed Aug 10 20:17:36 2016
New Revision: 1755840

URL: http://svn.apache.org/viewvc?rev=1755840&view=rev
Log:
Start fixing edit page

Modified:
    
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java
    
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/edit.html.jsp
    
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/html.jsp
    
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/resources/js/slingshot.js

Modified: 
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java?rev=1755840&r1=1755839&r2=1755840&view=diff
==============================================================================
--- 
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java
 (original)
+++ 
sling/trunk/samples/slingshot/src/main/java/org/apache/sling/sample/slingshot/model/StreamEntry.java
 Wed Aug 10 20:17:36 2016
@@ -72,6 +72,6 @@ public class StreamEntry extends Propert
     }
 
     public String getLocation() {
-        return this.getProperties().get(PROPERTY_LOCATION, String.class);
+        return this.getProperties().get(PROPERTY_LOCATION, "");
     }
 }

Modified: 
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/edit.html.jsp
URL: 
http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/edit.html.jsp?rev=1755840&r1=1755839&r2=1755840&view=diff
==============================================================================
--- 
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/edit.html.jsp
 (original)
+++ 
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/edit.html.jsp
 Wed Aug 10 20:17:36 2016
@@ -20,11 +20,12 @@
                   org.apache.sling.api.resource.ResourceUtil,
                   org.apache.sling.api.resource.ValueMap,
                   org.apache.sling.api.request.ResponseUtil,
+                  org.apache.sling.sample.slingshot.model.StreamEntry,         
         
+                  org.apache.sling.sample.slingshot.SlingshotUtil,             
     
                   org.apache.sling.sample.slingshot.SlingshotConstants"%><%
 %><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"; %><%
 %><sling:defineObjects/><%
-    final ValueMap attributes = resource.getValueMap();
-    final String title = 
ResponseUtil.escapeXml(attributes.get(SlingshotConstants.PROPERTY_TITLE, 
resource.getName()));
+    final StreamEntry entry = new StreamEntry(resource);
 
     String imagePath = null;
     final Resource imagesResource = 
resource.getResourceResolver().getResource(resource, "images");
@@ -36,20 +37,45 @@
     }
 %><html>
   <head>
-    <title><%= title %></title>
+    <title><%= ResponseUtil.escapeXml(entry.getTitle()) %></title>
     <sling:include resource="<%= resource %>" replaceSelectors="head"/>
   </head>
-  <body class="ui-slingshot-main">
+  <body>
     <sling:include resource="<%= resource %>" replaceSelectors="menu"/>
-    <h1><%= title %></h1>
-    <img src="<%= request.getContextPath() %><%= imagePath %>"/>
-    <form method="POST" action="<%= request.getContextPath() 
%><%=resource.getName() %>">
-      <input type="hidden" name=":redirect" value="<%= 
request.getContextPath() %><%=resource.getPath() %>.html"/>
-      <p>Title: <input name="<%= SlingshotConstants.PROPERTY_TITLE %>" 
value="<%= title %>"/></p>
-      <p>Description: <input name="<%= SlingshotConstants.PROPERTY_DESCRIPTION 
%>" 
value="<%=ResponseUtil.escapeXml(attributes.get(SlingshotConstants.PROPERTY_DESCRIPTION,
 ""))%>"/></p>
-      <p>Location: <input name="<%= SlingshotConstants.PROPERTY_LOCATION %>" 
value="<%=ResponseUtil.escapeXml(attributes.get(SlingshotConstants.PROPERTY_LOCATION,
 ""))%>"/></p>
-      <button class="ui-button ui-form-button" type="submit">Save</button>
-      <p><a href="<%= request.getContextPath() %><%=resource.getPath() 
%>.html">Cancel</a></p>
-    </form>
+    <div class="jumbotron">
+      <div class="container">
+        <h1><%= ResponseUtil.escapeXml(entry.getStream().getInfo().getTitle()) 
%></h1>
+        <p><%= 
ResponseUtil.escapeXml(entry.getStream().getInfo().getDescription()) %></p>
+      </div>
+    </div>
+    <div class="container">
+      <h1><%= ResponseUtil.escapeXml(entry.getTitle()) %></h1>
+      <div class="row">
+        <div class="col-xs-12 col-md-8">
+          <img class="img-responsive center-block" src="<%= 
request.getContextPath() %><%= imagePath %>"/>
+          <div class="well">
+            <div class="row">
+            <form class="navbar-form navbar-left" role="comment" method="POST" 
action="<%= request.getContextPath() %><%=resource.getName() %>">
+              <input type="hidden" name=":redirect" value="<%= 
request.getContextPath() %><%=resource.getPath() %>.html"/>
+              <div class="form-group">
+                <label for="<%= SlingshotConstants.PROPERTY_TITLE 
%>">Title</label>
+                <input type="text" class="form-control" placeholder="Title" 
name="<%= SlingshotConstants.PROPERTY_TITLE %>" 
value="<%=ResponseUtil.escapeXml(entry.getTitle())%>"/>
+              </div>
+              <div class="form-group">
+                <label for="<%= SlingshotConstants.PROPERTY_DESCRIPTION 
%>">Description</label>
+                <input type="text" class="form-control" 
placeholder="Description" name="<%= SlingshotConstants.PROPERTY_DESCRIPTION %>" 
value="<%=ResponseUtil.escapeXml(entry.getDescription())%>"/>
+              </div>
+              <div class="form-group">
+                <label for="<%= SlingshotConstants.PROPERTY_LOCATION 
%>">Location</label>
+                <input type="text" class="form-control" placeholder="Location" 
name="<%= SlingshotConstants.PROPERTY_LOCATION %>" 
value="<%=ResponseUtil.escapeXml(entry.getLocation())%>"/>
+              </div>
+              <button type="submit" class="ui-button 
ui-form-button">Update</button>
+            </form>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+    <sling:include resource="<%= resource %>" replaceSelectors="bottom"/>
   </body>
 </html>
\ No newline at end of file

Modified: 
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/html.jsp
URL: 
http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/html.jsp?rev=1755840&r1=1755839&r2=1755840&view=diff
==============================================================================
--- 
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/html.jsp
 (original)
+++ 
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Streamentry/html.jsp
 Wed Aug 10 20:17:36 2016
@@ -57,7 +57,7 @@
         <div class="col-xs-12 col-md-8">
           <img class="img-responsive center-block" src="<%= 
request.getContextPath() %><%= imagePath %>"/>
           <div class="well">
-            <% if ( entry.getLocation() != null ) { %>
+            <% if ( entry.getLocation().length() > 0 ) { %>
               <p>Location: <%=ResponseUtil.escapeXml(entry.getLocation())%></p>
             <% } %>
             <p><%=ResponseUtil.escapeXml(entry.getDescription())%></p>

Modified: 
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/resources/js/slingshot.js
URL: 
http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/resources/js/slingshot.js?rev=1755840&r1=1755839&r2=1755840&view=diff
==============================================================================
--- 
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/resources/js/slingshot.js
 (original)
+++ 
sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/slingshot/resources/js/slingshot.js
 Wed Aug 10 20:17:36 2016
@@ -15,6 +15,10 @@
  * limitations under the License.
  */
 $( document ).ready(function() {
+       $(".ui-slingshot-clickable").click(function() { 
+           var $input = $( this );
+           window.location.href=$input.attr("data-link");
+    });
        $(".form-signin").submit(function(event) {
         event.preventDefault();
         var form = this;


Reply via email to