Commit 2598c37efefbe43926935410c55299e73eefd0b8

Authored by Victor Costa
2 parents 45db34f5 e0f459cd

Merge branch 'master' into rails3_stable

@@ -18,6 +18,7 @@ gem 'rake', :require => false @@ -18,6 +18,7 @@ gem 'rake', :require => false
18 gem 'grape', '0.2.1' 18 gem 'grape', '0.2.1'
19 gem 'rest-client' 19 gem 'rest-client'
20 gem 'exception_notification' 20 gem 'exception_notification'
  21 +gem 'gettext_rails'
21 22
22 # FIXME list here all actual dependencies (i.e. the ones in debian/control), 23 # FIXME list here all actual dependencies (i.e. the ones in debian/control),
23 # with their GEM names (not the Debian package names) 24 # with their GEM names (not the Debian package names)
@@ -67,6 +67,15 @@ GEM @@ -67,6 +67,15 @@ GEM
67 activesupport (>= 3.0.4) 67 activesupport (>= 3.0.4)
68 fast_gettext (0.6.8) 68 fast_gettext (0.6.8)
69 ffi (1.0.11) 69 ffi (1.0.11)
  70 + gettext (2.2.1)
  71 + locale
  72 + gettext_activerecord (2.1.0)
  73 + activerecord (>= 2.3.2)
  74 + gettext (>= 2.1.0)
  75 + gettext_rails (2.1.0)
  76 + gettext_activerecord (>= 2.1.0)
  77 + locale_rails (>= 2.0.5)
  78 + rails (>= 2.3.2)
70 gherkin (2.4.21) 79 gherkin (2.4.21)
71 json (>= 1.4.6) 80 json (>= 1.4.6)
72 hike (1.2.1) 81 hike (1.2.1)
@@ -74,6 +83,9 @@ GEM @@ -74,6 +83,9 @@ GEM
74 i18n (0.6.0) 83 i18n (0.6.0)
75 journey (1.0.3) 84 journey (1.0.3)
76 json (1.7.3) 85 json (1.7.3)
  86 + locale (2.0.5)
  87 + locale_rails (2.0.5)
  88 + locale (>= 2.0.5)
77 mail (2.4.4) 89 mail (2.4.4)
78 i18n (>= 0.4.0) 90 i18n (>= 0.4.0)
79 mime-types (~> 1.16) 91 mime-types (~> 1.16)
@@ -172,6 +184,7 @@ DEPENDENCIES @@ -172,6 +184,7 @@ DEPENDENCIES
172 database_cleaner 184 database_cleaner
173 exception_notification 185 exception_notification
174 fast_gettext 186 fast_gettext
  187 + gettext_rails
175 hpricot 188 hpricot
176 mocha 189 mocha
177 nokogiri 190 nokogiri
app/controllers/my_profile/memberships_controller.rb
@@ -21,6 +21,9 @@ class MembershipsController < MyProfileController @@ -21,6 +21,9 @@ class MembershipsController < MyProfileController
21 @back_to = params[:back_to] || url_for(:action => 'index') 21 @back_to = params[:back_to] || url_for(:action => 'index')
22 if request.post? && @community.valid? 22 if request.post? && @community.valid?
23 @community = Community.create_after_moderation(user, params[:community].merge({:environment => environment})) 23 @community = Community.create_after_moderation(user, params[:community].merge({:environment => environment}))
  24 + if @community.new_record?
  25 + session[:notice] = _('Your new community creation request will be evaluated by an administrator. You will be notified.')
  26 + end
24 redirect_to @back_to 27 redirect_to @back_to
25 return 28 return
26 end 29 end
app/controllers/my_profile/tasks_controller.rb
@@ -4,6 +4,7 @@ class TasksController < MyProfileController @@ -4,6 +4,7 @@ class TasksController < MyProfileController
4 4
5 def index 5 def index
6 @filter = params[:filter_type].blank? ? nil : params[:filter_type] 6 @filter = params[:filter_type].blank? ? nil : params[:filter_type]
  7 + @task_types = Task.pending_types_for(profile)
