Commit 0fa194678c323f3a13625b71da2e09cc959143dc

Authored by Joenio Costa
2 parents 46ab6d44 49e084f8

Merge branch 'stable'

HACKING
... ... @@ -70,3 +70,17 @@ environment, you must run the delayed_job server like this:
70 70 ./script/delayed_job run
71 71  
72 72 This will block your terminal. To stop the delayed_job server, hit Control-C.
  73 +
  74 +== Enabling exceptions notification
  75 +
  76 +By default, exception notifications are disabled in development environment. If
  77 +you want to enable it then you need to change some files:
  78 +
  79 +1) Add in config/environments/development.rb:
  80 + config.action_controller.consider_all_requests_local = false
  81 +
  82 +2) Add in app/controller/application.rb:
  83 + local_addresses.clear
  84 +
  85 +3) Add in config/noosfero.yml at development section:
  86 + exception_recipients: [admin@example.com]
... ...
app/helpers/dates_helper.rb
... ... @@ -46,7 +46,7 @@ module DatesHelper
46 46 if (date1 == date2) || (date2.nil?)
47 47 show_date(date1)
48 48 else
49   - _('from %s to %s') % [show_date(date1), show_date(date2)]
  49 + _('from %{date1} to %{date2}') % {:date1 => show_date(date1), :date2 => show_date(date2)}
50 50 end
51 51 end
52 52  
... ...
app/helpers/forms_helper.rb
... ... @@ -111,6 +111,18 @@ module FormsHelper
111 111 ))
112 112 end
113 113  
  114 + def options_for_select_with_title(container, selected = nil)
  115 + container = container.to_a if Hash === container
  116 +
  117 + options_for_select = container.inject([]) do |options, element|
  118 + text, value = option_text_and_value(element)
  119 + selected_attribute = ' selected="selected"' if option_value_selected?(value, selected)
  120 + options << %(<option title="#{html_escape(text.to_s)}" value="#{html_escape(value.to_s)}"#{selected_attribute}>#{html_escape(text.to_s)}</option>)
  121 + end
  122 +
  123 + options_for_select.join("\n")
  124 + end
  125 +
114 126 protected
115 127 def self.next_id_number
116 128 if defined? @@id_num
... ...
app/models/community.rb
... ... @@ -39,10 +39,6 @@ class Community &lt; Organization
39 39 end
40 40 end
41 41  
42   - def display_name
43   - self.name
44   - end
45   -
46 42 def active_fields
47 43 environment ? environment.active_community_fields : []
48 44 end
... ...
app/models/create_community.rb
... ... @@ -74,10 +74,6 @@ class CreateCommunity &lt; Task
74 74 true
75 75 end
76 76  
77   - def display_name
78   - self.name
79   - end
80   -
81 77 # tells if this request was rejected
82 78 def rejected?
83 79 self.status == Task::Status::CANCELLED
... ...
app/views/box_organizer/_article_block.rhtml
1   -
  1 +<div class='article-block-edition'>
2 2 <% if @block.box.owner.kind_of?(Environment) and @block.box.owner.portal_community.nil? %>
3 3 <p id='no_portal_community'>
4 4 <%= _("You don't have an community defined as the portal community. Define it before use this block properly.") %>
5 5 </p>
6 6 <% else %>
7 7 <% articles = @block.available_articles.select {|article| !article.folder? } %>
8   - <%= select('block', 'article_id', articles.map {|item| [ item.path, item.id]}) %>
  8 + <%= select_tag('block[article_id]', options_for_select_with_title(articles.map {|item| [item.path, item.id]})) %>
9 9 <% end %>
  10 +</div>
... ...
app/views/profile/_profile.rhtml
... ... @@ -10,7 +10,9 @@
10 10 <% end %>
11 11  
12 12 <% if @profile.organization? %>
13   - <% tabs << {:title => _('What\'s new'), :id => 'profile-network', :content => (render :partial => 'profile_network')} %>
  13 + <% if @profile.public? || (logged_in? && current_person.follows?(@profile)) %>
  14 + <% tabs << {:title => _('What\'s new'), :id => 'profile-network', :content => (render :partial => 'profile_network')} %>
  15 + <% end %>
14 16 <% tabs << {:title => _('Profile'), :id => 'organization-profile', :content => (render :partial => 'organization_profile')} %>
15 17 <% elsif @profile.person? %>
16 18 <% if logged_in? && current_person.follows?(@profile) %>
... ...
app/views/tasks/_suggest_article_accept_details.rhtml
... ... @@ -5,6 +5,7 @@
5 5 <%= labelled_form_field(_("Source URL"), f.text_field(:source)) %>
6 6  
7 7 <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task]", 'article_parent_id', task.target) %>
  8 +<%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %>
