Skip to content

Commit

Permalink
Change filenames to match WordPress coding standards. Add options to …
Browse files Browse the repository at this point in the history
…enable, disable, and arrange the front page sections.
  • Loading branch information
Brian Welch committed Feb 28, 2015
1 parent c8275c6 commit adfe325
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 185 deletions.
52 changes: 26 additions & 26 deletions assets/js/app.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
// This checks to see if the window has scrolled below the first section.
// If it has, it will change the menu class and affix it to the top.

jQuery( document ).ready(function( $ ) {
$(window).scroll(function() {
if ($(document).scrollTop() >= $('#section_1').height() - $('nav').height() ){
$('nav').removeClass('bottom-nav', 500, 'linear' );
$('nav').addClass('small-nav', 500, 'linear' );
$('.navbar-nav').addClass('navbar-right', 100, 'linear' );
$('.navbar-brand').addClass('show-brand', 100, 'linear' );
$('.navbar-brand').removeClass('hide-brand' );
$('.navbar-brand').animate({ opacity: 1, easing: 'linear', }, 100);
} else {
$('nav').addClass('bottom-nav' );
$('nav').removeClass('small-nav' );
$('.navbar-nav').removeClass('navbar-right' );
$('.navbar-brand').addClass('hide-brand' );
$('.navbar-brand').removeClass('show-brand' );
$('.navbar-brand').animate({ opacity: 0, easing: 'linear', }, 50);
}
});
});
// jQuery( document ).ready(function( $ ) {
// $(window).scroll(function() {
// if ($(document).scrollTop() >= $('#section_1').height() - $('nav').height() ){
// $('nav').removeClass('bottom-nav', 500, 'linear' );
// $('nav').addClass('small-nav', 500, 'linear' );
// $('.navbar-nav').addClass('navbar-right', 100, 'linear' );
// $('.navbar-brand').addClass('show-brand', 100, 'linear' );
// $('.navbar-brand').removeClass('hide-brand' );
// $('.navbar-brand').animate({ opacity: 1, easing: 'linear', }, 100);
// } else {
// $('nav').addClass('bottom-nav' );
// $('nav').removeClass('small-nav' );
// $('.navbar-nav').removeClass('navbar-right' );
// $('.navbar-brand').addClass('hide-brand' );
// $('.navbar-brand').removeClass('show-brand' );
// $('.navbar-brand').animate({ opacity: 0, easing: 'linear', }, 50);
// }
// });
// });

// This helps the above function work a lot smoother/better.
jQuery( document ).ready(function( $ ) {
$('nav').affix({
offset: {
top: $('#section_1').height() - $('nav').height()
}
});
});
// jQuery( document ).ready(function( $ ) {
// $('nav').affix({
// offset: {
// top: $('#section_1').height() - $('nav').height()
// }
// });
// });


// ***** DEBUG ***** //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,24 @@ function maera_res_customizer_sections( $wp_customize ){
$panels = array(
'maera_res_layout' => array( 'title' => __( 'Layout', 'maera-restaurant' ), 'description' => __( 'Set an array of layout options.', 'maera-restaurant' ), 'priority' => 25 ),
'maera_res_styling' => array( 'title' => __( 'Styling', 'maera-restaurant' ), 'description' => __( 'Set an array of styling options.', 'maera-restaurant' ), 'priority' => 30 ),

'maera_res_backgrounds' => array( 'title' => __( 'Backgrounds', 'maera-restaurant' ), 'description' => __( 'Set an array of background options.', 'maera-restaurant' ), 'priority' => 30 ),
);

