marvelapi

commit 0cd929a291c6204cead7fd87a308c12b48522bbb

Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>

views: add attribution text and link images to their marvel profile

According to Marvel's API documentation, all you'll need to do is add a
generic text in every page that the API is used with the current year,
so instead of using the attributionText that the API sends to us, I've
decided to just use the text model and thrown the current year there.

I also didn't really liked the way that those images link were
constructed, but it would take a little bit more of time to reorganize
that into a perhaps a struct that reads from the JSON and expose those
details as methods, build the thumbnail URL, etc instead of doing that
on-the-fly.

 views/index.erb | 7 +++++--
 views/layout.erb | 4 ++++


diff --git a/views/index.erb b/views/index.erb
index 371e905373de01146fb769d668022c9d133a238d..f462b1e4250637abfb429a5647947262abf5022a 100644
--- a/views/index.erb
+++ b/views/index.erb
@@ -12,9 +12,12 @@     
    <% @characters.each do |character| %> <li> <div class="flex col align-center justify-center mb-10"> - <% thumbnail = character['thumbnail'] %> + <% thumbnail = character["thumbnail"] %> + <% detail = character["urls"].first %> <% src = "#{thumbnail['path']}.#{thumbnail['extension']}" %> - <img src="<%= src %>" style="width: 250px; height: auto;"> + <a href="<%= detail['url'] %>"> + <img src="<%= src %>" style="width: 250px; height: auto;"> + </a> <strong> <%= character["name"] %> </strong> diff --git a/views/layout.erb b/views/layout.erb index bbc7ace53c18c8aad1759025669a0d2cc7774cbf..e8c764f38418e9b7eb4a3e58b7c3445ab064085b 100644 --- a/views/layout.erb +++ b/views/layout.erb @@ -50,5 +50,9 @@ </head> <body> <%= yield %> + + <footer> + Data provided by Marvel. © <%= Date.today.year %> Marvel + </footer> </body> </html>