Commit 0d1b2d3f767f54a25eb4041551b17be2955de414

Authored by Daniela Feitosa
2 parents 1ceb891e 54e2f909

Merge branch 'stable'

app/controllers/application_controller.rb
@@ -42,7 +42,8 @@ class ApplicationController < ActionController::Base @@ -42,7 +42,8 @@ class ApplicationController < ActionController::Base
42 def set_locale 42 def set_locale
43 FastGettext.available_locales = Noosfero.available_locales 43 FastGettext.available_locales = Noosfero.available_locales
44 FastGettext.default_locale = Noosfero.default_locale 44 FastGettext.default_locale = Noosfero.default_locale
45 - I18n.locale = FastGettext.locale = (params[:lang] || session[:lang] || Noosfero.default_locale || request.env['HTTP_ACCEPT_LANGUAGE'] || 'en') 45 + FastGettext.locale = (params[:lang] || session[:lang] || Noosfero.default_locale || request.env['HTTP_ACCEPT_LANGUAGE'] || 'en')
  46 + I18n.locale = FastGettext.locale
46 if params[:lang] 47 if params[:lang]
47 session[:lang] = params[:lang] 48 session[:lang] = params[:lang]
48 end 49 end
app/helpers/tags_helper.rb
@@ -20,12 +20,12 @@ module TagsHelper @@ -20,12 +20,12 @@ module TagsHelper
20 # 20 #
21 # <tt>options</tt> can include one or more of the following: 21 # <tt>options</tt> can include one or more of the following:
22 # 22 #
23 - # * <tt>:max_size</tt>: font size for the tag with largest count  
24 - # * <tt>:min_size</tt>: font size for the tag with smallest count 23 + # * <tt>:max_size</tt>: font size for the tag with largest count
  24 + # * <tt>:min_size</tt>: font size for the tag with smallest count
25 # * <tt>:show_count</tt>: whether to show the count of contents for each tag. Defauls to <tt>false</tt>. 25 # * <tt>:show_count</tt>: whether to show the count of contents for each tag. Defauls to <tt>false</tt>.
26 - # 26 + #
27 # The algorithm for generating the different sizes and positions is a 27 # The algorithm for generating the different sizes and positions is a
28 - # courtesy of Aurelio: http://www.colivre.coop.br/Aurium/Nuvem 28 + # courtesy of Aurelio: http://www.colivre.coop.br/Aurium/Nuvem
29 # (pt_BR only). 29 # (pt_BR only).
30 def tag_cloud(tags, tagname_option, url, options = {}) 30 def tag_cloud(tags, tagname_option, url, options = {})
31 31
@@ -41,7 +41,15 @@ module TagsHelper @@ -41,7 +41,15 @@ module TagsHelper
41 max = tags.values.max.to_f 41 max = tags.values.max.to_f
42 min = tags.values.min.to_f 42 min = tags.values.min.to_f
43 43
44 - tags.sort_by{ |k,v| k.downcase }.map do |tag,count| 44 + # Uses iconv to translate utf8 strings to ascii.
  45 + # If can't translate a character, ignore it.
  46 + require 'iconv'
  47 + utf8_to_ascii = Iconv.new("ASCII//TRANSLIT//IGNORE","UTF8")
  48 + # Sorts first based on translated strings and then, if they are equal, based on the original form.
  49 + # This way variant characters falls on the same level as their base characters and don't end up
  50 + # at the end of the tag list.
  51 + # Example: AA ÁA AB Z instead of AA AB Z ÁA
  52 + tags.collect{ |k,v| [utf8_to_ascii.iconv(k).downcase, [k,v]] }.sort.collect { |ascii, t| t }.map do |tag,count|
