Commit 7020cd0e9a0000e4e3aa83e2674ae3cbe66f489b
Exists in
master
and in
29 other branches
Merge branch 'stable'
Conflicts: debian/changelog lib/noosfero.rb
Showing
26 changed files
with
196 additions
and
79 deletions
Show diff stats
app/helpers/content_viewer_helper.rb
@@ -20,14 +20,18 @@ module ContentViewerHelper | @@ -20,14 +20,18 @@ module ContentViewerHelper | ||
20 | unless args[:no_link] | 20 | unless args[:no_link] |
21 | title = content_tag('h1', link_to(article.name, article.url), :class => 'title') | 21 | title = content_tag('h1', link_to(article.name, article.url), :class => 'title') |
22 | end | 22 | end |
23 | - comments = args[:no_comments] ? '' : (("- %s") % link_to_comments(article)) | 23 | + comments = '' |
24 | + unless args[:no_comments] || !article.accept_comments | ||
25 | + comments = ("- %s") % link_to_comments(article) | ||
26 | + end | ||
24 | title << content_tag('span', _("%s, by %s %s") % [show_date(article.published_at), link_to(article.author_name, article.author.url), comments], :class => 'created-at') | 27 | title << content_tag('span', _("%s, by %s %s") % [show_date(article.published_at), link_to(article.author_name, article.author.url), comments], :class => 'created-at') |
25 | end | 28 | end |
26 | title | 29 | title |
27 | end | 30 | end |
28 | 31 | ||
29 | def link_to_comments(article, args = {}) | 32 | def link_to_comments(article, args = {}) |
30 | - link_to( number_of_comments(article), article.url.merge(:anchor => 'comments_list') ) | 33 | + return '' unless article.accept_comments? |
34 | + link_to(number_of_comments(article), article.url.merge(:anchor => 'comments_list') ) | ||
31 | end | 35 | end |
32 | 36 | ||
33 | def article_translations(article) | 37 | def article_translations(article) |
app/helpers/search_helper.rb
@@ -65,7 +65,7 @@ module SearchHelper | @@ -65,7 +65,7 @@ module SearchHelper | ||
65 | data << content_tag('strong', _('Address: ')) + profile.address + '<br/>' | 65 | data << content_tag('strong', _('Address: ')) + profile.address + '<br/>' |
66 | end | 66 | end |
67 | unless profile.products.empty? | 67 | unless profile.products.empty? |
68 | - data << content_tag('strong', _('Products/Services: ')) + profile.products.map{|i| link_to(i.name, :controller => 'catalog', :profile => profile.identifier, :action => 'show', :id => i.id)}.join(', ') + '<br/>' | 68 | + data << content_tag('strong', _('Products/Services: ')) + profile.products.map{|i| link_to(i.name, :controller => 'manage_products', :profile => profile.identifier, :action => 'show', :id => i.id)}.join(', ') + '<br/>' |
69 | end | 69 | end |
70 | if profile.respond_to?(:distance) and !profile.distance.nil? | 70 | if profile.respond_to?(:distance) and !profile.distance.nil? |
71 | data << content_tag('strong', _('Distance: ')) + "%.2f%" % profile.distance + '<br/>' | 71 | data << content_tag('strong', _('Distance: ')) + "%.2f%" % profile.distance + '<br/>' |
app/models/uploaded_file.rb
@@ -30,6 +30,10 @@ class UploadedFile < Article | @@ -30,6 +30,10 @@ class UploadedFile < Article | ||
30 | title.blank? ? name : title | 30 | title.blank? ? name : title |
31 | end | 31 | end |
32 | 32 | ||
33 | + def first_paragraph | ||
34 | + '' | ||
35 | + end | ||
36 | + | ||
33 | def self.max_size | 37 | def self.max_size |
34 | UploadedFile.attachment_options[:max_size] | 38 | UploadedFile.attachment_options[:max_size] |
35 | end | 39 | end |
@@ -50,7 +54,7 @@ class UploadedFile < Article | @@ -50,7 +54,7 @@ class UploadedFile < Article | ||
50 | 54 | ||
51 | def self.icon_name(article = nil) | 55 | def self.icon_name(article = nil) |
52 | if article | 56 | if article |
53 | - article.image? ? article.public_filename(:icon) : article.mime_type.gsub(/[\/+.]/, '-') | 57 | + article.image? ? article.public_filename(:icon) : (article.mime_type ? article.mime_type.gsub(/[\/+.]/, '-') : 'upload-file') |
54 | else | 58 | else |
55 | 'upload-file' | 59 | 'upload-file' |
56 | end | 60 | end |
app/views/cms/_event.rhtml
@@ -15,5 +15,4 @@ | @@ -15,5 +15,4 @@ | ||
15 | 15 | ||
16 | <%= labelled_form_field(_('Address:'), text_field(:article, :address)) %> | 16 | <%= labelled_form_field(_('Address:'), text_field(:article, :address)) %> |
17 | 17 | ||
18 | -<%= labelled_form_field(_('Information about the event:'), text_area(:article, :body, :cols => 64, :class => 'mceEditor')) %> | ||
19 | - | 18 | +<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Information about the event:'} %> |
app/views/cms/_textile_article.rhtml
@@ -5,17 +5,4 @@ | @@ -5,17 +5,4 @@ | ||
5 | <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64')) %> | 5 | <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64')) %> |
6 | 6 | ||
7 | <%= render :partial => 'translatable' %> | 7 | <%= render :partial => 'translatable' %> |
8 | - | ||
9 | -<br style="clear: both;"/> | ||
10 | -<%= button :add, _("Lead"), '#', :id => "lead-button", :style => "margin-left: 0px;" %> | ||
11 | -<em><%= _('Used when a short version of your text is needed.') %></em> | ||
12 | - | ||
13 | -<div id="article-lead"> | ||
14 | - <%= labelled_form_field(_('Lead'), text_area(:article, 'abstract', :cols => 64, :rows => 10)) %> | ||
15 | -</div> | ||
16 | -<div style="margin-top: 10px;"> | ||
17 | - <%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 64, :rows => 30)) %> | ||
18 | -</div> | ||
19 | - | ||
20 | -<%= javascript_include_tag 'article'%> | ||
21 | - | 8 | +<%= render :partial => 'shared/lead_and_body' %> |
app/views/cms/_tiny_mce_article.rhtml
@@ -12,18 +12,5 @@ | @@ -12,18 +12,5 @@ | ||
12 | <% end %> | 12 | <% end %> |
13 | 13 | ||
14 | <%= render :partial => 'translatable' %> | 14 | <%= render :partial => 'translatable' %> |
15 | - | ||
16 | - <br style="clear: both;"/> | ||
17 | - <%= button :add, _("Lead"), '#', :id => "lead-button", :style => "margin-left: 0px;" %> | ||
18 | - <em><%= _('Used when a short version of your text is needed.') %></em> | ||
19 | - | ||
20 | - <div id="article-lead"> | ||
21 | - <%= labelled_form_field(_('Lead'), text_area(:article, 'abstract', :style => 'width: 100%; height: 200px;', :class => 'mceEditor')) %> | ||
22 | - </div> | ||
23 | - <div style="margin-top: 10px;"> | ||
24 | - <%= labelled_form_field(_('Text'), text_area(:article, 'body', :style => 'width:100%; height: 500px;', :class => 'mceEditor')) %> | ||
25 | - </div> | ||
26 | - | 15 | + <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true} %> |
27 | </div> | 16 | </div> |
28 | - | ||
29 | -<%= javascript_include_tag 'article' %> |
app/views/cms/suggest_an_article.rhtml
@@ -16,16 +16,7 @@ | @@ -16,16 +16,7 @@ | ||
16 | 16 | ||
17 | <%= required labelled_form_field(_('Email'), text_field(:task, 'email')) %> | 17 | <%= required labelled_form_field(_('Email'), text_field(:task, 'email')) %> |
18 | 18 | ||
19 | - <br style="clear: both;"/> | ||
20 | - <%= button :add, _("Lead"), '#', :id => "lead-button", :style => "margin-left: 0px;" %> | ||
21 | - <em><%= _('Used when a short version of your text is needed.') %></em> | ||
22 | - | ||
23 | - <div id="article-lead"> | ||
24 | - <%= labelled_form_field(_('Lead'), text_area(:task , 'article_abstract', :style => 'width: 100%; height: 200px;', :class => 'mceEditor')) %> | ||
25 | - </div> | ||
26 | - <div style="margin-top: 10px;"> | ||
27 | - <%= labelled_form_field(_('Text'), text_area(:task, 'article_body', :style => 'width:100%; height: 500px;', :class => 'mceEditor')) %> | ||
28 | - </div> | 19 | + <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :object => :task, :abstract_method => 'article_abstract', :body_method => 'article_body'} %> |
29 | 20 | ||
30 | <div id="captcha"> | 21 | <div id="captcha"> |
31 | <%= labelled_form_field(_("What is the result of '%s = ?'") % @task.captcha.task, text_field(:task, 'captcha_solution')) %> | 22 | <%= labelled_form_field(_("What is the result of '%s = ?'") % @task.captcha.task, text_field(:task, 'captcha_solution')) %> |
@@ -39,5 +30,3 @@ | @@ -39,5 +30,3 @@ | ||
39 | <%= button :cancel, _('Cancel'), @back_to %> | 30 | <%= button :cancel, _('Cancel'), @back_to %> |
40 | <% end %> | 31 | <% end %> |
41 | <% end %> | 32 | <% end %> |
42 | - | ||
43 | -<%= javascript_include_tag 'article' %> |
@@ -0,0 +1,29 @@ | @@ -0,0 +1,29 @@ | ||
1 | +<% object ||= :article %> | ||
2 | +<% abstract_label ||= 'Lead' %> | ||
3 | +<% abstract_method ||= :abstract %> | ||
4 | +<% body_label ||= 'Text' %> | ||
5 | +<% body_method ||= :body %> | ||
6 | +<% editor_type = defined?(tiny_mce) && tiny_mce ? 'mceEditor' : '' %> | ||
7 | +<% lead_id ||= 0%> | ||
8 | +<% f ||= false%> | ||
9 | + | ||
10 | +<br style="clear: both;"/> | ||
11 | +<%= button :add, _("Lead"), '#', :class => "lead-button", :article_id => "#article-lead-"+lead_id.to_s, :style => "margin-left: 0px;" %> | ||
12 | +<em><%= _('Used when a short version of your text is needed.') %></em> | ||
13 | + | ||
14 | +<div class='article-lead' id="article-lead-<%=lead_id.to_s%>"> | ||
15 | + <% if f %> | ||
16 | + <%= labelled_form_field(_(abstract_label), f.text_area(abstract_method, :style => 'width: 98%; height: 200px;', :class => editor_type)) %> | ||
17 | + <% else %> | ||
18 | + <%= labelled_form_field(_(abstract_label), text_area(object, abstract_method, :style => 'width: 98%; height: 200px;', :class => editor_type)) %> | ||
19 | + <% end %> | ||
20 | +</div> | ||
21 | +<div style="margin-top: 10px;"> | ||
22 | + <% if f %> | ||
23 | + <%= labelled_form_field(_(body_label), f.text_area(body_method, :style => 'width: 98%; height: 400px;', :class => editor_type)) %> | ||
24 | + <% else %> | ||
25 | + <%= labelled_form_field(_(body_label), text_area(object, body_method, :style => 'width: 98%; height: 400px;', :class => editor_type)) %> | ||
26 | + <% end %> | ||
27 | +</div> | ||
28 | + | ||
29 | +<%= javascript_include_tag 'article'%> |
app/views/tasks/_approve_article_accept_details.rhtml
@@ -4,21 +4,8 @@ | @@ -4,21 +4,8 @@ | ||
4 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task]", 'article_parent_id', task.target) %> | 4 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task]", 'article_parent_id', task.target) %> |
5 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> | 5 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> |
6 | 6 | ||
7 | -<div> | ||
8 | - <% if task.article && task.article.tiny_mce? %> | ||
9 | - <%= labelled_form_field(_('Lead'), f.text_area(:abstract, :style => 'width: 482px; height: 200px;', :class => 'mceEditor')) %> | ||
10 | - <% else %> | ||
11 | - <%= labelled_form_field(_('Lead'), f.text_area(:abstract, :style => 'width: 482px; height: 200px;')) %> | ||
12 | - <% end %> | ||
13 | -</div> | ||
14 | -<em><%= _('Used when a short version your text is needed.') %></em> | 7 | +<% tiny = task.article && task.article.tiny_mce? ? {:tiny_mce => true} : {} %> |
8 | +<%= render :partial => 'shared/lead_and_body', :locals => {:lead_id => task.id, :f => f}.merge(tiny)%> | ||
15 | 9 | ||
16 | -<div style="margin-top: 10px;"> | ||
17 | - <% if task.article && task.article.tiny_mce? %> | ||
18 | - <%= labelled_form_field(_('Text'), f.text_area(:body, :style => 'width:482px; height: 500px;', :class => 'mceEditor')) %> | ||
19 | - <% else %> | ||
20 | - <%= labelled_form_field(_('Text'), f.text_area(:body, :style => 'width:482px; height: 500px;')) %> | ||
21 | - <% end %> | ||
22 | -</div> | ||
23 | <%= labelled_form_field _('Comment for author'), f.text_field(:closing_statment, :style => 'width: 488px;') %> | 10 | <%= labelled_form_field _('Comment for author'), f.text_field(:closing_statment, :style => 'width: 488px;') %> |
24 | 11 |
app/views/tasks/_suggest_article_accept_details.rhtml
@@ -9,11 +9,4 @@ | @@ -9,11 +9,4 @@ | ||
9 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task]", 'article_parent_id', task.target) %> | 9 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task]", 'article_parent_id', task.target) %> |
10 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> | 10 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> |
11 | 11 | ||
12 | -<div> | ||
13 | - <%= labelled_form_field(_('Lead'), f.text_area(:article_abstract, :style => 'width: 482px; height: 200px;', :class => 'mceEditor')) %> | ||
14 | -</div> | ||
15 | -<em><%= _('Used when a short version your text is needed.') %></em> | ||
16 | - | ||
17 | -<div style="margin-top: 10px;"> | ||
18 | - <%= labelled_form_field(_('Text'), f.text_area(:article_body, :style => 'width:482px; height: 500px;', :class => 'mceEditor')) %> | ||
19 | -</div> | 12 | +<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :f => f, :abstract_method => 'article_abstract', :body_method => 'article_body', :lead_id => task.id} %> |
config/initializers/exception_notification.rb
1 | unless NOOSFERO_CONF['exception_recipients'].blank? | 1 | unless NOOSFERO_CONF['exception_recipients'].blank? |
2 | + require 'noosfero.rb' | ||
2 | require 'exception_notification.rb' | 3 | require 'exception_notification.rb' |
3 | ExceptionNotifier.sender_address = "noreply@#{Noosfero.default_hostname}" | 4 | ExceptionNotifier.sender_address = "noreply@#{Noosfero.default_hostname}" |
4 | ExceptionNotifier.email_prefix = "[Noosfero ERROR] " | 5 | ExceptionNotifier.email_prefix = "[Noosfero ERROR] " |
db/migrate/20110302214607_move_data_serialized_hash_to_setting_field_for_events.rb
0 → 100644
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +class MoveDataSerializedHashToSettingFieldForEvents < ActiveRecord::Migration | ||
2 | + def self.up | ||
3 | + select_all("SELECT id FROM articles WHERE type = 'Event' AND body LIKE '%:link:%'").each do |data| | ||
4 | + article = Event.find(data['id']) | ||
5 | + body = '' | ||
6 | + begin | ||
7 | + body = YAML.load(article.body) | ||
8 | + rescue | ||
9 | + # do nothing | ||
10 | + next | ||
11 | + end | ||
12 | + if body.kind_of?(Hash) | ||
13 | + settings = article.setting.merge(body) | ||
14 | + body = ActiveRecord::Base.sanitize_sql_for_assignment(:body => settings[:description]) | ||
15 | + update("UPDATE articles set %s WHERE id = %d" % [body, article.id]) | ||
16 | + setting = ActiveRecord::Base.sanitize_sql_for_assignment(:setting => settings.to_yaml) | ||
17 | + update("UPDATE articles set %s WHERE id = %d" % [setting, article.id]) | ||
18 | + end | ||
19 | + end | ||
20 | + end | ||
21 | + | ||
22 | + def self.down | ||
23 | + say "Nothing to undo" | ||
24 | + end | ||
25 | +end |
db/schema.rb
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | # | 9 | # |
10 | # It's strongly recommended to check this file into your version control system. | 10 | # It's strongly recommended to check this file into your version control system. |
11 | 11 | ||
12 | -ActiveRecord::Schema.define(:version => 20110228174632) do | 12 | +ActiveRecord::Schema.define(:version => 20110302214607) do |
13 | 13 | ||
14 | create_table "action_tracker", :force => true do |t| | 14 | create_table "action_tracker", :force => true do |t| |
15 | t.integer "user_id" | 15 | t.integer "user_id" |
@@ -31,8 +31,8 @@ ActiveRecord::Schema.define(:version => 20110228174632) do | @@ -31,8 +31,8 @@ ActiveRecord::Schema.define(:version => 20110228174632) do | ||
31 | t.integer "profile_id" | 31 | t.integer "profile_id" |
32 | end | 32 | end |
33 | 33 | ||
34 | - add_index "action_tracker_notifications", ["action_tracker_id", "profile_id"], :name => "index_action_tracker_notifications_on_profile_id_and_action_tra", :unique => true | ||
35 | add_index "action_tracker_notifications", ["action_tracker_id"], :name => "index_action_tracker_notifications_on_action_tracker_id" | 34 | add_index "action_tracker_notifications", ["action_tracker_id"], :name => "index_action_tracker_notifications_on_action_tracker_id" |
35 | + add_index "action_tracker_notifications", ["profile_id", "action_tracker_id"], :name => "index_action_tracker_notifications_on_profile_id_and_action_tracker_id", :unique => true | ||
36 | add_index "action_tracker_notifications", ["profile_id"], :name => "index_action_tracker_notifications_on_profile_id" | 36 | add_index "action_tracker_notifications", ["profile_id"], :name => "index_action_tracker_notifications_on_profile_id" |
37 | 37 | ||
38 | create_table "article_versions", :force => true do |t| | 38 | create_table "article_versions", :force => true do |t| |
debian/changelog
1 | +noosfero (0.29.3) unstable; urgency=low | ||
2 | + | ||
3 | + * Bugfixes Version release. (Closes: AI#1760 AI#1907 AI#1899 AI#1891 AI#1904 AI#1888 AI#1869 AI#1900 AI#1914) | ||
4 | + | ||
5 | + -- Joenio Costa <joenio@colivre.coop.br> Fri, 11 Mar 2011 13:12:43 -0300 | ||
6 | + | ||
1 | noosfero (0.29.2) unstable; urgency=low | 7 | noosfero (0.29.2) unstable; urgency=low |
2 | 8 | ||
3 | * Bugfixes Version release. (Closes: AI#1922) | 9 | * Bugfixes Version release. (Closes: AI#1922) |
etc/init.d/noosfero
@@ -48,7 +48,7 @@ FERRET_PID_FILE=$NOOSFERO_DIR/tmp/pids/ferret.production.pid | @@ -48,7 +48,7 @@ FERRET_PID_FILE=$NOOSFERO_DIR/tmp/pids/ferret.production.pid | ||
48 | main_script() { | 48 | main_script() { |
49 | cd $NOOSFERO_DIR | 49 | cd $NOOSFERO_DIR |
50 | if [ "$NOOSFERO_USER" != "$USER" ]; then | 50 | if [ "$NOOSFERO_USER" != "$USER" ]; then |
51 | - su $NOOSFERO_USER -c "./script/production $1" | 51 | + su $NOOSFERO_USER -l -c "./script/production $1" |
52 | else | 52 | else |
53 | ./script/production $1 | 53 | ./script/production $1 |
54 | fi | 54 | fi |
features/events.feature
@@ -206,3 +206,27 @@ Feature: events | @@ -206,3 +206,27 @@ Feature: events | ||
206 | When I am on /profile/josesilva/events/2009/10/25 | 206 | When I am on /profile/josesilva/events/2009/10/25 |
207 | Then I should see "Unpublished event" | 207 | Then I should see "Unpublished event" |
208 | And I should see "25" link | 208 | And I should see "25" link |
209 | + | ||
210 | + Scenario: events have lead field | ||
211 | + Given I am logged in as "josesilva" | ||
212 | + And I am on josesilva's Event creation | ||
213 | + Then I should see "Lead" | ||
214 | + | ||
215 | + Scenario: events lead should be shown on blogs with short format | ||
216 | + Given I am logged in as "josesilva" | ||
217 | + And I am on josesilva's control panel | ||
218 | + And I follow "Configure blog" | ||
219 | + And I select "First paragraph" from "How to display posts:" | ||
220 | + And I press "Save" | ||
221 | + And I follow "New post" | ||
222 | + And I follow "Event" | ||
223 | + And I follow "Lead" | ||
224 | + And I fill in the following: | ||
225 | + | Title | Leaded event | | ||
226 | + | Information about the event | This is the real text.| | ||
227 | + | Lead | This is the abstract. | | ||
228 | + And I press "Save" | ||
229 | + When I am on josesilva's blog | ||
230 | + Then I should see "Leaded event" | ||
231 | + And I should see "This is the abstract." | ||
232 | + And I should not see "This is the real text." |
features/suggest_article.feature
@@ -21,3 +21,24 @@ Feature: suggest article | @@ -21,3 +21,24 @@ Feature: suggest article | ||
21 | And I follow "Process requests" | 21 | And I follow "Process requests" |
22 | And I should see "suggested the publication of the article" | 22 | And I should see "suggested the publication of the article" |
23 | Then I should see "Highlight this article" within ".task_box" | 23 | Then I should see "Highlight this article" within ".task_box" |
24 | + | ||
25 | + Scenario: an article is suggested and the admin approve it | ||
26 | + Given I am on Sample Community's blog | ||
27 | + And I follow "Suggest an article" | ||
28 | + And I fill in the following: | ||
29 | + | Title | Suggestion | | ||
30 | + | Your name | Some Guy | | ||
31 | + | Email | someguy@somewhere.com | | ||
32 | + | Lead | This is my suggestion's lead | | ||
33 | + | Text | I like free software | | ||
34 | + And I press "Save" | ||
35 | + And I am logged in as "joaosilva" | ||
36 | + And I go to Sample Community's control panel | ||
37 | + When I follow "Process requests" | ||
38 | + Then I should see "suggested the publication of the article: Suggestion." | ||
39 | + When I choose "Accept" | ||
40 | + And I select "sample-community/Blog" from "Select the folder where the article must be published" | ||
41 | + And I press "Apply!" | ||
42 | + And I go to Sample Community's blog | ||
43 | + Then I should see "Suggestion" | ||
44 | + Then I should see "I like free software" |
features/support/paths.rb
@@ -27,6 +27,12 @@ module NavigationHelpers | @@ -27,6 +27,12 @@ module NavigationHelpers | ||
27 | when /^(.*)'s homepage$/ | 27 | when /^(.*)'s homepage$/ |
28 | '/%s' % Profile.find_by_name($1).identifier | 28 | '/%s' % Profile.find_by_name($1).identifier |
29 | 29 | ||
30 | + when /^(.*)'s blog$/ | ||
31 | + '/%s/blog' % Profile.find_by_name($1).identifier | ||
32 | + | ||
33 | + when /^(.*)'s (.+) creation$/ | ||
34 | + '/myprofile/%s/cms/new?type=%s' % [Profile.find_by_name($1).identifier,$2] | ||
35 | + | ||
30 | when /^(.*)'s sitemap/ | 36 | when /^(.*)'s sitemap/ |
31 | '/profile/%s/sitemap' % Profile.find_by_name($1).identifier | 37 | '/profile/%s/sitemap' % Profile.find_by_name($1).identifier |
32 | 38 |
lib/noosfero.rb
1 | module Noosfero | 1 | module Noosfero |
2 | PROJECT = 'noosfero' | 2 | PROJECT = 'noosfero' |
3 | - VERSION = '0.29.2' | 3 | + VERSION = '0.29.3' |
4 | 4 | ||
5 | def self.pattern_for_controllers_in_directory(dir) | 5 | def self.pattern_for_controllers_in_directory(dir) |
6 | disjunction = controllers_in_directory(dir).join('|') | 6 | disjunction = controllers_in_directory(dir).join('|') |
public/javascripts/article.js
1 | (function($) { | 1 | (function($) { |
2 | - $("#lead-button").click(function(){ | 2 | + $(".lead-button").live('click', function(){ |
3 | + article_id = this.getAttribute("article_id"); | ||
3 | $(this).toggleClass('icon-add').toggleClass('icon-remove'); | 4 | $(this).toggleClass('icon-add').toggleClass('icon-remove'); |
4 | - $('#article-lead').slideToggle(); | 5 | + $(article_id).slideToggle(); |
5 | return false; | 6 | return false; |
6 | }) | 7 | }) |
7 | $("#body-button").click(function(){ | 8 | $("#body-button").click(function(){ |
public/stylesheets/application.css
@@ -1004,7 +1004,7 @@ code input { | @@ -1004,7 +1004,7 @@ code input { | ||
1004 | font-weight: normal; | 1004 | font-weight: normal; |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | -#article-lead, | 1007 | +.article-lead, |
1008 | #article-body-field { | 1008 | #article-body-field { |
1009 | margin-top: 10px; | 1009 | margin-top: 10px; |
1010 | display: none; | 1010 | display: none; |
test/functional/catalog_controller_test.rb
@@ -87,4 +87,10 @@ class CatalogControllerTest < Test::Unit::TestCase | @@ -87,4 +87,10 @@ class CatalogControllerTest < Test::Unit::TestCase | ||
87 | assert_tag :a, :attributes => { :href => "http://" + url}, :content => url.scan(/.{4}/).join('​') | 87 | assert_tag :a, :attributes => { :href => "http://" + url}, :content => url.scan(/.{4}/).join('​') |
88 | end | 88 | end |
89 | 89 | ||
90 | + should 'show action moved to manage_products controller' do | ||
91 | + assert_raise ActionController::RoutingError do | ||
92 | + get :show, :id => 1 | ||
93 | + end | ||
94 | + end | ||
95 | + | ||
90 | end | 96 | end |
test/integration/exception_notification_test.rb
@@ -9,9 +9,9 @@ class ExceptionNotificationTest < ActionController::IntegrationTest | @@ -9,9 +9,9 @@ class ExceptionNotificationTest < ActionController::IntegrationTest | ||
9 | ActionMailer::Base.delivery_method = :test | 9 | ActionMailer::Base.delivery_method = :test |
10 | ActionMailer::Base.perform_deliveries = true | 10 | ActionMailer::Base.perform_deliveries = true |
11 | ActionMailer::Base.deliveries = [] | 11 | ActionMailer::Base.deliveries = [] |
12 | - AccountController.any_instance.stubs(:signup).raises(RuntimeError) | ||
13 | - AccountController.any_instance.stubs(:local_request?).returns(false) | ||
14 | - AccountController.any_instance.stubs(:consider_all_requests_local).returns(false) | 12 | + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:signup).raises(RuntimeError)} |
13 | + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:local_request?).returns(false)} | ||
14 | + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:consider_all_requests_local).returns(false)} | ||
15 | end | 15 | end |
16 | 16 | ||
17 | should 'deliver mail notification about exceptions' do | 17 | should 'deliver mail notification about exceptions' do |
test/unit/content_viewer_helper_test.rb
@@ -46,6 +46,20 @@ class ContentViewerHelperTest < Test::Unit::TestCase | @@ -46,6 +46,20 @@ class ContentViewerHelperTest < Test::Unit::TestCase | ||
46 | assert_no_match /a href='#{article.url}'>#{article.name}</, result | 46 | assert_no_match /a href='#{article.url}'>#{article.name}</, result |
47 | end | 47 | end |
48 | 48 | ||
49 | + should 'not create link to comments if called with no_comments' do | ||
50 | + blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) | ||
51 | + article = fast_create(TextileArticle, :name => 'art test', :profile_id => profile.id, :parent_id => blog.id) | ||
52 | + result = article_title(article, :no_comments => true) | ||
53 | + assert_no_match(/a href='.*comments_list.*>No comments yet</, result) | ||
54 | + end | ||
55 | + | ||
56 | + should 'not create link to comments if the article doesn\'t allow comments' do | ||
57 | + blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) | ||
58 | + article = fast_create(TextileArticle, :name => 'art test', :profile_id => profile.id, :parent_id => blog.id, :accept_comments => false) | ||
59 | + result = article_title(article) | ||
60 | + assert_no_match(/a href='.*comments_list.*>No comments yet</, result) | ||
61 | + end | ||
62 | + | ||
49 | should 'count total of comments from post' do | 63 | should 'count total of comments from post' do |
50 | article = TextileArticle.new(:name => 'first post for test', :body => 'first post for test', :profile => profile) | 64 | article = TextileArticle.new(:name => 'first post for test', :body => 'first post for test', :profile => profile) |
51 | article.stubs(:url).returns({}) | 65 | article.stubs(:url).returns({}) |
@@ -54,6 +68,14 @@ class ContentViewerHelperTest < Test::Unit::TestCase | @@ -54,6 +68,14 @@ class ContentViewerHelperTest < Test::Unit::TestCase | ||
54 | assert_match /One comment/, result | 68 | assert_match /One comment/, result |
55 | end | 69 | end |
56 | 70 | ||
71 | + should 'not display total of comments if the article doesn\'t allow comments' do | ||
72 | + article = TextileArticle.new(:name => 'first post for test', :body => 'first post for test', :profile => profile, :accept_comments => false) | ||
73 | + article.stubs(:url).returns({}) | ||
74 | + article.stubs(:comments).returns([Comment.new(:author => profile, :title => 'test', :body => 'test')]) | ||
75 | + result = link_to_comments(article) | ||
76 | + assert_equal '', result | ||
77 | + end | ||
78 | + | ||
57 | should 'not list feed article' do | 79 | should 'not list feed article' do |
58 | profile.articles << Blog.new(:name => 'Blog test', :profile => profile) | 80 | profile.articles << Blog.new(:name => 'Blog test', :profile => profile) |
59 | assert_includes profile.blog.children.map{|i| i.class}, RssFeed | 81 | assert_includes profile.blog.children.map{|i| i.class}, RssFeed |
test/unit/search_helper_test.rb
@@ -55,6 +55,14 @@ class SearchHelperTest < Test::Unit::TestCase | @@ -55,6 +55,14 @@ class SearchHelperTest < Test::Unit::TestCase | ||
55 | assert_tag_in_string result, :tag => 'a', :attributes => {:href => /:id=>#{product2.id}/}, :content => product2.name | 55 | assert_tag_in_string result, :tag => 'a', :attributes => {:href => /:id=>#{product2.id}/}, :content => product2.name |
56 | end | 56 | end |
57 | 57 | ||
58 | + should 'link to manage_products controller on display_profile_info' do | ||
59 | + enterprise = fast_create(Enterprise) | ||
60 | + product = fast_create(Product, :enterprise_id => enterprise.id) | ||
61 | + result = display_profile_info(enterprise) | ||
62 | + assert_tag_in_string result, :tag => 'a', :attributes => {:href => /:controller=>\"manage_products\"/}, :content => product.name | ||
63 | + assert_no_tag_in_string result, :tag => 'a', :attributes => {:href => /:id=>\"catalog\"/}, :content => product.name | ||
64 | + end | ||
65 | + | ||
58 | protected | 66 | protected |
59 | include NoosferoTestHelper | 67 | include NoosferoTestHelper |
60 | 68 |
test/unit/uploaded_file_test.rb
@@ -275,4 +275,22 @@ class UploadedFileTest < Test::Unit::TestCase | @@ -275,4 +275,22 @@ class UploadedFileTest < Test::Unit::TestCase | ||
275 | assert_nil ActionTracker::Record.last(:conditions => { :verb => "upload_image" }) | 275 | assert_nil ActionTracker::Record.last(:conditions => { :verb => "upload_image" }) |
276 | end | 276 | end |
277 | 277 | ||
278 | + should 'not crash if first paragraph called' do | ||
279 | + f = fast_create(UploadedFile) | ||
280 | + assert_nothing_raised do | ||
281 | + f.first_paragraph | ||
282 | + end | ||
283 | + end | ||
284 | + | ||
285 | + should 'return empty string to lead if no abstract given' do | ||
286 | + f = fast_create(UploadedFile, :abstract => nil) | ||
287 | + assert_equal '', f.lead | ||
288 | + end | ||
289 | + | ||
290 | + should 'survive when try to get icon_name from a file with mime_type nil' do | ||
291 | + f = UploadedFile.new | ||
292 | + f.expects(:mime_type).returns(nil) | ||
293 | + assert_equal 'upload-file', UploadedFile.icon_name(f) | ||
294 | + end | ||
295 | + | ||
278 | end | 296 | end |