More tabs styling

This commit is contained in:
Andy Miller
2017-03-10 15:13:16 -07:00
parent 6d52b5f430
commit db79d4633f
4 changed files with 35 additions and 9 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -830,7 +830,31 @@ form {
color: shade($content-text, 20%);
background: shade($content-bg, 10%);
}
border-bottom: 1px solid $form-border;
&.active {
border-top: 1px solid $form-border;
border-left: 1px solid $form-border;
border-right: 1px solid $form-border;
border-bottom: 0;
&:hover {
background: $content-bg;
}
&:first-child {
border-left: 0;
}
&:last-child {
border-right: 0;
}
}
}
}
.tabs-content {

View File

@@ -8,6 +8,8 @@
{% set active = 1 %}
{% endif %}
{{ dump(active) }}
{% if field.fields %}
{% set storedValue = get_cookie('grav-tabs-state')|default('{}')|json_decode %}
{% set tabsKey = field.fields|keys|join('.') %}
@@ -15,14 +17,14 @@
<div class="tabs-nav">
{% for tab in field.fields %}
{% if tab.type == 'tab' and (tab.security is empty or authorize(array(tab.security))) %}
{#<input type="radio" name="tab-{{ tabsKey }}" id="tab-{{ tabsKey ~ loop.index }}" value="{{ (scope ~ tab.name) }}" class="tab-head no-form" />#}
{#<label for="tab-{{ tabsKey ~ loop.index }}">#}
{#{% if grav.twig.twig.filters['tu'] is defined %}{{ tab.title|tu }}{% else %}{{ tab.title|t }}{% endif %}#}
{#</label>#}
{#<input type="radio" name="tab-{{ tabsKey }}" id="tab-{{ tabsKey ~ loop.index }}" value="{{ (scope ~ tab.name) }}" class="tab-head no-form" />#}
{#<label for="tab-{{ tabsKey ~ loop.index }}">#}
{#{% if grav.twig.twig.filters['tu'] is defined %}{{ tab.title|tu }}{% else %}{{ tab.title|t }}{% endif %}#}
{#</label>#}
<a class="tab__link {{ ((attribute(storedValue, 'tab-' ~ tabsKey) == scope ~ tab.name) or active == loop.index) ? 'active' : '' }}" href="#" data-tabid="tab-{{ tabsKey ~ loop.index }}">
{% if grav.twig.twig.filters['tu'] is defined %}{{ tab.title|tu }}{% else %}{{ tab.title|t }}{% endif %}
</a>
<a class="tab__link {{ ((attribute(storedValue, 'tab-' ~ tabsKey) == scope ~ tab.name) or active == loop.index) ? 'active' : '' }}" href="#" data-tabid="tab-{{ tabsKey ~ loop.index }}">
{% if grav.twig.twig.filters['tu'] is defined %}{{ tab.title|tu }}{% else %}{{ tab.title|t }}{% endif %}
</a>
{% endif %}
{% endfor %}
</div>