Skip to content

Commit

Permalink
Add very basic layout for resources section
Browse files Browse the repository at this point in the history
  • Loading branch information
stacytalbot committed Dec 16, 2019
1 parent 5b941f8 commit ab99cbb
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
18 changes: 18 additions & 0 deletions app/assets/stylesheets/components/_cards.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@
@include flex-column;
}
}

//--------------------------------------------------
// class - resources
//--------------------------------------------------
&--resources {
.cards {
&__cards {
@include flex;
@include responsive-styles(flex-wrap, wrap, nowrap, nowrap);
}
}

.card {
@include responsive-styles(width, 100%, 25%, 25%);
}
}


//--------------------------------------------------
// class - squares
//--------------------------------------------------
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ def index
@news_articles_title = comfy_news.label
@news_articles_url = comfy_news.full_path
@news_articles = comfy_news.children.published.order(created_at: :desc).limit(2) #TODO replace with correct pages #TODO get ordering to work


comfy_news = Comfy::Cms::Page.find_by_slug("resources")
@resources_title = comfy_news.label
@resources_url = comfy_news.full_path
@resources = comfy_news.children.published.order(created_at: :desc).limit(4) #TODO replace with correct pages #TODO get ordering to work

@regions_page = Comfy::Cms::Page.find_by_slug("unep-regions")

@thematicAreas = [
Expand Down
10 changes: 8 additions & 2 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@

<%= render "partials/ctas/api" %>

<section>
resources carousel
<section class="container section-padding">
<%= render partial: "partials/cards/articles", locals:
{
title: @resources_title,
cards: @resources,
url: @resources_url
}
%>
</section>

<section class="container section-padding">
Expand Down
18 changes: 18 additions & 0 deletions app/views/partials/cards/_resources.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="cards--resources">

<h3><%= title %></h3>

<%= link_to t('global.view_all'), url, target: '_blank', title: t('global.view_all') %>

<div class="cards__cards">
<% cards.each do |card| %>
<div class="card">
<p><%= card.created_at %></p>
<h3><%= card.label %></h3>
<p>intro field needs creating</p>

links to download or new page
</div>
<% end %>
</div>
</div>

0 comments on commit ab99cbb

Please sign in to comment.