Merge pull request #397 from ZeusWPI/fix-subnavigation

Fix css and refactor subnavigation bar
This commit is contained in:
redfast00 2020-08-06 16:58:36 +02:00 committed by GitHub
commit 4fb0873fd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 58 additions and 20 deletions

View file

@ -1,8 +1,12 @@
--- ---
narrow_page: true narrow_page: true
subnavigation:
bar: about
identifier: about
name: Zeus WPI
order: 100
--- ---
<%= render '/partials/_about_sub_navbar.*', selected: 'about' %>
<h1 class="title is-1 has-text-centered">About Zeus WPI</h1> <h1 class="title is-1 has-text-centered">About Zeus WPI</h1>
<div class="content"> <div class="content">

View file

@ -1,8 +1,13 @@
--- ---
narrow_page: true narrow_page: true
typography: true typography: true
subnavigation:
bar: about
identifier: historiek
name: Historiek
order: 400
--- ---
<%= render '/partials/_about_sub_navbar.*', selected: 'historiek' %>
<h1 class="title is-1 has-text-centered">Historiek</h1> <h1 class="title is-1 has-text-centered">Historiek</h1>
<div class="timeline"> <div class="timeline">

View file

@ -1,9 +1,12 @@
--- ---
narrow_page: true narrow_page: true
subnavigation:
bar: about
identifier: oud-bestuur
name: Oud-bestuur
order: 500
--- ---
<%= render '/partials/_about_sub_navbar.*', selected: 'oud-bestuur' %>
<h1 class="title is-1 has-text-centered">Oud-bestuur</h1> <h1 class="title is-1 has-text-centered">Oud-bestuur</h1>
<div class="content"> <div class="content">

View file

@ -3,8 +3,13 @@ title: Privacybeleid
narrow_page: true narrow_page: true
typography: true typography: true
toc: true toc: true
subnavigation:
bar: about
identifier: privacy
name: Privacybeleid
order: 300
--- ---
<%= render '/partials/_about_sub_navbar.*', selected: 'privacy' %>
<h1 class="title is-1 has-text-centered" id="top">Privacybeleid</h1> <h1 class="title is-1 has-text-centered" id="top">Privacybeleid</h1>
<div id="table-of-contents" class="menu column is-4"> <div id="table-of-contents" class="menu column is-4">
<p class="menu-label"> <p class="menu-label">

View file

@ -1,8 +1,12 @@
--- ---
narrow_page: true narrow_page: true
subnavigation:
bar: about
identifier: sponsorende-leden
name: Sponsorende leden
order: 700
--- ---
<%= render '/partials/_about_sub_navbar.*', selected: 'sponsoring-members' %>
<h1 class='title is-1 has-text-centered'>Sponsorende leden</h1> <h1 class='title is-1 has-text-centered'>Sponsorende leden</h1>
<div id='sponsoring-members' class="content"> <div id='sponsoring-members' class="content">

View file

@ -1,9 +1,12 @@
--- ---
narrow_page: true narrow_page: true
subnavigation:
bar: about
identifier: statuten
name: Statuten
order: 200
--- ---
<%= render '/partials/_about_sub_navbar.*', selected: 'statuten' %>
# Statuten # Statuten
{:.title.is-1.has-text-centered} {:.title.is-1.has-text-centered}

View file

@ -1,8 +1,12 @@
--- ---
narrow_page: true narrow_page: true
subnavigation:
bar: about
identifier: verslagen
name: Verslagen
order: 600
--- ---
<%= render '/partials/_about_sub_navbar.*', selected: 'verslagen' %>
<h1 class="title is-1 has-text-centered">Reports</h1> <h1 class="title is-1 has-text-centered">Reports</h1>
<div class="content"> <div class="content">

View file

@ -4,6 +4,9 @@
</header> </header>
<main class="section"> <main class="section">
<% if item[:narrow_page] %> <% if item[:narrow_page] %>
<% if item[:subnavigation] %>
<%= render '/partials/_sub_navbar.*', selected: item[:subnavigation][:identifier] %>
<% end %>
<div class="columns"> <div class="columns">
<article class="column is-8 is-offset-2 <%= 'toc-container' if @item[:toc] %>"> <article class="column is-8 is-offset-2 <%= 'toc-container' if @item[:toc] %>">
<% end %> <% end %>

View file

@ -1,11 +0,0 @@
<div class="subnav tabs">
<ul>
<li class="<%= 'is-active' if @selected == 'about'%>"><a href="/about/about">Zeus WPI</a></li>
<li class="<%= 'is-active' if @selected == 'statuten'%>"><a href="/about/statuten">Statuten</a></li>
<li class="<%= 'is-active' if @selected == 'privacy'%>"><a href="/about/privacy">Privacybeleid</a></li>
<li class="<%= 'is-active' if @selected == 'historiek'%>"><a href="/about/historiek">Historiek</a></li>
<li class="<%= 'is-active' if @selected == 'oud-bestuur'%>"><a href="/about/oud-bestuur">Oud-bestuur</a></li>
<li class="<%= 'is-active' if @selected == 'verslagen'%>"><a href="/about/verslagen">Verslagen</a></li>
<li class="<%= 'is-active' if @selected == 'sponsoring-members'%>"><a href="/about/sponsorende-leden">Sponsorende leden</a></li>
</ul>
</div>

View file

@ -0,0 +1,11 @@
<div class="subnav tabs is-centered">
<ul>
<% subnavigables(@item[:subnavigation][:bar]).map { |e| e[:subnavigation] }.each do |nav| %>
<li class="<%= 'is-active' if @selected == nav[:identifier] %>">
<a href="<%= "/#{nav[:bar]}/#{nav[:identifier]}" %>">
<%= nav[:name] %>
</a>
</li>
<% end %>
</ul>
</div>

View file

@ -12,4 +12,11 @@ module NavigationHelper
def navigables def navigables
items.select { |i| i[:navigable] }.sort_by { |x| x[:order] || 10_000 } items.select { |i| i[:navigable] }.sort_by { |x| x[:order] || 10_000 }
end end
def subnavigables(bar)
items
.select { |i| i.attributes.dig(:subnavigation, :bar) == bar }
.sort_by { |x| x[:subnavigation][:order] || 10_000 }
end
end end