MDL-46470 bootstrapbase: support linkedwhenselected attribute for tabs

This commit is contained in:
Marina Glancy
2014-08-06 11:46:16 +08:00
parent 6b7a5f86a0
commit ef494edcd6
3 changed files with 11 additions and 8 deletions
+7 -5
View File
@@ -130,16 +130,18 @@
}
}
// Active state, and it's :hover/:focus to override normal :hover/:focus
.nav-tabs > .active > a,
.nav-tabs > .active > a:hover,
.nav-tabs > .active > a:focus {
color: @gray;
.nav-tabs > .active > a {
background-color: @bodyBackground;
border: 1px solid #ddd;
border-bottom-color: transparent;
cursor: default;
}
.nav-tabs > .active > a:not([href]),
.nav-tabs > .active > a:not([href]):hover,
.nav-tabs > .active > a:not([href]):focus {
color: @gray;
cursor: default;
}
// PILLS
// -----
@@ -209,7 +209,7 @@ class theme_bootstrapbase_core_renderer extends core_renderer {
* @return string HTML fragment
*/
protected function render_tabobject(tabobject $tab) {
if ($tab->selected or $tab->activated) {
if (($tab->selected and (!$tab->linkedwhenselected)) or $tab->activated) {
return html_writer::tag('li', html_writer::tag('a', $tab->text), array('class' => 'active'));
} else if ($tab->inactive) {
return html_writer::tag('li', html_writer::tag('a', $tab->text), array('class' => 'disabled'));
@@ -220,7 +220,8 @@ class theme_bootstrapbase_core_renderer extends core_renderer {
} else {
$link = html_writer::link($tab->link, $tab->text, array('title' => $tab->title));
}
return html_writer::tag('li', $link);
$params = $tab->selected ? array('class' => 'active') : null;
return html_writer::tag('li', $link, $params);
}
}
}
File diff suppressed because one or more lines are too long