author | Lennard de Rijk <ljvderijk@gmail.com> |
Sat, 04 Jul 2009 15:16:54 +0200 | |
changeset 2532 | 0b4dbe4b3fb7 |
parent 2526 | 8f29bfb9eb52 |
child 2550 | 85ee43d4a6f5 |
permissions | -rw-r--r-- |
2423
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
1 |
/* Copyright 2009 the Melange authors. |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
2 |
* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
3 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
4 |
* you may not use this file except in compliance with the License. |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
5 |
* You may obtain a copy of the License at |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
6 |
* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
8 |
* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
9 |
* Unless required by applicable law or agreed to in writing, software |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
10 |
* distributed under the License is distributed on an "AS IS" BASIS, |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
11 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
12 |
* See the License for the specific language governing permissions and |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
13 |
* limitations under the License. |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
14 |
*/ |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
15 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
16 |
/* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
17 |
* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
18 |
* @author <a href="mailto:ajaksu@gmail.com">Daniel Diniz</a> |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
19 |
* @author <a href="mailto:jamesalexanderlevy@gmail.com">James Levy</a> |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
20 |
*/ |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
21 |
|
2526
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
22 |
(function ($) { |
2423
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
23 |
$(function () { |
2526
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
24 |
|
2423
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
25 |
/* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
26 |
* == Setup Survey on Page Load == |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
27 |
* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
28 |
*/ |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
29 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
30 |
var widget = $('div#survey_widget'); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
31 |
widget.parents('td.formfieldvalue:first').css({ |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
32 |
'float': 'left', |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
33 |
'width': 200 |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
34 |
}); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
35 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
36 |
// TODO(ajaksu) survey below is unused, remove if no known use is predicted |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
37 |
var survey = widget.find('tbody:first'); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
38 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
39 |
if (widget.hasClass('create')) { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
40 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
41 |
/* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
42 |
* == Set Custom Field Rules == |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
43 |
* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
44 |
*/ |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
45 |
widget.find('input').each( |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
46 |
function () { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
47 |
$(this).preserveDefaultText($(this).val()); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
48 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
49 |
); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
50 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
51 |
widget.find('textarea').each( |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
52 |
function () { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
53 |
$(this).preserveDefaultText($(this).val()).attr('overflow', 'auto') |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
54 |
.growfield(); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
55 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
56 |
); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
57 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
58 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
59 |
else { // survey has saved results |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
60 |
widget.find('textarea').each( |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
61 |
function () { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
62 |
$(this).attr('overflow', 'auto').growfield(); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
63 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
64 |
).end() |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
65 |
.find('.pick_multi').each( |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
66 |
function () { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
67 |
$(this).find('input').each( |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
68 |
function () { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
69 |
// if $(this).attr('checked', 'true');}); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
70 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
71 |
); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
72 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
73 |
); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
74 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
75 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
76 |
/* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
77 |
* == Configure Project == |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
78 |
* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
79 |
*/ |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
80 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
81 |
// remember if form has been touched |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
82 |
$('input,textarea,select').change( |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
83 |
function () { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
84 |
if ($(this).attr('id') === 'id_project') { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
85 |
return; |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
86 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
87 |
$('form:first').data('touched', true); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
88 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
89 |
); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
90 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
91 |
// remember initially chosen project choice |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
92 |
$('select#id_project').blur( |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
93 |
function () { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
94 |
$(this).data('selected', $(this).find('option:first')); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
95 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
96 |
).change( |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
97 |
function () { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
98 |
if ($('form:first').data('touched') === true) { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
99 |
// if form has been touched, send confirmation dialog |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
100 |
var save_check = confirm(["Switching projects will lose unsaved ", |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
101 |
"edits made to this survey."].join("")); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
102 |
if (!save_check) { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
103 |
$(this).data('selected').attr('selected', 'selected'); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
104 |
return false; |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
105 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
106 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
107 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
108 |
if ($(this).val() !== 'None') { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
109 |
// redirect with new project GET param |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
110 |
window.location = [window.location.href.split('?')[0], "?project=", |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
111 |
$(this).val()].join(""); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
112 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
113 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
114 |
); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
115 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
116 |
// insert project link after project select field |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
117 |
$('div#project_link').insertAfter($('select#id_project')).show(); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
118 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
119 |
/* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
120 |
* == Survey Submission Handler == |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
121 |
* |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
122 |
*/ |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
123 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
124 |
// validate form |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
125 |
$('input[type=submit]').bind( |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
126 |
'click', |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
127 |
function (e) { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
128 |
e.preventDefault(); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
129 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
130 |
// validate project and grade choice fields |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
131 |
if ($('select#id_project') && |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
132 |
$('select#id_project').val() === 'None') { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
133 |
return alert('Please Choose a Project'); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
134 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
135 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
136 |
if ($('select#id_grade') && $('select#id_grade').val() === 'None') { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
137 |
return alert('Please Choose a Grade'); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
138 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
139 |
$('form').trigger('submit'); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
140 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
141 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
142 |
); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
143 |
|
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
144 |
$('form').bind('submit', |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
145 |
function () { |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
146 |
$('input#id_s_html').val( |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
147 |
widget.find('div#survey_options').remove().end().html() |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
148 |
); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
149 |
} |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
150 |
); |
2526
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
151 |
|
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
152 |
/* |
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
153 |
* == Customize Comment Appearance == |
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
154 |
*/ |
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
155 |
|
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
156 |
var comments = widget.find('td > .comment'); |
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
157 |
comments.each(function(){ |
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
158 |
$(this).parents('tr:first') |
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
159 |
.css({'margin-top': '-10px', 'margin-bottom': '10px'}) |
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
160 |
.prev().css({'margin-top': '-10px'}) |
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
161 |
.find('label').css({'font-size': '11px'}); |
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
162 |
}); |
8f29bfb9eb52
Survey editing/taking Javascript and CSS fixes.
James Levy <jamesalexanderlevy@gmail.com>
parents:
2423
diff
changeset
|
163 |
|
2423
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
164 |
}); |
d6b4be046c26
Adding JS files for use in Surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
165 |
}(jQuery)); |