Commit b6ca02d8104ac851128f79d937dd96acee23d6d2
1 parent
90f4f1c1
Exists in
master
and in
27 other branches
Move hard coded list of profiles from view to SearchHelper
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing
2 changed files
with
8 additions
and
2 deletions
Show diff stats
app/helpers/search_helper.rb
| ... | ... | @@ -21,6 +21,12 @@ module SearchHelper |
| 21 | 21 | 'more_comments' => _('More comments') |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | + COMMON_PROFILE_LIST_BLOCK = [ | |
| 25 | + :enterprises, | |
| 26 | + :people, | |
| 27 | + :communities | |
| 28 | + ] | |
| 29 | + | |
| 24 | 30 | # FIXME remove it after search_controler refactored |
| 25 | 31 | include EventsHelper |
| 26 | 32 | |
| ... | ... | @@ -94,7 +100,7 @@ module SearchHelper |
| 94 | 100 | compact_link = display?(asset, :compact) ? (display == 'compact' ? _('Compact') : link_to(_('Compact'), params.merge(:display => 'compact'))) : nil |
| 95 | 101 | map_link = display?(asset, :map) ? (display == 'map' ? _('Map') : link_to(_('Map'), params.merge(:display => 'map'))) : nil |
| 96 | 102 | full_link = display?(asset, :full) ? (display == 'full' ? _('Full') : link_to(_('Full'), params.merge(:display => 'full'))) : nil |
| 97 | - content_tag('div', | |
| 103 | + content_tag('div', | |
| 98 | 104 | content_tag('strong', _('Display')) + ': ' + [compact_link, map_link, full_link].compact.join(' | ').html_safe, |
| 99 | 105 | :class => 'search-customize-options' |
| 100 | 106 | ) | ... | ... |
app/views/search/_display_results.html.erb
| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | |
| 15 | 15 | <% display = display_filter(name, params[:display]) %> |
| 16 | 16 | |
| 17 | - <div class="search-results-innerbox search-results-type-<%= name.to_s.singularize %> <%= 'common-profile-list-block' if [:enterprises, :people, :communities].include?(name) %>"> | |
| 17 | + <div class="search-results-innerbox search-results-type-<%= name.to_s.singularize %> <%= 'common-profile-list-block' if SearchHelper::COMMON_PROFILE_LIST_BLOCK.include?(name) %>"> | |
| 18 | 18 | <ul> |
| 19 | 19 | <% search[:results].each do |hit| %> |
| 20 | 20 | <% partial = partial_for_class(hit.class, display) %> | ... | ... |