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

Fix/litigations sidebar #196

Merged
merged 5 commits into from
Dec 9, 2019
Merged
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
45 changes: 45 additions & 0 deletions app/assets/stylesheets/cclow/_geography-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,48 @@ mark {
left: 10%;
z-index: 35;
}

.sidebar__categories {
margin-top: 30px;

& > hr {
background-color: $grey-light;
}

.categories {
&__container {
margin-top: 30px;

&:first-child {
margin-top: 20px;
}
}

&__title {
font-size: 0.625rem;
line-height: 0.938rem;
color: $gun-powder;
text-transform: uppercase;
letter-spacing: 1.5px;
}

&__tags {
display: flex;
}

&__tag:not(body) {
margin-top: 10px;
border: none;
border-radius: 0;
margin-right: 12px;
background-color: $grey-light;
color: $blue-dark;
font-size: 0.75rem;
line-height: 0.938rem;

&:last-child {
margin-right: 0;
}
}
}
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/cclow/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $navbar-item-color: $grey;
// BREADCRUMB
$breadcrumb-item-color: $red;
$breadcrumb-item-active-color: $grey-text;
$breadcrumb-item-separator-color: $storm-gray;

// DIVIDER
$hr-background-color: $blue-dark;
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/cclow/geography/legislations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def index
def show
@legislation = CCLOW::LegislationDecorator.new(::Legislation.find(params[:id]))
add_breadcrumb(@legislation.title, request.path)
@sectors = @legislation.laws_sectors.order(:name)
@keywords = @legislation.keywords.order(:name)
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def show
@legislations = CCLOW::LegislationDecorator.decorate_collection(@litigation.legislations)
add_breadcrumb('Litigation cases', cclow_geography_litigation_cases_path(@geography))
add_breadcrumb(@litigation.title, request.path)
@sectors = @litigation.laws_sectors.order(:name)
@keywords = @litigation.keywords.order(:name)
end
end
end
Expand Down
31 changes: 31 additions & 0 deletions app/views/cclow/geography/legislations/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
<% content_for :page_title, "Climate Laws - #{@geography.name} - #{@legislation.title}" %>

<% content_for :sidebar do %>
<div class="sidebar__categories">
<hr />

<% if @sectors.count > 0 %>
<div class="categories__container">
<p class="categories__title">Sectors</p>

<div class="categories_tags">
<% @sectors.each do |sector| %>
<span class="tag categories__tag"><%= sector.name %></span>
<% end %>
</div>
</div>
<% end %>

<% if @keywords.count > 0 %>
<div class="categories__container">
<p class="categories__title">Keywords</p>

<div class="categories_tags">
<% @keywords.each do |keyword| %>
<span class="tag categories__tag"><%= keyword.name %></span>
<% end %>
</div>
</div>
<% end %>
</div>
<% end %>

<div class="content-show">
<h3 class="title"><%= @legislation.title %></h3>
<div class="meta">
Expand Down
31 changes: 31 additions & 0 deletions app/views/cclow/geography/litigation_cases/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
<% content_for :page_title, "Climate Laws - #{@geography.name} - #{@litigation.title}" %>

<% content_for :sidebar do %>
<div class="sidebar__categories">
<hr />

<% if @sectors.count > 0 %>
<div class="categories__container">
<p class="categories__title">Sectors</p>

<div class="categories_tags">
<% @sectors.each do |sector| %>
<span class="tag categories__tag"><%= sector.name %></span>
<% end %>
</div>
</div>
<% end %>

<% if @keywords.count > 0 %>
<div class="categories__container">
<p class="categories__title">Keywords</p>

<div class="categories_tags">
<% @keywords.each do |keyword| %>
<span class="tag categories__tag"><%= keyword.name %></span>
<% end %>
</div>
</div>
<% end %>
</div>
<% end %>

<div class="content-show">
<h3 class="title"><%= @litigation.title %></h3>
<div class="meta">
Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/cclow/geography.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<li><%= active_link_to "#{link[:label]} (#{link[:count]})", link[:path], active: :exclusive %></li>
<% end %>
</ul>

<%= yield :sidebar %>
</aside>
<main class="column is-three-quarters">
<%= yield %>
Expand Down