RS needs to submit the form using angular.

This commit is contained in:
Stefan Midjich 2016-12-17 23:50:55 +01:00
parent ce68f61292
commit 81aaf663c6
3 changed files with 30 additions and 9 deletions

View file

@ -1,3 +1,5 @@
[portal]
plugin_ttl=20
index_page=rs
redis_host=db01.swehack.local

View file

@ -14,7 +14,22 @@ app.config(function($routeProvider) {
.otherwise({redirectTo: '/Swedish'});
});
app.controller('RSMainCtrl', function($scope) {
app.controller('RSMainCtrl', function($scope, $http) {
$scope.approved = {};
$scope.submit = function() {
if ($scope.approved.answer == true) {
$http({
method: 'POST',
url: '/approve',
}).then(function success(response) {
poll_jobs(response.data);
}, function error(response) {
// Failure
console.log(response);
});
}
};
});

View file

@ -57,10 +57,14 @@
<ul id="mobile-nav-list">
<li><a title="Hem" href="/">Hem</a></li>
<li><a href="/#/FAQ-Swedish">Vanliga Frågor</a></li>
<li><a href="/#/English">English</a></li>
</ul>
<ul id="main-nav-list">
<li><a href="/">Hem</a></li>
<li><a href="/#/FAQ-Swedish">Vanliga Frågor</a></li>
<li><a href="/#/English">English</a></li>
</ul>
</nav>
</div>
@ -96,10 +100,6 @@
<div class="article-img-container">
</div>
<nav class="header-nav">
<ul class="help-menu">
<li><a title="Vanliga frågor" href="/#/FAQ-Swedish">Vanliga frågor</a></li>
<li><a title="English" href="/#/English">English</a></li>
</ul>
</nav>
<h1 role="heading" class="title">Villkor för tjänsten</h1>
<div class="body">
@ -124,16 +124,16 @@
följa regler ex. förbudskyltar som gäller användning av enheter i
närheten Medicinteknisk utrustning, då denna kan störas.</p>
<form id="approveForm" method="post">
<form ng-submit="submit()" id="approveForm" method="post">
<div class="static-form-block">
<div id="error-box" class="msg-container success-msg hide">
</div>
<div class="input-container">
<label>
<input type="checkbox" id="approveCheckbox" required> Jag godkänner avtalet
<input ng-model="approved.answer" type="checkbox" id="approveCheckbox" required> Jag godkänner avtalet
</label>
<button type="submit" class="button" id="approveButton" value="Godkänn"></button>
<button type="submit" class="button" id="approveButton" value="Godkänn">Godkänn</button>
</div>
</div>
</form>
@ -250,10 +250,14 @@
</article>
</script>
<script>
// This is fetched server side through template value.
var plugin_timeout = {{plugin_timeout}}
</script>
<script src="/static/js/jquery-1.12.2.min.js"></script>
<script src="/static/rs/js/angular.min.js"></script>
<script src="/static/rs/js/rsapp.js"></script>
<script src="/static/js/jquery-1.12.2.min.js"></script>
<script src="/static/js/captiveportal.js"></script>
</body>