All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit de375e61 authored by Leigh B Stoller's avatar Leigh B Stoller

Suggestions by Jon and some fixes.

parent e37786a4
......@@ -20,6 +20,8 @@ define(['underscore', 'js/quickvm_sup',
function Initialize()
{
howlong = 1;
// Click handler.
$('button#request-extension').click(function (event) {
event.preventDefault();
......@@ -124,7 +126,7 @@ define(['underscore', 'js/quickvm_sup',
/*
* User has changed the slider. Show new instructions.
*/
var minchars = 0; // For the character countdown.
var minchars = 120; // For the character countdown.
var lastvalue = 0; // Last callback value.
var lastlabel = 0; // So we know which div to hide.
var setvalue = 0; // where to jump the slider to after stop.
......@@ -146,7 +148,7 @@ define(['underscore', 'js/quickvm_sup',
extend_value = day + " days";
setvalue = Math.round((day - 1) * divider);
label = 0;
howlong = 1;
howlong = day;
}
else if (which <= 66) {
var divider = 33 / 20.0;
......@@ -192,11 +194,22 @@ define(['underscore', 'js/quickvm_sup',
function UpdateCountdown() {
var len = $('#why_extend').val().length;
var msg = "";
if (len) {
var left = minchars - len;
if (left < 0) {
if (left <= 0) {
left = 0;
EnableSubmitButton();
}
else if (left) {
msg = "You need at least " + left + " more characters";
DisableSubmitButton();
}
}
else {
DisableSubmitButton();
}
var msg = "You need at least " + left + " more characters";
$('#extend_counter_msg').html(msg);
}
......@@ -257,6 +270,23 @@ define(['underscore', 'js/quickvm_sup',
});
}
function EnableSubmitButton()
{
ButtonState('button#request-extension', 1);
}
function DisableSubmitButton()
{
ButtonState('button#request-extension', 0);
}
function ButtonState(button, enable)
{
if (enable) {
$(button).removeAttr("disabled");
}
else {
$(button).attr("disabled", "disabled");
}
}
return function(thisuuid, func, admin, guest, extendfor)
{
isadmin = admin;
......
......@@ -154,7 +154,6 @@ function Do_RequestExtension()
global $instance, $creator, $this_user;
global $ajax_args;
global $TBMAIL_OPS, $APTMAIL, $APTBASE;
$howlong = 3600 * 24;
$reason = "";
if (StatusSetupAjax()) {
......
......@@ -28,7 +28,7 @@
<span id='extend_counter_msg'>&nbsp</span>
</span>
<br>
<button class='btn btn-primary btn-sm align-center'
<button class='btn btn-primary btn-sm align-center' disabled
id='request-extension'
type='submit' name='request'>Request Extension</button>
</form>
......
......@@ -65,7 +65,7 @@
<div id='why_extend_div'>
<textarea id='why_extend'
class='form-control align-center-inline'
rows=3></textarea>
rows=5></textarea>
<span style="font:normal 11px sans-serif;color:#B00400;">
<span id='extend_counter_msg'>&nbsp</span>
</span>
......@@ -73,7 +73,7 @@
</div>
</div>
<br>
<button class='btn btn-primary btn-sm align-center'
<button class='btn btn-primary btn-sm align-center' disabled
id='request-extension'
type='submit' name='request'>Request Extension</button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment