Commit b16df6d9a6fc8c39e42f233455805dacc83e46e0

Authored by AurelioAHeckert
1 parent 2011e00c

ActionItem488: better profile list and "search for sellers" box

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2091 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/public/search_controller.rb
... ... @@ -177,12 +177,12 @@ class SearchController < ApplicationController
177 177 @results = {}
178 178 @names = {}
179 179 [
180   - [ :people, _('Recently registered people'), @finder.recent('people') ],
181   - [ :communities, _('Recently created communities'), @finder.recent('communities') ],
182   - [ :articles, _('Recent articles'), @finder.recent('articles') ],
  180 + [ :people, _('Newer profiles'), @finder.recent('people') ],
  181 + [ :communities, _('Newer communities'), @finder.recent('communities') ],
  182 + [ :articles, _('Newer articles'), @finder.recent('articles') ],
183 183 [ :most_commented_articles, _('Most commented articles'), @finder.most_commented_articles ],
184   - [ :enterprises, _('Recently created enterprises'), @finder.recent('enterprises') ],
185   - [ :events, _('Recently added events'), @finder.current_events(params[:year], params[:month]) ]
  184 + [ :enterprises, _('Newer enterprises'), @finder.recent('enterprises') ],
  185 + [ :events, _('Near events TODO'), @finder.current_events(params[:year], params[:month]) ]
186 186 ].each do |key, name, list|
187 187 @results[key] = list
188 188 @names[key] = name
... ...
app/helpers/application_helper.rb
... ... @@ -424,6 +424,8 @@ module ApplicationHelper
424 424 def profile_image(profile, size=:portrait, opt={})
425 425 opt[:alt] ||= profile.name()
426 426 opt[:title] ||= ''
  427 + opt[:class] ||= ''
  428 + opt[:class] += ( profile.class == Person ? ' photo' : ' logo' )
427 429 image_tag(profile_icon(profile, size), opt )
428 430 end
429 431  
... ... @@ -446,10 +448,18 @@ module ApplicationHelper
446 448  
447 449 # displays a link to the profile homepage with its image (as generated by
448 450 # #profile_image) and its name below it.
449   - def profile_image_link(profile, size=:portrait)
450   - link_to( '<div>'+ profile_image(profile, size) +'</div><span>'+ profile.name() +'</span>', profile.url,
451   - :class => 'profile_link',
452   - :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name )
  451 + def profile_image_link( profile, size=:portrait, tag='li' )
  452 + #link_to( '<div>'+ profile_image(profile, size) +'</div><span>'+ profile.name() +'</span>', profile.url,
  453 + # :class => 'profile_link',
  454 + # :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name )
  455 + content_tag tag,
  456 + link_to(
  457 + content_tag( 'span', profile_image(profile, size), :class => 'profile-image' ) +
  458 + content_tag( 'span', profile.name(), :class => ( profile.class == Person ? 'fn' : 'org' ) ),
  459 + profile.url,
  460 + :class => 'profile_link url',
  461 + :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name ),
  462 + :class => 'vcard'
453 463 end
454 464  
455 465 def text_field_with_local_autocomplete(name, choices, html_options = {})
... ...
app/models/profile_list_block.rb
... ... @@ -64,15 +64,21 @@ class ProfileListBlock &lt; Block
64 64 title = self.title
65 65 nl = "\n"
66 66 lambda do
67   - list = profiles.map {|item| content_tag( 'li', profile_image_link(item) ) }.join("\n ")
  67 + #list = profiles.map {|item| content_tag( 'li', profile_image_link(item) ) }.join("\n ")
  68 + count=0
  69 + list = profiles.map {|item|
  70 + count+=1
  71 + profile_image_link( item ) #+
  72 + #( ( count%2 == 0 && count < profiles.size ) ? nl+'</tr><tr>' : '' )
  73 + }.join("\n ")
68 74 if list.empty?
69 75 list = '<div class="common-profile-list-block-none">'+ _('None') +'</div>'
70 76 else
71   - list = content_tag( 'ul', nl +' '+ list + nl )
  77 + list = content_tag 'ul', nl +' '+ list + nl
72 78 end
  79 + block_title(title) + nl +
73 80 '<div class="common-profile-list-block">' +
74   - nl + block_title(title) + nl + list + nl +
75   - '</div>'
  81 + nl + list + nl + '</div>'
76 82 end
77 83 end
78 84  
... ...
app/views/search/_sellers_form.rhtml
1 1 <h3><%= _('Search for sellers') %></h3>
  2 +
2 3 <% form_tag({:controller => 'search', :action => 'assets'}, {:method => 'get'}) do %>
3   - <p class="search-in-opt"><%= _('Search in:') %><dir>
4   - <%= labelled_radio_button _('Products'), 'asset', 'products', true %><br />
5   - <%= labelled_radio_button _('Enterprises'), 'asset', 'enterprises', false %></dir></p>
6   - <p class="search-distance-opt"><%= labelled_text_field _('Distance (km): '), 'radius' %></p>
7   - <p class="search-from-opt"><%= labelled_text_field _('From: '), 'region[name]', nil, :id => 'search_region_block' %></p>
8   - <div id='search_region_block_auto_complete' class='auto-complete'></div>
9   - <%= auto_complete_field('search_region_block', :url => {:controller => 'search', :action => 'complete_region'}) %>
10   - <br/>
11   - <%= submit_tag _('Search') %>
  4 +
  5 + <div class="search-in-opt"><%= _('Search in:') %>
  6 + <dir>
  7 + <%= labelled_radio_button _('Products'), 'asset', 'products', true %><br />
  8 + <%= labelled_radio_button _('Enterprises'), 'asset', 'enterprises', false %>
  9 + </dir>
  10 + </div>
  11 +
  12 + <div class="formfield search-distance-opt">
  13 + <%= labelled_text_field _('Distance (km): '), 'radius' %>
  14 + </div>
  15 + <div class="formfield search-from-opt">
  16 + <%= labelled_text_field _('From: '), 'region[name]', nil, :id => 'search_region_block' %>
  17 + <div id="search_region_block_auto_complete" class="auto-complete"></div>
  18 + <%= auto_complete_field('search_region_block', :url => {:controller => 'search', :action => 'complete_region'}) %>
  19 + </div>
  20 +
  21 + <div class="button-bar">
  22 + <%= submit_tag _('Search'), :class => 'button with-text icon-search' %>
  23 + </div>
  24 +
