Commit 00863a6ed8fefc951a0d17b103813c7168938853
Committed by
Rodrigo Souto
1 parent
52e81c77
Exists in
web_steps_improvements
and in
9 other branches
Avoid fetch of profile in link_to_homepage
Closes !467 Signed-off-by: Braulio Bhavamitra <brauliobo@gmail.com> Signed-off-by: Rodrigo Souto <rodrigo@colivre.coop.br>
Showing
6 changed files
with
7 additions
and
13 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -148,14 +148,8 @@ module ApplicationHelper |
148 | 148 | link_to text, profile_path(:profile => profile) , options |
149 | 149 | end |
150 | 150 | |
151 | - def link_to_homepage(text, profile = nil, options = {}) | |
152 | - p = if profile | |
153 | - Profile[profile] | |
154 | - else | |
155 | - user | |
156 | - end | |
157 | - | |
158 | - link_to text, p.url, options | |
151 | + def link_to_homepage(text, profile, options = {}) | |
152 | + link_to text, profile.url, options | |
159 | 153 | end |
160 | 154 | |
161 | 155 | def link_if_permitted(link, permission = nil, target = nil) | ... | ... |
app/views/account/index.html.erb
app/views/region_validators/region.html.erb
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | <ul> |
6 | 6 | <% for validator in @region.validators %> |
7 | 7 | <li> |
8 | - <%= link_to_homepage validator.name, validator.identifier %> | |
8 | + <%= link_to_homepage validator.name, validator %> | |
9 | 9 | <%= link_to _('Remove validation rights'), { :action => 'remove', :id => @region.id, :validator_id => validator }, :method => 'post' %> |
10 | 10 | </li> |
11 | 11 | <% end %> | ... | ... |
app/views/search/_full_enterprise.html.erb
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | @order == 'more_recent' ? enterprise.send(@order + '_label') + show_date(enterprise.created_at) : enterprise.send(@order + '_label') %> |
6 | 6 | </div> |
7 | 7 | <div class="search-enterprise-item-column-right"> |
8 | - <%= link_to_homepage(enterprise.name, enterprise.identifier, :class => "search-result-title") %> | |
8 | + <%= link_to_homepage enterprise.name, enterprise, class: "search-result-title" %> | |
9 | 9 | <div class="search-enterprise-description"> |
10 | 10 | <% if enterprise.description %> |
11 | 11 | <% body_stripped = strip_tags(enterprise.description) %> | ... | ... |
app/views/search/_full_product.html.erb
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | <div class="search-product-item-second-column"> |
45 | 45 | <%= link_to_product product, :class => 'search-result-title' %> |
46 | 46 | <div class="search-product-supplier"> |
47 | - <span class="search-field-label"><%= _('Supplier') %> </span><%= link_to_homepage(product.enterprise.name, product.enterprise.identifier) %> | |
47 | + <span class="search-field-label"><%= _('Supplier') %> </span><%= link_to_homepage product.enterprise.name, product.enterprise %> | |
48 | 48 | </div> |
49 | 49 | <div class="search-product-description"> |
50 | 50 | <% if product.description %> | ... | ... |
plugins/sub_organizations/views/sub_organizations_plugin_profile/_full_related_organizations.html.erb
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | <%= profile_image_link organization, :big, 'div' %> |
11 | 11 | </div> |
12 | 12 | <div class="related-organizations-item-column-right"> |
13 | - <%= link_to_homepage(organization.name, organization.identifier, :class => "search-result-title") %> | |
13 | + <%= link_to_homepage(organization.name, organization, :class => "search-result-title") %> | |
14 | 14 | <div class="related-organizations-description"> |
15 | 15 | <% if organization.description %> |
16 | 16 | <% body_stripped = strip_tags(organization.description) %> | ... | ... |