Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs to switch between term pages for legislatures/houses in a single country #13598

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,5 @@ DEPENDENCIES
sinatra!
yajl-ruby

RUBY VERSION
ruby 2.0.0p648

BUNDLED WITH
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change was added because I ran bundle install before starting work. Not sure whether it's needed or not? @tmtmtmtm @chrismytton

1.12.5
1 change: 0 additions & 1 deletion views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<a href="/"><span class="header-logo">EveryPolitician</span></a>
<% end %>
</h2>
<% if @house %><h3><%= @house[:name] %></h3><% end %>
</div>
<div class="site-header__navigation site-header__navigation--primary">
<nav role="navigation">
Expand Down
62 changes: 54 additions & 8 deletions views/sass/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,58 @@ p.lead {

// Little round social icons for membership tables
.person-link {
display: inline-block;
width: 24px;
padding-top: 24px;
height: 0;
overflow: hidden;
vertical-align: middle;
border-radius: 100%;
margin-right: 0.3em;
display: inline-block;
width: 24px;
padding-top: 24px;
height: 0;
overflow: hidden;
vertical-align: middle;
border-radius: 100%;
margin-right: 0.3em;
}

.house-tabs {
@extend .unstyled-list;
@extend .inline-list;
padding-top: 1em;

// Make the tabs scroll horizontally on small screens.
// TODO: Make this not suck when the currently selected tab is
// hidden off to the far right of the line.
@media (max-width: $small_screen_max) {
text-align: left;
white-space: nowrap;
overflow: auto;
margin: 0 -1em;
padding: 1em 0.5em 0 0.5em;
}

@media (min-width: $medium_screen) and (min-height: 600px) {
padding-top: 1.5em;
}
}

.house-tab {
display: inline-block;
padding: 0.5em 1em;
border-radius: 5px 5px 0 0;
background-color: mix($colour_green, #fff, 25%);
background: linear-gradient(180deg, mix($colour_green, #fff, 20%), 50%, mix($colour_green, #fff, 30%));
color: darken($colour_green, 10%) !important;

&:hover,
&:focus {
background-color: mix($colour_green, #fff, 15%);
background: linear-gradient(180deg, mix($colour_green, #fff, 10%), 50%, mix($colour_green, #fff, 20%));
}
}

.house-tab--active,
.house-tab--active:hover,
.house-tab--active:focus {
background: #fff;
}

.source-credits a {
@extend .break-word;
}
15 changes: 15 additions & 0 deletions views/sass/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,18 @@
}
}
}

.break-word {
// https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/
overflow-wrap: break-word;
word-wrap: break-word;

-ms-word-break: break-all;
word-break: break-all;
word-break: break-word;

-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
4 changes: 4 additions & 0 deletions views/sass/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ textarea {
-webkit-appearance: none;
}

select {
max-width: 100%;
}

fieldset {
padding: 0;
border: 0;
Expand Down
1 change: 1 addition & 0 deletions views/sass/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ $high_dpi_screen: '-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi

$large_screen_max: $giant_screen - (1em * (1px / $size_font-base));
$medium_screen_max: $large_screen - (1em * (1px / $size_font-base));
$small_screen_max: $medium_screen - (1em * (1px / $size_font-base));

$animation-short: 0.2s ease-out;

Expand Down
14 changes: 14 additions & 0 deletions views/term_table.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
<div class="page-section page-section--green page-section--no-padding">
<div class="container text-center">
<ul class="house-tabs">
<% @country[:legislatures].each do |house| %>
<li>
<a class="house-tab <% if @house == house %>house-tab--active<% end %>" href="<%= term_table_url(@country, house, house[:legislative_periods].first) %>">
<%= house[:name] %>
</a>
</li>
<% end %>
</ul>
</div>
</div>

<div class="page-section" id="term">
<div class="container text-center">
<h1><span class="avatar"><i class="fa fa-university"></i></span> <%= @term[:name] %></h1>
Expand Down