github issue #9 - strikethrough remains on tab change
This commit is contained in:
@@ -64,7 +64,7 @@ function do_search (event, tab) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
inner_view_processing();
|
inner_view_processing(tab);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,40 @@
|
|||||||
// this is called by do_search to support local code
|
|
||||||
function inner_view_processing() {}
|
|
||||||
|
|
||||||
// used by the tabbing interface to make sure the correct
|
// used by the tabbing interface to make sure the correct
|
||||||
// ajax content is loaded
|
// ajax content is loaded
|
||||||
var path = 'search';
|
var path = 'search';
|
||||||
|
|
||||||
$(document).ready(function() {
|
// fields in the Device Search Options form (Device tab)
|
||||||
// highlight active search filters in green.
|
var d_inputs = $("#device_form .clearfix input").not('[type="checkbox"]')
|
||||||
// strikethrough the navbar search if using device_form instead.
|
.add("#device_form .clearfix select");
|
||||||
|
|
||||||
var d_inputs = $("#device_form .clearfix input").not('[type="checkbox"]')
|
// if any field in Device Search Options has content, highlight in green
|
||||||
.add("#device_form .clearfix select");
|
// and strikethrough the navbar search
|
||||||
|
function device_form_state(e) {
|
||||||
function device_form_state(e) {
|
if (e.is('[value!=""]')) {
|
||||||
if (e.is('[value!=""]')) {
|
e.parent(".clearfix").addClass('success');
|
||||||
e.parent(".clearfix").addClass('success');
|
$('#nq').css('text-decoration', 'line-through');
|
||||||
$('#nq').css('text-decoration', 'line-through');
|
}
|
||||||
}
|
else {
|
||||||
else {
|
e.parent(".clearfix").removeClass('success');
|
||||||
e.parent(".clearfix").removeClass('success');
|
if (! d_inputs.is('[value!=""]') ) {
|
||||||
if (! d_inputs.is('[value!=""]') ) {
|
$('#nq').css('text-decoration', 'none');
|
||||||
$('#nq').css('text-decoration', 'none');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// this is called by do_search to support local code
|
||||||
|
// here, when tab changes need to strike/unstrike the navbar search
|
||||||
|
function inner_view_processing(tab) {
|
||||||
|
if (tab == 'device') {
|
||||||
|
d_inputs.each(function() {device_form_state($(this))});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#nq').css('text-decoration', 'none');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// on load, check initial Device Search Options form state,
|
||||||
|
// and on each change to the form fields
|
||||||
|
$(document).ready(function() {
|
||||||
d_inputs.each(function() {device_form_state($(this))});
|
d_inputs.each(function() {device_form_state($(this))});
|
||||||
d_inputs.change(function() {device_form_state($(this))});
|
d_inputs.change(function() {device_form_state($(this))});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user