Merge pull request #41 from ZeusWPI/fix-imagefunction

Fix imagefunction
This commit is contained in:
mcbloch 2020-08-29 17:16:42 +02:00 committed by GitHub Enterprise
commit ff973ac8f6
2 changed files with 12 additions and 14 deletions

View file

@ -3,7 +3,7 @@
<h1> Thema's </h1>
<ul>
<% for thema in themas %>
<img src="<%= image_url(thema) %>" alt="<%= thema[:naam] %>">
<%= image_tag thema %>
<li> <%= link_to(thema[:naam], thema) %> </li>
<% end %>
</ul>
@ -12,7 +12,7 @@
<h1> Konventen en projecten </h1>
<ul>
<% for item in konventen_and_projecten %>
<img src="<%= image_url(item) %>" alt="<%= item[:naam] %>">
<%= image_tag item %>
<li> <%= link_to(item[:naam], item) %> </li>
<% end %>
</ul>

View file

@ -51,20 +51,18 @@ module VerenigingenHelper
else
item[:image]
end
def abbreviation(item)
item.identifier.without_ext.split('/').last
end
def verenigingen_random(amount)
@items.find_all("**/verenigingen/*").map{|x| {
"titel" => x[:titel],
"naam" => x[:naam],
"konvent" => x[:konvent],
"themas" => x[:themas]
}}.to_a.shuffle[0..amount]
end
end
def verenigingen_random(amount)
@items.find_all("**/verenigingen/*").map { |x| {
"titel" => x[:titel],
"naam" => x[:naam],
"konvent" => x[:konvent],
"themas" => x[:themas]
} }.to_a.shuffle[0..amount]
end
def image_tag(item)
"<img src='#{ image_url item }' alt='#{ item[:name] } logo' />"
"<img src='#{ image_url item }' alt='#{ item[:naam] } logo' />"
end
end