7 @tasks = Task.to(profile).without_spam.pending.of(@filter).order_by('created_at', 'asc').paginate(:per_page => Task.per_page, :page => params[:page]) 8 @tasks = Task.to(profile).without_spam.pending.of(@filter).order_by('created_at', 'asc').paginate(:per_page => Task.per_page, :page => params[:page])
8 @failed = params ? params[:failed] : {} 9 @failed = params ? params[:failed] : {}
9 end 10 end
app/models/task.rb
@@ -73,10 +73,6 @@ class Task < ActiveRecord::Base @@ -73,10 +73,6 @@ class Task < ActiveRecord::Base
73 end 73 end
74 end 74 end
75 75
76 - def self.all_types  
77 - %w[Invitation EnterpriseActivation AddMember Ticket SuggestArticle AddFriend CreateCommunity AbuseComplaint ApproveComment ApproveArticle CreateEnterprise ChangePassword EmailActivation InviteFriend InviteMember]  
78 - end  
79 -  
80 # this method finished the task. It calls #perform, which must be overriden 76 # this method finished the task. It calls #perform, which must be overriden
81 # by subclasses. At the end a message (as returned by #finish_message) is 77 # by subclasses. At the end a message (as returned by #finish_message) is
82 # sent to the requestor with #notify_requestor. 78 # sent to the requestor with #notify_requestor.
@@ -254,6 +250,10 @@ class Task < ActiveRecord::Base @@ -254,6 +250,10 @@ class Task < ActiveRecord::Base
254 { :conditions => [environment_condition, profile_condition].compact.join(' OR ') } 250 { :conditions => [environment_condition, profile_condition].compact.join(' OR ') }
255 } 251 }
256 252
  253 + def self.pending_types_for(profile)
  254 + Task.to(profile).pending.select('distinct type').map { |t| [t.class.name, t.title] }
  255 + end
  256 +
257 def opened? 257 def opened?
258 status == Task::Status::ACTIVE || status == Task::Status::HIDDEN 258 status == Task::Status::ACTIVE || status == Task::Status::HIDDEN
259 end 259 end
app/views/tasks/index.html.erb
@@ -3,10 +3,9 @@ @@ -3,10 +3,9 @@
3 <h1><%= _("%s's pending tasks") % profile.name %></h1> 3 <h1><%= _("%s's pending tasks") % profile.name %></h1>
4 <p> 4 <p>
5 5
6 -<% type_collection = [[nil, _('All')]] %>  
7 -<% type_collection += Task.all_types.sort_by {|klass| klass.constantize.new.title}.map{|s| [s, s.constantize.new.title] } %>  
8 -  
9 - 6 +<%
  7 + type_collection = [[nil, _('All')]] + @task_types
  8 +%>
10 9
11 <% if !@failed.blank? %> 10 <% if !@failed.blank? %>
12 <div id="errorExplanation"> 11 <div id="errorExplanation">
@@ -39,7 +38,7 @@ @@ -39,7 +38,7 @@
39 38
40 <ul class='task-list'> 39 <ul class='task-list'>
41 <p> 40 <p>
42 - <%= labelled_select(_('Filter')+': ', :filter_type, :first, :last, @filter, type_collection, :onchange => 'document.location.href = "?filter_type="+this.value')%> 41 + <%= labelled_select(_('Filter')+': ', :filter_type, :first, :last, @filter, type_collection, :onchange => "document.location.href = '?filter_type='+this.value") %>
43 </p> 42 </p>
44 <p> 43 <p>
45 <%= labelled_select(_("Set all to: "), 'set-decisions', 'first', 'last', nil, [['',""],['accept',_("Accept")],['reject',_("Reject")],['skip',_("Skip")]], :id => "up-set-all-tasks-to") %> 44 <%= labelled_select(_("Set all to: "), 'set-decisions', 'first', 'last', nil, [['',""],['accept',_("Accept")],['reject',_("Reject")],['skip',_("Skip")]], :id => "up-set-all-tasks-to") %>
debian/control
@@ -7,6 +7,7 @@ Build-Depends: @@ -7,6 +7,7 @@ Build-Depends:
7 debhelper (>= 7.0.50~), 7 debhelper (>= 7.0.50~),
8 po4a, 8 po4a,
9 ruby-gettext, 9 ruby-gettext,
  10 + ruby-gettext-rails,
