Commit 9945b6c34991e4edbec1602d128c861e3c83f818

Authored by Antonio Terceiro
1 parent a3872907

ActionItem1044: enhancements to the profile screen

app/models/profile.rb
... ... @@ -137,6 +137,10 @@ class Profile < ActiveRecord::Base
137 137 has_many :profile_categorizations, :conditions => [ 'categories_profiles.virtual = ?', false ]
138 138 has_many :categories, :through => :profile_categorizations
139 139  
  140 + def interests
  141 + categories.select {|item| !item.is_a?(Region)}
  142 + end
  143 +
140 144 belongs_to :region
141 145  
142 146 def location
... ...
app/views/profile/_person.rhtml
... ... @@ -21,19 +21,38 @@
21 21 </tr>
22 22 <%= display_field(_('Organization:'), profile, :organization) %>
23 23 <%= display_field(_('Organization website:'), profile, :organization_website) { |url| link_to(url, url) }%>
  24 +<% if !profile.enterprises.empty? %>
  25 + <% profile.enterprises.each_with_index do |item, i| %>
  26 + <tr>
  27 + <td class='field-name'><%= __('Enterprises:') if (i == 0) %></td>
  28 + <td><%= button 'menu-enterprise', item.name, item.url %></td>
  29 + </tr>
  30 + <% end %>
  31 +<% end %>
24 32  
25 33 <tr>
26 34 <th colspan='2'><%= _('Network')%></th>
27 35 </tr>
28 36 <tr>
29   - <td colspan='2'>
30   - <%= link_to __('Friends'), :controller => 'profile', :action => 'friends' %>
31   -
32   - &mdash; <%= link_to __('Communities'), :controller => "profile", :action => 'communities' %>
  37 + <td></td>
  38 + <td><%= link_to __('Friends') + (' (%d)' % profile.friends.count), { :controller => 'profile', :action => 'friends' } %></td>
  39 +</tr
  40 +<tr>
  41 + <td></td>
  42 + <td><%= link_to __('Communities') + (' (%d)' % profile.communities.count), :controller => "profile", :action => 'communities' %></td>
  43 +</tr>
33 44  
34   - <% if !environment.enabled?('disable_asset_enterprises') %>
35   - &mdash; <%= link_to __('Enterprises'), :controller => 'profile', :action => 'enterprises' %>
36   - <% end %>
37 45 </td>
38 46 </tr>
39 47  
  48 +<% if !environment.enabled?('disable_categories') && !profile.interests.empty? %>
  49 + <tr>
  50 + <th colspan='2'><%= _('Interests') %></th>
  51 + </tr>
  52 + <% profile.interests.each do |item| %>
  53 + <tr>
  54 + <td></td>
  55 + <td><%= link_to item.name, :controller => 'search', :action => 'category_index', :category_path => item.explode_path %></td>
  56 + </tr>
  57 + <% end %>
  58 +<% end %>
... ...
app/views/profile/index.rhtml
1   -<% if profile.enterprise? and !profile.enabled? and !profile.blocks.select {|b| b.class == DisabledEnterpriseMessageBlock}.any? %>
  1 +<% if profile.enterprise? && !profile.enabled? && !profile.blocks.select {|b| b.class == DisabledEnterpriseMessageBlock}.any? %>
2 2 <div id='profile-disabled'>
3 3 <%= environment.message_for_disabled_enterprise %>
4 4 </div>
5 5 <% end %>
6 6  
  7 +<% cache_timeout(profile.identifier + '-profile', 30.minutes.from_now) do %>
7 8 <h1><%= _("%s's profile") % profile.identifier %></h1>
8 9  
9 10 <table class='profile'>
... ... @@ -30,3 +31,4 @@
30 31 </td>
31 32 </tr>
32 33 </table>
  34 +<% end %>
... ...