Commit 17cff0555257a000ea3dbf37290b9947ac239a10
1 parent
a43f1346
Exists in
master
and in
28 other branches
ActionItem265: added profile photo
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1964 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
37 additions
and
3 deletions
Show diff stats
app/helpers/search_helper.rb
| ... | ... | @@ -39,4 +39,24 @@ module SearchHelper |
| 39 | 39 | content_tag('div', data[:toggle] + (render :partial => data[:partial]), :class => "map-or-list-search-results #{data[:class]}") |
| 40 | 40 | end |
| 41 | 41 | |
| 42 | + def display_profile_info(profile) | |
| 43 | + profile = Enterprise.find :first | |
| 44 | + table_rows = '' | |
| 45 | + profile.summary.each do |item| | |
| 46 | + name = item[0] | |
| 47 | + value = item[1] | |
| 48 | + if value.is_a?(Proc) | |
| 49 | + value = self.instance_eval(value) | |
| 50 | + end | |
| 51 | + table_rows << content_tag('tr', content_tag('td', _(name)) + content_tag('td', value)) | |
| 52 | + end | |
| 53 | + content_tag( 'table', | |
| 54 | + content_tag( 'tr', | |
| 55 | + content_tag('td', content_tag('div', profile_image(profile, :thumb), :class => 'profile-info-picture')) + | |
| 56 | + content_tag('td', content_tag('table', table_rows)) | |
| 57 | + ), | |
| 58 | + :class => 'profile-info' | |
| 59 | + ) | |
| 60 | + end | |
| 61 | + | |
| 42 | 62 | end | ... | ... |
app/views/search/_google_maps.rhtml
| ... | ... | @@ -7,13 +7,13 @@ |
| 7 | 7 | |
| 8 | 8 | <script type='text/javascript'> |
| 9 | 9 | |
| 10 | -function putMarker(lat, lng, title) { | |
| 10 | +function putMarker(lat, lng, title, summary) { | |
| 11 | 11 | var point = new GLatLng(lat, lng); |
| 12 | 12 | var options = { 'title' : title }; |
| 13 | 13 | var marker = new GMarker(point, options); |
| 14 | 14 | map.addOverlay(marker); |
| 15 | 15 | GEvent.addListener(marker, 'click', function() { |
| 16 | - map.openInfoWindowHtml(point, title); | |
| 16 | + map.openInfoWindowHtml(point, summary); | |
| 17 | 17 | }); |
| 18 | 18 | } |
| 19 | 19 | |
| ... | ... | @@ -34,7 +34,7 @@ if (GBrowserIsCompatible()) { |
| 34 | 34 | results.each do |item| |
| 35 | 35 | if item.lat && item.lng |
| 36 | 36 | %> |
| 37 | - putMarker(<%= item.lat.to_json %>, <%= item.lng.to_json %>, <%= item.name.to_json %>); | |
| 37 | + putMarker(<%= item.lat.to_json %>, <%= item.lng.to_json %>, <%= item.name.to_json %>, <%= display_profile_info(item).to_json %>); | |
| 38 | 38 | <% |
| 39 | 39 | end |
| 40 | 40 | end | ... | ... |
| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | +require File.dirname(__FILE__) + '/../test_helper' | |
| 2 | + | |
| 3 | +class SearchHelperTest < Test::Unit::TestCase | |
| 4 | + | |
| 5 | + def setup | |
| 6 | + @profile = mock | |
| 7 | + @helper = mock | |
| 8 | + helper.extend(SearchHelper) | |
| 9 | + end | |
| 10 | + attr_reader :profile, :helper | |
| 11 | + | |
| 12 | + should 'display profile info' | |
| 13 | + | |
| 14 | +end | ... | ... |