Commit dfd6153eaf43a8394ed756b4b4aa79a44aca3194

Authored by Antonio Terceiro
1 parent 57086078

ActionItem1041: fixing cache in profile screen

app/views/profile/_person.rhtml
... ... @@ -4,62 +4,62 @@
4 4 <%= display_field(_('Name:'), profile, :name) { |name| link_to name, profile.url } %>
5 5 <%= display_field(_('Sex:'), profile, :sex) { |gender| { 'male' => _('Male'), 'female' => _('Female') }[gender] } %>
6 6 <%= display_field(_('Date of birth:'), profile, :birth_date) { |date| show_date(date) }%>
  7 +<%= display_field(_('Location:'), profile, :location) %>
7 8  
8   -<tr>
9   - <th colspan='2'><%= _('Contact')%></th>
10   -</tr>
11 9 <% if profile == user || profile.friends.include?(user) %>
  10 + <tr>
  11 + <th colspan='2'><%= _('Contact')%></th>
  12 + </tr>
12 13 <%= display_field(_('Address:'), profile, :address) %>
13 14 <%= display_field(_('ZIP code:'), profile, :zip_code) %>
14 15 <%= display_field(_('Contact phone:'), profile, :contact_phone) %>
15 16 <%= display_field(_('e-Mail:'), profile, :email) { |email| link_to_email(email) } %>
16 17 <% end %>
17   -<%= display_field(_('Location:'), profile, :location) %>
18 18  
19   -<% if !(profile.organization.blank? && profile.organization_website.blank?) %>
20   -<tr>
21   - <th colspan='2'><%= _('Work')%></th>
22   -</tr>
23   -<% end %>
24   -<%= display_field(_('Organization:'), profile, :organization) %>
25   -<%= display_field(_('Organization website:'), profile, :organization_website) { |url| link_to(url, url) }%>
26   -
27   -
28   -<% if !profile.enterprises.empty? %>
29   - <tr>
30   - <th colspan='2'><%= __('Enterprises') %></th>
31   - </tr>
32   - <% profile.enterprises.each do |item| %>
  19 +<% cache_timeout(profile.identifier + '-profile-relationships', 4.hours.from_now) do %>
  20 + <% if !(profile.organization.blank? && profile.organization_website.blank?) %>
33 21 <tr>
34   - <td></td>
35   - <td><%= button 'menu-enterprise', item.name, item.url %></td>
  22 + <th colspan='2'><%= _('Work')%></th>
36 23 </tr>
37 24 <% end %>
38   -<% end %>
  25 + <%= display_field(_('Organization:'), profile, :organization) %>
  26 + <%= display_field(_('Organization website:'), profile, :organization_website) { |url| link_to(url, url) }%>
39 27  
40   -<tr>
41   - <th colspan='2'><%= _('Network')%></th>
42   -</tr>
43   -<tr>
44   - <td></td>
45   - <td><%= link_to __('Friends') + (' (%d)' % profile.friends.count), { :controller => 'profile', :action => 'friends' } %></td>
46   -</tr
47   -<tr>
48   - <td></td>
49   - <td><%= link_to __('Communities') + (' (%d)' % profile.communities.count), :controller => "profile", :action => 'communities' %></td>
50   -</tr>
51 28  
52   - </td>
53   -</tr>
  29 + <% if !profile.enterprises.empty? %>
  30 + <tr>
  31 + <th colspan='2'><%= __('Enterprises') %></th>
  32 + </tr>
  33 + <% profile.enterprises.each do |item| %>
  34 + <tr>
  35 + <td></td>
  36 + <td><%= button 'menu-enterprise', item.name, item.url %></td>
  37 + </tr>
  38 + <% end %>
  39 + <% end %>
54 40  
55   -<% if !environment.enabled?('disable_categories') && !profile.interests.empty? %>
56 41 <tr>
57   - <th colspan='2'><%= _('Interests') %></th>
  42 + <th colspan='2'><%= _('Network')%></th>
  43 + </tr>
  44 + <tr>
  45 + <td></td>
  46 + <td><%= link_to __('Friends') + (' (%d)' % profile.friends.count), { :controller => 'profile', :action => 'friends' } %></td>
58 47 </tr>
59   - <% profile.interests.each do |item| %>
  48 + <tr>
  49 + <td></td>
  50 + <td><%= link_to __('Communities') + (' (%d)' % profile.communities.count), :controller => "profile", :action => 'communities' %></td>
  51 + </tr>
  52 +
  53 + <% if !environment.enabled?('disable_categories') && !profile.interests.empty? %>
60 54 <tr>
61   - <td></td>
62   - <td><%= link_to item.name, :controller => 'search', :action => 'category_index', :category_path => item.explode_path %></td>
  55 + <th colspan='2'><%= _('Interests') %></th>
63 56 </tr>
  57 + <% profile.interests.each do |item| %>
  58 + <tr>
  59 + <td></td>
  60 + <td><%= link_to item.name, :controller => 'search', :action => 'category_index', :category_path => item.explode_path %></td>
  61 + </tr>
  62 + <% end %>
64 63 <% end %>
  64 +
65 65 <% end %>
... ...
app/views/profile/index.rhtml
... ... @@ -4,31 +4,31 @@
4 4 </div>
5 5 <% end %>
6 6  
7   -<% cache_timeout(profile.identifier + '-profile', 30.minutes.from_now) do %>
8 7 <h1><%= _("%s's profile") % profile.name %></h1>
9 8  
10 9 <table class='profile'>
11 10 <%= render :partial => partial_for_class(profile.class) %>
12   - <tr>
13   - <th colspan='2'>
14   - <%= _('Content') %>
15   - </th>
16   - </tr>
17   - <tr>
18   - <td>
19   - <%= _('Content published:') %>
20   - </td>
21   - <td>
22   - <%= link_to _('Site map'), :controller => 'profile', :action => 'sitemap' %>
23   - </td>
24   - </tr>
25   - <tr>
26   - <td>
27   - <%= _('Tags:') %>
28   - </td>
29   - <td>
30   - <%= tag_cloud @tags, :id, { :action => 'tag' }, :max_size => 18, :min_size => 10%>
31   - </td>
32   - </tr>
  11 + <% cache_timeout(profile.identifier + '-profile-general-info', 4.hours.from_now) do %>
  12 + <tr>
  13 + <th colspan='2'>
  14 + <%= _('Content') %>
  15 + </th>
  16 + </tr>
  17 + <tr>
  18 + <td>
  19 + <%= _('Content published:') %>
  20 + </td>
  21 + <td>
  22 + <%= link_to _('Site map'), :controller => 'profile', :action => 'sitemap' %>
  23 + </td>
  24 + </tr>
  25 + <tr>
  26 + <td>
  27 + <%= _('Tags:') %>
  28 + </td>
  29 + <td>
  30 + <%= tag_cloud @tags, :id, { :action => 'tag' }, :max_size => 18, :min_size => 10%>
  31 + </td>
  32 + </tr>
  33 + <% end %>
33 34 </table>
34   -<% end %>
... ...