12 25 <% end %>
... ...
public/designs/themes/ecosol/stylesheets/blocks/profile-list-block.css
1 1  
2   -.common-profile-list-block {
3   - color: #B8CFE7;
4   -}
5   -
6   -#content .common-profile-list-block .block-title {
7   - font-size: 14px;
8   -}
9   -
10   -.common-profile-list-block li a {
11   - border: 2px solid #FFF;
12   -}
13   -
14   -.common-profile-list-block li a:hover {
15   - border: 2px solid #2A5896;
16   - background: #B8CFE7;
17   - color: #035;
18   -}
19   -
20   -.enterprises-block .block-footer-content,
21   -.friends-block .block-footer-content,
22   -.communities-block .block-footer-content {
23   - text-align: center;
24   - font-size: 80%;
25   - padding: 5px 0px 0px 0px;
26   -}
27   -.msie .enterprises-block .block-footer-content,
28   -.msie .friends-block .block-footer-content,
29   -.msie .communities-block .block-footer-content {
30   - padding: 0px;
31   - margin-top: -5px;
32   -}
33   -
34   -.common-profile-list-block-none {
35   - font-style: italic;
36   - margin-bottom: -10px;
37   -}
38   -.msie .common-profile-list-block-none {
39   - margin-bottom: 0px;
40   - padding-bottom: 10px;
41   -}
42   -
43   -.common-profile-list-block .button-bar {
44   - padding-top: 15px;
45   - clear: left;
  2 +.common-profile-list-block .vcard a {
  3 + -moz-border-radius: 10px;
  4 + color: #026;
46 5 }
47 6  
... ...
public/designs/themes/zen3/stylesheets/blocks/profile-list-block.css
1 1  
2   -.common-profile-list-block li a {
3   - border: 2px solid transparent;
4   - color: #C00;
5   - -moz-border-radius: 4px;
6   -}
7   -.msie6 .common-profile-list-block li a {
8   - border: 2px solid #FFF;
  2 +.common-profile-list-block .vcard a {
  3 + -moz-border-radius: 10px;
9 4 }
10 5  
11   -.common-profile-list-block li a:hover {
  6 +.common-profile-list-block .vcard a:hover {
12 7 border: 2px solid #C00;
13   - background: #fcaf3e;
  8 + background: #FCAF3E;
14 9 color: #FFF;
15 10 }
16 11  
... ...
public/designs/themes/zen3/stylesheets/login-box.css
1 1  
2 2 .login-box-content {
3 3 border: 2px solid #A40000;
4   - background: #fcaf3e;
  4 + background: #FCAF3E;
5 5 }
6 6  
... ...
public/stylesheets/blocks/profile-list-block.css
1   -.common-profile-list-block {
2   - text-align: center;
3   -}
4 1  
5   -.common-profile-list-block ul {
  2 +#content .common-profile-list-block ul,
  3 +#content .common-profile-list-block li {
6 4 margin: 0px;
7 5 padding: 0px;
  6 + list-style: none;
  7 + display: inline;
8 8 }
9 9  
10   -#content .common-profile-list-block li {
11   - list-style: none;
12   - margin: 0px;
13   - padding: 0px;
  10 +.common-profile-list-block .vcard a {
  11 + width: 92px;
  12 + height: 95px;
  13 + max-height: 92px;
  14 + padding-top: 3px;
  15 + margin: 0px 2px;
14 16 float: left;
  17 + border: 2px solid transparent;
  18 + text-align: center;
  19 + overflow: hidden;
  20 + font-size: 11px;
  21 + text-decoration: none;
  22 + color: #000;
  23 +}
  24 +.msie6 .common-profile-list-block .vcard a {
  25 + border: 2px solid #FFF;
  26 +}
  27 +.common-profile-list-block .vcard a:hover {
  28 + border: 2px solid #2A5896;
  29 + background: #B8CFE7;
15 30 }
16 31  
17   -.common-profile-list-block li a {
  32 +.common-profile-list-block span {
18 33 display: block;
19   - height: 100px;
20   - padding-top: 2px;
21   - width: 96px;
22 34 overflow: hidden;
23   - text-decoration: none;
24   - font-size: 9px;
25   -}
26   -.msie .common-profile-list-block li a {
27   - line-height: 10px;
28   - cursor: pointer;
29 35 }
30 36  
31   -.common-profile-list-block li div {
  37 +.common-profile-list-block .profile-image {
32 38 width: 96px;
  39 + display: table-cell;
  40 + vertical-align: middle;
33 41 height: 64px;
34 42 }
35 43  
36   -.common-profile-list-block li span {
37   - display: block;
38   - width: 92px;
39   -}
40   -
41   -.common-profile-list-block li img {
  44 +.common-profile-list-block img {
42 45 border: none;
43 46 }
44 47  
... ...