Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 2d4b0d6

Browse files
Merge branch '30048806_project_budget_edit' into dev
2 parents 62acf37 + 13583e6 commit 2d4b0d6

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

src/web/scripts/editCockpitProject.js

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (C) 2011 - 2013 TopCoder Inc., All Rights Reserved.
2+
* Copyright (C) 2011 - 2015 TopCoder Inc., All Rights Reserved.
33
*
44
* The JS script for edit project page..
55
*
@@ -40,8 +40,11 @@
4040
* - Fix the issue TCCC-5633 to prevent edit project page cover the game plan dropdown
4141
* by reducing the zindex of edit page
4242
*
43+
* Version 2.9 (TC Direct - Update Edit Project Budget Controls)
44+
* - Update the slider control to allow input box to input exact value
45+
*
4346
* @author GreatKevin, Ghost_141, GreatKevin, freegod, TCSASSEMBLER
44-
* @version 2.8
47+
* @version 2.9
4548
*/
4649
Date.format = 'mm/dd/yyyy';
4750

@@ -1076,6 +1079,7 @@ $(document).ready(function (e) {
10761079
var t1 = d1.getTime();
10771080
var t2 = d2.getTime();
10781081
var duration = Math.floor((t2 - t1) / (3600 * 1000 * 24));
1082+
10791083
$('#durationOutput').val(duration);
10801084
if (duration > 400) {
10811085
$('.durationPanel .sliderView input.radio').attr('disabled', 'disabled');
@@ -1138,7 +1142,7 @@ $(document).ready(function (e) {
11381142
}
11391143
return;
11401144
}
1141-
var num = parseInt($(this).val(), 10);
1145+
var num = parseInt(v, 10);
11421146
if (num < 0 || isNaN(num)) {
11431147
num = 0;
11441148
}
@@ -2172,7 +2176,7 @@ function formatNumber(number) {
21722176
if ($.browser.msie && ($.browser.msie.version == '7.0' || $.browser.version == '8.0')) {
21732177
handler.addClass('addMore');
21742178
}
2175-
var onDrag = function (target, left) {
2179+
var onDrag = function (target, left, needsUpdateOutput) {
21762180
var container = target.parent();
21772181
var w = target.data('w');
21782182
var wrapper = container.parent();
@@ -2195,22 +2199,25 @@ function formatNumber(number) {
21952199
}
21962200
left = (value - minValue) / distance * w;
21972201
$('.valueRule', wrapper).width(left);
2198-
var output = s.output;
2199-
if (output) {
2200-
if(!s.step){
2201-
output.val(formatNumber(parseInt(value, 10)));
2202-
}else{
2203-
output.val(formatNumber(parseInt(parseInt(value, 10)/1000)*1000));
2202+
2203+
if(needsUpdateOutput) {
2204+
var output = s.output;
2205+
if (output) {
2206+
if(!s.step){
2207+
output.val(formatNumber(parseInt(value, 10)));
2208+
}else{
2209+
output.val(formatNumber(parseInt(parseInt(value, 10)/s.step)*s.step));
2210+
}
22042211
}
2212+
return left;
22052213
}
2206-
return left;
22072214
};
22082215
handler.draggable({
22092216
axis:'x',
22102217
containment:'parent',
22112218
drag:function (event, ui) {
22122219
var left = ui.position.left;
2213-
onDrag($(this), left);
2220+
onDrag($(this), left, 1);
22142221
}
22152222
});
22162223

@@ -2224,7 +2231,7 @@ function formatNumber(number) {
22242231
var offset = $(this).offset();
22252232
var left = x - offset.left - h.width() / 2;
22262233

2227-
h.css('left', onDrag(h, left) + 'px');
2234+
h.css('left', onDrag(h, left, 1) + 'px');
22282235

22292236
});
22302237

@@ -2310,9 +2317,13 @@ function formatNumber(number) {
23102317

23112318
if (value == 0) {
23122319
$(this).val('');
2320+
} else {
2321+
// update the input value, always use the input
2322+
var actualInputValue = $(this).val().replace(/[,]/g, '').replace(/[ ]/g, '');
2323+
$(this).val(formatNumber(parseInt(actualInputValue, 10)));
23132324
}
2314-
});
23152325

2326+
});
23162327
setValue(s, s.defaultValue);
23172328

23182329
}

0 commit comments

Comments
 (0)