$sections = array(
'maera_res_general' => array( 'title' => __( 'General', 'maera-restaurant' ), 'priority' => 35, 'panel' => null ),

// Frontpage Sections
'maera_res_section_1' => array( 'title' => __( 'First Section', 'maera-restaurant' ), 'priority' => 40, 'panel' => 'maera_res_layout' ),
'maera_res_section_2' => array( 'title' => __( 'Second Section', 'maera-restaurant' ), 'priority' => 45, 'panel' => 'maera_res_layout' ),
'maera_res_section_3' => array( 'title' => __( 'Third Section', 'maera-restaurant' ), 'priority' => 50, 'panel' => 'maera_res_layout' ),
'maera_res_section_4' => array( 'title' => __( 'Fourth Section', 'maera-restaurant' ), 'priority' => 60, 'panel' => 'maera_res_layout' ),
'maera_res_section_5' => array( 'title' => __( 'Fifth Section', 'maera-restaurant' ), 'priority' => 65, 'panel' => 'maera_res_layout' ),
'maera_res_footer' => array( 'title' => __( 'Footer', 'maera-restaurant' ), 'priority' => 70, 'panel' => 'maera_res_layout' ),
'maera_res_section_1' => array( 'title' => __( 'First Section', 'maera-restaurant' ), 'priority' => 40, 'panel' => 'maera_res_backgrounds' ),
'maera_res_section_2' => array( 'title' => __( 'Second Section', 'maera-restaurant' ), 'priority' => 45, 'panel' => 'maera_res_backgrounds' ),
'maera_res_section_3' => array( 'title' => __( 'Third Section', 'maera-restaurant' ), 'priority' => 50, 'panel' => 'maera_res_backgrounds' ),
'maera_res_section_4' => array( 'title' => __( 'Fourth Section', 'maera-restaurant' ), 'priority' => 60, 'panel' => 'maera_res_backgrounds' ),
'maera_res_section_5' => array( 'title' => __( 'Fifth Section', 'maera-restaurant' ), 'priority' => 65, 'panel' => 'maera_res_backgrounds' ),
'maera_res_footer' => array( 'title' => __( 'Footer', 'maera-restaurant' ), 'priority' => 70, 'panel' => 'maera_res_backgrounds' ),

// Styling
'maera_res_colors' => array( 'title' => __( 'Colors', 'maera-restaurant' ), 'priority' => 75, 'panel' => 'maera_res_styling' ),
'maera_res_backgrounds' => array( 'title' => __( 'Backgrounds', 'maera-restaurant' ), 'priority' => 80, 'panel' => 'maera_res_styling' ),
'maera_res_typography' => array( 'title' => __( 'Typography', 'maera-restaurant' ), 'priority' => 85, 'panel' => 'maera_res_styling' ),
// 'maera_res_navigation' => array( 'title' => __( 'Navigation', 'maera-restaurant' ), 'priority' => 90, 'panel' => 'maera_res_styling' ),
'maera_res_colors' => array( 'title' => __( 'Colors', 'maera-restaurant' ), 'priority' => 75, 'panel' => 'maera_res_styling' ),
'maera_res_all_backgrounds' => array( 'title' => __( 'Backgrounds', 'maera-restaurant' ), 'priority' => 80, 'panel' => 'maera_res_backgrounds' ),
'maera_res_typography' => array( 'title' => __( 'Typography', 'maera-restaurant' ), 'priority' => 85, 'panel' => 'maera_res_styling' ),

);

