You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2013/09/22 23:49:54 UTC

svn commit: r1525456 - in /tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp: ./ WEB-INF/ app/ app/js/ app/js/model/ app/js/templates/ app/js/view/

Author: tveronezi
Date: Sun Sep 22 21:49:54 2013
New Revision: 1525456

URL: http://svn.apache.org/r1525456
Log:
https://issues.apache.org/jira/browse/TOMEE-1037

Added:
    tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/index.jsp
      - copied unchanged from r1525449, tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/application.jsp
Removed:
    tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/application.jsp
Modified:
    tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/WEB-INF/web.xml
    tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/app.less
    tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/application.js
    tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/model/movie.js
    tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/templates/application-table-row.handlebars
    tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/templates/movie.handlebars
    tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/view/application.js
    tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/view/movie.js

Modified: tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/WEB-INF/web.xml?rev=1525456&r1=1525455&r2=1525456&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/WEB-INF/web.xml (original)
+++ tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/WEB-INF/web.xml Sun Sep 22 21:49:54 2013
@@ -18,7 +18,7 @@
 
 <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
   <welcome-file-list>
-    <welcome-file>application.jsp</welcome-file>
+    <welcome-file>index.jsp</welcome-file>
   </welcome-file-list>
 
   <!-- The trick is to put all your static files under the same directory and map the "default" servlet to it -->
@@ -31,7 +31,7 @@
    at the client side in case the user starts the application from a permalink. -->
   <servlet>
     <servlet-name>application</servlet-name>
-    <jsp-file>/application.jsp</jsp-file>
+    <jsp-file>/index.jsp</jsp-file>
   </servlet>
   <servlet-mapping>
     <servlet-name>application</servlet-name>

Modified: tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/app.less
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/app.less?rev=1525456&r1=1525455&r2=1525456&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/app.less (original)
+++ tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/app.less Sun Sep 22 21:49:54 2013
@@ -41,7 +41,7 @@ body {
       width: 5px;
     }
 
-    a.ux-edit-row:hover {
+    a.ux-delete-row:hover, a.ux-edit-row:hover {
       cursor: hand;
     }
   }

Modified: tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/application.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/application.js?rev=1525456&r1=1525455&r2=1525456&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/application.js (original)
+++ tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/application.js Sun Sep 22 21:49:54 2013
@@ -66,6 +66,7 @@
                         success: function (total) {
                             var count = Math.ceil(total / max);
                             paginator.setCount(count);
+                            applicationView.setPaginator(count);
                         }
                     });
                 }

Modified: tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/model/movie.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/model/movie.js?rev=1525456&r1=1525455&r2=1525456&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/model/movie.js (original)
+++ tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/model/movie.js Sun Sep 22 21:49:54 2013
@@ -28,9 +28,11 @@
                 return {
                     'movie': this.attributes
                 };
+            },
+            defaults: {
+                rating: 5,
+                year: new Date().getFullYear()
             }
         });
     });
-}());
-
-
+}());
\ No newline at end of file

Modified: tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/templates/application-table-row.handlebars
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/templates/application-table-row.handlebars?rev=1525456&r1=1525455&r2=1525456&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/templates/application-table-row.handlebars (original)
+++ tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/templates/application-table-row.handlebars Sun Sep 22 21:49:54 2013
@@ -4,5 +4,5 @@
 <td>{{rating}}</td>
 <td>{{year}}</td>
 <td>
-    <span class="glyphicon glyphicon-trash ux-delete-row"></span>
+    <a href="delete" class="ux-delete-row"><span class="glyphicon glyphicon-trash"></span></a>
 </td>
\ No newline at end of file

Modified: tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/templates/movie.handlebars
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/templates/movie.handlebars?rev=1525456&r1=1525455&r2=1525456&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/templates/movie.handlebars (original)
+++ tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/templates/movie.handlebars Sun Sep 22 21:49:54 2013
@@ -35,7 +35,7 @@
 
                     <div class="col-lg-10">
                         <input class="form-control ux-rating" id="{{id_current}}"
-                               type="number" placeholder="{{i18n 'rating'}}" value="{{rating}}">
+                               type="number" min="0" max="10" placeholder="{{i18n 'rating'}}" value="{{rating}}">
                     </div>
                 </div>
                 <div class="form-group">
@@ -43,7 +43,7 @@
 
                     <div class="col-lg-10">
                         <input class="form-control ux-year" id="{{id_current}}" placeholder="{{i18n 'year'}}"
-                               type="number" value="{{year}}">
+                               type="number" min="1900" max="{{currentYear}}" value="{{year}}">
                     </div>
                 </div>
             </form>

Modified: tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/view/application.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/view/application.js?rev=1525456&r1=1525455&r2=1525456&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/view/application.js (original)
+++ tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/view/application.js Sun Sep 22 21:49:54 2013
@@ -76,11 +76,17 @@
                     });
                     tbody.append(row.render().$el);
                 });
+            },
+
+            setPaginator: function (count) {
+                var me = this;
+                paginator.$el.detach();
+                me.loadDataLink.detach();
                 var addButton = $(me.$el.find('.ux-add-btn').get(0));
-                if (underscore.isEmpty(rows)) {
-                    addButton.before(me.loadDataLink);
-                } else {
+                if (count) {
                     addButton.before(paginator.$el);
+                } else {
+                    addButton.before(me.loadDataLink);
                 }
             }
         });

Modified: tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/view/movie.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/view/movie.js?rev=1525456&r1=1525455&r2=1525456&view=diff
==============================================================================
--- tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/view/movie.js (original)
+++ tomee/tomee/trunk/examples/moviefun-rest/src/main/webapp/app/js/view/movie.js Sun Sep 22 21:49:54 2013
@@ -64,7 +64,8 @@
                     director: me.model.get('director'),
                     genre: me.model.get('genre'),
                     rating: me.model.get('rating'),
-                    year: me.model.get('year')
+                    year: me.model.get('year'),
+                    currentYear: new Date().getFullYear()
                 }));
                 return me;
             }