Commit 19bad6fc6ea1d7c8b96c402b61393f1cfb6958fe

Authored by Joenio Costa
2 parents 28f10e1d 4dbbc3e2

Merge branch 'stable'

Conflicts:
	public/stylesheets/application.css
app/models/event.rb
... ... @@ -116,6 +116,10 @@ class Event < Article
116 116 true
117 117 end
118 118  
  119 + def tiny_mce?
  120 + true
  121 + end
  122 +
119 123 include Noosfero::TranslatableContent
120 124 include MaybeAddHttp
121 125  
... ...
app/models/gallery.rb
... ... @@ -9,7 +9,7 @@ class Gallery < Folder
9 9 end
10 10  
11 11 include ActionView::Helpers::TagHelper
12   - def to_html(options)
  12 + def to_html(options={})
13 13 article = self
14 14 lambda do
15 15 render :file => 'content_viewer/image_gallery', :locals => {:article => article}
... ...
app/models/profile_search_block.rb
... ... @@ -4,10 +4,6 @@ class ProfileSearchBlock < Block
4 4 _('Display a form to search the profile')
5 5 end
6 6  
7   - def default_title
8   - _('Profile search')
9   - end
10   -
11 7 def content
12 8 title = self.title
13 9 lambda do
... ...
app/views/cms/_event.rhtml
... ... @@ -15,5 +15,5 @@
15 15  
16 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)) %>
  18 +<%= labelled_form_field(_('Information about the event:'), text_area(:article, :body, :cols => 64, :class => 'mceEditor')) %>
19 19  
... ...
app/views/cms/suggest_an_article.rhtml
... ... @@ -21,10 +21,10 @@
21 21 <em><%= _('Used when a short version of your text is needed.') %></em>
22 22  
23 23 <div id="article-lead">
24   - <%= labelled_form_field(_('Lead'), text_area(:task , 'article_abstract', :style => 'width: 100%; height: 200px;')) %>
  24 + <%= labelled_form_field(_('Lead'), text_area(:task , 'article_abstract', :style => 'width: 100%; height: 200px;', :class => 'mceEditor')) %>
25 25 </div>
26 26 <div style="margin-top: 10px;">
27   - <%= labelled_form_field(_('Text'), text_area(:task, 'article_body', :style => 'width:100%; height: 500px;')) %>
  27 + <%= labelled_form_field(_('Text'), text_area(:task, 'article_body', :style => 'width:100%; height: 500px;', :class => 'mceEditor')) %>
28 28 </div>
29 29  
30 30 <div id="captcha">
... ...
app/views/profile/_common.rhtml
... ... @@ -2,7 +2,7 @@
2 2 <script type="text/javascript">
3 3 jQuery( function() {
4 4 var parent_selector = '.profile-wall-description, .profile-activity-description, .profile-network-description';
5   - var child_selector = '.icon-delete, .icon-reply, .icon-scrap';
  5 + var child_selector = '.icon-delete, .icon-reply';
6 6 jQuery(parent_selector).live('mouseover', function () { jQuery(this).find(child_selector).css('visibility', 'visible'); });
7 7 jQuery(parent_selector).live('mouseout', function () { jQuery(this).find(child_selector).css('visibility', 'hidden'); });
8 8 });
... ...
app/views/profile/_profile_network_activities.rhtml
... ... @@ -3,7 +3,7 @@
3 3 <div class='profile-network-image'>
4 4 <%= link_to(profile_image(activity.user, :minor), activity.user.url) %>
5 5 <% if logged_in? && current_person.follows?(activity.user) && current_person != activity.user %>
6   - <p class='profile-network-send-message'><%= link_to_function _('Scrap'), "hide_and_show(['#profile-network-message-response-#{activity.id}'],['#profile-network-message-#{activity.id}', '#profile-network-form-#{activity.id}']);$('content_#{activity.id}').value='';return false", :class => "profile-send-message icon-scrap" %></p>
  6 + <p class='profile-network-send-message'><%= link_to_function _('Scrap'), "hide_and_show(['#profile-network-message-response-#{activity.id}'],['#profile-network-message-#{activity.id}', '#profile-network-form-#{activity.id}']);$('content_#{activity.id}').value='';return false", :class => "profile-send-message", :title => _("Send a message to %s") % activity.user.name %></p>