45 if ( max == min ) 53 if ( max == min )
46 v = 0.5 54 v = 0.5
47 else 55 else
app/views/blocks/featured_products.rhtml
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <div class="featured-product-text"> 14 <div class="featured-product-text">
15 <h3><%= p.name %></h3> 15 <h3><%= p.name %></h3>
16 <p class="featured-product-price"><%= float_to_currency(p.price) %></p> 16 <p class="featured-product-price"><%= float_to_currency(p.price) %></p>
17 - <p class="featured-product-desc"><%= p.description.chars[0...50].to_s + '...' %></p> 17 + <p class="featured-product-desc"><%= truncate(p.description, 50, '...') %></p>
18 <p><%= link_to _('See More'), product_path(p), :class => 'featured-product-link' %></p> 18 <p><%= link_to _('See More'), product_path(p), :class => 'featured-product-link' %></p>
19 </div> 19 </div>
20 </div> 20 </div>
app/views/manage_products/_edit_info.rhtml
@@ -21,6 +21,10 @@ @@ -21,6 +21,10 @@
21 <td class='formlabel'><%= _('Available') %></td> 21 <td class='formlabel'><%= _('Available') %></td>
22 <td class='formfield'><%= labelled_radio_button( _('Yes'), 'product[available]', true, @product.available, :id => 'product_available') + labelled_radio_button( _('No'), 'product[available]', false, !@product.available) %></td> 22 <td class='formfield'><%= labelled_radio_button( _('Yes'), 'product[available]', true, @product.available, :id => 'product_available') + labelled_radio_button( _('No'), 'product[available]', false, !@product.available) %></td>
23 </tr> 23 </tr>
  24 + <tr>
  25 + <td><%= f.label :highlighted, _('Highlight this product?'), :class => 'formlabel' %></td>
  26 + <td class='formfield'><%= f.check_box(:highlighted) %></td>
  27 + </tr>
24 </table> 28 </table>
25 29
26 <% if !environment.qualifiers.empty? %> 30 <% if !environment.qualifiers.empty? %>
debian/changelog
  1 +noosfero (0.36.6) unstable; urgency=low
  2 +
  3 + * Bugfixes release
  4 +
  5 + -- Daniela Soares Feitosa <daniela@colivre.coop.br> Mon, 14 May 2012 22:05:26 -0300
  6 +
1 noosfero (0.36.5) unstable; urgency=low 7 noosfero (0.36.5) unstable; urgency=low
2 8
3 * Bugfixes release 9 * Bugfixes release
debian/noosfero.install
@@ -16,7 +16,7 @@ config/environment.rb usr/share/noosfero/config @@ -16,7 +16,7 @@ config/environment.rb usr/share/noosfero/config
16 config/environments usr/share/noosfero/config 16 config/environments usr/share/noosfero/config
17 config/initializers usr/share/noosfero/config 17 config/initializers usr/share/noosfero/config
18 config/routes.rb usr/share/noosfero/config 18 config/routes.rb usr/share/noosfero/config
19 -config/locales/ usr/share/noosfero/config 19 +config/locales usr/share/noosfero/config
20 20
21 plugins usr/share/noosfero 21 plugins usr/share/noosfero
22 22
features/featured_products_block.feature
@@ -20,6 +20,7 @@ Feature: featured_products_block @@ -20,6 +20,7 @@ Feature: featured_products_block
20 | owner | category | name | description | highlighted | 20 | owner | category | name | description | highlighted |
21 | redemoinho | automobile | Car | Red Car | true | 21 | redemoinho | automobile | Car | Red Car | true |
22 | redemoinho | automobile | Truck | Blue Truck | true | 22 | redemoinho | automobile | Truck | Blue Truck | true |
  23 + | redemoinho | automobile | Moto | Very long description of and auto-mobile moto to be truncated | true |
23 And I am logged in as "eddievedder" 24 And I am logged in as "eddievedder"
24 25
25 @selenium 26 @selenium
@@ -33,3 +34,14 @@ Feature: featured_products_block @@ -33,3 +34,14 @@ Feature: featured_products_block
33 Then I should see "Car" 34 Then I should see "Car"
34 And I should not see "float_to_currency" 35 And I should not see "float_to_currency"
35 And I should not see "product_path" 36 And I should not see "product_path"
  37 +
  38 + @selenium
  39 + Scenario: display block with long description
  40 + Given I follow "Manage my groups"
  41 + And I follow "Control panel of this group"
  42 + And I follow "Edit sideboxes"
  43 + And I follow "Edit" within ".featured-products-block"
  44 + And I select "Moto"
  45 + And I press "Save"
  46 + When I am on redemoinho's homepage
  47 + Then I should see "Very long description of and auto-mobile moto to b..."
features/manage_products.feature
@@ -526,3 +526,17 @@ Feature: manage products @@ -526,3 +526,17 @@ Feature: manage products
526 And I follow "Delete qualifier" 526 And I follow "Delete qualifier"
527 And I press "Save" 527 And I press "Save"
528 Then I should not see "Organic (Self declared)" 528 Then I should not see "Organic (Self declared)"
  529 +
  530 + @selenium
  531 + Scenario: Show checkbox to mark product as highlight
  532 + Given the following product_category
  533 + | name |
  534 + | Bicycle |
  535 + And the following products
  536 + | owner | category | name |
  537 + | redemoinho | bicycle | Bike |
  538 + And I am logged in as "joaosilva"
  539 + When I go to Rede Moinho's page of product Bike
  540 + And I follow "Add price and other basic information"
  541 + Then I should see "Highlight this product?"
  542 + And I check "Highlight this product?"
