Author: gjm
Date: Tue Nov 12 16:12:44 2013
New Revision: 1541127
URL: http://svn.apache.org/r1541127
Log:
qct changes to forget selections after timeout - towards #618
Modified:
bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js
bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
Modified: bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js?rev=1541127&r1=1541126&r2=1541127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js (original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/js/theme.js Tue Nov 12
16:12:44 2013
@@ -50,6 +50,16 @@ $( function () {
});
*/
+ function checkSelections () {
+ return $.inArray('', $('#qct-box
select[data-optional=false]').map(function() {
+ return $(this).val();
+ })) == -1;
+ }
+ $('#qct-create').attr("disabled", !checkSelections());
+ $('#qct-box select').change(function () {
+ $('#qct-create').attr("disabled", !checkSelections());
+ });
+
$('#qct-inline-newticket').click(function() {
$('#qct-inline-notice-success, #qct-inline-notice-error').hide();
@@ -100,9 +110,24 @@ $( function () {
}
// Clear input controls inside quick create box
+ var timeout;
+ $('#qct-newticket').click(function () {
+ if (timeout) {
+ clearTimeout(timeout);
+ }
+ });
function qct_clearui() {
- $('#qct-form input[name!="__FORM_TOKEN"], #qct-form select, #qct-form
textarea').val('');
- $('#qct-inline-form input[name!="__FORM_TOKEN"], #qct-inline-form
select, #qct-inline-form textarea').val('');
+ $('#qct-form input[name!="__FORM_TOKEN"], #qct-form textarea').val('');
+ $('#qct-inline-form input[name!="__FORM_TOKEN"], #qct-inline-form
textarea').val('');
+ $('#qct-create').attr("disabled", !checkSelections());
+ if (timeout) {
+ clearTimeout(timeout);
+ }
+ timeout = setTimeout(function () {
+ $('#qct-form select').val('');
+ $('#qct-inline-form select').val('');
+ $('#qct-create').attr("disabled", !checkSelections());
+ }, 120000);
}
// We want to submit via #qct-create
Modified:
bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
URL:
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html?rev=1541127&r1=1541126&r2=1541127&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
(original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
Tue Nov 12 16:12:44 2013
@@ -115,11 +115,10 @@
<!--! create ticket button + dropdown -->
<py:def function="field_select(field)">
<select id="field-${field.name}" name="field_${field.name}"
- class="input-block-level" data-empty="true"
data-field="${field.name}">
- <option py:if="field.optional"></option>
+ class="input-block-level" data-empty="true"
data-field="${field.name}" data-optional="${'true' if field.optional else
'false'}">
+ <option selected="selected" value="">${'' if field.optional
else 'Choose...'}</option>
<option py:for="idx,option in enumerate(field.options)"
py:with="description = field.options_desc[idx] if
field.options_desc else option"
- selected="${field.value == option or None}"
value = "$option"
py:content="description"></option>
<optgroup py:for="optgroup in field.optgroups"