From abad7ff5f6d2542be3106093ccb2108fcbeb6b97 Mon Sep 17 00:00:00 2001 From: simplefl <phoenixfl@gmx.de> Date: Sat, 11 Apr 2015 12:34:52 +0200 Subject: [PATCH] Add group name and task to posts. --- app/views/posts/_post.html.erb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/views/posts/_post.html.erb b/app/views/posts/_post.html.erb index c4806ef..7d92f74 100644 --- a/app/views/posts/_post.html.erb +++ b/app/views/posts/_post.html.erb @@ -13,6 +13,23 @@ <% end %> <dl> + <% if post.user.groups.count > 0 %> + <dd> + <% if post.user.admin?%> + <dt><%= namelink Group.find(Group::ADMINS) %></dt> + <dd><%= post.user.groupers.where(:group_id => Group::ADMINS).first.task %></dd> + <% elsif post.user.caster?%> + <dt><%= namelink Group.find(Group::CASTERS) %></dt> + <dd><%= post.user.groupers.where(:group_id => Group::CASTERS).first.task %></dd> + <% elsif post.user.ref?%> + <dt><%= namelink Group.find(Group::REFEREES) %></dt> + <dd><%= post.user.groupers.where(:group_id => Group::REFEREES).first.task %></dd> + <% else %> + <dt><%= namelink Group.find(post.user.groupers.first.group_id) %></dt> + <dd><%= post.user.groupers.first.task %></dd> + <% end %> + </dd> + <% end %> <dt>Posts</dt> <dd><%= post.user.posts.count %></dd> <dt>Location</dt>