summaryrefslogtreecommitdiffstats
path: root/f
diff options
context:
space:
mode:
authorokalintu <ilkka.oksanen@aalto.fi>2015-03-03 15:46:01 +0200
committerokalintu <ilkka.oksanen@aalto.fi>2015-03-03 15:46:01 +0200
commit10eb4471ab820bb2323077cb7be8029a2e9b0759 (patch)
tree0d3b77b065d46bd9657359d7e33f7e4c2881c323 /f
parent6cb2891f117e29ea7adc68f62fe422285fc8364b (diff)
sanitized routes
Diffstat (limited to 'f')
l---------f/scripts/angular1
-rw-r--r--f/scripts/client.js26
-rw-r--r--f/styles/style.css0
-rw-r--r--f/templates/adm.html18
-rw-r--r--f/templates/index.html23
5 files changed, 68 insertions, 0 deletions
diff --git a/f/scripts/angular b/f/scripts/angular
new file mode 120000
index 0000000..aaffc07
--- /dev/null
+++ b/f/scripts/angular
@@ -0,0 +1 @@
+../../node_modules/angular \ No newline at end of file
diff --git a/f/scripts/client.js b/f/scripts/client.js
new file mode 100644
index 0000000..fb612ed
--- /dev/null
+++ b/f/scripts/client.js
@@ -0,0 +1,26 @@
+var ioc = angular.module('ioc',[]);
+
+ioc.controller('ioctrl',function($scope){
+ var soc= io();
+ $scope.que=[];
+ $scope.row="";
+ $scope.name="";
+ $scope.qsize=0;
+
+ $scope.submit = function(){
+ soc.emit("queadd",{"row":$scope.row,"name":$scope.name});
+ $scope.row="";
+ $scope.name="";
+ };
+
+ soc.on("quedata",function(data){
+ $scope.que=data;
+ $scope.qsize=data.length;
+ $scope.$apply();
+ });
+
+ $scope.popfirst = function(){
+ soc.emit("quepopfirst","");
+ };
+
+});
diff --git a/f/styles/style.css b/f/styles/style.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/f/styles/style.css
diff --git a/f/templates/adm.html b/f/templates/adm.html
new file mode 100644
index 0000000..bbc4209
--- /dev/null
+++ b/f/templates/adm.html
@@ -0,0 +1,18 @@
+<!doctype HTML>
+<html >
+<head>
+<script src="f/scripts/angular/angular.min.js"></script>
+<script src="/socket.io/socket.io.js"></script>
+<script src="/f/scripts/client.js"></script>
+<title>Jono</title>
+</head>
+<body ng-app="ioc" >
+<div ng-controller="ioctrl">
+ <div ng-click="popfirst()" style="font-size:72px;">
+ <div>Jonoa: {{qsize}}</div>
+ <div>Rivi: {{que[0].row}}</div>
+ <div>Nimi: {{que[0].name}}</div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/f/templates/index.html b/f/templates/index.html
new file mode 100644
index 0000000..822c162
--- /dev/null
+++ b/f/templates/index.html
@@ -0,0 +1,23 @@
+<!doctype HTML>
+<html >
+<head>
+<script src="/f/scripts/angular/angular.min.js"></script>
+<script src="/socket.io/socket.io.js"></script>
+<script src="/f/scripts/client.js"></script>
+<title>Jono</title>
+</head>
+<body ng-app="ioc" >
+<div ng-controller="ioctrl" style="font-size:36px;width:400px;margin-left:auto;margin-right:auto;">
+<div>Rivi: <input type="text" ng-model="row"></input></div>
+<div> Nimi: <input type="text" ng-model="name"></input></div>
+<button ng-click="submit();">Add</button>
+
+<table>
+<tr ng-repeat="person in que">
+ <td >{{person.row}}</td>
+ <td >{{person.name}}</td>
+</tr>
+</table>
+</div>
+</body>
+</html>