8 9  
9 10 <div>
10 11 <%= labelled_form_field(_('Lead'), f.text_area(:article_abstract, :style => 'width: 482px; height: 200px;')) %>
... ...
debian/changelog
  1 +noosfero (0.28.3) unstable; urgency=low
  2 +
  3 + * Bugfixes Version release. (Closes: AI#1837 AI#1857 AI#1656 AI#1750 AI#1846 AI#1853 AI#1841 AI#1847 AI#1812 AI#1858)
  4 +
  5 + -- Joenio Costa <joenio@perl.org.br> Fri, 11 Feb 2011 22:54:24 -0300
  6 +
1 7 noosfero (0.28.2) unstable; urgency=low
2 8  
3 9 * Bugfixes Version release.
... ...
features/private_profile.feature
... ... @@ -29,3 +29,14 @@ Feature: private profiles
29 29 And I follow "Add friend"
30 30 When I go to shygirl's homepage
31 31 Then I should not see "Add friend"
  32 +
  33 + Scenario: viewing a private community profile shouldn't show the news if not logged or not a member
  34 + Given I am on Safernet's homepage
  35 + Then I should not see "What's new"
  36 + And I am logged in as "joao"
  37 + When I am on Safernet's homepage
  38 + Then I should not see "What's new"
  39 + And "joao" is a member of "Safernet"
  40 + When I am on Safernet's homepage
  41 + Then I should see "What's new"
  42 +
... ...
features/step_definitions/noosfero_steps.rb
... ... @@ -337,3 +337,13 @@ Given /^the community &quot;(.+)&quot; is closed$/ do |community|
337 337 community.closed = true
338 338 community.save
339 339 end
  340 +
  341 +Given /^someone suggested the following article to be published$/ do |table|
  342 + SuggestArticle.skip_captcha!
  343 + table.hashes.map{|item| item.dup}.each do |item|
  344 + target = Community[item.delete('target')]
  345 + task = SuggestArticle.create!(:target => target, :data => item)
  346 + end
  347 +end
  348 +
  349 +
... ...
features/suggest_article.feature 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +Feature: suggest article
  2 + As a not logged user
  3 + I want to suggest an article
  4 + In order to share it with other users
  5 +
  6 + Background:
  7 + Given the following users
  8 + | login | name |
  9 + | joaosilva | Joao Silva |
  10 + And the following communities
  11 + | identifier | name |
  12 + | sample-community | Sample Community |
  13 + And "Joao Silva" is admin of "Sample Community"
  14 +
  15 + Scenario: highlight an article before approval of a suggested article
  16 + Given someone suggested the following article to be published
  17 + | target | article_name | article_body | name | email |
  18 + | sample-community | A suggested article | this is an article about whales | jose | jose@example.org |
  19 + When I am logged in as "joaosilva"
  20 + And I go to Sample Community's control panel
  21 + And I follow "Process requests"
  22 + And I should see "suggested the publication of the article"
  23 + Then I should see "Highlight this article" within ".task_box"
... ...
lib/noosfero.rb
1 1 module Noosfero
2 2 PROJECT = 'noosfero'
3   - VERSION = '0.28.2'
  3 + VERSION = '0.28.3'
4 4  
5 5 def self.pattern_for_controllers_in_directory(dir)
6 6 disjunction = controllers_in_directory(dir).join('|')
... ...
po/pt/noosfero.po
... ... @@ -13,7 +13,7 @@ msgid &quot;&quot;
13 13 msgstr ""
14 14 "Project-Id-Version: noosfero 0.28.0\n"
15 15 "POT-Creation-Date: 2011-02-02 21:38-0300\n"
16   -"PO-Revision-Date: 2011-02-02 21:39-0300\n"
  16 +"PO-Revision-Date: 2011-02-10 14:54-0300\n"
17 17 "Last-Translator: Joenio Costa <joenio@colivre.coop.br>\n"
18 18 "Language-Team: LANGUAGE TEAM <E-MAIL@ADDRESS or HOME PAGE>\n"
19 19 "MIME-Version: 1.0\n"
... ... @@ -1660,7 +1660,7 @@ msgstr &quot;O conteúdo aqui está disponível apenas para os amigos do(a) %s.&quot;
1660 1660 #: app/controllers/public/profile_controller.rb:246
1661 1661 msgid "The contents in this community is available to members only."
1662 1662 msgstr ""
1663   -"O conteúdo desta comuninidade está disponível apenas para os seus membros."
  1663 +"O conteúdo desta comunidade está disponível apenas para os seus membros."
1664 1664  
1665 1665 #: app/controllers/public/profile_controller.rb:252
1666 1666 msgid ""
... ...
public/javascripts/application.js
... ... @@ -461,6 +461,7 @@ function new_qualifier_row(selector, select_qualifiers) {
461 461  
462 462 // controls the display of the login/logout stuff
463 463 jQuery(function($) {
  464 + $.ajaxSetup({cache: false});
464 465 $.getJSON('/account/user_data', function userDataCallBack(data) {
465 466 if (data.login) {
466 467 // logged in
... ...
public/stylesheets/application.css
... ... @@ -2068,6 +2068,8 @@ input.disabled {
2068 2068  
2069 2069 .common-profile-list-block img {
2070 2070 border: none;
  2071 + width: 50px;
  2072 + height: 50px;
2071 2073 }
2072 2074  
2073 2075 .box-2 .common-profile-list-block span,
... ... @@ -3942,6 +3944,15 @@ h1#agenda-title {
3942 3944 margin: 5px 0px 5px 160px;
3943 3945 }
3944 3946  
  3947 +.controller-profile_design .article-block-edition select,
  3948 +.controller-profile_design .article-block-edition option {
  3949 + width: 300px;
  3950 +}
  3951 +
  3952 +.controller-profile_design .article-block-edition option {
  3953 + overflow-x: hidden;
  3954 +}
  3955 +
3945 3956 /* ==> public/stylesheets/controller_profile_editor.css <== */
3946 3957  
3947 3958 .controller-profile_editor .categorie_box .button {
... ... @@ -5511,6 +5522,8 @@ h1#agenda-title {
5511 5522 padding: 1px;
5512 5523 border: 1px solid #ccc;
5513 5524 margin: 4px 3px 0 0;
  5525 + width: 20px;
  5526 + height: 20px;
5514 5527 }
5515 5528  
5516 5529 .profile-wall-image {
... ... @@ -5536,6 +5549,12 @@ h1#agenda-title {
5536 5549 text-align: center;
5537 5550 }
5538 5551  
  5552 +#profile-network .upload_image .profile-network-text span img,
  5553 +#profile-activity .upload_image .profile-activity-text span img {
  5554 + width: auto;
  5555 + height: auto;
  5556 +}
  5557 +
5539 5558 #profile-network .upload_image .profile-network-text img,
5540 5559 #profile-activity .upload_image .profile-activity-text img {
5541 5560 padding: 0;
... ...
test/functional/environment_design_controller_test.rb
... ... @@ -70,7 +70,7 @@ class EnvironmentDesignControllerTest &lt; Test::Unit::TestCase
70 70 article.expects(:path).returns('some_path')
71 71 article.expects(:id).returns(1)
72 72 get :edit, :id => l.id
73   - assert_tag :tag => 'select', :attributes => { :id => 'block_article_id' }
  73 + assert_tag :tag => 'select', :attributes => { :id => 'block[article_id]' }
74 74 end
75 75  
76 76 should 'be able to edit ArticleBlock without portal community' do
... ...
test/unit/dates_helper_test.rb
... ... @@ -20,7 +20,7 @@ class DatesHelperTest &lt; Test::Unit::TestCase
20 20 expects(:show_date).with(date1).returns('XXX')
21 21 date2 = mock
22 22 expects(:show_date).with(date2).returns('YYY')
23   - expects(:_).with('from %s to %s').returns('from %s to %s')
  23 + expects(:_).with('from %{date1} to %{date2}').returns('from %{date1} to %{date2}')
24 24 assert_equal 'from XXX to YYY', show_period(date1, date2)
25 25 end
26 26  
... ... @@ -36,6 +36,18 @@ class DatesHelperTest &lt; Test::Unit::TestCase
36 36 assert_equal 'XXX', show_period(date1)
37 37 end
38 38  
  39 + should 'not crash with events that have start_date and end_date' do
  40 + FastGettext.default_text_domain = 'noosferofull'
  41 + assert_nothing_raised do
  42 + Noosfero.locales.keys.each do |key|
  43 + Noosfero.with_locale(key) do
  44 + show_period(Date.today, Date.tomorrow)
  45 + end
  46 + end
  47 + end
  48 + FastGettext.default_text_domain = 'noosferotest'
  49 + end
  50 +
39 51 should 'show day of week' do
40 52 expects(:_).with("Sunday").returns("Domingo")
41 53 date = mock
... ...
test/unit/forms_helper_test.rb
... ... @@ -4,6 +4,7 @@ class FormsHelperTest &lt; Test::Unit::TestCase
4 4  
5 5 include FormsHelper
6 6 include ActionView::Helpers::TagHelper
  7 + include ActionView::Helpers::FormOptionsHelper
7 8  
8 9 should 'wrapper required fields in <span class=required-field>' do
9 10 content = required('<input type=text name=test>')
... ... @@ -20,6 +21,11 @@ class FormsHelperTest &lt; Test::Unit::TestCase
20 21 assert_tag_in_string content, :tag => 'label', :content => 'highlighted', :attributes => {:class => 'pseudoformlabel'}
21 22 end
22 23  
  24 + should 'show title for option in select' do
  25 + content = options_for_select_with_title({'option_value' => 'option_title'})
  26 + assert_tag_in_string content, :tag => 'option', :attributes => {:title => 'option_value'}
  27 + end
  28 +
23 29 protected
24 30  
25 31 def _(text)
... ...