10 ruby-sqlite3, 11 ruby-sqlite3,
11 rake, 12 rake,
12 rails3 (>= 3.2.6-1~), 13 rails3 (>= 3.2.6-1~),
lib/tasks/plugins.rake
@@ -7,7 +7,11 @@ namespace :noosfero do @@ -7,7 +7,11 @@ namespace :noosfero do
7 plugin_migration_dirs = Dir.glob(Rails.root.join('{baseplugins,config/plugins}', '*', 'db', 'migrate')) 7 plugin_migration_dirs = Dir.glob(Rails.root.join('{baseplugins,config/plugins}', '*', 'db', 'migrate'))
8 8
9 task :load_config do 9 task :load_config do
10 - dirs = Dir.glob("{baseplugins,config/plugins}/*/db/migrate") 10 + dirs = Dir.glob("{baseplugins,config/plugins}/*").uniq do |dir|
  11 + File.basename(dir)
  12 + end.map do |dir|
  13 + File.join(dir, 'db/migrate')
  14 + end
11 dirs.each do |dir| 15 dirs.each do |dir|
12 ActiveRecord::Migrator.migrations_paths << dir 16 ActiveRecord::Migrator.migrations_paths << dir
13 end 17 end
po/pt/noosfero.po
@@ -13,7 +13,7 @@ msgid &quot;&quot; @@ -13,7 +13,7 @@ msgid &quot;&quot;
13 msgstr "" 13 msgstr ""
14 "Project-Id-Version: noosfero 0.47.1\n" 14 "Project-Id-Version: noosfero 0.47.1\n"
15 "POT-Creation-Date: 2014-06-05 20:27-0000\n" 15 "POT-Creation-Date: 2014-06-05 20:27-0000\n"
16 -"PO-Revision-Date: 2013-07-30 12:53-0300\n" 16 +"PO-Revision-Date: 2014-08-19 10:30-0300\n"
17 "Last-Translator: Rodrigo Souto <rodrigo@colivre.coop.br>\n" 17 "Last-Translator: Rodrigo Souto <rodrigo@colivre.coop.br>\n"
18 "Language-Team: Noosfero Develeopers <noosfero-dev@listas.softwarelivre.org>\n" 18 "Language-Team: Noosfero Develeopers <noosfero-dev@listas.softwarelivre.org>\n"
19 "Language: pt\n" 19 "Language: pt\n"
@@ -469,7 +469,7 @@ msgstr &quot;Local: &quot; @@ -469,7 +469,7 @@ msgstr &quot;Local: &quot;
469 #: app/helpers/boxes_helper.rb:37 app/helpers/boxes_helper.rb:63 469 #: app/helpers/boxes_helper.rb:37 app/helpers/boxes_helper.rb:63
470 #: app/models/main_block.rb:4 470 #: app/models/main_block.rb:4
471 msgid "Main content" 471 msgid "Main content"
472 -msgstr "Gerenciar conteúdo" 472 +msgstr "Conteúdo principal"
473 473
474 #: app/helpers/boxes_helper.rb:100 474 #: app/helpers/boxes_helper.rb:100
475 msgid "This block is invisible. Your visitors will not see it." 475 msgid "This block is invisible. Your visitors will not see it."
script/quick-start
@@ -85,6 +85,7 @@ fi @@ -85,6 +85,7 @@ fi
85 run rake db:schema:load 85 run rake db:schema:load
86 run rake db:data:minimal 86 run rake db:data:minimal
87 run rake db:test:prepare 87 run rake db:test:prepare
  88 +run rails runner 'Environment.default.enable("skip_new_user_email_confirmation")'
88 89
89 # FIXME compile translations depends on ruby-gettext-rails, please see debian/control 90 # FIXME compile translations depends on ruby-gettext-rails, please see debian/control
90 # run rake noosfero:translations:compile 91 # run rake noosfero:translations:compile