changing the radio inputs into select lists, code formatting cleanup

This commit is contained in:
Ben Word
2011-07-22 08:17:42 -06:00
parent dd77a89b34
commit 103c4c5bd5
2 changed files with 110 additions and 136 deletions

View File

@@ -4,11 +4,11 @@ jQuery(document).ready(function(){
var $main = jQuery('#main_class');
var $sidebar = jQuery('#sidebar_class');
var framework = jQuery('.roots_css_frameworks input:checked').val();
var framework = jQuery('.roots_css_frameworks select option:selected').val();
var user_main_class = $main.val();
var user_sidebar_class = $sidebar.val();
jQuery('.roots_css_frameworks input').change(function (e) {
jQuery('.roots_css_frameworks select').change(function (e) {
var main_class = roots_css_frameworks[this.value].classes.main;
var sidebar_class = roots_css_frameworks[this.value].classes.sidebar;
@@ -23,7 +23,6 @@ jQuery(document).ready(function(){
$main.siblings('small').children().text(main_class);
$sidebar.siblings('small').children().text(sidebar_class);
});
});

View File

@@ -35,7 +35,7 @@ function roots_theme_options_add_page() {
__('Theme Options', 'roots'),
'edit_theme_options',
'theme_options',
'theme_options_render_page'
'roots_theme_options_render_page'
);
if (!$theme_page)
@@ -152,7 +152,7 @@ function roots_get_theme_options() {
return get_option('roots_theme_options', roots_get_default_theme_options());
}
function theme_options_render_page() {
function roots_theme_options_render_page() {
global $roots_css_frameworks;
?>
<div class="wrap">
@@ -172,20 +172,11 @@ function theme_options_render_page() {
<tr valign="top" class="radio-option"><th scope="row"><?php _e('CSS Grid Framework', 'roots'); ?></th>
<td>
<fieldset class="roots_css_frameworks"><legend class="screen-reader-text"><span><?php _e('CSS Grid Framework', 'roots'); ?></span></legend>
<?php
foreach ($roots_css_frameworks as $css_framework) {
?>
<div class="layout">
<label class="description">
<input type="radio" name="roots_theme_options[css_framework]" value="<?php echo esc_attr($css_framework['name']); ?>" <?php checked($roots_options['css_framework'], $css_framework['name']); ?> />
<span>
<?php echo $css_framework['label']; ?>
</span>
</label>
</div>
<?php
}
?>
<select name="roots_theme_options[css_framework]" id="roots_theme_options[css_framework]">
<?php foreach ($roots_css_frameworks as $css_framework) { ?>
<option value="<?php echo esc_attr($css_framework['name']); ?>" <?php selected($roots_options['css_framework'], $css_framework['name']); ?>><?php echo $css_framework['label']; ?></option>
<?php } ?>
</select>
</fieldset>
</td>
</tr>
@@ -223,18 +214,10 @@ function theme_options_render_page() {
<tr valign="top"><th scope="row"><?php _e('Cleanup Menu Output', 'roots'); ?></th>
<td>
<fieldset><legend class="screen-reader-text"><span><?php _e('Cleanup Menu Output', 'roots'); ?></span></legend>
<div>
<label class="description">
<input type="radio" name="roots_theme_options[clean_menu]" value="yes" <?php checked($roots_options['clean_menu'], true); ?> />
<span><?php echo _e('Yes', 'roots'); ?></span>
</label>
</div>
<div>
<label class="description">
<input type="radio" name="roots_theme_options[clean_menu]" value="no" <?php checked($roots_options['clean_menu'], false); ?> />
<span><?php echo _e('No', 'roots'); ?></span>
</label>
</div>
<select name="roots_theme_options[clean_menu]" id="roots_theme_options[clean_menu]">
<option value="yes" <?php selected($roots_options['clean_menu'], true); ?>><?php echo _e('Yes', 'roots'); ?></option>
<option value="no" <?php selected($roots_options['clean_menu'], false); ?>><?php echo _e('No', 'roots'); ?></option>
</select>
</fieldset>
</td>
</tr>
@@ -242,18 +225,10 @@ function theme_options_render_page() {
<tr valign="top"><th scope="row"><?php _e('Enable FOUT-B-Gone', 'roots'); ?></th>
<td>
<fieldset><legend class="screen-reader-text"><span><?php _e('Enable FOUT-B-Gone', 'roots'); ?></span></legend>
<div>
<label class="description">
<input type="radio" name="roots_theme_options[fout_b_gone]" value="yes" <?php checked($roots_options['fout_b_gone'], true); ?> />
<span><?php echo _e('Yes', 'roots'); ?></span>
</label>
</div>
<div>
<label class="description">
<input type="radio" name="roots_theme_options[fout_b_gone]" value="no" <?php checked($roots_options['fout_b_gone'], false); ?> />
<span><?php echo _e('No', 'roots'); ?></span>
</label>
</div>
<select name="roots_theme_options[fout_b_gone]" id="roots_theme_options[fout_b_gone]">
<option value="yes" <?php selected($roots_options['fout_b_gone'], true); ?>><?php echo _e('Yes', 'roots'); ?></option>
<option value="no" <?php selected($roots_options['fout_b_gone'], false); ?>><?php echo _e('No', 'roots'); ?></option>
</select>
</fieldset>
</td>
</tr>