Added function to support toggling of structure/data for all plugins

This commit is contained in:
lorilee
2010-06-09 20:21:55 -04:00
parent bb18a3b6c0
commit afd66f5ee2

View File

@@ -20,15 +20,12 @@
}); });
/** /**
* Toggles the hiding and showing of the SQL plugin's structure-specific and data-specific * Toggles the enabling and disabling of the SQL plugin's comment options that apply only when exporting structure
* options (TODO: expand to include other plugins).
*/ */
$(document).ready(function() { $(document).ready(function() {
$("input[type='radio'][name$='structure_or_data']").change(function() { $("input[type='radio'][name$='sql_structure_or_data']").change(function() {
var show = $("input[type='radio'][name$='structure_or_data']:checked").attr("value"); var show = $("input[type='radio'][name$='sql_structure_or_data']:checked").attr("value");
if(show == 'data') { if(show == 'data') {
$('#data').slideDown('slow');
$('#structure').slideUp('slow');
// disable the SQL comment options // disable the SQL comment options
$("#checkbox_sql_dates").parent().fadeTo('fast', 0.4); $("#checkbox_sql_dates").parent().fadeTo('fast', 0.4);
$("#checkbox_sql_dates").attr('disabled', 'disabled'); $("#checkbox_sql_dates").attr('disabled', 'disabled');
@@ -44,14 +41,47 @@ $(document).ready(function() {
$("#checkbox_sql_relation").removeAttr('disabled'); $("#checkbox_sql_relation").removeAttr('disabled');
$("#checkbox_sql_mime").parent().fadeTo('fast', 1); $("#checkbox_sql_mime").parent().fadeTo('fast', 1);
$("#checkbox_sql_mime").removeAttr('disabled'); $("#checkbox_sql_mime").removeAttr('disabled');
if(show == 'structure') { }
$('#structure').slideDown('slow'); });
$('#data').slideUp('slow'); });
/**
* Toggles the hiding and showing of plugin structure-specific and data-specific
* options
*/
$(document).ready(function() {
function toggleStructureAndDataOpts(pluginName) {
var radioFormName = pluginName + "_structure_or_data";
var dataDiv = "#" + pluginName + "_data";
var structureDiv = "#" + pluginName + "_structure";
var show = $("input[type='radio'][name='" + radioFormName + "']:checked").attr("value");
if(show == 'data') {
$(dataDiv).slideDown('slow');
$(structureDiv).slideUp('slow');
} else { } else {
$('#structure').slideDown('slow'); $(structureDiv).slideDown('slow');
$('#data').slideDown('slow'); if(show == 'structure') {
$(dataDiv).slideUp('slow');
} else {
$(dataDiv).slideDown('slow');
} }
} }
}
$("input[type='radio'][name='latex_structure_or_data']").change(function() {
toggleStructureAndDataOpts("latex");
});
$("input[type='radio'][name='odt_structure_or_data']").change(function() {
toggleStructureAndDataOpts("odt");
});
$("input[type='radio'][name='texytext_structure_or_data']").change(function() {
toggleStructureAndDataOpts("texytext");
});
$("input[type='radio'][name='htmlword_structure_or_data']").change(function() {
toggleStructureAndDataOpts("htmlword");
});
$("input[type='radio'][name='sql_structure_or_data']").change(function() {
toggleStructureAndDataOpts("sql");
}); });
}); });