-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.js
More file actions
78 lines (69 loc) · 1.96 KB
/
common.js
File metadata and controls
78 lines (69 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
$(function(){
$("td .row-actions span").hide();
$("table.listing tr").hover(
function(){
$(this).css("background","#fff");
$(this).children("td").children(".row-actions").children("span").show();
},
function(){
$(this).css("background","transparent");
$(this).children("td").children(".row-actions").children("span").hide();
}
);
$("a.confirm_action").click(function(){
return confirm( $(this).attr("title") );
});
$(".date_picker").datepicker({
dateFormat: 'mm/dd/yy',
buttonImage: '/images/icon_calendar.png',
buttonText: 'Select a Date',
buttonImageOnly: true,
showOn: 'both'
});
$(".time_date_picker").datepicker({
dateFormat: 'mm/dd/yy',
buttonImage: '/images/icon_calendar.png',
buttonText: 'Select a Date',
buttonImageOnly: true,
showOn: 'both'
});
function verify_mgr_start() {
var err = '';
if ( $("#time_entry form.start_form select").val() == '' ) {
err += 'Select a project.';
}
if ( err != '' ) {
alert(err);
return false;
}
return true;
}
$("#time_entry form.start_form .requires_project").hide();
$("#time_entry form.start_form #project_id").change(function(){
if ( $(this).val() != '' ) $("#time_entry form.start_form .requires_project").show();
});
$("#time_entry form.start_form").submit(function(){
return verify_mgr_start();
});
$("#time_entry form.start_form .view_time").click(function(){
if ( verify_mgr_start() ) {
$("#time_entry form.start_form input[type='submit']").val("Review Time");
$("#time_entry form.start_form").submit();
}
return false;
});
});
$(function(){
/*
* this swallows backspace keys on any non-input element.
* stops backspace -> back
*/
var rx = /INPUT|SELECT|TEXTAREA/i;
$(document).bind("keydown keypress", function(e){
if( e.which == 8 ){ // 8 == backspace
if(!rx.test(e.target.tagName) || e.target.disabled || e.target.readOnly ){
e.preventDefault();
}
}
});
});