features/session_and_cookies_handling.feature
@@ -16,6 +16,15 @@ Feature: session and cookies handling @@ -16,6 +16,15 @@ Feature: session and cookies handling
16 When I go to the homepage 16 When I go to the homepage
17 Then there must be no cookies 17 Then there must be no cookies
18 18
  19 + Scenario: user_data, not logged in
  20 + When I make a AJAX request to the user data path
  21 + Then there must be no cookies
  22 +
  23 + Scenario: user_data, logged in
  24 + Given I am logged in as admin
  25 + When I make a AJAX request to the user data path
  26 + Then there must be a cookie "_noosfero_session"
  27 +
19 # FIXME for some reason I could not test this scenario, although manual tests 28 # FIXME for some reason I could not test this scenario, although manual tests
20 # indicate this works! 29 # indicate this works!
21 # Scenario: logout 30 # Scenario: logout
features/step_definitions/noosfero_steps.rb
@@ -576,3 +576,8 @@ end @@ -576,3 +576,8 @@ end
576 Given /^the cache is turned (on|off)$/ do |state| 576 Given /^the cache is turned (on|off)$/ do |state|
577 ActionController::Base.perform_caching = (state == 'on') 577 ActionController::Base.perform_caching = (state == 'on')
578 end 578 end
  579 +
  580 +When /^I make a AJAX request to (.*)$/ do |page|
  581 + header 'X-Requested-With', 'XMLHttpRequest'
  582 + visit(path_to(page))
  583 +end
features/support/paths.rb
@@ -96,6 +96,9 @@ module NavigationHelpers @@ -96,6 +96,9 @@ module NavigationHelpers
96 when /^chat$/ 96 when /^chat$/
97 '/chat' 97 '/chat'
98 98
  99 + when /the user data path/
  100 + '/account/user_data'
  101 +
