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', ...@@ -20,6 +20,8 @@ define(['underscore', 'js/quickvm_sup',
function Initialize() function Initialize()
{ {
howlong = 1;
// Click handler. // Click handler.
$('button#request-extension').click(function (event) { $('button#request-extension').click(function (event) {
event.preventDefault(); event.preventDefault();
...@@ -124,10 +126,10 @@ define(['underscore', 'js/quickvm_sup', ...@@ -124,10 +126,10 @@ define(['underscore', 'js/quickvm_sup',
/* /*
* User has changed the slider. Show new instructions. * 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 lastvalue = 0; // Last callback value.
var lastlabel = 0; // So we know which div to hide. var lastlabel = 0; // So we know which div to hide.
var setvalue = 0; // where to jump the slider to after stop. var setvalue = 0; // where to jump the slider to after stop.
function SliderChanged(which) { function SliderChanged(which) {
var slider = $(slidername); var slider = $(slidername);
var label = 0; var label = 0;
...@@ -146,7 +148,7 @@ define(['underscore', 'js/quickvm_sup', ...@@ -146,7 +148,7 @@ define(['underscore', 'js/quickvm_sup',
extend_value = day + " days"; extend_value = day + " days";
setvalue = Math.round((day - 1) * divider); setvalue = Math.round((day - 1) * divider);
label = 0; label = 0;
howlong = 1; howlong = day;
} }
else if (which <= 66) { else if (which <= 66) {
var divider = 33 / 20.0; var divider = 33 / 20.0;
...@@ -192,11 +194,22 @@ define(['underscore', 'js/quickvm_sup', ...@@ -192,11 +194,22 @@ define(['underscore', 'js/quickvm_sup',
function UpdateCountdown() { function UpdateCountdown() {
var len = $('#why_extend').val().length; var len = $('#why_extend').val().length;
var left = minchars - len; var msg = "";
if (left < 0) {
left = 0; if (len) {
var left = minchars - len;
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); $('#extend_counter_msg').html(msg);
} }
...@@ -256,7 +269,24 @@ define(['underscore', 'js/quickvm_sup', ...@@ -256,7 +269,24 @@ define(['underscore', 'js/quickvm_sup',
return; return;
}); });
} }
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) return function(thisuuid, func, admin, guest, extendfor)
{ {
isadmin = admin; isadmin = admin;
......
...@@ -154,7 +154,6 @@ function Do_RequestExtension() ...@@ -154,7 +154,6 @@ function Do_RequestExtension()
global $instance, $creator, $this_user; global $instance, $creator, $this_user;
global $ajax_args; global $ajax_args;
global $TBMAIL_OPS, $APTMAIL, $APTBASE; global $TBMAIL_OPS, $APTMAIL, $APTBASE;
$howlong = 3600 * 24;
$reason = ""; $reason = "";
if (StatusSetupAjax()) { if (StatusSetupAjax()) {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<span id='extend_counter_msg'>&nbsp</span> <span id='extend_counter_msg'>&nbsp</span>
</span> </span>
<br> <br>
<button class='btn btn-primary btn-sm align-center' <button class='btn btn-primary btn-sm align-center' disabled
id='request-extension' id='request-extension'
type='submit' name='request'>Request Extension</button> type='submit' name='request'>Request Extension</button>
</form> </form>
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<div id='why_extend_div'> <div id='why_extend_div'>
<textarea id='why_extend' <textarea id='why_extend'
class='form-control align-center-inline' class='form-control align-center-inline'
rows=3></textarea> rows=5></textarea>
<span style="font:normal 11px sans-serif;color:#B00400;"> <span style="font:normal 11px sans-serif;color:#B00400;">
<span id='extend_counter_msg'>&nbsp</span> <span id='extend_counter_msg'>&nbsp</span>
</span> </span>
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</div> </div>
</div> </div>
<br> <br>
<button class='btn btn-primary btn-sm align-center' <button class='btn btn-primary btn-sm align-center' disabled
id='request-extension' id='request-extension'
type='submit' name='request'>Request Extension</button> 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