Created
January 3, 2013 15:34
-
-
Save anonymous/4444325 to your computer and use it in GitHub Desktop.
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
# Mapping to a view | |
class RekenserviceRated | |
include DataMapper::Resource | |
storage_names[:default] = 'rekenservice_rated' | |
is :read_only | |
property :rating, Float | |
property :count, Integer | |
belongs_to :rekenservice, :key => true | |
belongs_to :category, :key => true | |
end |
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
<%- i = 0 %> | |
<% data = group_by_category(RekenserviceRated.all(:order => [:rating.desc])) %> | |
<% not_used_categories = Category.all(:id.not => data.keys.map{|c| c.id })%> | |
<% data.each do |category, rekenservices| %> | |
<% if i % 3 == 0 %> | |
<div class="row"> | |
<% end %> | |
<% if i % 3 == 2 || data.length - 1 == i %> | |
</div> | |
<% end %> | |
<%- i= i+1 -%> | |
<% end %> | |
<p> | |
Voor de volgende categorieën zijn er bij ons nog geen rekenservices bekend: | |
<%= not_used_categories.to_a.map {|c| c.name}.join ", "%>. Bent u de eerste om | |
<%= link_to "uw rekenservice", new_registration_path(:user) %> aan te melden | |
in deze categorie? | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment