diff options
| author | okalintu <ilkka.oksanen@aalto.fi> | 2015-03-04 02:45:33 +0200 |
|---|---|---|
| committer | okalintu <ilkka.oksanen@aalto.fi> | 2015-03-04 02:45:33 +0200 |
| commit | f607dac15deb8b9faeb060661ccf8edd2b9564fc (patch) | |
| tree | f5ec095641b7f56b419c793e1ae3148a5b4650e5 /f | |
| parent | f1258540d0ab8bc8acbff3f31040539d34131e48 (diff) | |
implemented feature to allow ppl to remove themselves from que
Diffstat (limited to 'f')
| -rw-r--r-- | f/images/delete.jpg | bin | 0 -> 1307 bytes | |||
| -rw-r--r-- | f/scripts/client.js | 19 | ||||
| -rw-r--r-- | f/styles/style.css | 5 | ||||
| -rw-r--r-- | f/templates/index.html | 4 |
4 files changed, 24 insertions, 4 deletions
diff --git a/f/images/delete.jpg b/f/images/delete.jpg Binary files differnew file mode 100644 index 0000000..1ae7bfa --- /dev/null +++ b/f/images/delete.jpg diff --git a/f/scripts/client.js b/f/scripts/client.js index fb612ed..546aa57 100644 --- a/f/scripts/client.js +++ b/f/scripts/client.js @@ -2,13 +2,16 @@ var ioc = angular.module('ioc',[]); ioc.controller('ioctrl',function($scope){ var soc= io(); + var pw =0; + + $scope.uid =0; $scope.que=[]; $scope.row=""; $scope.name=""; $scope.qsize=0; $scope.submit = function(){ - soc.emit("queadd",{"row":$scope.row,"name":$scope.name}); + soc.emit("queadd",{"row":$scope.row,"name":$scope.name,"uid":$scope.uid}); $scope.row=""; $scope.name=""; }; @@ -19,8 +22,20 @@ ioc.controller('ioctrl',function($scope){ $scope.$apply(); }); + soc.on("userinfo",function(data){ + $scope.uid = data.uid; + pw= data.pw; + }); + + soc.on("err",function(err){ + console.log("error! msg: "+err.msg); + }); + $scope.popfirst = function(){ soc.emit("quepopfirst",""); }; - + $scope.querm = function(qid){ + data = {"qid":qid,"pw":pw}; + soc.emit("quedelete",data); + }; }); diff --git a/f/styles/style.css b/f/styles/style.css index 246a201..ae909c8 100644 --- a/f/styles/style.css +++ b/f/styles/style.css @@ -4,7 +4,7 @@ body{ }
#container_main{
font-size:24px;
- width:200px;
+ width:400px;
margin-top:40px;
margin-left:auto;
margin-right:auto;
@@ -26,6 +26,9 @@ td:first-child{ #que tr:nth-child(2){
background-color:darkgreen;
}
+#que td:nth-child(3){
+ text-align: center;
+}
#addform{
}
diff --git a/f/templates/index.html b/f/templates/index.html index b75ee8a..b02d4b8 100644 --- a/f/templates/index.html +++ b/f/templates/index.html @@ -27,10 +27,12 @@ <tr><td></td><td> <button id="addbutton" ng-click="submit();">Lisää</button></td></tr> </table> <table id="que"> -<tr><th>Rivi</th><th>Nimi</th></tr> +<tr><th>Rivi</th><th>Nimi</th><th>Poista</th></tr> <tr ng-repeat="person in que"> <td >Rivi {{person.row}}</td> <td >{{person.name}}</td> + <td ng-if="person.uid == uid" ng-click="querm(person.qid);"><img src="/f/images/delete.jpg"></td> + <td ng-if="person.uid != uid"></td> </tr> </table> </div> |
