diff --git a/app/assets/stylesheets/components/_cards.scss b/app/assets/stylesheets/components/_cards.scss index c2bb398ea..8c1f91d5d 100644 --- a/app/assets/stylesheets/components/_cards.scss +++ b/app/assets/stylesheets/components/_cards.scss @@ -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 //-------------------------------------------------- diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 3ad49cd80..169270c32 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -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 = [ diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index bb089611a..e93983969 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -35,8 +35,14 @@ <%= render "partials/ctas/api" %> -
- resources carousel +
+ <%= render partial: "partials/cards/articles", locals: + { + title: @resources_title, + cards: @resources, + url: @resources_url + } + %>
diff --git a/app/views/partials/cards/_resources.html.erb b/app/views/partials/cards/_resources.html.erb new file mode 100644 index 000000000..ad6dde529 --- /dev/null +++ b/app/views/partials/cards/_resources.html.erb @@ -0,0 +1,18 @@ +
+ +

<%= title %>

+ + <%= link_to t('global.view_all'), url, target: '_blank', title: t('global.view_all') %> + +
+ <% cards.each do |card| %> +
+

<%= card.created_at %>

+

<%= card.label %>

+

intro field needs creating

+ + links to download or new page +
+ <% end %> +
+
\ No newline at end of file