Created
June 24, 2013 00:19
-
-
Save porcelli/5847046 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <title>UberFire Showcase</title> | |
| <link rel="stylesheet" href="css/uberfire-loading.css"> | |
| <link rel="stylesheet" href="css/uberfire-showcase.css"> | |
| <link rel="stylesheet" href="css/ruleflow.css"> | |
| </head> | |
| <body> | |
| <iframe id="__gwt_historyFrame" style="width: 0; height: 0; border: 0"></iframe> | |
| <script type="text/javascript"> | |
| var current_user = { name:"@{name}", roles:[@{roles}] } | |
| </script> | |
| <!--add loading indicator while the app is being loaded--> | |
| <div id="loading"> | |
| <div class="loading-indicator"> | |
| <img src="images/loading-icon.gif" width="32" height="32" style="margin-right: 8px; float: left; vertical-align: top;"/> | |
| Please wait<br/><span id="loading-msg">Loading application...</span> | |
| </div> | |
| </div> | |
| <!-- The GWT js file generated at run time --> | |
| <script type="text/javascript" src='org.uberfire.UberfireShowcase.nocache.js'></script> | |
| <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script> | |
| <script type="text/javascript"> | |
| this.addEventListener("load", doStuff, true); | |
| function TodoCtrl($scope) { | |
| $scope.todos = [ | |
| {text:'learn angular', done:true}, | |
| {text:'build an angular app', done:false}]; | |
| $scope.addTodo = function() { | |
| $scope.todos.push({text:$scope.todoText, done:false}); | |
| $scope.todoText = ''; | |
| }; | |
| $scope.remaining = function() { | |
| var count = 0; | |
| angular.forEach($scope.todos, function(todo) { | |
| count += todo.done ? 0 : 1; | |
| }); | |
| return count; | |
| }; | |
| $scope.archive = function() { | |
| var oldTodos = $scope.todos; | |
| $scope.todos = []; | |
| angular.forEach(oldTodos, function(todo) { | |
| if (!todo.done) $scope.todos.push(todo); | |
| }); | |
| }; | |
| } | |
| function doStuff(e) { | |
| var strVar=""; | |
| strVar += "<div ng-controller=\"TodoCtrl\">"; | |
| strVar += " <span>{{remaining()}} of {{todos.length}} remaining<\/span>"; | |
| strVar += " [ <a href=\"\" ng-click=\"archive()\">archive<\/a> ]"; | |
| strVar += " <ul class=\"unstyled\">"; | |
| strVar += " <li ng-repeat=\"todo in todos\">"; | |
| strVar += " <input type=\"checkbox\" ng-model=\"todo.done\">"; | |
| strVar += " <span class=\"done-{{todo.done}}\">{{todo.text}}<\/span>"; | |
| strVar += " <\/li>"; | |
| strVar += " <\/ul>"; | |
| strVar += " <form ng-submit=\"addTodo()\">"; | |
| strVar += " <input type=\"text\" ng-model=\"todoText\" size=\"30\""; | |
| strVar += " placeholder=\"add new todo here\">"; | |
| strVar += " <input class=\"btn-primary\" type=\"submit\" value=\"add\">"; | |
| strVar += " <\/form>"; | |
| strVar += " <\/div>"; | |
| $registerPlugin( { | |
| id : "my angular js", | |
| build : function () { | |
| return strVar; | |
| } | |
| } ); | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment