diff --git a/inc/js/theme-options.js b/inc/js/theme-options.js index b91ceb6..cb57521 100644 --- a/inc/js/theme-options.js +++ b/inc/js/theme-options.js @@ -2,28 +2,27 @@ jQuery.noConflict(); jQuery(document).ready(function(){ - var $main = jQuery('#main_class'); - var $sidebar = jQuery('#sidebar_class'); - var framework = jQuery('.roots_css_frameworks input:checked').val(); - var user_main_class = $main.val(); - var user_sidebar_class = $sidebar.val(); + var $main = jQuery('#main_class'); + var $sidebar = jQuery('#sidebar_class'); + 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) { - var main_class = roots_css_frameworks[this.value].classes.main; - var sidebar_class = roots_css_frameworks[this.value].classes.sidebar; + 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; - // if the selected framework was the one originally set, load the original classes instead of the defaults - if (this.value === framework) { - $main.val(user_main_class); - $sidebar.val(user_sidebar_class); - } else { - $main.val(main_class); - $sidebar.val(sidebar_class); - } + // if the selected framework was the one originally set, load the original classes instead of the defaults + if (this.value === framework) { + $main.val(user_main_class); + $sidebar.val(user_sidebar_class); + } else { + $main.val(main_class); + $sidebar.val(sidebar_class); + } - $main.siblings('small').children().text(main_class); - $sidebar.siblings('small').children().text(sidebar_class); - - }); + $main.siblings('small').children().text(main_class); + $sidebar.siblings('small').children().text(sidebar_class); + }); }); diff --git a/inc/roots-options.php b/inc/roots-options.php index 5b37464..802d500 100644 --- a/inc/roots-options.php +++ b/inc/roots-options.php @@ -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) @@ -45,104 +45,104 @@ add_action('admin_menu', 'roots_theme_options_add_page'); global $roots_css_frameworks; $roots_css_frameworks = array( - 'blueprint' => array( + 'blueprint' => array( 'name' => 'blueprint', 'label' => __('Blueprint CSS', 'roots'), - 'classes' => array( - 'container' => 'span-24', - 'main' => 'span-14 append-1', - 'sidebar' => 'span-8 prepend-1 last' - ) - ), - '960gs_12' => array( + 'classes' => array( + 'container' => 'span-24', + 'main' => 'span-14 append-1', + 'sidebar' => 'span-8 prepend-1 last' + ) + ), + '960gs_12' => array( 'name' => '960gs_12', 'label' => __('960gs (12 cols)', 'roots'), - 'classes' => array( - 'container' => 'container_12', - 'main' => 'grid_7 suffix_1', - 'sidebar' => 'grid_4' - ) - ), - '960gs_16' => array( + 'classes' => array( + 'container' => 'container_12', + 'main' => 'grid_7 suffix_1', + 'sidebar' => 'grid_4' + ) + ), + '960gs_16' => array( 'name' => '960gs_16', 'label' => __('960gs (16 cols)', 'roots'), - 'classes' => array( - 'container' => 'container_16', - 'main' => 'grid_9 suffix_1', - 'sidebar' => 'grid_6' - ) - ), - '960gs_24' => array( + 'classes' => array( + 'container' => 'container_16', + 'main' => 'grid_9 suffix_1', + 'sidebar' => 'grid_6' + ) + ), + '960gs_24' => array( 'name' => '960gs_24', 'label' => __('960gs (24 cols)', 'roots'), - 'classes' => array( - 'container' => 'container_24', - 'main' => 'grid_15 suffix_1', - 'sidebar' => 'grid_8' - ) - ), - '1140' => array( + 'classes' => array( + 'container' => 'container_24', + 'main' => 'grid_15 suffix_1', + 'sidebar' => 'grid_8' + ) + ), + '1140' => array( 'name' => '1140', 'label' => __('1140', 'roots'), - 'classes' => array( - 'container' => 'container', - 'main' => 'sevencol', - 'sidebar' => 'fourcol last' - ) - ), - 'adapt' => array( + 'classes' => array( + 'container' => 'container', + 'main' => 'sevencol', + 'sidebar' => 'fourcol last' + ) + ), + 'adapt' => array( 'name' => 'adapt', 'label' => __('Adapt.js', 'roots'), - 'classes' => array( - 'container' => 'container_12 clearfix', - 'main' => 'grid_7 suffix_1', - 'sidebar' => 'grid_4' - ) - ), - 'less' => array( + 'classes' => array( + 'container' => 'container_12 clearfix', + 'main' => 'grid_7 suffix_1', + 'sidebar' => 'grid_4' + ) + ), + 'less' => array( 'name' => 'less', 'label' => __('Less Framework 4', 'roots'), - 'classes' => array( - 'container' => 'container', - 'main' => '', - 'sidebar' => '' - ) - ), - 'none' => array( + 'classes' => array( + 'container' => 'container', + 'main' => '', + 'sidebar' => '' + ) + ), + 'none' => array( 'name' => 'none', 'label' => __('None', 'roots'), - 'classes' => array( - 'container' => '', - 'main' => '', - 'sidebar' => '' - ) - ) + 'classes' => array( + 'container' => '', + 'main' => '', + 'sidebar' => '' + ) + ) ); // Write the above array of CSS frameworks into a script tag function roots_add_frameworks_object_script() { - global $roots_css_frameworks; - $json = json_encode($roots_css_frameworks); + global $roots_css_frameworks; + $json = json_encode($roots_css_frameworks); ?> - - + var roots_css_frameworks = ; + + $default_framework, - 'container_class' => $default_framework_settings['classes']['container'], - 'main_class' => $default_framework_settings['classes']['main'], - 'sidebar_class' => $default_framework_settings['classes']['sidebar'], + 'css_framework' => $default_framework, + 'container_class' => $default_framework_settings['classes']['container'], + 'main_class' => $default_framework_settings['classes']['main'], + 'sidebar_class' => $default_framework_settings['classes']['sidebar'], 'google_analytics_id' => '', - 'clean_menu' => true, - 'fout_b_gone' => false + 'clean_menu' => true, + 'fout_b_gone' => false ); return apply_filters('roots_default_theme_options', $default_theme_options); @@ -152,8 +152,8 @@ function roots_get_theme_options() { return get_option('roots_theme_options', roots_get_default_theme_options()); } -function theme_options_render_page() { - global $roots_css_frameworks; +function roots_theme_options_render_page() { + global $roots_css_frameworks; ?>
@@ -172,20 +172,11 @@ function theme_options_render_page() {
- -
- -
- +
@@ -195,7 +186,7 @@ function theme_options_render_page() {

- +
@@ -205,7 +196,7 @@ function theme_options_render_page() {

- +
@@ -223,18 +214,10 @@ function theme_options_render_page() {
-
- -
-
- -
+
@@ -242,18 +225,10 @@ function theme_options_render_page() {
-
- -
-
- -
+
@@ -268,14 +243,14 @@ function theme_options_render_page() { } function roots_theme_options_validate($input) { - global $roots_css_frameworks; + global $roots_css_frameworks; $output = $defaults = roots_get_default_theme_options(); if (isset($input['css_framework']) && array_key_exists($input['css_framework'], $roots_css_frameworks)) $output['css_framework'] = $input['css_framework']; // set the value of the main container class depending on the selected grid framework - $output['container_class'] = $roots_css_frameworks[$output['css_framework']]['classes']['container']; + $output['container_class'] = $roots_css_frameworks[$output['css_framework']]['classes']['container']; if (isset($input['main_class'])) $output['main_class'] = $input['main_class'];