7 7 <% end %>
8 8 </div>
9 9 <div class='profile-network-description'>
... ...
app/views/profile/_profile_scrap.rhtml
... ... @@ -2,7 +2,7 @@
2 2 <div class='profile-wall-image'>
3 3 <%= link_to(profile_image(scrap.sender, :minor), scrap.sender.url) %>
4 4 <% if logged_in? && current_person.follows?(scrap.sender) && current_person != scrap.sender %>
5   - <p class='profile-wall-send-message'><%= link_to_function _('Scrap'), "hide_and_show(['#profile-wall-message-response-#{scrap.id}'],['#profile-wall-message-#{scrap.id}', '#profile-wall-form-#{scrap.id}']);$('content_#{scrap.id}').value='';return false", :class => "profile-send-message icon-scrap" %></p>
  5 + <p class='profile-wall-send-message'><%= link_to_function _('Scrap'), "hide_and_show(['#profile-wall-message-response-#{scrap.id}'],['#profile-wall-message-#{scrap.id}', '#profile-wall-form-#{scrap.id}']);$('content_#{scrap.id}').value='';return false", :class => "profile-send-message", :title => _("Send a message to %s") % scrap.sender.name %></p>
6 6 <% end %>
7 7 </div>
8 8 <% comment_balloon :class => 'profile-wall-description' do %>
... ...
app/views/search/_article.rhtml
1   -<li>
2   - <strong><%= link_to(article.title, article.url, :class => icon_for_article(article)) %></strong>
  1 +<li class="<%= icon_for_article(article) %>">
  2 + <strong><%= link_to(article.title, article.url) %></strong>
3 3 <div class="item_meta">
4 4 <% if article.last_changed_by %>
5 5 <span class="cat_item_by">
... ...
app/views/tasks/_suggest_article_accept_details.rhtml
  1 +<%= render :file => 'shared/tiny_mce' %>
  2 +
1 3 <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %>
2 4 <p><%= label_tag(_("Email: %s") % task.email) %> </p>
3 5 <%= required labelled_form_field(_('Title'), f.text_field(:article_name, :size => 50)) %>
... ... @@ -8,10 +10,10 @@
8 10 <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %>
9 11  
10 12 <div>
11   - <%= labelled_form_field(_('Lead'), f.text_area(:article_abstract, :style => 'width: 482px; height: 200px;')) %>
  13 + <%= labelled_form_field(_('Lead'), f.text_area(:article_abstract, :style => 'width: 482px; height: 200px;', :class => 'mceEditor')) %>
12 14 </div>
13 15 <em><%= _('Used when a short version your text is needed.') %></em>
14 16  
15 17 <div style="margin-top: 10px;">
16   - <%= labelled_form_field(_('Text'), f.text_area(:article_body, :style => 'width:482px; height: 500px;')) %>
  18 + <%= labelled_form_field(_('Text'), f.text_area(:article_body, :style => 'width:482px; height: 500px;', :class => 'mceEditor')) %>
17 19 </div>
... ...
debian/changelog
  1 +noosfero (0.28.5) unstable; urgency=low
  2 +
  3 + * Bugfixes Version release. (Closes: AI#1867 AI#1866 AI#1870 AI#1854 AI#1851 AI#1810 AI#1889 AI#1868 AI#1855 AI#1887)
  4 +
  5 + -- Joenio Costa <joenio@perl.org.br> Sun, 20 Feb 2011 12:13:25 -0300
  6 +
1 7 noosfero (0.28.4) unstable; urgency=low
2 8  
3 9 * Bugfixes Version release. (Closes: AI#1865)
... ...
lib/noosfero.rb
1 1 module Noosfero
2 2 PROJECT = 'noosfero'
3   - VERSION = '0.28.4'
  3 + VERSION = '0.28.5'
4 4  
5 5 def self.pattern_for_controllers_in_directory(dir)
6 6 disjunction = controllers_in_directory(dir).join('|')
... ...
public/designs/icons/tango/style.css
... ... @@ -90,7 +90,6 @@
90 90 .icon-media-next { background-image: url(Tango/16x16/actions/media-skip-forward.png) }
91 91 .icon-lock { background-image: url(Tango/16x16/actions/lock.png) }
92 92 .icon-chat { background-image: url(Tango/16x16/apps/internet-group-chat.png); background-repeat: no-repeat }
93   -.icon-scrap { background-image: url(Tango/16x16/actions/format-justify-left.png) }
94 93 .icon-reply { background-image: url(Tango/16x16/actions/mail-reply-sender.png) }
95 94 .icon-newforum { background-image: url(Tango/16x16/apps/system-users.png) }
96 95 .icon-forum { background-image: url(Tango/16x16/apps/system-users.png) }
... ...
public/designs/templates/default/stylesheets/style.css
... ... @@ -27,3 +27,8 @@
27 27 float: none;
28 28 }
29 29  
  30 +#profile-activity ul,
  31 +#profile-network ul,
  32 +#profile-wall ul {
  33 + width: 460px;
  34 +}