99 # Add more mappings here. 102 # Add more mappings here.
100 # Here is a more fancy example: 103 # Here is a more fancy example:
101 # 104 #
lib/noosfero.rb
@@ -2,7 +2,7 @@ require &#39;fast_gettext&#39; @@ -2,7 +2,7 @@ require &#39;fast_gettext&#39;
2 2
3 module Noosfero 3 module Noosfero
4 PROJECT = 'noosfero' 4 PROJECT = 'noosfero'
5 - VERSION = '0.36.5' 5 + VERSION = '0.36.6'
6 6
7 def self.pattern_for_controllers_in_directory(dir) 7 def self.pattern_for_controllers_in_directory(dir)
8 disjunction = controllers_in_directory(dir).join('|') 8 disjunction = controllers_in_directory(dir).join('|')
plugins/google_cse/views/search-box.rhtml
1 <script type="text/javascript"> 1 <script type="text/javascript">
2 jQuery(function($) { 2 jQuery(function($) {
3 $('<%= locals[:selector] %>') 3 $('<%= locals[:selector] %>')
4 - .attr({class: "cse-search-box", action: "<%= GoogleCsePlugin.results_url_path %>"}) 4 + .attr({'class': "cse-search-box", 'action': "<%= GoogleCsePlugin.results_url_path %>"})
5 .append('<input type="hidden" name="cx" value="<%= locals[:plugin].google_id %>" /><input type="hidden" name="cof" value="FORID:10" /><input type="hidden" name="ie" value="UTF-8" /><input type="hidden" name="siteurl" value="<%= context.environment.default_hostname %>">') 5 .append('<input type="hidden" name="cx" value="<%= locals[:plugin].google_id %>" /><input type="hidden" name="cof" value="FORID:10" /><input type="hidden" name="ie" value="UTF-8" /><input type="hidden" name="siteurl" value="<%= context.environment.default_hostname %>">')
6 .children("input[name='query']") 6 .children("input[name='query']")
7 .attr('name', 'q') 7 .attr('name', 'q')
public/designs/themes/base/style.css
@@ -63,6 +63,10 @@ body, th, td, input { @@ -63,6 +63,10 @@ body, th, td, input {
63 background-color: white; 63 background-color: white;
64 } 64 }
65 65
  66 +.msie7 #wrap-2 {
  67 + height: 100%;
  68 +}
  69 +
66 #content { 70 #content {
67 margin-top: 105px; 71 margin-top: 105px;
68 } 72 }
@@ -632,13 +636,6 @@ div#notice { @@ -632,13 +636,6 @@ div#notice {
632 height: auto; 636 height: auto;
633 } 637 }
634 638
635 -.communities-block .vcard a {  
636 - clear: left;  
637 - text-align: left;  
638 - padding-bottom: 3px;  
639 - width: 99%;  
640 - height: auto;  
641 -}  
642 .msie7 .communities-block .common-profile-list-block .vcard a { 639 .msie7 .communities-block .common-profile-list-block .vcard a {
643 height: auto; 640 height: auto;
644 width: 99%; 641 width: 99%;
script/quick-start-debian
@@ -21,7 +21,7 @@ runtime_dependencies=$(sed -e &#39;1,/^Depends:/d; /^Recommends:/,$ d; s/([^)]*)//g; @@ -21,7 +21,7 @@ runtime_dependencies=$(sed -e &#39;1,/^Depends:/d; /^Recommends:/,$ d; s/([^)]*)//g;
21 run sudo apt-get -y install $runtime_dependencies 21 run sudo apt-get -y install $runtime_dependencies
22 22
23 # needed for development 23 # needed for development
24 -run sudo apt-get -y install libtidy-ruby libhpricot-ruby libmocha-ruby imagemagick po4a xvfb 24 +run sudo apt-get -y install libtidy-ruby libhpricot-ruby libmocha-ruby imagemagick po4a xvfb libxml2-dev libxslt-dev
25 run gem install bundler 25 run gem install bundler
26 run bundle install 26 run bundle install
27 27
test/functional/application_controller_test.rb
@@ -334,6 +334,12 @@ class ApplicationControllerTest &lt; ActionController::TestCase @@ -334,6 +334,12 @@ class ApplicationControllerTest &lt; ActionController::TestCase
334 assert_tag :html, :attributes => { :lang => 'es' } 334 assert_tag :html, :attributes => { :lang => 'es' }
335 end 335 end
336 336
  337 + should 'set Rails locale correctly' do
  338 + @request.env['HTTP_ACCEPT_LANGUAGE'] = 'pt-BR,pt;q=0.8,en;q=0.6,en-US;q=0.4'
  339 + get :index
  340 + assert_equal 'pt', I18n.locale.to_s
  341 + end
  342 +
337 should 'include stylesheets supplied by plugins' do 343 should 'include stylesheets supplied by plugins' do
338 class Plugin1 < Noosfero::Plugin 344 class Plugin1 < Noosfero::Plugin
339 def stylesheet? 345 def stylesheet?
test/unit/tags_helper_test.rb
@@ -18,4 +18,14 @@ class TagsHelperTest &lt; ActiveSupport::TestCase @@ -18,4 +18,14 @@ class TagsHelperTest &lt; ActiveSupport::TestCase
18 assert_equal %w(aTag beTag tag1 Tag2 Tag3).join("\n"), result 18 assert_equal %w(aTag beTag tag1 Tag2 Tag3).join("\n"), result
19 end 19 end
20 20
  21 + should 'order tags alphabetically with special characters' do
  22 + result = tag_cloud(
  23 + { 'aula'=>9, 'área'=>2, 'area'=>2, 'avião'=>2, 'armário'=>2,
  24 + 'A'=>1, 'Á'=>1, 'AB'=>1, 'ÁA'=>1 },
  25 + :id,
  26 + { :host=>'noosfero.org', :controller=>'test', :action=>'tag' }
  27 + )
  28 + assert_equal %w(A Á ÁA AB area área armário aula avião).join("\n"), result
  29 + end
  30 +
21 end 31 end
vendor/plugins/noosfero_caching/init.rb
@@ -27,7 +27,7 @@ module NoosferoHttpCaching @@ -27,7 +27,7 @@ module NoosferoHttpCaching
27 end 27 end
28 28
29 def noosfero_session_check 29 def noosfero_session_check
30 - return if params[:controller] == 'account' || request.xhr? 30 + return if (params[:controller] == 'account' && params[:action] != 'user_data')
31 headers["X-Noosfero-Auth"] = (session[:user] != nil).to_s 31 headers["X-Noosfero-Auth"] = (session[:user] != nil).to_s
32 end 32 end
33 33