Skip to content

Commit

Permalink
Merge pull request #103 from rodrigo-brito/summary-sidebar
Browse files Browse the repository at this point in the history
Summary sidebar
  • Loading branch information
nicholasio committed Feb 29, 2016
2 parents 386aa6f + 31f10a0 commit a64a729
Show file tree
Hide file tree
Showing 10 changed files with 446 additions and 12 deletions.
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ module.exports = function( grunt ) {
'<%= dirs.js %>/libs/bootstrap.min.js': [
'<%= dirs.js %>/bootstrap/button.js',
'<%= dirs.js %>/bootstrap/dropdown.js',
'<%= dirs.js %>/bootstrap/collapse.js'
'<%= dirs.js %>/bootstrap/collapse.js',
'<%= dirs.js %>/bootstrap/tab.js'
]
}
}
Expand Down
155 changes: 155 additions & 0 deletions assets/js/bootstrap/tab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/* ========================================================================
* Bootstrap: tab.js v3.3.5
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */


+function ($) {
'use strict';

// TAB CLASS DEFINITION
// ====================

var Tab = function (element) {
// jscs:disable requireDollarBeforejQueryAssignment
this.element = $(element)
// jscs:enable requireDollarBeforejQueryAssignment
}

Tab.VERSION = '3.3.5'

Tab.TRANSITION_DURATION = 150

Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')

if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}

if ($this.parent('li').hasClass('active')) return

var $previous = $ul.find('.active:last a')
var hideEvent = $.Event('hide.bs.tab', {
relatedTarget: $this[0]
})
var showEvent = $.Event('show.bs.tab', {
relatedTarget: $previous[0]
})

$previous.trigger(hideEvent)
$this.trigger(showEvent)

if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return

var $target = $(selector)

this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function () {
$previous.trigger({
type: 'hidden.bs.tab',
relatedTarget: $this[0]
})
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: $previous[0]
})
})
}

Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)

function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false)

element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)

if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}

if (element.parent('.dropdown-menu').length) {
element
.closest('li.dropdown')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
}

callback && callback()
}

$active.length && transition ?
$active
.one('bsTransitionEnd', next)
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
next()

$active.removeClass('in')
}


// TAB PLUGIN DEFINITION
// =====================

function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tab')

if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}

var old = $.fn.tab

$.fn.tab = Plugin
$.fn.tab.Constructor = Tab


// TAB NO CONFLICT
// ===============

$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}


// TAB DATA-API
// ============

var clickHandler = function (e) {
e.preventDefault()
Plugin.call($(this), 'show')
}

$(document)
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)

}(jQuery);
2 changes: 1 addition & 1 deletion assets/js/libs/bootstrap.min.js

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ jQuery(document).ready(function($) {
* Horizon Theme Core shortcodes
*/

// Tabs.
/*$( '.odin-tabs a' ).click(function(e) {
e.preventDefault();
$(this).tab( 'show' );
});*/
// Tooltip.
//$( '.odin-tooltip' ).tooltip();


});
4 changes: 2 additions & 2 deletions assets/js/main.min.js

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions assets/scss/horizon/_classes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,45 @@ blockquote {
}
}
}

.horizon-summary-sidebar {
.nav-tabs {
margin: 0;
padding: 0;
border: 0;
li {
width: 33.333%;
}
}

.nav-tabs > li > a {
border: 1px solid #eee;
width: 100%;
border-radius: 0;
text-align: center;
padding: 15px 0 !important;
background: #fff;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:focus,
.nav-tabs > li.active > a:hover {
border-top: 3px $secondaryColor solid !important;
background: #eee;
}

.tab-content {
border: 1px #eee solid;
margin-bottom: 10px;
}

.list-featured {
padding: 15px;
p {

}
h5 {
font-weight: bold;
}
}
}
2 changes: 1 addition & 1 deletion assets/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Domain Path: languages/
//@import "bootstrap/thumbnails";
//@import "bootstrap/alerts";
//@import "bootstrap/progress-bars";
//@import "bootstrap/media";
@import "bootstrap/media";
//@import "bootstrap/list-group";
//@import "bootstrap/panels";
@import "bootstrap/responsive-embed";
Expand Down
3 changes: 3 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ function horizon_theme_enqueue_scripts() {

// General scripts.
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
// Bootstrap.
wp_enqueue_script( 'owl-carousel', $template_url . '/assets/js/libs/owl.carousel.js', array( 'jquery' ), null, true );

// Bootstrap.
wp_enqueue_script( 'bootstrap', $template_url . '/assets/js/libs/bootstrap.min.js', array( 'jquery' ), null, true );

Expand Down
Loading

0 comments on commit a64a729

Please sign in to comment.