... ...
public/designs/templates/leftbar/stylesheets/style.css
... ... @@ -22,3 +22,9 @@
22 22 #leave_scrap_content_left {
23 23 float: none;
24 24 }
  25 +
  26 +#profile-activity ul,
  27 +#profile-network ul,
  28 +#profile-wall ul {
  29 + width: 620px;
  30 +}
... ...
public/designs/templates/rightbar/stylesheets/style.css
... ... @@ -22,3 +22,9 @@
22 22 #leave_scrap_content_left {
23 23 float: none;
24 24 }
  25 +
  26 +#profile-activity ul,
  27 +#profile-network ul,
  28 +#profile-wall ul {
  29 + width: 620px;
  30 +}
... ...
public/stylesheets/application.css
... ... @@ -1047,6 +1047,10 @@ code input {
1047 1047 background: transparent url(/images/zoom.png) left center no-repeat;
1048 1048 }
1049 1049  
  1050 +#article pre {
  1051 + white-space: pre-wrap;
  1052 +}
  1053 +
1050 1054 /* * * Comments * * */
1051 1055  
1052 1056 .comments { }
... ... @@ -1208,6 +1212,7 @@ a.comment-picture {
1208 1212 color: #000;
1209 1213 }
1210 1214  
  1215 +#profile-activity .profile-activity-send-message a:hover, #profile-network .profile-network-send-message a:hover, #profile-wall .profile-wall-send-message a:hover,
1211 1216 #article .comment-reply-link:hover {
1212 1217 text-decoration: underline;
1213 1218 }
... ... @@ -1722,10 +1727,28 @@ input.disabled {
1722 1727 margin-left: 40px;
1723 1728 }
1724 1729  
  1730 +
  1731 +/******** tagged-items list ***************************/
  1732 +
1725 1733 .search-tagged-items {
1726 1734 margin-top: 1em;
1727 1735 }
1728 1736  
  1737 +.controller-search .search-tagged-items li {
  1738 + padding-left: 20px;
  1739 + background-repeat: no-repeat;
  1740 + background-position: left 2px;
  1741 + border: none;
  1742 +}
  1743 +
  1744 +.controller-search .search-tagged-items .icon:hover {
  1745 + background-color: transparent;
  1746 +}
  1747 +
  1748 +.controller-search .search-tagged-items .item_meta {
  1749 + margin-top: 2px;
  1750 +}
  1751 +
