yesterday train ride
This commit is contained in:
1 parent
9fcf26ea75
commit
18959cc4f9
7 files changed
+97
-7
No files matched your search
@@ -1,10 +1,11 @@
|
||||
define ["app", "lodash", "directives/ratinput"], (app, _, ratinput) ->
|
||||
|
||||
app.controller "DoormanCtrl", ["$scope", "$http","$routeParams","$location", ($scope, $http, $routeParams, $location) ->
|
||||
app.controller "DoormanCtrl", ["$scope", "$http","$routeParams","$location", "$timeout", ($scope, $http, $routeParams, $location, $timeout) ->
|
||||
$scope.doorman = {values: []}
|
||||
$scope.somevalue = "2/6"
|
||||
$scope.apiurl = "/api/doormen/#{$routeParams.id}"
|
||||
$scope.user = localStorage.getItem("email")
|
||||
$scope.doormanChanged = false
|
||||
|
||||
$http.get($scope.apiurl).then((res) ->
|
||||
$scope.doorman = res.data
|
||||
@@ -61,6 +62,11 @@ define ["app", "lodash", "directives/ratinput"], (app, _, ratinput) ->
|
||||
params = {params: {user: $scope.user}}
|
||||
$http.put($scope.apiurl, $scope.doorman, params).then((ret)->
|
||||
console.log "update"
|
||||
).then((res) ->
|
||||
$scope.doormanChanged = true
|
||||
$timeout(() ->
|
||||
$scope.doormanChanged = false
|
||||
, 3000)
|
||||
).catch((res) ->
|
||||
$scope.error =
|
||||
message: res.data
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<h3>End points</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row wab-apispect">
|
||||
<table class="columns large-12">
|
||||
@@ -26,3 +31,23 @@
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<h3>Authentication</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<p>
|
||||
All calls that change an asset requires authentication.
|
||||
Authentication is done by adding a <code class="light">
|
||||
user={user_name}</code> parameter to the endpoint. For example, to
|
||||
authenticate to <code class="light">/api/doormen/zST8_FWcPDT2-14wDQAAAQ==</code>
|
||||
with a user called "bob", the url becomes
|
||||
<code class="light">/api/doormen/zST8_FWcPDT2-14wDQAAAQ==?user=bob</code>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -12,8 +12,16 @@
|
||||
</div>
|
||||
|
||||
<div class="row" ng-repeat="value in doorman.values">
|
||||
<div class="columns large-7 small-10">
|
||||
<label >name<input type="text" placeholder="value name" ng-value="value.name" disabled></label>
|
||||
<div class="columns large-8 small-10">
|
||||
<div class="row">
|
||||
<div class="large-2 columns">
|
||||
<a class="button prefix disabled" ng-bind="$index"> </a>
|
||||
</div>
|
||||
<div class="large-10 columns">
|
||||
<input type="text" placeholder="value name" ng-value="value.name" disabled>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns large-4 small-2">
|
||||
<label >
|
||||
@@ -76,7 +84,9 @@
|
||||
<div class="large-12 small-12 columns">
|
||||
<ul class="button-group">
|
||||
<li><a ng-click="updateDoorman()" class="small button" ng-class="{disabled: !validate()}">Update</a></li>
|
||||
<li><a ng-click="deleteDoorman()" class="small button">Delete</a></li>
|
||||
</ul>
|
||||
<span ng-show="doormanChanged">
|
||||
doorman changed
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -16,7 +16,7 @@
|
||||
<input type="text" placeholder="email" ng-model="email">
|
||||
</div>
|
||||
<div class="small-2 columns">
|
||||
<input type="submit" class="button postfix" >Login!</input>
|
||||
<button type="submit" class="button postfix" >Login!</input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -91,11 +91,11 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="large-11 columns">
|
||||
<div class="large-9 columns">
|
||||
<button ng-click="createDoorman()" ng-class="{disabled: !isDoormanValid()}">create</button>
|
||||
</div>
|
||||
|
||||
<div class="large-1 columns">
|
||||
<div class="large-3 columns">
|
||||
<span >propability remaning: {{ getProbabilityRemaining() | ratpp}}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -61,3 +61,7 @@ h1, h2{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.light{
|
||||
border-style: none;
|
||||
}
|
||||
Reference in new issue
Block a user