Skip to content

Commit

Permalink
add basic layout for list of PAs
Browse files Browse the repository at this point in the history
  • Loading branch information
stacytalbot committed Dec 17, 2019
1 parent ff56f85 commit 6dd37ae
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ group :development do
gem 'capistrano-sidekiq','1.0.2'
gem 'capistrano-git-with-submodules', '2.0.3'
gem 'capistrano-service'
gem 'awesome_print'
# gem 'listen', '~> 3.1.5'
# gem 'spring-watcher-listen', '~> 2.0.0'
#
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ GEM
arel (7.1.4)
autoprefixer-rails (9.7.2)
execjs
awesome_print (1.8.0)
aws-eventstream (1.0.3)
aws-partitions (1.246.0)
aws-sdk (3.0.1)
Expand Down Expand Up @@ -1248,6 +1249,7 @@ DEPENDENCIES
activerecord-postgis-adapter (= 4.1.0)
appsignal (~> 1.3.6)
autoprefixer-rails
awesome_print
aws-sdk (= 3.0.1)
best_in_place (~> 3.0.1)
byebug (~> 9.0, >= 9.0.5)
Expand Down
10 changes: 6 additions & 4 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ def index
@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
comfy_resources = Comfy::Cms::Page.find_by_slug("resources")
@resources_title = comfy_resources.label
@resources_url = comfy_resources.full_path
@resources = comfy_resources.children.published.order(created_at: :desc).limit(4) #TODO replace with correct pages #TODO get ordering to work

@temp_pas = ProtectedArea.first(4)

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

Expand Down
9 changes: 8 additions & 1 deletion app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,11 @@
%>
</section>

<%= render "partials/ctas/live-report" %>
<%= render "partials/ctas/live-report" %>

<%= render partial: "partials/cards/sites", locals:
{
title: 'title',
cards: @temp_pas
}
%>
25 changes: 25 additions & 0 deletions app/views/partials/cards/_sites.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div class="cards--sites">

<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| %>
<%= link_to protected_area_path(card.wdpa_id), title: "View more about the site: #{card.name}", class: "card" do %>
<%= cover card %>

<h3><%= card.name %></h3>
<div>
<p>
<% card.countries_for_index.each do |country| %>
<span><%= country.iso_3 %></span>
<%= country.name %>
<% end %>
</p>
</div>
</div>
<% end %>
<% end %>
</div>
</div>

0 comments on commit 6dd37ae

Please sign in to comment.