1729 1752 /***** search-popup ***************************/
1730 1753  
1731 1754 #search-popup h3 {
... ... @@ -3985,11 +4008,13 @@ h1#agenda-title {
3985 4008 }
3986 4009  
3987 4010 .controller-profile_design .article-block-edition select,
3988   -.controller-profile_design .article-block-edition option {
3989   - width: 300px;
  4011 +.controller-environment_design .article-block-edition select{
  4012 + width: 100%;
3990 4013 }
3991 4014  
3992   -.controller-profile_design .article-block-edition option {
  4015 +.controller-profile_design .article-block-edition option,
  4016 +.controller-environment_design .article-block-edition option {
  4017 + width: 470px;
3993 4018 overflow-x: hidden;
3994 4019 }
3995 4020  
... ... @@ -5548,10 +5573,8 @@ h1#agenda-title {
5548 5573 }
5549 5574  
5550 5575 #profile-activity .profile-activity-send-message, #profile-network .profile-network-send-message, #profile-wall .profile-wall-send-message {
5551   - text-decoration: none;
5552   - font-size: 11px;
5553   - color: #000;
5554   - margin: 10px 0 0 0;
  5576 + font-size: 10px;
  5577 + margin: 2px 0 0 0;
5555 5578 }
5556 5579  
5557 5580 #profile-activity .profile-activity-send-message a, #profile-network .profile-network-send-message a, #profile-wall .profile-wall-send-message a {
... ... @@ -5654,21 +5677,6 @@ h1#agenda-title {
5654 5677 margin: 0;
5655 5678 }
5656 5679  
5657   -.profile-send-message {
5658   - color: #555;
5659   - border: 1px solid #ccc;
5660   - background-color: #eee;
5661   - padding: 4px 4px 4px 20px;
5662   - background-repeat: no-repeat;
5663   - background-position: 4px center;
5664   -}
5665   -
5666   -.ui-widget-content .profile-send-message:hover,
5667   -.profile-send-message:hover {
5668   - color: #eee;
5669   - background-color: #555;
5670   -}
5671   -
5672 5680 .limited-text-area p {
5673 5681 margin: 0;
5674 5682 font-size: 11px;
... ... @@ -5847,7 +5855,7 @@ h1#agenda-title {
5847 5855  
5848 5856 /* friends online }}} */
5849 5857  
5850   -#profile-wall .profile-wall-description .icon-scrap, #profile-wall .profile-wall-description .icon-reply {
  5858 +#profile-wall .profile-wall-description .icon-reply {
5851 5859 visibility: hidden;
5852 5860 border-radius: 3px;
5853 5861 -webkit-border-radius: 3px;
... ... @@ -5887,6 +5895,7 @@ h1#agenda-title {
5887 5895  
5888 5896 #profile-activity .profile-activity-description, #profile-network .profile-network-description, #profile-wall .profile-wall-description {
5889 5897 width: 80%;
  5898 + word-wrap: break-word;
5890 5899 }
5891 5900  
5892 5901 #profile-wall .profile-wall-scrap-replies textarea,
... ... @@ -5953,7 +5962,6 @@ h1#agenda-title {
5953 5962 .msie7 #profile-network .profile-network-send-message,
5954 5963 .msie7 #profile-wall .profile-wall-send-message {
5955 5964 line-height: 24px;
5956   - margin-top: 2px;
5957 5965 }
5958 5966  
5959 5967 .msie7 #profile-wall a.button.with-text.icon-cancel {
... ...
script/sample-articles 0 → 100755
... ... @@ -0,0 +1,37 @@
  1 +#!/usr/bin/env ruby
  2 +require File.dirname(__FILE__) + '/../config/environment'
  3 +
  4 +# tourn on autoflush
  5 +STDOUT.sync = true
  6 +
  7 +profiles = Profile.all
  8 +SUBJECTS = ['got a new car', 'release a new version of project X', "doesn't like wales no more", "doesn't use free-software no more"]
  9 +TAGS = ['free-software', 'noosfero', 'development', 'rails', 'ruby']
  10 +
  11 +print "Creating some TinyMce articles: "
  12 +for subject in SUBJECTS
  13 + rand(20).times do |i|
  14 + profile = profiles.rand
  15 + profile.articles << TinyMceArticle.new(
  16 + :name => "%s #{subject}" % profile.name,
  17 + :body => "%s #{subject}" % profile.name,
  18 + :tag_list => [TAGS.rand, TAGS.rand]
  19 + )
  20 + print '.'
  21 + end
  22 +end
  23 +puts ' done!'
  24 +
  25 +print "Creating some galleries: "
  26 +for subject in SUBJECTS
  27 + rand(20).times do |i|
  28 + profile = profiles.rand
  29 + profile.articles << Gallery.new(
  30 + :name => "Gallery %s #{subject}" % profile.name,
  31 + :body => "Gallery %s #{subject}" % profile.name,
  32 + :tag_list => [TAGS.rand, TAGS.rand]
  33 + )
  34 + print '.'
  35 + end
  36 +end
  37 +puts ' done!'
