Browse Source

account.settings

master
yuriy0803 2 years ago
parent
commit
b74a105bee
  1. 1
      www/app/router.js
  2. 3
      www/app/templates/account.hbs
  3. 59
      www/app/templates/account/settings.hbs

1
www/app/router.js

@ -9,6 +9,7 @@ Router.map(function() {
this.route('account', { path: '/account/:login' }, function() {
this.route('payouts');
this.route('rewards');
this.route('settings');
});
this.route('not-found');

3
www/app/templates/account.hbs

@ -72,6 +72,9 @@
{{#active-li currentWhen='account.payouts' role='presentation'}}
{{#link-to 'account.payouts'}}Payouts{{/link-to}}
{{/active-li}}
{{#active-li currentWhen='account.settings' role='presentation'}}
{{#link-to 'account.settings'}}Settings{{/link-to}}
{{/active-li}}
</ul>
</div>

59
www/app/templates/account/settings.hbs

@ -0,0 +1,59 @@
<div class="container">
<div id="settings" style="margin-top:50px;" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
<div class="row">
<div id="alertSuccess" class="alert alert-success" role="alert">
Success
</div>
<div id="alertError" class="alert alert-danger" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
Error
</div>
</div>
<form action="/api/settings" method="post">
<div class="form-group">
<label for="threshold">Payment Threshold</label>
<input class="form-control" id="threshold" name="threshold" placeholder="min 0.5 - max 10000" min="0.5" max="10000"
type='number' step='1'>
<small id="thresholdHelp" class="form-text text-dark">Payment threshold in {{config.Unit}} (Min: 0.5, Max: 10000)</small>
</div>
<div class="form-group">
<label for="ip_address">Active Worker IP address</label>
<input class="form-control" name="ip_address" id="ip_address" placeholder="192.168.0.1" type="text">
<small id="ip_address" class="form-text text-dark">
Please complete your worker`s IP address in order to validate and save your settings.
</small>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
<script>
$(document).ready(function () {
var $form = $('form');
$form.submit(function () {
$.post($(this).attr('action'), $(this).serialize(), function (response) {
console.log(response.result);
if (response.result == "success") {
$('#alertSuccess').html(response.result);
$("#alertSuccess").fadeIn(); //or fadeIn
setTimeout(function() {
$("#alertSuccess").fadeOut(); //or fadeOut
}, 5000);
} else {
$('#alertError').html(response.result);
$("#alertError").fadeIn(); //or fadeIn
setTimeout(function() {
$("#alertError").fadeOut(); //or fadeOut
}, 5000);
}
}, 'json');
return false;
});
});
</script>
Loading…
Cancel
Save