-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WDTK] Added article section in frontpage
[WTDK] Added articles into frontpage_extra file [WTDK] Get articles information from JSON API
- Loading branch information
1 parent
aa2f6c2
commit 1251855
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<% @research_articles = JSON.parse(Net::HTTP.get(URI('https://research.mysociety.org/embed/foi/limit:10/format:json/'))). with_indifferent_access[:items]. map { |item| item.slice(:title, :url, :thumbnail) } %> | ||
|
||
<div class="homepage-article-section" id="homepage-article"> | ||
<div class="row homepage-article-section__ar-contet"> | ||
<div class="ar-content__headings "> | ||
<h2><%= _("Our Freedom of Information Research") %></h2> | ||
</div> | ||
<div class="ar-content__article-grid col-2-grid"> | ||
<% @research_articles.sample(6).each do |article| %> | ||
<div class="article-grid__item"> | ||
<img class="item-content__img" src="<%= image_path(article[:thumbnail]) %>" alt="Cover for: <%= article[:title] %>" loading="lazy"> | ||
<div class="article-grid__item-content"> | ||
<h3 class="item-content__heading"><%= article[:title] %></h3> | ||
<a href="<%= article[:url] %>" target="_blank">Read article</a> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
<div class="cta-button-wrapper"> | ||
<a class="button" href="https://www.mysociety.org/donate/?utm_medium=link&how-much=10">Donate £10</a> | ||
<span>to support our research or <a href="https://research.mysociety.org/section/foi">Browse more</a></span> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= render :partial => "frontpage_articles" %> |