... ...
script/sample-data
... ... @@ -16,3 +16,4 @@ system(&#39;./script/sample-profiles&#39;)
16 16 system('./script/sample-categories')
17 17 system('./script/sample-enterprises')
18 18 system('./script/sample-products')
  19 +system('./script/sample-articles')
... ...
script/sample-profiles
... ... @@ -112,3 +112,11 @@ ze = User.create!({
112 112 }).person
113 113 environment.add_admin(ze)
114 114  
  115 +admin = User.create!({
  116 + :login => "adminuser",
  117 + :email => 'adminuser@localhost.localdomain',
  118 + :password => 'admin',
  119 + :password_confirmation => 'admin',
  120 + :environment => environment,
  121 +}).person
  122 +environment.add_admin(admin)
... ...
test/functional/cms_controller_test.rb
... ... @@ -1423,6 +1423,14 @@ class CmsControllerTest &lt; Test::Unit::TestCase
1423 1423 assert_template 'suggest_an_article'
1424 1424 end
1425 1425  
  1426 + should 'render TinyMce Editor on suggestion of article' do
  1427 + logout
  1428 + get :suggest_an_article, :profile => profile.identifier
  1429 +
  1430 + assert_tag :tag => 'textarea', :attributes => { :name => /article_abstract/, :class => 'mceEditor' }
  1431 + assert_tag :tag => 'textarea', :attributes => { :name => /article_body/, :class => 'mceEditor' }
  1432 + end
  1433 +
1426 1434 should 'create a task suggest task to a profile' do
1427 1435 c = Community.create!(:name => 'test comm', :identifier => 'test_comm', :moderated_articles => true)
1428 1436  
... ... @@ -1576,4 +1584,9 @@ class CmsControllerTest &lt; Test::Unit::TestCase
1576 1584 assert_redirected_to :action => 'view', :id => f
1577 1585 end
1578 1586  
  1587 + should 'render TinyMce Editor for events' do
  1588 + get :new, :profile => @profile.identifier, :type => 'Event'
  1589 + assert_tag :tag => 'textarea', :attributes => { :class => 'mceEditor' }
  1590 + end
  1591 +
1579 1592 end
... ...
test/functional/tasks_controller_test.rb
... ... @@ -231,6 +231,19 @@ class TasksControllerTest &lt; Test::Unit::TestCase
231 231 assert_equal Task::Status::ACTIVE, task.status
232 232 end
233 233  
  234 + should 'render TinyMce Editor when approving suggested article task' do
  235 + Task.destroy_all
  236 + c = fast_create(Community)
  237 + c.add_admin profile
  238 + @controller.stubs(:profile).returns(c)
  239 + SuggestArticle.skip_captcha!
  240 + t = SuggestArticle.create!(:article_name => 'test name', :article_abstract => 'test abstract', :article_body => 'test body', :name => 'some name', :email => 'test@localhost.com', :target => c)
  241 +
  242 + get :index
  243 + assert_tag :tag => 'textarea', :content => 'test abstract', :attributes => { :name => /article_abstract/, :class => 'mceEditor' }
  244 + assert_tag :tag => 'textarea', :content => 'test body', :attributes => { :name => /article_body/, :class => 'mceEditor' }
  245 + end
  246 +
234 247 should 'create TinyMceArticle article after finish approve suggested article task' do
235 248 TinyMceArticle.destroy_all
236 249 c = fast_create(Community)
... ...
test/unit/article_test.rb
... ... @@ -1440,4 +1440,8 @@ class ArticleTest &lt; Test::Unit::TestCase
1440 1440 assert_nil post.info_from_last_update[:author_url]
1441 1441 end
1442 1442  
  1443 + should 'tiny mce editor is disabled by default' do
  1444 + assert !Article.new.tiny_mce?
  1445 + end
  1446 +
1443 1447 end
... ...
test/unit/event_test.rb
... ... @@ -270,4 +270,8 @@ class EventTest &lt; ActiveSupport::TestCase
270 270 assert_kind_of Noosfero::TranslatableContent, Event.new
271 271 end
272 272  
  273 + should 'tiny mce editor is enabled' do
  274 + assert Event.new.tiny_mce?
  275 + end
  276 +
273 277 end
... ...
test/unit/feed_writer_test.rb
... ... @@ -14,6 +14,16 @@ class FeedWriterTest &lt; Test::Unit::TestCase
14 14 assert_match('/tagger/' + articles.first.slug, feed)
15 15 end
16 16  
  17 + should 'generate feed with a gallery' do
  18 + articles = []
  19 + profile = fast_create(:profile, :identifier => "tagger")
  20 + articles << fast_create(:gallery, :name => 'my pics', :profile_id => profile.id)
  21 + writer = FeedWriter.new
  22 +
  23 + feed = writer.write(articles)
  24 + assert_match('my pics', feed)
  25 + end
  26 +
17 27 should 'use title, link and description' do
18 28 writer = FeedWriter.new
19 29 rss = writer.write([], :title => "my title", :description => "my description", :link => "http://example.com/")
... ...
test/unit/profile_search_block_test.rb
... ... @@ -6,8 +6,8 @@ class ProfileSearchBlockTest &lt; Test::Unit::TestCase
6 6 assert_not_equal Block.description, ProfileSearchBlock.description
7 7 end
8 8  
9   - should 'provide a default title' do
10   - assert_not_equal Block.new.default_title, ProfileSearchBlock.new.default_title
  9 + should 'not provide a default title' do
  10 + assert_equal Block.new.default_title, ProfileSearchBlock.new.default_title
11 11 end
12 12  
13 13 should 'render profile search' do
... ...
test/unit/tiny_mce_article_test.rb
... ... @@ -236,4 +236,9 @@ class TinyMceArticleTest &lt; Test::Unit::TestCase
236 236 assert_equal false, a.advertise?
237 237 assert_equal false, a.is_trackable?
238 238 end
  239 +
  240 + should 'tiny mce editor is enabled' do
  241 + assert TinyMceArticle.new.tiny_mce?
  242 + end
  243 +
239 244 end
... ...