Expand Down Expand Up @@ -113,6 +112,23 @@ function maera_res_customizer_sections( $wp_customize ){
*/
function maera_res_general_settings( $controls ) {

$controls[] = array(
'type' => 'sortable',
'setting' => 'front_page_sections',
'label' => __( 'Front Page Sections', 'maera_mg' ),
'section' => 'maera_res_general',
'default' => serialize( array( 'navbar', 'section_1', 'section_2', 'section_3' ) ),
'priority' => 50,
'choices' => array(
'navbar' => __( 'Navigation Menu', 'maera-restaurant' ),
'section_1' => __( 'Section 1', 'maera-restaurant' ),
'section_2' => __( 'Section 2', 'maera-restaurant' ),
'section_3' => __( 'Section 3', 'maera-restaurant' ),
'section_4' => __( 'Section 4', 'maera-restaurant' ),
'section_5' => __( 'Section 5', 'maera-restaurant' ),
),
);

$controls[] = array(
'type' => 'radio',
'mode' => 'buttonset',
Expand Down Expand Up @@ -141,6 +157,16 @@ function maera_res_general_settings( $controls ) {
),
);

$controls[] = array(
'type' => 'select',
'setting' => 'currency',
'label' => __( 'Select a currency to use for the restaurant.', 'maera_bs' ),
'section' => 'maera_res_restaurant',
'default' => 'United States dollar',
'priority' => 10,
'choices' => null, // Maera_Restaurant_Data::get_currencies(), // Needs fixed.
);

return $controls;

}
Expand All @@ -155,17 +181,13 @@ function maera_res_general_settings( $controls ) {
function maera_res_section_1( $controls ) {

$controls[] = array(
'type' => 'radio',
'mode' => 'buttonset',
'setting' => 'show_first_section',
'label' => __( 'Show First Section', 'maera-restaurant' ),
'type' => 'checkbox',
'setting' => 'section_1_parallax',
'label' => __( 'Enable Parallax', 'maera-restaurant' ),
'section' => 'maera_res_section_1',
'default' => 1,
'default' => 0,
'priority' => 1,
'choices' => array(
1 => __( 'On', 'maera-restaurant' ),
0 => __( 'Off', 'maera-restaurant' ),
),
'mode' => 'toggle',
);

$controls[] = array(
Expand Down Expand Up @@ -201,17 +223,13 @@ function maera_res_section_1( $controls ) {
function maera_res_section_2( $controls ) {

$controls[] = array(
'type' => 'radio',
'mode' => 'buttonset',
'setting' => 'show_second_section',
'label' => __( 'Show Second Section', 'maera-restaurant' ),
'type' => 'checkbox',
'setting' => 'section_2_parallax',
'label' => __( 'Enable Parallax', 'maera-restaurant' ),
'section' => 'maera_res_section_2',
'default' => 1,
'default' => 0,
'priority' => 1,
'choices' => array(
1 => __( 'On', 'maera-restaurant' ),
0 => __( 'Off', 'maera-restaurant' ),
),
'mode' => 'toggle',
);

$controls[] = array(
Expand Down Expand Up @@ -247,17 +265,13 @@ function maera_res_section_2( $controls ) {
function maera_res_section_3( $controls ) {

$controls[] = array(
'type' => 'radio',
'mode' => 'buttonset',
'setting' => 'show_third_section',
'label' => __( 'Show Third Section', 'maera-restaurant' ),
'type' => 'checkbox',
'setting' => 'section_3_parallax',
'label' => __( 'Enable Parallax', 'maera-restaurant' ),
'section' => 'maera_res_section_3',
'default' => 1,
'default' => 0,
'priority' => 1,
'choices' => array(
1 => __( 'On', 'maera-restaurant' ),
0 => __( 'Off', 'maera-restaurant' ),
),
'mode' => 'toggle',
);

$controls[] = array(
Expand All @@ -279,16 +293,6 @@ function maera_res_section_3( $controls ) {
'output' => '#section_3',
);

// $controls[] = array(
// 'type' => 'select',
// 'setting' => 'currency',
// 'label' => __( 'Select a currency to use for the restaurant.', 'maera_bs' ),
// 'section' => 'maera_res_restaurant',
// 'default' => 'United States dollar',
// 'priority' => 10,
// 'choices' => null, // Maera_Restaurant_Data::get_currencies(), // Needs fixed.
// );

return $controls;

}
Expand All @@ -303,17 +307,13 @@ function maera_res_section_3( $controls ) {
function maera_res_section_4( $controls ) {

$controls[] = array(
'type' => 'radio',
'mode' => 'buttonset',
'setting' => 'show_fourth_section',
'label' => __( 'Show Fourth Section', 'maera-restaurant' ),
'type' => 'checkbox',
'setting' => 'section_4_parallax',
'label' => __( 'Enable Parallax', 'maera-restaurant' ),
'section' => 'maera_res_section_4',
'default' => 1,
'default' => 0,
'priority' => 1,
'choices' => array(
1 => __( 'On', 'maera-restaurant' ),
0 => __( 'Off', 'maera-restaurant' ),
),
'mode' => 'toggle',
);

$controls[] = array(
Expand Down Expand Up @@ -349,17 +349,13 @@ function maera_res_section_4( $controls ) {
function maera_res_section_5( $controls ) {

$controls[] = array(
'type' => 'radio',
'mode' => 'buttonset',
'setting' => 'show_fifth_section',
'label' => __( 'Show Fifth Section', 'maera-restaurant' ),
'type' => 'checkbox',
'setting' => 'section_5_parallax',
'label' => __( 'Enable Parallax', 'maera-restaurant' ),
'section' => 'maera_res_section_5',
'default' => 1,
'default' => 0,
'priority' => 1,
'choices' => array(
1 => __( 'On', 'maera-restaurant' ),
0 => __( 'Off', 'maera-restaurant' ),
),
'mode' => 'toggle',
);

$controls[] = array(
Expand Down Expand Up @@ -471,7 +467,7 @@ function maera_res_background_settings( $controls ) {
'setting' => 'html_background',
'label' => __( 'HTML Background', 'maera-restaurant' ),
'description' => __( 'Set the background options for the HTML container.', 'maera-restaurant' ),
'section' => 'maera_res_backgrounds',
'section' => 'maera_res_all_backgrounds',
'default' => array(
'color' => '#ffffff',
'image' => null,
Expand All @@ -490,7 +486,7 @@ function maera_res_background_settings( $controls ) {
'setting' => 'body_background',
'label' => __( 'Body Background', 'maera-restaurant' ),
'description' => __( 'Set the background options for the body section.', 'maera-restaurant' ),
'section' => 'maera_res_backgrounds',
'section' => 'maera_res_all_backgrounds',
'default' => array(
'color' => '#ffffff',
'image' => null,
Expand All @@ -509,7 +505,7 @@ function maera_res_background_settings( $controls ) {
'setting' => 'content_background',
'label' => __( 'Main Content Background', 'maera-restaurant' ),
'description' => __( 'Set the background options for the main content sections.', 'maera-restaurant' ),
'section' => 'maera_res_backgrounds',
'section' => 'maera_res_all_backgrounds',
'default' => array(
'color' => '#fff',
'image' => null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function maera_res_context( $context ) {

$context['slides'] = Timber::get_posts( $slide_args );
$context['restaurant_items'] = Timber::get_posts( $restaurant_args );
$context['menu_sections'] = Timber::get_terms('restaurant_item_menu_section');
$context['menu_sections'] = Timber::get_terms( 'restaurant_item_menu_section' );
$context['sidebar']['section_1'] = Timber::get_widgets( 'section_1' );
$context['sidebar']['section_2'] = Timber::get_widgets( 'section_2' );
$context['sidebar']['section_3'] = Timber::get_widgets( 'section_3' );
Expand Down Expand Up @@ -121,7 +121,7 @@ public function get_categories() {
$categories = get_categories( $args );

foreach ( $categories as $category ) {
$cats[$category->term_id] = $category->name;
$cats[ $category->term_id ] = $category->name;
}

return $cats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ function scripts() {
wp_register_script( 'maera-res', trailingslashit( MAERA_RES_SHELL_URL ) . 'assets/js/app.js', array('jquery'), time(), false );
wp_enqueue_script( 'maera-res' );




}

/**
Expand All @@ -103,7 +100,6 @@ function admin_scripts() {

}


// End Methods
} // End Class
} // End If
19 changes: 9 additions & 10 deletions maera-restaurant.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public function __construct() {
}

// Require or include any additional files that may be needed.
require_once( __DIR__ . '/includes/class-Maera_Restaurant_Customizer.php');
require_once( __DIR__ . '/includes/class-Maera_Restaurant_Scripts.php');
require_once( __DIR__ . '/includes/class-Maera_Restaurant_Structure.php');
require_once( __DIR__ . '/includes/class-Maera_Restaurant_Data.php');
require_once( __DIR__ . '/includes/class-Maera_Restaurant_PostTypes.php');
require_once( __DIR__ . '/includes/class-Maera_Restaurant_Widget_Areas.php');
require_once( __DIR__ . '/includes/class-Maera_Restaurant_Taxonomies.php');
require_once( __DIR__ . '/includes/class-maera-restaurant-customizer.php');
require_once( __DIR__ . '/includes/class-maera-restaurant-scripts.php');
require_once( __DIR__ . '/includes/class-maera-restaurant-structure.php');
require_once( __DIR__ . '/includes/class-maera-restaurant-data.php');
require_once( __DIR__ . '/includes/class-maera-restaurant-posttypes.php');
require_once( __DIR__ . '/includes/class-maera-restaurant-widget-areas.php');
require_once( __DIR__ . '/includes/class-maera-restaurant-taxonomies.php');

// Instantiate additional classes.
$this->customizer = new Maera_Restaurant_Customizer();
Expand Down Expand Up @@ -157,7 +157,6 @@ function required_plugins( $plugins = array() ) {
);
}


$plugins = new Maera_Required_Plugins( $plugins );
}

Expand Down Expand Up @@ -199,8 +198,8 @@ function maera_restaurant_licensing() {
/**
* Load and register widgets.
*/
include_once( __DIR__ . '/includes/class-Maera_Restaurant_Slider_Widget.php');
include_once( __DIR__ . '/includes/class-Maera_Restaurant_Menu_Widget.php');
include_once( __DIR__ . '/includes/class-maera-restaurant-slider-widget.php');
include_once( __DIR__ . '/includes/class-maera-restaurant-menu-widget.php');


/**
Expand Down
Loading

0 comments on commit adfe325

Please sign in to comment.