Commit 2598c37efefbe43926935410c55299e73eefd0b8

Authored by Victor Costa
2 parents 45db34f5 e0f459cd

Merge branch 'master' into rails3_stable

Gemfile
... ... @@ -18,6 +18,7 @@ gem 'rake', :require => false
18 18 gem 'grape', '0.2.1'
19 19 gem 'rest-client'
20 20 gem 'exception_notification'
  21 +gem 'gettext_rails'
21 22  
22 23 # FIXME list here all actual dependencies (i.e. the ones in debian/control),
23 24 # with their GEM names (not the Debian package names)
... ...
Gemfile.lock
... ... @@ -67,6 +67,15 @@ GEM
67 67 activesupport (>= 3.0.4)
68 68 fast_gettext (0.6.8)
69 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 79 gherkin (2.4.21)
71 80 json (>= 1.4.6)
72 81 hike (1.2.1)
... ... @@ -74,6 +83,9 @@ GEM
74 83 i18n (0.6.0)
75 84 journey (1.0.3)
76 85 json (1.7.3)
  86 + locale (2.0.5)
  87 + locale_rails (2.0.5)
  88 + locale (>= 2.0.5)
77 89 mail (2.4.4)
78 90 i18n (>= 0.4.0)
79 91 mime-types (~> 1.16)
... ... @@ -172,6 +184,7 @@ DEPENDENCIES
172 184 database_cleaner
173 185 exception_notification
174 186 fast_gettext
  187 + gettext_rails
175 188 hpricot
176 189 mocha
177 190 nokogiri
... ...
app/controllers/my_profile/memberships_controller.rb
... ... @@ -21,6 +21,9 @@ class MembershipsController < MyProfileController
21 21 @back_to = params[:back_to] || url_for(:action => 'index')
22 22 if request.post? && @community.valid?
23 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 27 redirect_to @back_to
25 28 return
26 29 end
... ...
app/controllers/my_profile/tasks_controller.rb
... ... @@ -4,6 +4,7 @@ class TasksController < MyProfileController
4 4  
5 5 def index
6 6 @filter = params[:filter_type].blank? ? nil : params[:filter_type]
  7 + @task_types = Task.pending_types_for(profile)
7 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 9 @failed = params ? params[:failed] : {}
9 10 end
... ...
app/models/task.rb
... ... @@ -73,10 +73,6 @@ class Task < ActiveRecord::Base
73 73 end
74 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 76 # this method finished the task. It calls #perform, which must be overriden
81 77 # by subclasses. At the end a message (as returned by #finish_message) is
82 78 # sent to the requestor with #notify_requestor.
... ... @@ -254,6 +250,10 @@ class Task < ActiveRecord::Base
254 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 257 def opened?
258 258 status == Task::Status::ACTIVE || status == Task::Status::HIDDEN
259 259 end
... ...
app/views/tasks/index.html.erb
... ... @@ -3,10 +3,9 @@
3 3 <h1><%= _("%s's pending tasks") % profile.name %></h1>
4 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 10 <% if !@failed.blank? %>
12 11 <div id="errorExplanation">
... ... @@ -39,7 +38,7 @@
39 38  
40 39 <ul class='task-list'>
41 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 42 </p>
44 43 <p>
45 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 7 debhelper (>= 7.0.50~),
8 8 po4a,
9 9 ruby-gettext,
  10 + ruby-gettext-rails,
10 11 ruby-sqlite3,
11 12 rake,
12 13 rails3 (>= 3.2.6-1~),
... ...
lib/tasks/plugins.rake
... ... @@ -7,7 +7,11 @@ namespace :noosfero do
7 7 plugin_migration_dirs = Dir.glob(Rails.root.join('{baseplugins,config/plugins}', '*', 'db', 'migrate'))
8 8  
9 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 15 dirs.each do |dir|
12 16 ActiveRecord::Migrator.migrations_paths << dir
13 17 end
... ...
po/pt/noosfero.po
... ... @@ -13,7 +13,7 @@ msgid &quot;&quot;
13 13 msgstr ""
14 14 "Project-Id-Version: noosfero 0.47.1\n"
15 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 17 "Last-Translator: Rodrigo Souto <rodrigo@colivre.coop.br>\n"
18 18 "Language-Team: Noosfero Develeopers <noosfero-dev@listas.softwarelivre.org>\n"
19 19 "Language: pt\n"
... ... @@ -469,7 +469,7 @@ msgstr &quot;Local: &quot;
469 469 #: app/helpers/boxes_helper.rb:37 app/helpers/boxes_helper.rb:63
470 470 #: app/models/main_block.rb:4
471 471 msgid "Main content"
472   -msgstr "Gerenciar conteúdo"
  472 +msgstr "Conteúdo principal"
473 473  
474 474 #: app/helpers/boxes_helper.rb:100
475 475 msgid "This block is invisible. Your visitors will not see it."
... ...
script/quick-start
... ... @@ -85,6 +85,7 @@ fi
85 85 run rake db:schema:load
86 86 run rake db:data:minimal
87 87 run rake db:test:prepare
  88 +run rails runner 'Environment.default.enable("skip_new_user_email_confirmation")'
88 89  
89 90 # FIXME compile translations depends on ruby-gettext-rails, please see debian/control
90 91 # run rake noosfero:translations:compile
... ...