Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrammatiko committed Apr 20, 2017
1 parent 1ca327a commit 033e4a9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 46 deletions.
21 changes: 0 additions & 21 deletions layouts/libraries/cms/html/bootstrap/starttabsetscript.php

This file was deleted.

26 changes: 13 additions & 13 deletions libraries/cms/html/bootstrap.php
Expand Up @@ -40,7 +40,7 @@ public static function alert($selector = 'alert')
}

// Include Bootstrap framework
static::framework();
JHtml::_('bootstrap.framework');

JFactory::getDocument()->addScriptOptions('bootstrap.alert', array($selector => ''));

Expand All @@ -65,7 +65,7 @@ public static function button($selector = 'button')
}

// Include Bootstrap framework
static::framework();
JHtml::_('bootstrap.framework');

JFactory::getDocument()->addScriptOptions('bootstrap.button', array($selector));

Expand Down Expand Up @@ -96,7 +96,7 @@ public static function carousel($selector = 'carousel', $params = array())
}

// Include Bootstrap framework
static::framework();
JHtml::_('bootstrap.framework');

// Setup options object
$opt['interval'] = isset($params['interval']) ? (int) $params['interval'] : 5000;
Expand Down Expand Up @@ -125,7 +125,7 @@ public static function dropdown($selector = 'dropdown-toggle')
}

// Include Bootstrap framework
static::framework();
JHtml::_('bootstrap.framework');

JFactory::getDocument()->addScriptOptions('bootstrap.dropdown', array($selector));

Expand Down Expand Up @@ -194,7 +194,7 @@ public static function renderModal($selector = 'modal', $params = array(), $body
}

// Include Bootstrap framework
static::framework();
JHtml::_('bootstrap.framework');

$layoutData = array(
'selector' => $selector,
Expand Down Expand Up @@ -244,7 +244,7 @@ public static function popover($selector = '.hasPopover', $params = array())
}

// Include Bootstrap framework
static::framework();
JHtml::_('bootstrap.framework');

$opt['animation'] = isset($params['animation']) ? $params['animation'] : null;
$opt['container'] = isset($params['container']) ? $params['container'] : 'body';
Expand All @@ -259,9 +259,8 @@ public static function popover($selector = '.hasPopover', $params = array())
$opt['constraints'] = isset($params['constraints']) ? $params['constraints'] : ['to' => 'scrollParent', 'attachment' => 'together', 'pin' => true];
$opt['offset'] = isset($params['offset']) ? $params['offset'] : '0 0';

$opt = (object) array_filter((array) $opt);


$opt = (object) array_filter((array) $opt);

JFactory::getDocument()->addScriptOptions('bootstrap.popover', array($selector => $opt));

Expand Down Expand Up @@ -289,7 +288,7 @@ public static function scrollspy($selector = 'navbar', $params = array())
}

// Include Bootstrap framework
static::framework();
JHtml::_('bootstrap.framework');

JFactory::getDocument()->addScriptOptions('bootstrap.scrollspy', array($selector => $params));

Expand Down Expand Up @@ -334,7 +333,7 @@ public static function tooltip($selector = '.hasTooltip', $params = array())
}

// Include Bootstrap framework
static::framework();
JHtml::_('bootstrap.framework');

// Setup options object
$opt['animation'] = isset($params['animation']) ? $params['animation'] : null;
Expand All @@ -354,13 +353,14 @@ public static function tooltip($selector = '.hasTooltip', $params = array())
$onHidden = isset($params['onHidden']) ? (string) $params['onHidden'] : null;


$opt = (object) array_filter((array) $opt);

JFactory::getDocument()->addScriptOptions('bootstrap.tooltip', array($selector => $opt));

// Set static array
static::$loaded[__METHOD__][$selector] = true;
}


/**
* Add javascript support for Bootstrap accordians and insert the accordian
*
Expand Down Expand Up @@ -392,7 +392,7 @@ public static function startAccordion($selector = 'myAccordian', $params = array
}

// Include Bootstrap framework
static::framework();
JHtml::_('bootstrap.framework');

// Setup options object
$opt['parent'] = isset($params['parent']) ? ($params['parent'] == true ? '#' . $selector : $params['parent']) : false;
Expand Down Expand Up @@ -480,7 +480,7 @@ public static function startTabSet($selector = 'myTab', $params = array())
if (!isset(static::$loaded[__METHOD__][$sig]))
{
// Include Bootstrap framework
static::framework();
JHtml::_('bootstrap.framework');

// Setup options object
$opt['active'] = (isset($params['active']) && ($params['active'])) ? (string) $params['active'] : '';
Expand Down
27 changes: 15 additions & 12 deletions media/system/js/bootstrap-init.js
Expand Up @@ -114,12 +114,7 @@
/** Popover **/
if (popover) {
$.each(popover, function(index, value) {
var tmpArray = $.map(value.constraints, function(value, index) {
return [value];
});

value.constraints = tmpArray;

value.constraints = [value.constraints];
$(index).popover(value);
});
}
Expand All @@ -134,19 +129,28 @@
/** Tabs **/
if (tabs) {
$.each(tabs, function(index, value) {
var liNodes = $('#' + index + 'Tabs').find('li');

$.each($('#' + index + 'Content').find('.tab-pane'), function(i, v) {
if ($(v).data('node')) {
var attribs = $(v).data('node').split('['),
classLi = (attribs[0] != '') ? 'class="' + attribs[0] + '"' : '';
$('#' + index + 'Tabs').append('<li ' + classLi + '><a href="#' + attribs[1] + '" data-toggle="tab">' + attribs[2] + '</a></li>');
classLi = (attribs[0] != '') ? 'class="nav-item ' + attribs[0] + '"' : '';
$('#' + index + 'Tabs').append('<li ' + classLi + '><a class="nav-link" href="#' + attribs[1] + '" data-toggle="tab">' + attribs[1] + '</a></li>');
}
});

var liNodes = $('#' + index + 'Tabs').find('li');

$.each(liNodes, function() {
$(this + ' a').click(function (e) {
$(this).click(function (e) {
e.preventDefault();
var liNodes = $(e.target).parents('ul');
liNodes = liNodes.find('li');

$.each(liNodes, function(index, value) {
$(value).removeClass("active");
$(value).find('a').removeClass("active");
});

$(this).tab("show");
});
});
Expand All @@ -155,9 +159,8 @@

/** Tooltip **/
if (tooltip) {
console.log(tooltip)
$.each(tooltip, function(index, value) {
console.log(value)
value.constraints = [value.constraints];
$(index).tooltip(value)
.on("show.bs.tooltip", new Function(value.onShow)())
.on("shown.bs.tooltip", new Function(value.onShown)())
Expand Down
1 change: 1 addition & 0 deletions media/system/js/bootstrap-init.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 033e4a9

Please sign in to comment.