O conteúdo desse portal pode ser acessível em Libras usando o VLibras

Commit 5cc216ef9913a194075440ed12a44e93ceeb35c5

Authored by Braulio Bhavamitra
2 parents d6340a14 180ad529

Merge branch 'noosfero' into rails4

Showing 754 changed files with 35050 additions and 9712 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 754 files displayed.

AUTHORS.md
... ... @@ -17,11 +17,13 @@ Ana Losnak <analosnak@gmail.com>
17 17 Ana Paula Vargas <anapaulavnoronha@gmail.com>
18 18 Andre Bedran <bedran.fleck@gmail.com>
19 19 André Guedes <andrebsguedes@gmail.com>
  20 +Andrey Aleksanyants <aaleksanyants@yahoo.com>
20 21 Antonio Terceiro <terceiro@colivre.coop.br>
21 22 Arthur Del Esposte <arthurmde@gmail.com>
22 23 Athos Ribeiro <athoscribeiro@gmail.com>
23 24 Aurelio A. Heckert <aurelio@colivre.coop.br>
24 25 Braulio Bhavamitra <braulio@eita.org.br>
  26 +Brenddon Gontijo <brenddongontijo@msn.com>
25 27 Caio Formiga <caio.formiga@gmail.com>
26 28 Caio Salgado <caio.csalgado@gmail.com>
27 29 Caio SBA <caio@colivre.coop.br>
... ...
app/controllers/application_controller.rb
... ... @@ -7,7 +7,10 @@ class ApplicationController &lt; ActionController::Base
7 7 before_filter :detect_stuff_by_domain
8 8 before_filter :init_noosfero_plugins
9 9 before_filter :allow_cross_domain_access
  10 +
  11 + before_filter :login_from_cookie
10 12 before_filter :login_required, :if => :private_environment?
  13 +
11 14 before_filter :verify_members_whitelist, :if => [:private_environment?, :user]
12 15 before_filter :redirect_to_current_user
13 16  
... ...
app/controllers/my_profile/enterprise_validation_controller.rb
1 1 class EnterpriseValidationController < MyProfileController
2 2  
3 3 protect 'validate_enterprise', :profile
4   -
  4 +
5 5 def index
6 6 @pending_validations = profile.pending_validations
7 7 end
... ... @@ -27,7 +27,7 @@ class EnterpriseValidationController &lt; MyProfileController
27 27 post_only :reject
28 28 def reject
29 29 @pending = profile.find_pending_validation(params[:id])
30   - if @pending
  30 + if @pending
31 31 @pending.reject_explanation = params[:reject_explanation]
32 32 begin
33 33 @pending.reject
... ...
app/controllers/my_profile/favorite_enterprises_controller.rb
1 1 class FavoriteEnterprisesController < MyProfileController
2   -
3   -# protect 'manage_favorite_enteprises', :profile
  2 +
  3 +# protect 'manage_favorite_enterprises', :profile
4 4  
5 5 requires_profile_class Person
6   -
  6 +
7 7 def index
8 8 @favorite_enterprises = profile.favorite_enterprises
9 9 end
... ... @@ -12,7 +12,7 @@ class FavoriteEnterprisesController &lt; MyProfileController
12 12 @favorite_enterprise = Enterprise.find(params[:id])
13 13 if request.post? && params[:confirmation]
14 14 profile.favorite_enterprises << @favorite_enterprise
15   - redirect_to :action => 'index'
  15 + redirect_to :action => 'index'
16 16 end
17 17 end
18 18  
... ...
app/controllers/my_profile/profile_editor_controller.rb
... ... @@ -5,6 +5,7 @@ class ProfileEditorController &lt; MyProfileController
5 5  
6 6 before_filter :access_welcome_page, :only => [:welcome_page]
7 7 before_filter :back_to
  8 + before_filter :forbid_destroy_profile, :only => [:destroy_profile]
8 9 helper_method :has_welcome_page
9 10  
10 11 def index
... ... @@ -109,7 +110,7 @@ class ProfileEditorController &lt; MyProfileController
109 110 profile = environment.profiles.find(params[:id])
110 111 if profile.disable
111 112 profile.save
112   - session[:notice] = _("The profile '#{profile.name}' was deactivated.")
  113 + session[:notice] = _("The profile '%s' was deactivated.") % profile.name
113 114 else
114 115 session[:notice] = _('Could not deactivate profile.')
115 116 end
... ... @@ -123,7 +124,7 @@ class ProfileEditorController &lt; MyProfileController
123 124 profile = environment.profiles.find(params[:id])
124 125  
125 126 if profile.enable
126   - session[:notice] = _("The profile '#{profile.name}' was activated.")
  127 + session[:notice] = _("The profile '%s' was activated.") % profile.name
127 128 else
128 129 session[:notice] = _('Could not activate the profile.')
129 130 end
... ... @@ -155,4 +156,10 @@ class ProfileEditorController &lt; MyProfileController
155 156 end
156 157 end
157 158  
  159 + def forbid_destroy_profile
  160 + if environment.enabled?('forbid_destroy_profile') && !current_person.is_admin?(environment)
  161 + session[:notice] = _('You can not destroy the profile.')
  162 + redirect_to_previous_location
  163 + end
  164 + end
158 165 end
... ...
app/controllers/public/account_controller.rb
... ... @@ -50,10 +50,12 @@ class AccountController &lt; ApplicationController
50 50  
51 51 if logged_in?
52 52 check_join_in_community(self.current_user)
  53 +
53 54 if params[:remember_me] == "1"
54 55 self.current_user.remember_me
55   - cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at }
  56 + cookies[:auth_token] = {value: self.current_user.remember_token, expires: self.current_user.remember_token_expires_at}
56 57 end
  58 +
57 59 if redirect?
58 60 go_to_initial_page
59 61 session[:notice] = _("Logged in successfully")
... ... @@ -92,6 +94,7 @@ class AccountController &lt; ApplicationController
92 94 @invitation_code = params[:invitation_code]
93 95 begin
94 96 @user = User.new(params[:user])
  97 + @user.session = session
95 98 @user.terms_of_use = environment.terms_of_use
96 99 @user.environment = environment
97 100 @terms_of_use = environment.terms_of_use
... ... @@ -435,7 +438,7 @@ class AccountController &lt; ApplicationController
435 438 end
436 439  
437 440 def go_to_signup_initial_page
438   - check_redirection_options(user, user.environment.redirection_after_signup, user.url)
  441 + check_redirection_options user, user.environment.redirection_after_signup, user.url, signup: true
439 442 end
440 443  
441 444 def redirect_if_logged_in
... ... @@ -455,8 +458,11 @@ class AccountController &lt; ApplicationController
455 458  
456 459 protected
457 460  
458   - def check_redirection_options(user, condition, default)
459   - case condition
  461 + def check_redirection_options user, condition, default, options={}
  462 + if options[:signup] and target = session.delete(:after_signup_redirect_to)
  463 + redirect_to target
  464 + else
  465 + case condition
460 466 when 'keep_on_same_page'
461 467 redirect_back_or_default(user.admin_url)
462 468 when 'site_homepage'
... ... @@ -469,8 +475,11 @@ class AccountController &lt; ApplicationController
469 475 redirect_to user.admin_url
470 476 when 'welcome_page'
471 477 redirect_to :controller => :home, :action => :welcome, :template_id => (user.template && user.template.id)
472   - else
473   - redirect_back_or_default(default)
  478 + when 'custom_url'
  479 + if (url = user.custom_url_redirection).present? then redirect_to url else redirect_back_or_default default end
  480 + else
  481 + redirect_back_or_default(default)
  482 + end
474 483 end
475 484 end
476 485  
... ...
app/controllers/public/profile_controller.rb
... ... @@ -6,6 +6,7 @@ class ProfileController &lt; PublicController
6 6 before_filter :login_required, :only => [:add, :join, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_activities, :view_more_network_activities, :report_abuse, :register_report, :leave_comment_on_activity, :send_mail]
7 7  
8 8 helper TagsHelper
  9 + helper ActionTrackerHelper
9 10  
10 11 protect 'send_mail_to_members', :profile, :only => [:send_mail]
11 12  
... ...
app/helpers/action_tracker_helper.rb 0 → 100644
... ... @@ -0,0 +1,94 @@
  1 +module ActionTrackerHelper
  2 +
  3 + def create_article_description ta
  4 + _('published an article: %{title}') % { title: link_to(truncate(ta.get_name), ta.get_url) }
  5 + end
  6 +
  7 + def new_friendship_description ta
  8 + n_('has made 1 new friend:<br />%{name}', 'has made %{num} new friends:<br />%{name}', ta.get_friend_name.size) % {
  9 + num: ta.get_friend_name.size,
  10 + name: ta.collect_group_with_index(:friend_name) do |n,i|
  11 + link_to image_tag(ta.get_friend_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/person-icon.png")),
  12 + ta.get_friend_url[i], title: n
  13 + end.join
  14 + }
  15 + end
  16 +
  17 + def join_community_description ta
  18 + n_('has joined 1 community:<br />%{name}', 'has joined %{num} communities:<br />%{name}', ta.get_resource_name.size) % {
  19 + num: ta.get_resource_name.size,
  20 + name: ta.collect_group_with_index(:resource_name) do |n,i|
  21 + link_to image_tag(ta.get_resource_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/community-icon.png")),
  22 + ta.get_resource_url[i], title: n
  23 + end.join
  24 + }
  25 + end
  26 +
  27 + def add_member_in_community_description ta
  28 + _('has joined the community.')
  29 + end
  30 +
  31 + def upload_image_description ta
  32 + total = ta.get_view_url.size
  33 + (n_('uploaded 1 image', 'uploaded %d images', total) % total) +
  34 + tag(:br) +
  35 + ta.collect_group_with_index(:thumbnail_path) do |t,i|
  36 + if total == 1
  37 + link_to image_tag(t), ta.get_view_url[i], class: 'upimg'
  38 + else
  39 + pos = total-i;
  40 + morethen2 = pos>2 ? 'morethen2' : ''
  41 + morethen5 = pos>5 ? 'morethen5' : ''
  42 + t = t.gsub(/(.*)(display)(.*)/, '\\1thumb\\3')
  43 +
  44 + link_to '&nbsp;'.html_safe, ta.get_view_url[i],
  45 + style: "background-image:url(#{t})",
  46 + class: "upimg pos#{pos} #{morethen2} #{morethen5}"
  47 + end
  48 + end.reverse.join +
  49 + if total <= 5 then ''.html_safe else content_tag :span, '&hellip;'.html_safe,
  50 + class: 'more', onclick: "this.parentNode.className+=' show-all'" end +
  51 + tag(:br, style: 'clear: both')
  52 + end
  53 +
  54 + def reply_scrap_description ta
  55 + _('sent a message to %{receiver}: <br /> "%{message}"') % {
  56 + receiver: link_to(ta.get_receiver_name, ta.get_receiver_url),
  57 + message: auto_link_urls(ta.get_content)
  58 + }
  59 + end
  60 +
  61 + alias :leave_scrap_description :reply_scrap_description
  62 + alias :reply_scrap_on_self_description :reply_scrap_description
  63 +
  64 + def leave_scrap_to_self_description ta
  65 + _('wrote: <br /> "%{text}"') % {
  66 + text: auto_link_urls(ta.get_content)
  67 + }
  68 + end
  69 +
  70 + def create_product_description
  71 + _('created the product %{title}') % {
  72 + title: link_to(truncate(ta.get_name), ta.get_url),
  73 + }
  74 + end
  75 +
  76 + def update_product_description
  77 + _('updated the product %{title}') % {
  78 + title: link_to(truncate(ta.get_name), ta.get_url),
  79 + }
  80 + end
  81 +
  82 + def remove_product_description
  83 + _('removed the product %{title}') % {
  84 + title: truncate(ta.get_name),
  85 + }
  86 + end
  87 +
  88 + def favorite_enterprise_description ta
  89 + _('favorited enterprise %{title}') % {
  90 + title: link_to(truncate(ta.get_enterprise_name), ta.get_enterprise_url),
  91 + }
  92 + end
  93 +
  94 +end
... ...
app/helpers/layout_helper.rb
... ... @@ -77,15 +77,8 @@ module LayoutHelper
77 77  
78 78  
79 79 def icon_theme_stylesheet_path
80   - icon_themes = []
81 80 theme_icon_themes = theme_option(:icon_theme) || []
82   - for icon_theme in theme_icon_themes do
83   - theme_path = "designs/icons/#{icon_theme}/style.css"
84   - if File.exists?(Rails.root.join('public', theme_path))
85   - icon_themes << theme_path
86   - end
87   - end
88   - icon_themes
  81 + theme_icon_themes.map{ |it| "designs/icons/#{it}/style.css" }
89 82 end
90 83  
91 84 def jquery_ui_theme_stylesheet_path
... ...
app/mailers/scrap_notifier.rb
... ... @@ -3,6 +3,8 @@ class ScrapNotifier &lt; ApplicationMailer
3 3 def notification(scrap)
4 4 sender, receiver = scrap.sender, scrap.receiver
5 5 self.environment = sender.environment
  6 + # for tests
  7 + return unless receiver.email
6 8  
7 9 @recipient = receiver.name
8 10 @sender = sender.name
... ...
app/models/add_member.rb
... ... @@ -26,7 +26,8 @@ class AddMember &lt; Task
26 26 end
27 27  
28 28 def information
29   - {:message => _('%{requestor} wants to be a member of this community.')}
  29 + {:message => _("%{requestor} wants to be a member of '%{organization}'."),
  30 + variables: {requestor: requestor.name, organization: organization.name}}
30 31 end
31 32  
32 33 def accept_details
... ... @@ -42,7 +43,7 @@ class AddMember &lt; Task
42 43 end
43 44  
44 45 def target_notification_description
45   - _('%{requestor} wants to be a member of this community.') % {:requestor => requestor.name}
  46 + _("%{requestor} wants to be a member of '%{organization}'.") % {:requestor => requestor.name, :organization => organization.name}
46 47 end
47 48  
48 49 def target_notification_message
... ...
app/models/article.rb
... ... @@ -8,7 +8,8 @@ class Article &lt; ActiveRecord::Base
8 8 :accept_comments, :feed, :published, :source, :source_name,
9 9 :highlighted, :notify_comments, :display_hits, :slug,
10 10 :external_feed_builder, :display_versions, :external_link,
11   - :image_builder, :show_to_followers
  11 + :image_builder, :show_to_followers,
  12 + :author
12 13  
13 14 acts_as_having_image
14 15  
... ...
app/models/community.rb
... ... @@ -86,8 +86,8 @@ class Community &lt; Organization
86 86 {:title => _('Community Info and settings'), :icon => 'edit-profile-group'}
87 87 end
88 88  
89   - def activities
90   - Scrap.find_by_sql("SELECT id, updated_at, '#{Scrap.to_s}' AS klass FROM #{Scrap.table_name} WHERE scraps.receiver_id = #{self.id} AND scraps.scrap_id IS NULL UNION SELECT id, updated_at, '#{ActionTracker::Record.to_s}' AS klass FROM #{ActionTracker::Record.table_name} WHERE action_tracker.target_id = #{self.id} and action_tracker.verb != 'join_community' and action_tracker.verb != 'leave_scrap' UNION SELECT at.id, at.updated_at, '#{ActionTracker::Record.to_s}' AS klass FROM #{ActionTracker::Record.table_name} at INNER JOIN articles a ON at.target_id = a.id WHERE a.profile_id = #{self.id} AND at.target_type = 'Article' ORDER BY updated_at DESC")
  89 + def exclude_verbs_on_activities
  90 + %w[join_community leave_scrap]
91 91 end
92 92  
93 93 end
... ...
app/models/enterprise.rb
... ... @@ -15,12 +15,15 @@ class Enterprise &lt; Organization
15 15  
16 16 N_('Enterprise')
17 17  
18   - has_many :products, :foreign_key => :profile_id, :dependent => :destroy, :order => 'name ASC'
  18 + acts_as_trackable after_add: proc{ |p, t| notify_activity t }
  19 +
  20 + has_many :products, :foreign_key => :profile_id, :dependent => :destroy
  21 + has_many :product_categories, :through => :products
19 22 has_many :inputs, :through => :products
20 23 has_many :production_costs, :as => :owner
21 24  
22 25 has_many :favorite_enterprise_people
23   - has_many :fans, through: :favorite_enterprise_people, source: :person
  26 + has_many :fans, source: :person, through: :favorite_enterprise_people
24 27  
25 28 def product_categories
26 29 ProductCategory.by_enterprise(self)
... ... @@ -194,10 +197,6 @@ class Enterprise &lt; Organization
194 197 true
195 198 end
196 199  
197   - def activities
198   - Scrap.find_by_sql("SELECT id, updated_at, 'Scrap' AS klass FROM scraps WHERE scraps.receiver_id = #{self.id} AND scraps.scrap_id IS NULL UNION SELECT id, updated_at, 'ActionTracker::Record' AS klass FROM action_tracker WHERE action_tracker.target_id = #{self.id} UNION SELECT action_tracker.id, action_tracker.updated_at, 'ActionTracker::Record' AS klass FROM action_tracker INNER JOIN articles ON action_tracker.target_id = articles.id WHERE articles.profile_id = #{self.id} AND action_tracker.target_type = 'Article' ORDER BY updated_at DESC")
199   - end
200   -
201 200 def catalog_url
202 201 { :profile => identifier, :controller => 'catalog'}
203 202 end
... ... @@ -206,4 +205,9 @@ class Enterprise &lt; Organization
206 205 ''
207 206 end
208 207  
  208 + def followed_by? person
  209 + super or self.fans.where(id: person.id).count > 0
  210 + end
  211 +
  212 +
209 213 end
... ...
app/models/environment.rb
... ... @@ -131,6 +131,7 @@ class Environment &lt; ActiveRecord::Base
131 131 'disable_select_city_for_contact' => _('Disable state/city select for contact form'),
132 132 'disable_contact_person' => _('Disable contact for people'),
133 133 'disable_contact_community' => _('Disable contact for groups/communities'),
  134 + 'forbid_destroy_profile' => _('Forbid users of removing profiles'),
134 135  
135 136 'products_for_enterprises' => _('Enable products for enterprises'),
136 137 'enterprise_registration' => _('Enterprise registration'),
... ... @@ -170,7 +171,8 @@ class Environment &lt; ActiveRecord::Base
170 171 'site_homepage' => _('Redirects the user to the environment homepage.'),
171 172 'user_profile_page' => _('Redirects the user to his profile page.'),
172 173 'user_homepage' => _('Redirects the user to his homepage.'),
173   - 'user_control_panel' => _('Redirects the user to his control panel.')
  174 + 'user_control_panel' => _('Redirects the user to his control panel.'),
  175 + 'custom_url' => _('Specify the URL to redirect to:'),
174 176 }
175 177 end
176 178 validates_inclusion_of :redirection_after_login, :in => Environment.login_redirection_options.keys, :allow_nil => true
... ... @@ -253,6 +255,9 @@ class Environment &lt; ActiveRecord::Base
253 255 # store the Environment settings as YAML-serialized Hash.
254 256 acts_as_having_settings :field => :settings
255 257  
  258 + # introduce and explain to users something about the signup
  259 + settings_items :signup_intro, :type => String
  260 +
256 261 # the environment's terms of use: every user must accept them before registering.
257 262 settings_items :terms_of_use, :type => String
258 263  
... ... @@ -287,7 +292,20 @@ class Environment &lt; ActiveRecord::Base
287 292 settings_items :activation_blocked_text, :type => String
288 293 settings_items :message_for_disabled_enterprise, :type => String,
289 294 :default => _('This enterprise needs to be enabled.')
290   - settings_items :location, :type => String
  295 +
  296 + settings_items :contact_phone, type: String
  297 + settings_items :address, type: String
  298 + settings_items :city, type: String
  299 + settings_items :state, type: String
  300 + settings_items :country_name, type: String
  301 + settings_items :lat, type: Float
  302 + settings_items :lng, type: Float
  303 + settings_items :postal_code, type: String
  304 + settings_items :location, type: String
  305 +
  306 + alias_method :zip_code=, :postal_code
  307 + alias_method :zip_code, :postal_code
  308 +
291 309 settings_items :layout_template, :type => String, :default => 'default'
292 310 settings_items :homepage, :type => String
293 311 settings_items :description, :type => String, :default => '<div style="text-align: center"><a href="http://noosfero.org/"><img src="/images/noosfero-network.png" alt="Noosfero"/></a></div>'
... ...
app/models/favorite_enterprise_person.rb
1 1 class FavoriteEnterprisePerson < ActiveRecord::Base
2 2  
3   - self.table_name = :favorite_enteprises_people
  3 + attr_accessible :person, :enterprise
  4 +
  5 + track_actions :favorite_enterprise, :after_create, keep_params: [:enterprise_name, :enterprise_url], if: proc{ |f| f.is_trackable? }
4 6  
5 7 belongs_to :enterprise
6 8 belongs_to :person
7 9  
  10 + protected
  11 +
  12 + def is_trackable?
  13 + self.enterprise.public?
  14 + end
  15 +
  16 + def enterprise_name
  17 + self.enterprise.short_name(nil)
  18 + end
  19 + def enterprise_url
  20 + self.enterprise.url
  21 + end
  22 +
8 23 end
... ...
app/models/organization.rb
... ... @@ -35,6 +35,10 @@ class Organization &lt; Profile
35 35  
36 36 validate :presence_of_required_fieds, :unless => :is_template
37 37  
  38 + def self.notify_activity tracked_action
  39 + Delayed::Job.enqueue NotifyActivityToProfilesJob.new(tracked_action.id)
  40 + end
  41 +
38 42 def presence_of_required_fieds
39 43 self.required_fields.each do |field|
40 44 if self.send(field).blank?
... ...
app/models/person.rb
... ... @@ -82,6 +82,9 @@ class Person &lt; Profile
82 82  
83 83 has_many :scraps_sent, :class_name => 'Scrap', :foreign_key => :sender_id, :dependent => :destroy
84 84  
  85 + has_many :favorite_enterprise_people
  86 + has_many :favorite_enterprises, source: :enterprise, through: :favorite_enterprise_people
  87 +
85 88 has_and_belongs_to_many :acepted_forums, :class_name => 'Forum', :join_table => 'terms_forum_people'
86 89 has_and_belongs_to_many :articles_with_access, :class_name => 'Article', :join_table => 'article_privacy_exceptions'
87 90  
... ... @@ -326,8 +329,6 @@ class Person &lt; Profile
326 329 ]
327 330 end
328 331  
329   - has_and_belongs_to_many :favorite_enterprises, :class_name => 'Enterprise', :join_table => 'favorite_enteprises_people'
330   -
331 332 def email_domain
332 333 user && user.email_domain || environment.default_hostname(true)
333 334 end
... ... @@ -507,8 +508,8 @@ class Person &lt; Profile
507 508 user.save!
508 509 end
509 510  
510   - def activities
511   - Scrap.find_by_sql("SELECT id, updated_at, '#{Scrap.to_s}' AS klass FROM #{Scrap.table_name} WHERE scraps.receiver_id = #{self.id} AND scraps.scrap_id IS NULL UNION SELECT id, updated_at, '#{ActionTracker::Record.to_s}' AS klass FROM #{ActionTracker::Record.table_name} WHERE action_tracker.user_id = #{self.id} and action_tracker.verb != 'leave_scrap_to_self' and action_tracker.verb != 'add_member_in_community' and action_tracker.verb != 'reply_scrap_on_self' ORDER BY updated_at DESC")
  511 + def exclude_verbs_on_activities
  512 + %w[leave_scrap_to_self add_member_in_community reply_scrap_on_self]
512 513 end
513 514  
514 515 # by default, all fields are private
... ...
app/models/person_notifier.rb
... ... @@ -80,6 +80,7 @@ class PersonNotifier
80 80 class Mailer < ActionMailer::Base
81 81  
82 82 helper ApplicationHelper
  83 + helper ActionTrackerHelper
83 84  
84 85 def session
85 86 {:theme => nil}
... ...
app/models/product.rb
... ... @@ -17,13 +17,14 @@ class Product &lt; ActiveRecord::Base
17 17 'full'
18 18 end
19 19  
20   - belongs_to :enterprise, :foreign_key => :profile_id, :class_name => 'Profile'
21 20 belongs_to :profile
  21 + # backwards compatibility
  22 + belongs_to :enterprise, :foreign_key => :profile_id, :class_name => 'Profile'
22 23 alias_method :enterprise=, :profile=
23 24 alias_method :enterprise, :profile
24 25  
25   - has_one :region, :through => :enterprise
26   - validates_presence_of :enterprise
  26 + has_one :region, :through => :profile
  27 + validates_presence_of :profile
27 28  
28 29 belongs_to :product_category
29 30  
... ... @@ -37,6 +38,10 @@ class Product &lt; ActiveRecord::Base
37 38  
38 39 acts_as_having_settings :field => :data
39 40  
  41 + track_actions :create_product, :after_create, :keep_params => [:name, :url ], :if => Proc.new { |a| a.is_trackable? }, :custom_user => :action_tracker_user
  42 + track_actions :update_product, :before_update, :keep_params => [:name, :url], :if => Proc.new { |a| a.is_trackable? }, :custom_user => :action_tracker_user
  43 + track_actions :remove_product, :before_destroy, :keep_params => [:name], :if => Proc.new { |a| a.is_trackable? }, :custom_user => :action_tracker_user
  44 +
40 45 validates_uniqueness_of :name, :scope => :profile_id, :allow_nil => true, :if => :validate_uniqueness_of_column_name?
41 46  
42 47 validates_presence_of :product_category_id
... ... @@ -54,10 +59,10 @@ class Product &lt; ActiveRecord::Base
54 59 after_update :save_image
55 60  
56 61 def lat
57   - self.enterprise.lat
  62 + self.profile.lat
58 63 end
59 64 def lng
60   - self.enterprise.lng
  65 + self.profile.lng
61 66 end
62 67  
63 68 xss_terminate :only => [ :name ], :on => 'validation'
... ... @@ -71,7 +76,7 @@ class Product &lt; ActiveRecord::Base
71 76 filter_iframes :description
72 77  
73 78 def iframe_whitelist
74   - enterprise && enterprise.environment && enterprise.environment.trusted_sites_for_iframe
  79 + self.profile && self.profile.environment && self.profile.environment.trusted_sites_for_iframe
75 80 end
76 81  
77 82 def name
... ... @@ -109,16 +114,16 @@ class Product &lt; ActiveRecord::Base
109 114 end
110 115  
111 116 def url
112   - enterprise.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => id)
  117 + self.profile.public_profile_url.merge(:controller => 'manage_products', :action => 'show', :id => id)
113 118 end
114 119  
115 120 def public?
116   - enterprise.public?
  121 + self.profile.public?
117 122 end
118 123  
119 124 def formatted_value(method)
120 125 value = self[method] || self.send(method)
121   - ("%.2f" % value).to_s.gsub('.', enterprise.environment.currency_separator) if value
  126 + ("%.2f" % value).to_s.gsub('.', self.profile.environment.currency_separator) if value
122 127 end
123 128  
124 129 def price_with_discount
... ... @@ -223,16 +228,16 @@ class Product &lt; ActiveRecord::Base
223 228 end
224 229  
225 230 def available_production_costs
226   - self.enterprise.environment.production_costs + self.enterprise.production_costs
  231 + self.profile.environment.production_costs + self.profile.production_costs
227 232 end
228 233  
229 234 include Rails.application.routes.url_helpers
230 235 def price_composition_bar_display_url
231   - url_for({:host => enterprise.default_hostname, :controller => 'manage_products', :action => 'display_price_composition_bar', :profile => enterprise.identifier, :id => self.id }.merge(Noosfero.url_options))
  236 + url_for({:host => self.profile.default_hostname, :controller => 'manage_products', :action => 'display_price_composition_bar', :profile => self.profile.identifier, :id => self.id }.merge(Noosfero.url_options))
232 237 end
233 238  
234 239 def inputs_cost_update_url
235   - url_for({:host => enterprise.default_hostname, :controller => 'manage_products', :action => 'display_inputs_cost', :profile => enterprise.identifier, :id => self.id }.merge(Noosfero.url_options))
  240 + url_for({:host => self.profile.default_hostname, :controller => 'manage_products', :action => 'display_inputs_cost', :profile => self.profile.identifier, :id => self.id }.merge(Noosfero.url_options))
236 241 end
237 242  
238 243 def percentage_from_solidarity_economy
... ... @@ -249,7 +254,7 @@ class Product &lt; ActiveRecord::Base
249 254 end
250 255 end
251 256  
252   - delegate :enabled, :region, :region_id, :environment, :environment_id, :to => :enterprise
  257 + delegate :enabled, :region, :region_id, :environment, :environment_id, :to => :profile, allow_nil: true
253 258  
254 259 protected
255 260  
... ... @@ -257,4 +262,13 @@ class Product &lt; ActiveRecord::Base
257 262 true
258 263 end
259 264  
  265 + def is_trackable?
  266 + # shopping_cart create products without profile
  267 + self.profile.present?
  268 + end
  269 +
  270 + def action_tracker_user
  271 + self.profile
  272 + end
  273 +
260 274 end
... ...
app/models/profile.rb
... ... @@ -3,7 +3,9 @@
3 3 # which by default is the one returned by Environment:default.
4 4 class Profile < ActiveRecord::Base
5 5  
6   - attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time, :redirection_after_login, :email_suggestions, :allow_members_to_invite, :invite_friends_only, :secret
  6 + attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time,
  7 + :redirection_after_login, :custom_url_redirection,
  8 + :email_suggestions, :allow_members_to_invite, :invite_friends_only, :secret
7 9  
8 10 # use for internationalizable human type names in search facets
9 11 # reimplement on subclasses
... ... @@ -152,6 +154,7 @@ class Profile &lt; ActiveRecord::Base
152 154  
153 155 acts_as_trackable :dependent => :destroy
154 156  
  157 + has_many :profile_activities
155 158 has_many :action_tracker_notifications, :foreign_key => 'profile_id'
156 159 has_many :tracked_notifications, :through => :action_tracker_notifications, :source => :action_tracker, :order => 'updated_at DESC'
157 160 has_many :scraps_received, :class_name => 'Scrap', :foreign_key => :receiver_id, :order => "updated_at DESC", :dependent => :destroy
... ... @@ -748,7 +751,11 @@ private :generate_url, :url_options
748 751 include ActionView::Helpers::TextHelper
749 752 def short_name(chars = 40)
750 753 if self[:nickname].blank?
751   - truncate self.name, :length => chars, :omission => '...'
  754 + if chars
  755 + truncate self.name, length: chars, omission: '...'
  756 + else
  757 + self.name
  758 + end
752 759 else
753 760 self[:nickname]
754 761 end
... ... @@ -981,9 +988,13 @@ private :generate_url, :url_options
981 988 name
982 989 end
983 990  
984   - # Override in your subclasses
  991 + def exclude_verbs_on_activities
  992 + %w[]
  993 + end
  994 +
  995 + # Customize in subclasses
985 996 def activities
986   - []
  997 + self.profile_activities.includes(:activity).order('updated_at DESC')
987 998 end
988 999  
989 1000 def may_display_field_to? field, user = nil
... ... @@ -1030,6 +1041,7 @@ private :generate_url, :url_options
1030 1041 def preferred_login_redirection
1031 1042 redirection_after_login.blank? ? environment.redirection_after_login : redirection_after_login
1032 1043 end
  1044 + settings_items :custom_url_redirection, type: String, default: nil
1033 1045  
1034 1046 def remove_from_suggestion_list(person)
1035 1047 suggestion = person.suggested_profiles.find_by_suggestion_id self.id
... ...
app/models/profile_activity.rb 0 → 100644
... ... @@ -0,0 +1,31 @@
  1 +class ProfileActivity < ActiveRecord::Base
  2 +
  3 + self.record_timestamps = false
  4 +
  5 + attr_accessible :profile_id,
  6 + :profile, :activity
  7 +
  8 + belongs_to :profile
  9 + belongs_to :activity, polymorphic: true
  10 +
  11 + # non polymorphic versions
  12 + belongs_to :scrap, foreign_key: :activity_id, class_name: 'Scrap', conditions: {profile_activities: {activity_type: 'Scrap'}}
  13 + belongs_to :action_tracker, foreign_key: :activity_id, class_name: 'ActionTracker::Record', conditions: {profile_activities: {activity_type: 'ActionTracker::Record'}}
  14 +
  15 + before_validation :copy_timestamps
  16 +
  17 + def self.update_activity activity
  18 + profile_activity = ProfileActivity.where(activity_id: activity.id, activity_type: activity.class.base_class.name).first
  19 + profile_activity.send :copy_timestamps
  20 + profile_activity.save!
  21 + profile_activity
  22 + end
  23 +
  24 + protected
  25 +
  26 + def copy_timestamps
  27 + self.created_at = self.activity.created_at
  28 + self.updated_at = self.activity.updated_at
  29 + end
  30 +
  31 +end
... ...
app/models/profile_list_block.rb
... ... @@ -16,19 +16,19 @@ class ProfileListBlock &lt; Block
16 16  
17 17 def profile_list
18 18 result = nil
19   - visible_profiles = profiles.visible.includes([:image,:domains,:preferred_domain,:environment])
  19 + public_profiles = profiles.public.includes([:image,:domains,:preferred_domain,:environment])
20 20 if !prioritize_profiles_with_image
21   - result = visible_profiles.all(:limit => get_limit, :order => 'profiles.updated_at DESC').sort_by{ rand }
  21 +result = public_profiles.all(:limit => get_limit, :order => 'profiles.updated_at DESC').sort_by{ rand }
22 22 elsif profiles.visible.with_image.count >= get_limit
23   - result = visible_profiles.with_image.all(:limit => get_limit * 5, :order => 'profiles.updated_at DESC').sort_by{ rand }
  23 + result = public_profiles.with_image.all(:limit => get_limit * 5, :order => 'profiles.updated_at DESC').sort_by{ rand }
24 24 else
25   - result = visible_profiles.with_image.sort_by{ rand } + visible_profiles.without_image.all(:limit => get_limit * 5, :order => 'profiles.updated_at DESC').sort_by{ rand }
  25 + result = public_profiles.with_image.sort_by{ rand } + public_profiles.without_image.all(:limit => get_limit * 5, :order => 'profiles.updated_at DESC').sort_by{ rand }
26 26 end
27 27 result.slice(0..get_limit-1)
28 28 end
29 29  
30 30 def profile_count
31   - profiles.visible.length
  31 + profiles.public.length
32 32 end
33 33  
34 34 # the title of the block. Probably will be overriden in subclasses.
... ...
app/models/scrap.rb
... ... @@ -13,6 +13,11 @@ class Scrap &lt; ActiveRecord::Base
13 13 has_many :replies, :class_name => 'Scrap', :foreign_key => 'scrap_id', :dependent => :destroy
14 14 belongs_to :root, :class_name => 'Scrap', :foreign_key => 'scrap_id'
15 15  
  16 + has_many :profile_activities, foreign_key: :activity_id, conditions: {profile_activities: {activity_type: 'Scrap'}}, dependent: :destroy
  17 +
  18 + after_create :create_activity
  19 + after_update :update_activity
  20 +
16 21 scope :all_scraps, -> (profile) { limit(30).where("receiver_id = ? OR sender_id = ?", profile, profile) }
17 22  
18 23 scope :not_replies, -> { where scrap_id: nil }
... ... @@ -23,10 +28,7 @@ class Scrap &lt; ActiveRecord::Base
23 28  
24 29 track_actions :reply_scrap_on_self, :after_create, :keep_params => ['sender.name', 'content'], :if => Proc.new{|s| s.sender != s.receiver && s.sender == s.top_root.receiver}
25 30  
26   - after_create do |scrap|
27   - scrap.root.update_attribute('updated_at', DateTime.now) unless scrap.root.nil?
28   - ScrapNotifier.notification(scrap).deliver if scrap.send_notification?
29   - end
  31 + after_create :send_notification
30 32  
31 33 before_validation :strip_all_html_tags
32 34  
... ... @@ -57,4 +59,21 @@ class Scrap &lt; ActiveRecord::Base
57 59 sender != receiver && (is_root? ? root.receiver.receives_scrap_notification? : receiver.receives_scrap_notification?)
58 60 end
59 61  
  62 + protected
  63 +
  64 + def create_activity
  65 + # do not scrap replies (when scrap_id is not nil)
  66 + return if self.scrap_id.present?
  67 + ProfileActivity.create! profile_id: self.receiver_id, activity: self
  68 + end
  69 +
  70 + def update_activity
  71 + ProfileActivity.update_activity self
  72 + end
  73 +
  74 + def send_notification
  75 + self.root.update_attribute('updated_at', DateTime.now) unless self.root.nil?
  76 + ScrapNotifier.notification(self).deliver if self.send_notification?
  77 + end
  78 +
60 79 end
... ...
app/models/session.rb 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +class Session < ActiveRecord::SessionStore::Session
  2 +
  3 + # removed and redefined on super class
  4 + def self.find_by_session_id session_id
  5 + super
  6 + end
  7 +
  8 + belongs_to :user
  9 +
  10 + before_save :copy_to_columns
  11 +
  12 + protected
  13 +
  14 + def copy_to_columns
  15 + self.user_id = self.data['user']
  16 + end
  17 +
  18 +end
... ...
app/models/uploaded_file.rb
... ... @@ -164,4 +164,8 @@ class UploadedFile &lt; Article
164 164 true
165 165 end
166 166  
  167 + def notifiable?
  168 + true
  169 + end
  170 +
167 171 end
... ...
app/models/user.rb
... ... @@ -15,6 +15,14 @@ class User &lt; ActiveRecord::Base
15 15 :email => {:label => _('Email'), :weight => 5},
16 16 }
17 17  
  18 + # see http://stackoverflow.com/a/2513456/670229
  19 + def self.current
  20 + Thread.current[:current_user]
  21 + end
  22 + def self.current=(user)
  23 + Thread.current[:current_user] = user
  24 + end
  25 +
18 26 def self.[](login)
19 27 self.find_by_login(login)
20 28 end
... ... @@ -89,6 +97,10 @@ class User &lt; ActiveRecord::Base
89 97 has_one :person, dependent: :destroy, autosave: false
90 98 belongs_to :environment
91 99  
  100 + has_many :sessions, dependent: :destroy
  101 + # holds the current session, see lib/authenticated_system.rb
  102 + attr_accessor :session
  103 +
92 104 attr_protected :activated_at
93 105  
94 106 # Virtual attribute for the unencrypted password
... ... @@ -242,8 +254,9 @@ class User &lt; ActiveRecord::Base
242 254  
243 255 # These create and unset the fields required for remembering users between browser closes
244 256 def remember_me
245   - self.remember_token_expires_at = 2.weeks.from_now.utc
246   - self.remember_token = encrypt("#{email}--#{remember_token_expires_at}")
  257 + self.remember_token_expires_at = 1.months.from_now.utc
  258 + # if the user's email/password changes this won't be valid anymore
  259 + self.remember_token = encrypt "#{email}-#{self.crypted_password}-#{remember_token_expires_at}"
247 260 save(:validate => false)
248 261 end
249 262  
... ...
app/models/validation_info.rb
... ... @@ -2,9 +2,10 @@ class ValidationInfo &lt; ActiveRecord::Base
2 2  
3 3 attr_accessible :validation_methodology, :restrictions, :organization
4 4  
5   - validates_presence_of :validation_methodology
6   -
7 5 belongs_to :organization
8 6  
  7 + validates_presence_of :organization
  8 + validates_presence_of :validation_methodology
  9 +
9 10 xss_terminate :only => [ :validation_methodology, :restrictions ], :on => 'validation'
10 11 end
... ...
app/views/account/login.html.erb
... ... @@ -13,7 +13,14 @@
13 13  
14 14 <%= f.password_field :password %>
15 15  
16   - <%= @plugins.dispatch(:login_extra_contents).collect { |content| instance_eval(&content) }.join("") %>
  16 + <div class='checkbox'>
  17 + <label>
  18 + <%= check_box_tag :remember_me, '1', true %>
  19 + <%= _'Keep me logged in' %>
  20 + </label>
  21 + </div>
  22 +
  23 + <%= @plugins.dispatch(:login_extra_contents).collect { |content| instance_exec(&content) }.join("") %>
17 24  
18 25 <% button_bar do %>
19 26 <%= submit_button( 'login', _('Log in') )%>
... ...
app/views/account/signup.html.erb
1 1 <h1><%= _('Sign up for %s!') % environment.name %></h1>
  2 +
  3 +<div id='signup-intro'>
  4 + <%= environment.signup_intro %>
  5 +</div>
  6 +
2 7 <%= render :partial => 'signup_form' %>
... ...
app/views/admin_panel/_signup_intro.html.erb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<div class='description'>
  2 + <%= _('This text will be shown to the user on the top of the sign up form.') %>
  3 +</div>
  4 +
  5 +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_intro, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %>
... ...
app/views/admin_panel/site_info.html.erb
... ... @@ -17,6 +17,8 @@
17 17 :content => (render :partial => 'signup_welcome_text', :locals => {:f => f})} %>
18 18 <% tabs << {:title => _('Signup welcome page'), :id => 'signup-welcome-message',
19 19 :content => (render :partial => 'signup_welcome_screen', :locals => {:f => f}) }%>
  20 + <% tabs << {:title => _('Signup introduction text'), :id => 'signup-intro',
  21 + :content => (render :partial => 'signup_intro', :locals => {:f => f})} %>
20 22 <%= render_tabs(tabs) %>
21 23 <% button_bar do %>
22 24 <%= submit_button(:save, _('Save'), :cancel => {:action => 'index'}) %>
... ...
app/views/blocks/profile_info_actions/_enterprise.html.erb
1 1 <ul>
2 2 <%if logged_in? %>
3 3 <%if !user.favorite_enterprises.include?(profile) %>
4   - <li><%= button(:add, _('Add as favorite'), { :profile => user.identifier, :controller => 'favorite_enterprises', :action => 'add', :id => profile.id }, :title => _('Add enterprise as favorite')) %></li>
  4 + <li><%= button(:love, _('Add as favorite'), { profile: user.identifier, controller: 'favorite_enterprises', action: 'add', id: profile.id }, title: _('Add enterprise as favorite')) %></li>
5 5 <% end %>
6 6 <% end %>
7 7 <% if profile.enable_contact? %>
... ...
app/views/blocks/profile_info_actions/_join_leave_community.html.erb
1 1 <div class='join-leave-button require-login-popup'>
2 2 <% if logged_in? %>
3   - <% if profile.members.include?(user) %>
4   - <%= button(:delete, content_tag('span', _('Leave community')), profile.leave_url,
5   - :class => 'leave-community',
6   - :title => _("Leave community"),
7   - :style => 'position: relative;') %>
8   - <%= button(:add, content_tag('span', _('Join')), profile.join_url,
9   - :class => 'join-community',
10   - :title => _("Join community"),
11   - :style => 'position: relative; display: none;') %>
  3 + <% if profile.already_request_membership? user %>
  4 + <%= _('Your membership is waiting for approval') %>
12 5 <% else %>
13   - <% unless profile.already_request_membership?(user) %>
14   - <%= button(:delete, content_tag('span', _('Leave community')), profile.leave_url,
15   - :class => 'leave-community',
16   - :title => _("Leave community"),
17   - :style => 'position: relative; display: none;') %>
18   - <%= button(:add, content_tag('span', _('Join')), profile.join_url,
19   - :class => 'join-community',
20   - :title => _("Join community"),
21   - :style => 'position: relative;') %>
  6 + <% if user.in? profile.members %>
  7 + <%= button :delete, content_tag('span', _('Leave community')), profile.leave_url,
  8 + class: 'leave-community',
  9 + style: 'position: relative;' %>
  10 + <%= button :add, content_tag('span', _('Join this community')), profile.join_url,
  11 + class: 'join-community',
  12 + style: 'position: relative; display: none;' %>
  13 + <% else %>
  14 + <%= button :add, _('Join this community'), profile.join_url %>
22 15 <% end %>
23 16 <% end %>
24 17 <% else %>
25   - <%= button(:add, _('Join'), profile.join_not_logged_url, :title => _('Join this community')) %>
  18 + <%= button :add, _('Join this community'), profile.join_not_logged_url %>
26 19 <% end %>
27 20 </div>
  21 +
  22 +<%= javascript_tag do %>
  23 + noosfero.add_and_join.locales.leaveConfirmation = <%= (_("Please confirm to leave the community '%{name}'") % {name: profile.name}).to_json %>
  24 +<% end %>
  25 +
... ...
app/views/cms/_blog.html.erb
... ... @@ -53,7 +53,7 @@
53 53 %>
54 54 </div>
55 55  
56   -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10)) %>
  56 +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10, :class => 'mceEditor')) %>
57 57  
58 58 <%= f.fields_for :image_builder, @article.image do |i| %>
59 59 <%= file_field_or_thumbnail(_('Cover image:'), @article.image, i)%>
... ...
app/views/content_viewer/_article_toolbar.html.erb
... ... @@ -62,7 +62,7 @@
62 62 <% if @page.blog? and !@page.image.nil? %>
63 63 <div class="blog-cover"><%= image_tag(@page.image.public_filename())%></div>
64 64 <% end %>
65   - <%= link_to(image_tag('/images/icons-mime/rss-feed.png'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %>
  65 + <%= button_without_text(:feed, _('RSS feed'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %>
66 66 <%= @plugins.dispatch(:article_header_extra_contents, @page).collect { |content| instance_exec(&content) }.join("") %>
67 67 <%= render :partial => 'article_title', :locals => {:no_link => true} %>
68 68 <%= article_translations(@page) %>
... ...
app/views/content_viewer/article_versions.html.erb
... ... @@ -12,7 +12,7 @@
12 12 <li>
13 13 <%= radio_button_tag 'v1', v.version, false, :onclick => 'versionInputClicked(this)' %>
14 14 <%= radio_button_tag 'v2', v.version, false, :onclick => 'versionInputClicked(this)' %>
15   - <%= link_to(_("Version #{v.version}"), @page.url.merge(:version => v.version)) %>
  15 + <%= link_to(_("Version %s") % v.version, @page.url.merge(:version => v.version)) %>
16 16 <%= @page.version == v.version ? _('(current)') : '' %>
17 17 <span class='updated-by'><%= _('by %{author}') % {:author => link_to(@page.author_name(v.version), @page.author_url(v.version))} %></span>
18 18 <span class='updated-on'><%= show_time(v.updated_at) %></span>
... ...
app/views/content_viewer/folder.html.erb
... ... @@ -5,3 +5,4 @@
5 5 <% end %>
6 6  
7 7 <%= list_contents contents: folder.children %>
  8 +
... ...
app/views/content_viewer/view_page.html.erb
... ... @@ -24,7 +24,7 @@
24 24 <%= render :partial => 'article_toolbar' %>
25 25 </div>
26 26  
27   -<% if NOOSFERO_CONF['addthis_enabled'] %>
  27 +<% if NOOSFERO_CONF['addthis_enabled'] and @page.public? %>
28 28 <%= render :partial => 'addthis' %>
29 29 <% end %>
30 30  
... ...
app/views/file_presenter/_generic.html.erb
1   -<span class="download-link">
2   - <span>Download</span>
3   - <strong><%= link_to generic.filename, [Noosfero.root, generic.public_filename].join %></strong>
4   -</span>
5   -
6 1 <div class="uploaded-file-description <%= 'empty' if generic.abstract.blank? %>">
7 2 <%= generic.abstract %>
8 3 </div>
9 4  
  5 +<%= button(:download, _('Download'), [Noosfero.root, generic.public_filename].join, class:'download-link', option:'primary', size:'lg') %>
... ...
app/views/organizations/_results.html.erb
... ... @@ -30,7 +30,7 @@
30 30 </div>
31 31 </td>
32 32  
33   - <td> <%= _("#{p.type}") %> </td>
  33 + <td> <%= _(p.type) %> </td>
34 34 </tr>
35 35 <% end %>
36 36 </table>
... ...
app/views/person_notifier/mailer/_default_activity.html.erb
... ... @@ -4,7 +4,10 @@
4 4 </td>
5 5 <td>
6 6 <p>
7   - <span style="font-size: 14px;"><%= link_to activity.user.name, activity.user.url %> <%= describe activity %></span>
  7 + <span style="font-size: 14px;">
  8 + <%= link_to activity.user.name, activity.user.url %>
  9 + <%= describe activity %>
  10 + </span>
8 11 <span style="font-size: 10px; color: #929292; float: right;"><%= time_ago_in_words(activity.created_at) %></span>
9 12 </p>
10 13 </td>
... ...
app/views/profile/_create_product.html.erb 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +<div class='profile-activity-image'>
  2 + <%= link_to image_tag(activity.target.default_image :minor), activity.target.url, class: 'product-pic' if activity.target.present? %>
  3 +</div>
  4 +<div class='profile-activity-description'>
  5 + <p class='profile-activity-text'><%= link_to activity.user.short_name(nil), activity.user.url %> <%= describe activity %></p>
  6 + <p class='profile-activity-time'><%= time_ago_as_sentence activity.created_at %></p>
  7 +
  8 + <div class='profile-wall-actions'>
  9 + <%= link_to_function(_('Remove'), 'remove_item_wall(this, \'%s\', \'%s\', \'%s\'); return false ;' % [".profile-activity-item", url_for(:profile => params[:profile], :action => :remove_activity, :activity_id => activity.id, :view => params[:view]), _('Are you sure you want to remove this activity and all its replies?')]) if logged_in? && current_person == @profile %>
  10 + </div>
  11 +</div>
  12 +
  13 +<div style="clear: both"></div>
... ...
app/views/profile/_favorite_enterprise.html.erb 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +<div class='profile-activity-image'>
  2 + <%= link_to(profile_image(activity.user, :minor), activity.user.url) %>
  3 +</div>
  4 +<div class='profile-activity-description'>
  5 + <p class='profile-activity-text'>
  6 + <%= link_to activity.user.short_name(nil), activity.user.url %> <%= describe activity %>
  7 + </p>
  8 + <p class='profile-activity-time'><%= time_ago_as_sentence activity.created_at %></p>
  9 +
  10 + <div class='profile-wall-actions'>
  11 + <%= link_to_function(_('Remove'), 'remove_item_wall(this, \'%s\', \'%s\', \'%s\'); return false ;' % [".profile-activity-item", url_for(:profile => params[:profile], :action => :remove_activity, :activity_id => activity.id, :view => params[:view]), _('Are you sure you want to remove this activity and all its replies?')]) if logged_in? && current_person == @profile %>
  12 + </div>
  13 +</div>
  14 +
  15 +<div style="clear: both"></div>
... ...
app/views/profile/_profile_activities_list.html.erb
1 1 <% unless activities.nil? %>
2   - <% activities.each do |a| %>
3   - <% activity = a.klass.constantize.find(a.id) %>
  2 + <% activities.each do |profile_activity| %>
  3 + <% activity = profile_activity.activity %>
4 4 <% if activity.kind_of?(ActionTracker::Record) %>
5 5 <%= render :partial => 'profile_activity', :locals => { :activity => activity, :tab_action => 'wall' } if activity.visible? %>
6 6 <% else %>
... ...
app/views/profile/_remove_product.html.erb 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +<div class='profile-activity-image'>
  2 +</div>
  3 +<div class='profile-activity-description'>
  4 + <p class='profile-activity-text'><%= link_to activity.user.short_name(nil), activity.user.url %> <%= describe activity %></p>
  5 + <p class='profile-activity-time'><%= time_ago_as_sentence activity.created_at %></p>
  6 +
  7 + <div class='profile-wall-actions'>
  8 + <%= link_to_function(_('Remove'), 'remove_item_wall(this, \'%s\', \'%s\', \'%s\'); return false ;' % [".profile-activity-item", url_for(:profile => params[:profile], :action => :remove_activity, :activity_id => activity.id, :view => params[:view]), _('Are you sure you want to remove this activity and all its replies?')]) if logged_in? && current_person == @profile %>
  9 + </div>
  10 +</div>
  11 +
  12 +<div style="clear: both"></div>
... ...
app/views/profile/_update_product.html.erb 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +<div class='profile-activity-image'>
  2 + <%= link_to image_tag(activity.target.default_image :minor), activity.target.url, class: 'product-pic' if activity.target.present? %>
  3 +</div>
  4 +<div class='profile-activity-description'>
  5 + <p class='profile-activity-text'><%= link_to activity.user.short_name(nil), activity.user.url %> <%= describe activity %></p>
  6 + <p class='profile-activity-time'><%= time_ago_as_sentence activity.created_at %></p>
  7 +
  8 + <div class='profile-wall-actions'>
  9 + <%= link_to_function(_('Remove'), 'remove_item_wall(this, \'%s\', \'%s\', \'%s\'); return false ;' % [".profile-activity-item", url_for(:profile => params[:profile], :action => :remove_activity, :activity_id => activity.id, :view => params[:view]), _('Are you sure you want to remove this activity and all its replies?')]) if logged_in? && current_person == @profile %>
  10 + </div>
  11 +</div>
  12 +
  13 +<div style="clear: both"></div>
... ...
app/views/profile_editor/_redirection_after_login.html.erb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +<% content_for :head do %>
  2 + <%= javascript_include_tag 'redirection_after_login' %>
  3 +<% end %>
  4 +
  5 +<h2><%= _('Page to redirect after login') %></h2>
  6 +<%= f.select :redirection_after_login, Environment.login_redirection_options.map{ |key,value| [value,key] }, selected: @profile.preferred_login_redirection %>
  7 +
  8 +<%= f.text_field :custom_url_redirection %>
  9 +
... ...
app/views/profile_editor/edit.html.erb
... ... @@ -44,8 +44,7 @@
44 44 <% end %>
45 45  
46 46 <% if environment.enabled?('allow_change_of_redirection_after_login') %>
47   - <h2><%= _('Page to redirect after login') %></h2>
48   - <%= select 'profile_data', 'redirection_after_login', Environment.login_redirection_options.map{|key,value|[value,key]}, { :selected => @profile.preferred_login_redirection} %>
  47 + <%= render 'redirection_after_login', f: f %>
49 48 <% end %>
50 49  
51 50 <h2><%= _('Translations') %></h2>
... ... @@ -75,14 +74,23 @@
75 74  
76 75 <% if user && user.has_permission?('destroy_profile', profile) %>
77 76 <% button_bar(:id => 'delete-profile') do %>
78   - <%= button(:remove, _('Delete profile'), {:action => :destroy_profile}) %>
79 77  
80   - <% if environment.admins.include?(current_person) %>
  78 + <% if !environment.enabled?('forbid_destroy_profile') || user.is_admin?(environment) %>
  79 + <%= button(:remove, _('Delete profile'), {:action => :destroy_profile}) %>
  80 + <% end %>
81 81  
  82 + <% if user.is_admin?(environment) %>
82 83 <% if profile.visible? %>
83   - <%= button(:remove, _('Deactivate profile'), {action: :deactivate_profile, id: profile.id}, id: 'deactivate_profile_button', data: {confirm: _("Are you sure you want to deactivate this profile?")}) %>
  84 + <%= button(:remove, _('Deactivate profile'),
  85 + {:action => :deactivate_profile, :id=>profile.id},
  86 + :id=>'deactivate_profile_button',
  87 + :data => {:confirm=>_("Are you sure you want to deactivate this profile?")})
  88 + %>
84 89 <% else %>
85   - <%= button(:add, _('Activate profile'), {action: :activate_profile, id: profile.id}, data: {confirm: _("Are you sure you want to deactivate this profile?")}) %>
  90 + <%= button(:add, _('Activate profile'),
  91 + {:action => :activate_profile, :id=>profile.id},
  92 + :data => {:confirm=>_("Are you sure you want to activate this profile?")})
  93 + %>
86 94 <% end %>
87 95 <% end %>
88 96 <% end %>
... ...
app/views/profile_roles/assign.html.erb
1 1 <%= javascript_include_tag('assign_role.js') %>
2 2  
3   -<h1> <%= _("Assign #{@role.name}") %> </h1>
  3 +<h1> <%= _("Assign %s") % @role.name %> </h1>
4 4  
5 5  
6 6 <%= labelled_form_for :role, :url => { :action => 'define', :id => @role.id } do |f| %>
... ...
app/views/profile_roles/destroy.html.erb
1   -<h1> <%= _("Deleting #{@role.name}") %> </h1>
  1 +<h1> <%= _("Deleting %s") % @role.name %> </h1>
2 2  
3 3 <% if @members.nil? || @members.empty? %>
4 4 <p><%= _('This role is not being currently used.')%></p>
... ...
app/views/profile_roles/edit.html.erb
1   -<h1> <%= _("Editing #{@role.name}") %> </h1>
  1 +<h1> <%= _("Editing %s") % @role.name %> </h1>
2 2  
3 3 <%= render :partial => 'form', :locals => { :mode => :edit, :role => @role, :permissions => [@role.kind] } %>
... ...
app/views/role/edit.html.erb
1   -<h2> <%= _("Editing #{@role.name}") %> </h2>
  1 +<h2> <%= _("Editing %s") % @role.name %> </h2>
2 2  
3 3 <%= render :partial => 'form', :locals => { :mode => :edit, :role => @role, :permissions => role_available_permissions(@role) } %>
... ...
app/views/shared/_content_item.html.erb
... ... @@ -6,6 +6,6 @@
6 6 <span class="item-description">
7 7 <%= link_to(content.name, content.url) %>
8 8 </span>
9   - <span class="item-date"><%= _("Published at: #{show_date(content.updated_at)}") %></span>
  9 + <span class="item-date"><%= _("Published at: %s") % show_date(content.updated_at) %></span>
10 10 </div>
11 11 </div>
... ...
app/views/shared/_list_groups.html.erb
1 1 <ul id="groups-list">
2   -<% for group in groups %>
3   - <li>
4   - <div class='common-profile-list-block'>
5   - <%= profile_image_link(group, :portrait, 'div') %>
6   - </div>
7   - <span class='profile-details'>
8   - <strong><%= group.name %></strong><br/>
9   - <%= _('Role: %s') % rolename_for(profile, group) + '<br/>' if profile.role_assignments.find_by_resource_id(group.id) %>
10   - <%= _('Type: %s') % _(group.class.identification) %> <br/>
11   - <%= _('Description: %s') % group.description + '<br/>' if group.community? %>
12   - <%= _('Members: %s') % group.members_count.to_s %> <br/>
13   - <%= _('Created at: %s') % show_date(group.created_at) unless group.enterprise? %> <br/>
14   - <% button_bar do %>
15   - <% if user.has_permission?(:edit_profile, group) %>
16   - <%= button 'menu-ctrl-panel', _('Control panel of this group'), group.admin_url %>
17   - <% end %>
18   - <%= button 'menu-logout', _('Leave community'), group.leave_url(true), :class => 'leave-community' %>
19   - <% if (group.community? && user.has_permission?(:destroy_profile, group)) %>
20   - <%= button 'delete', _('Remove'), { :controller => 'profile_editor', :action => 'destroy_profile', :profile => group.identifier } %>
  2 + <% for group in groups %>
  3 + <li>
  4 + <div class='common-profile-list-block'>
  5 + <%= profile_image_link(group, :portrait, 'div') %>
  6 + </div>
  7 + <span class='profile-details'>
  8 + <strong><%= group.name %></strong><br/>
  9 + <%= _('Role: %s') % rolename_for(profile, group) + '<br/>' if profile.role_assignments.find_by_resource_id(group.id) %>
  10 + <%= _('Type: %s') % _(group.class.identification) %> <br/>
  11 + <%= _('Description: %s') % group.description + '<br/>' if group.community? %>
  12 + <%= _('Members: %s') % group.members_count.to_s %> <br/>
  13 + <%= _('Created at: %s') % show_date(group.created_at) unless group.enterprise? %> <br/>
  14 + <% button_bar do %>
  15 + <% if user.has_permission?(:edit_profile, group) %>
  16 + <%= button 'menu-ctrl-panel', _('Control panel of this group'), group.admin_url %>
  17 + <% end %>
  18 + <%= button 'menu-logout', _('Leave community'), group.leave_url(true), :class => 'leave-community' %>
  19 +
  20 + <% if (user.has_permission?(:destroy_profile, group) && !environment.enabled?('forbid_destroy_profile')) || user.is_admin?(environment) %>
  21 + <%= button 'delete', _('Remove'),
  22 + { :controller => 'profile_editor',
  23 + :action => 'destroy_profile',
  24 + :profile => group.identifier }
  25 + %>
  26 + <% end %>
21 27 <% end %>
22   - <% end %>
23   - </span>
24   - <br class="may-clear" />
25   - </li>
26   -<% end %>
  28 + </span>
  29 + <br class="may-clear" />
  30 + </li>
  31 + <% end %>
27 32 </ul>
28   -
... ...
config/application.rb
... ... @@ -101,6 +101,7 @@ module Noosfero
101 101 config.action_dispatch.session = {
102 102 :key => '_noosfero_session',
103 103 }
  104 + config.session_store :active_record_store, key: '_noosfero_session'
104 105  
105 106 config.paths['db/migrate'].concat Dir.glob("#{Rails.root}/{baseplugins,config/plugins}/*/db/migrate")
106 107 config.i18n.load_path.concat Dir.glob("#{Rails.root}/{baseplugins,config/plugins}/*/locales/*.{rb,yml}")
... ...
config/initializers/action_tracker.rb
... ... @@ -3,67 +3,51 @@ require &#39;action_tracker_config&#39;
3 3  
4 4 # ActionTracker plugin stuff
5 5  
6   -@reply_scrap_description = proc { _('sent a message to %{receiver}: <br /> "%{message}"') % { :receiver => "{{link_to(ta.get_receiver_name, ta.get_receiver_url)}}", :message => "{{auto_link_urls(ta.get_content)}}" } }
7   -
8 6 ActionTrackerConfig.verbs = {
9 7  
10   - :create_article => {
11   - :description => proc { _('published an article: %{title}') % { :title => '{{link_to(truncate(ta.get_name), ta.get_url)}}' } }
  8 + create_article: {
  9 + },
  10 +
  11 + new_friendship: {
  12 + type: :groupable
  13 + },
  14 +
  15 + join_community: {
  16 + type: :groupable
12 17 },
13 18  
14   - :new_friendship => {
15   - :description => proc { n_('has made 1 new friend:<br />%{name}', 'has made %{num} new friends:<br />%{name}', get_friend_name.size) % { :num => get_friend_name.size, :name => '{{ta.collect_group_with_index(:friend_name){ |n,i| link_to(image_tag(ta.get_friend_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/person-icon.png")), ta.get_friend_url[i], :title => n)}.join}}' } },
16   - :type => :groupable
  19 + add_member_in_community: {
17 20 },
18 21  
19   - :join_community => {
20   - :description => proc { n_('has joined 1 community:<br />%{name}', 'has joined %{num} communities:<br />%{name}', get_resource_name.size) % { :num => get_resource_name.size, :name => '{{ta.collect_group_with_index(:resource_name){ |n,i| link_to(image_tag(ta.get_resource_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/community-icon.png")), ta.get_resource_url[i], :title => n)}.join}}' } },
21   - :type => :groupable
  22 + upload_image: {
  23 + type: :groupable
22 24 },
23 25  
24   - :add_member_in_community => {
25   - :description => proc { _('has joined the community.') },
  26 + leave_scrap: {
26 27 },
27 28  
28   - :upload_image => {
29   - :description => proc do
30   - total = get_view_url.size
31   - n_('uploaded 1 image', 'uploaded %d images', total) % total +
32   - '<br />{{'+
33   - 'ta.collect_group_with_index(:thumbnail_path) { |t,i|' +
34   - " if ( #{total} == 1 );" +
35   - ' link_to( image_tag(t), ta.get_view_url[i], :class => \'upimg\' );' +
36   - ' else;' +
37   - " pos = #{total}-i;" +
38   - ' morethen2 = pos>2 ? \'morethen2\' : \'\';' +
39   - ' morethen5 = pos>5 ? \'morethen5\' : \'\';' +
40   - ' t = t.gsub(/(.*)(display)(.*)/, \'\\1thumb\\3\');' +
41   - ' link_to( \'&nbsp;\', ta.get_view_url[i],' +
42   - ' :style => "background-image:url(#{t})",' +
43   - ' :class => "upimg pos#{pos} #{morethen2} #{morethen5}" );' +
44   - ' end' +
45   - '}.reverse.join}}' +
46   - ( total > 5 ?
47   - '<span class="more" onclick="this.parentNode.className+=\' show-all\'">' +
48   - '&hellip;</span>' : '' ) +
49   - '<br style="clear: both;" />'
50   - end,
51   - :type => :groupable
  29 + leave_scrap_to_self: {
52 30 },
53 31  
54   - :leave_scrap => {
55   - :description => @reply_scrap_description
  32 + reply_scrap_on_self: {
56 33 },
57 34  
58   - :leave_scrap_to_self => {
59   - :description => proc { _('wrote: <br /> "%{text}"') % { :text => "{{auto_link_urls(ta.get_content)}}" } }
  35 + create_product: {
60 36 },
61 37  
62   - :reply_scrap_on_self => {
63   - :description => @reply_scrap_description
  38 + update_product: {
64 39 },
  40 +
  41 + remove_product: {
  42 + },
  43 +
  44 + favorite_enterprise: {
  45 + },
  46 +
65 47 }
66 48  
67   -ActionTrackerConfig.current_user_method = :current_person
  49 +ActionTrackerConfig.current_user = proc do
  50 + User.current.person rescue nil
  51 +end
68 52  
69 53 ActionTrackerConfig.timeout = 24.hours
... ...
config/initializers/session.rb 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +ActionDispatch::Reloader.to_prepare do
  2 + ActiveRecord::SessionStore.session_class = Session
  3 +end
  4 +
... ...
config/routes.rb
... ... @@ -56,37 +56,37 @@ Noosfero::Application.routes.draw do
56 56 match 'search(/:action(/*category_path))', controller: 'search', via: :all
57 57  
58 58 # events
59   - match 'profile/:profile/events_by_day', controller: 'events', action: 'events_by_day', profile: /#{Noosfero.identifier_format_in_url}/, via: :all
60   - match 'profile/:profile/events_by_month', controller: 'events', action: 'events_by_month', profile: /#{Noosfero.identifier_format_in_url}/, via: :all
61   - match 'profile/:profile/events/:year/:month/:day', controller: 'events', action: 'events', year: /\d*/, month: /\d*/, day: /\d*/, profile: /#{Noosfero.identifier_format_in_url}/, via: :all
62   - match 'profile/:profile/events/:year/:month', controller: 'events', action: 'events', year: /\d*/, month: /\d*/, profile: /#{Noosfero.identifier_format_in_url}/, via: :all
63   - match 'profile/:profile/events', controller: 'events', action: 'events', profile: /#{Noosfero.identifier_format_in_url}/, via: :all
  59 + match 'profile/:profile/events_by_day', controller: 'events', action: 'events_by_day', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
  60 + match 'profile/:profile/events_by_month', controller: 'events', action: 'events_by_month', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
  61 + match 'profile/:profile/events/:year/:month/:day', controller: 'events', action: 'events', year: /\d*/, month: /\d*/, day: /\d*/, profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
  62 + match 'profile/:profile/events/:year/:month', controller: 'events', action: 'events', year: /\d*/, month: /\d*/, profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
  63 + match 'profile/:profile/events', controller: 'events', action: 'events', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
64 64  
65 65 # catalog
66   - match 'catalog/:profile', controller: 'catalog', action: 'index', profile: /#{Noosfero.identifier_format_in_url}/, as: :catalog, via: :all
  66 + match 'catalog/:profile', controller: 'catalog', action: 'index', profile: /#{Noosfero.identifier_format_in_url}/i, as: :catalog, via: :all
67 67  
68 68 # invite
69   - match 'profile/:profile/invite/friends', controller: 'invite', action: 'invite_friends', profile: /#{Noosfero.identifier_format_in_url}/, via: :all
70   - match 'profile/:profile/invite/:action', controller: 'invite', profile: /#{Noosfero.identifier_format_in_url}/, via: :all
  69 + match 'profile/:profile/invite/friends', controller: 'invite', action: 'invite_friends', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
  70 + match 'profile/:profile/invite/:action', controller: 'invite', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
71 71  
72 72 # feeds per tag
73   - match 'profile/:profile/tags/:id/feed', controller: 'profile', action:'tag_feed', id: /.+/, profile: /#{Noosfero.identifier_format_in_url}/, as: :tag_feed, via: :all
  73 + match 'profile/:profile/tags/:id/feed', controller: 'profile', action:'tag_feed', id: /.+/, profile: /#{Noosfero.identifier_format_in_url}/i, as: :tag_feed, via: :all
74 74  
75 75 # profile tags
76   - match 'profile/:profile/tags/:id', controller: 'profile', action: 'content_tagged', id: /.+/, profile: /#{Noosfero.identifier_format_in_url}/, via: :all
77   - match 'profile/:profile/tags(/:id)', controller: 'profile', action: 'tags', profile: /#{Noosfero.identifier_format_in_url}/, via: :all
  76 + match 'profile/:profile/tags/:id', controller: 'profile', action: 'content_tagged', id: /.+/, profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
  77 + match 'profile/:profile/tags(/:id)', controller: 'profile', action: 'tags', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
78 78  
79 79 # profile search
80   - match 'profile/:profile/search', controller: 'profile_search', action: 'index', profile: /#{Noosfero.identifier_format_in_url}/, via: :all
  80 + match 'profile/:profile/search', controller: 'profile_search', action: 'index', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
81 81  
82 82 # comments
83   - match 'profile/:profile/comment/:action/:id', controller: 'comment', profile: /#{Noosfero.identifier_format_in_url}/, via: :all
  83 + match 'profile/:profile/comment/:action/:id', controller: 'comment', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
84 84  
85 85 # public profile information
86   - match 'profile/:profile(/:action(/:id))', controller: 'profile', action: 'index', id: /[^\/]*/, profile: /#{Noosfero.identifier_format_in_url}/, as: :profile, via: :all
  86 + match 'profile/:profile(/:action(/:id))', controller: 'profile', action: 'index', id: /[^\/]*/, profile: /#{Noosfero.identifier_format_in_url}/i, as: :profile, via: :all
87 87  
88 88 # contact
89   - match 'contact/:profile/:action(/:id)', controller: 'contact', action: 'index', id: /.*/, profile: /#{Noosfero.identifier_format_in_url}/, via: :all
  89 + match 'contact/:profile/:action(/:id)', controller: 'contact', action: 'index', id: /.*/, profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
90 90  
91 91 # map balloon
92 92 match 'map_balloon/:action/:id', controller: 'map_balloon', id: /.*/, via: :all
... ... @@ -98,8 +98,8 @@ Noosfero::Application.routes.draw do
98 98 ## Controllers that are profile-specific (for profile admins )
99 99 ######################################################
100 100 # profile customization - "My profile"
101   - match 'myprofile/:profile', controller: 'profile_editor', action: 'index', profile: /#{Noosfero.identifier_format_in_url}/, via: :all
102   - match 'myprofile/:profile/:controller(/:action(/:id))', controller: Noosfero.pattern_for_controllers_in_directory('my_profile'), profile: /#{Noosfero.identifier_format_in_url}/, as: :myprofile, via: :all
  101 + match 'myprofile/:profile', controller: 'profile_editor', action: 'index', profile: /#{Noosfero.identifier_format_in_url}/i, via: :all
  102 + match 'myprofile/:profile/:controller(/:action(/:id))', controller: Noosfero.pattern_for_controllers_in_directory('my_profile'), profile: /#{Noosfero.identifier_format_in_url}/i, as: :myprofile, via: :all
103 103  
104 104  
105 105 ######################################################
... ... @@ -127,14 +127,14 @@ Noosfero::Application.routes.draw do
127 127 # cache stuff - hack
128 128 match 'public/:action/:id', controller: 'public', via: :all
129 129  
130   - match ':profile/*page/versions', controller: 'content_viewer', action: 'article_versions', profile: /#{Noosfero.identifier_format_in_url}/, constraints: EnvironmentDomainConstraint.new, via: :all
  130 + match ':profile/*page/versions', controller: 'content_viewer', action: 'article_versions', profile: /#{Noosfero.identifier_format_in_url}/i, constraints: EnvironmentDomainConstraint.new, via: :all
131 131 match '*page/versions', controller: 'content_viewer', action: 'article_versions', via: :all
132 132  
133   - match ':profile/*page/versions_diff', controller: 'content_viewer', action: 'versions_diff', profile: /#{Noosfero.identifier_format_in_url}/, constraints: EnvironmentDomainConstraint.new, via: :all
  133 + match ':profile/*page/versions_diff', controller: 'content_viewer', action: 'versions_diff', profile: /#{Noosfero.identifier_format_in_url}/i, constraints: EnvironmentDomainConstraint.new, via: :all
134 134 match '*page/versions_diff', controller: 'content_viewer', action: 'versions_diff', via: :all
135 135  
136 136 # match requests for profiles that don't have a custom domain
137   - match ':profile(/*page)', controller: 'content_viewer', action: 'view_page', profile: /#{Noosfero.identifier_format_in_url}/, constraints: EnvironmentDomainConstraint.new, via: :all
  137 + match ':profile(/*page)', controller: 'content_viewer', action: 'view_page', profile: /#{Noosfero.identifier_format_in_url}/i, constraints: EnvironmentDomainConstraint.new, via: :all
138 138  
139 139 # match requests for content in domains hosted for profiles
140 140 match '/(*page)', controller: 'content_viewer', action: 'view_page', via: :all
... ...
db/migrate/20150216213259_create_profile_activity.rb 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +class CreateProfileActivity < ActiveRecord::Migration
  2 + def up
  3 + ActiveRecord::Base.transaction do
  4 + create_table :profile_activities do |t|
  5 + t.integer :profile_id
  6 + t.integer :activity_id
  7 + t.string :activity_type
  8 + t.timestamps
  9 + end
  10 + add_index :profile_activities, :profile_id
  11 + add_index :profile_activities, [:activity_id, :activity_type]
  12 + add_index :profile_activities, :activity_type
  13 +
  14 + Scrap.find_each batch_size: 50 do |scrap|
  15 + scrap.send :create_activity
  16 + end
  17 + ActionTracker::Record.find_each batch_size: 50 do |action_tracker|
  18 + action_tracker.send :create_activity
  19 + end
  20 + end
  21 + end
  22 +
  23 + def down
  24 + drop_table :profile_activities
  25 + end
  26 +end
... ...
db/migrate/20150310132902_add_id_to_favorite_enterprises_people.rb 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +class AddIdToFavoriteEnterprisesPeople < ActiveRecord::Migration
  2 + def up
  3 + rename_table :favorite_enteprises_people, :favorite_enterprise_people
  4 +
  5 + change_table :favorite_enterprise_people do |t|
  6 + t.timestamps
  7 + end
  8 + add_column :favorite_enterprise_people, :id, :primary_key
  9 +
  10 + add_index :favorite_enterprise_people, [:person_id, :enterprise_id]
  11 + add_index :favorite_enterprise_people, :person_id
  12 + add_index :favorite_enterprise_people, :enterprise_id
  13 + end
  14 +
  15 + def down
  16 + rename_table :favorite_enterprise_people, :favorite_enteprises_people
  17 +
  18 + remove_column :favorite_enteprises_people, :id
  19 + remove_column :favorite_enteprises_people, :created_at
  20 + remove_column :favorite_enteprises_people, :updated_at
  21 +
  22 + remove_index :favorite_enteprises_people, [:person_id, :enterprise_id]
  23 + remove_index :favorite_enteprises_people, :person_id
  24 + remove_index :favorite_enteprises_people, :enterprise_id
  25 + end
  26 +end
... ...
db/migrate/20150625234824_add_user_id_to_session.rb 0 → 100644
... ... @@ -0,0 +1,31 @@
  1 +class AddUserIdToSession < ActiveRecord::Migration
  2 +
  3 + def change
  4 + add_column :sessions, :user_id, :integer
  5 + add_index :sessions, :user_id
  6 + end
  7 +
  8 + def up
  9 + Session.reset_column_information
  10 +
  11 + # cleanup data: {}
  12 + Session.where(data: "BAh7AA==\n").delete_all
  13 + # cleanup data with lang key only
  14 + Session.where("data ~ 'BAh7BjoJbGFuZyIH.{3,3}=\n'").delete_all
  15 +
  16 + # very slow migration, only do for the last month
  17 + Session.where('updated_at > ?', 1.month.ago).find_each batch_size: 50 do |session|
  18 + begin
  19 + # this calls Session#copy_to_columns
  20 + session.save!
  21 + rescue ArgumentError
  22 + # old ActionController::Flash::FlashHash from rails 2.3
  23 + session.destroy
  24 + end
  25 +
  26 + # limit limitless allocations
  27 + GC.start
  28 + end
  29 + end
  30 +
  31 +end
... ...
db/migrate/20150712130827_index_user_id_on_profiles.rb 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +class IndexUserIdOnProfiles < ActiveRecord::Migration
  2 +
  3 + def change
  4 + add_index :profiles, :user_id
  5 + add_index :profiles, [:user_id, :type]
  6 + end
  7 +
  8 +end
... ...
db/schema.rb
... ... @@ -11,7 +11,7 @@
11 11 #
12 12 # It's strongly recommended to check this file into your version control system.
13 13  
14   -ActiveRecord::Schema.define(:version => 20150603182105) do
  14 +ActiveRecord::Schema.define(:version => 20150712130827) do
15 15  
16 16 create_table "abuse_reports", :force => true do |t|
17 17 t.integer "reporter_id"
... ... @@ -351,11 +351,17 @@ ActiveRecord::Schema.define(:version =&gt; 20150603182105) do
351 351 add_index "external_feeds", ["enabled"], :name => "index_external_feeds_on_enabled"
352 352 add_index "external_feeds", ["fetched_at"], :name => "index_external_feeds_on_fetched_at"
353 353  
354   - create_table "favorite_enteprises_people", :id => false, :force => true do |t|
355   - t.integer "person_id"
356   - t.integer "enterprise_id"
  354 + create_table "favorite_enterprise_people", :force => true do |t|
  355 + t.integer "person_id"
  356 + t.integer "enterprise_id"
  357 + t.datetime "created_at"
  358 + t.datetime "updated_at"
357 359 end
358 360  
  361 + add_index "favorite_enterprise_people", ["enterprise_id"], :name => "index_favorite_enterprise_people_on_enterprise_id"
  362 + add_index "favorite_enterprise_people", ["person_id", "enterprise_id"], :name => "index_favorite_enterprise_people_on_person_id_and_enterprise_id"
  363 + add_index "favorite_enterprise_people", ["person_id"], :name => "index_favorite_enterprise_people_on_person_id"
  364 +
359 365 create_table "friendships", :force => true do |t|
360 366 t.integer "person_id"
361 367 t.integer "friend_id"
... ... @@ -489,6 +495,18 @@ ActiveRecord::Schema.define(:version =&gt; 20150603182105) do
489 495 add_index "products", ["product_category_id"], :name => "index_products_on_product_category_id"
490 496 add_index "products", ["profile_id"], :name => "index_products_on_profile_id"
491 497  
  498 + create_table "profile_activities", :force => true do |t|
  499 + t.integer "profile_id"
  500 + t.integer "activity_id"
  501 + t.string "activity_type"
  502 + t.datetime "created_at", :null => false
  503 + t.datetime "updated_at", :null => false
  504 + end
  505 +
  506 + add_index "profile_activities", ["activity_id", "activity_type"], :name => "index_profile_activities_on_activity_id_and_activity_type"
  507 + add_index "profile_activities", ["activity_type"], :name => "index_profile_activities_on_activity_type"
  508 + add_index "profile_activities", ["profile_id"], :name => "index_profile_activities_on_profile_id"
  509 +
492 510 create_table "profile_suggestions", :force => true do |t|
493 511 t.integer "person_id"
494 512 t.integer "suggestion_id"
... ... @@ -555,6 +573,8 @@ ActiveRecord::Schema.define(:version =&gt; 20150603182105) do
555 573 add_index "profiles", ["identifier"], :name => "index_profiles_on_identifier"
556 574 add_index "profiles", ["members_count"], :name => "index_profiles_on_members_count"
557 575 add_index "profiles", ["region_id"], :name => "index_profiles_on_region_id"
  576 + add_index "profiles", ["user_id", "type"], :name => "index_profiles_on_user_id_and_type"
  577 + add_index "profiles", ["user_id"], :name => "index_profiles_on_user_id"
558 578  
559 579 create_table "qualifier_certifiers", :force => true do |t|
560 580 t.integer "qualifier_id"
... ... @@ -645,10 +665,12 @@ ActiveRecord::Schema.define(:version =&gt; 20150603182105) do
645 665 t.text "data"
646 666 t.datetime "created_at"
647 667 t.datetime "updated_at"
  668 + t.integer "user_id"
648 669 end
649 670  
650 671 add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
651 672 add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
  673 + add_index "sessions", ["user_id"], :name => "index_sessions_on_user_id"
652 674  
653 675 create_table "suggestion_connections", :force => true do |t|
654 676 t.integer "suggestion_id", :null => false
... ...
debian/changelog
  1 +noosfero (1.2) wheezy; urgency=low
  2 +
  3 + * Noosfero 1.2
  4 +
  5 + -- Antonio Terceiro <terceiro@colivre.coop.br> Fri, 07 Aug 2015 13:39:14 -0300
  6 +
  7 +noosfero (1.2~rc2) wheezy; urgency=low
  8 +
  9 + * Noosfero 1.2 RC2
  10 +
  11 + -- Antonio Terceiro <terceiro@colivre.coop.br> Mon, 27 Jul 2015 09:56:55 -0300
  12 +
1 13 noosfero (1.2~rc1) wheezy; urgency=medium
2 14  
3 15 [ Joenio Costa ]
... ...
doc/noosfero/navigation/searching-enterprises.textile
... ... @@ -14,7 +14,7 @@ p. Find on top of page the term &quot;Enterprises&quot; and click on it:
14 14 h2(#description). Description
15 15  
16 16 # Fill in the search field with what you want to look for and click on "Search" !=/images/doc/enterprises-search-field.en.png(Enterprises search field)!
17   -# Then you will see the search results. To see more results, click on the pages below the search results. !=/images/doc/enterprises-search-results-with-example.en.png(Enteprises search results with example)!
  17 +# Then you will see the search results. To see more results, click on the pages below the search results. !=/images/doc/enterprises-search-results-with-example.en.png(Enterprises search results with example)!
18 18 # Clicking on one of the search results, you will be redirected to the homepage of choosen enterprise.
19 19  
20 20 h3. More options
... ...
features/accept_member.feature
... ... @@ -14,6 +14,16 @@ Feature: accept member
14 14 And the community "My Community" is closed
15 15 And "Mario Souto" is admin of "My Community"
16 16  
  17 + Scenario: a user should see its merbership is pending
  18 + Given I am logged in as "mario"
  19 + And the following communities
  20 + | owner | identifier | name | closed |
  21 + | marie | private-community | Private Community | true |
  22 + And I go to private-community's homepage
  23 + When I follow "Join this community"
  24 + And I go to private-community's homepage
  25 + Then I should see "Your membership is waiting for approval"
  26 +
17 27 @selenium
18 28 Scenario: approve a task to accept a member as admin in a closed community
19 29 Given "Marie Curie" asked to join "My Community"
... ...
features/members_block.feature
... ... @@ -9,8 +9,8 @@ Feature:
9 9 | joaosilva | Joao Silva |
10 10 | mariasilva | Maria Silva |
11 11 And the following communities
12   - | owner | identifier | name |
13   - | joaosilva | sample-community | Sample Community |
  12 + | owner | identifier | name |
  13 + | joaosilva | sample-community | Sample Community |
14 14 And the following blocks
15 15 | owner | type |
16 16 | sample-community | MembersBlock |
... ... @@ -24,7 +24,7 @@ Feature:
24 24 Scenario: a user can join in a community by members block's button
25 25 Given I am logged in as "mariasilva"
26 26 And I go to sample-community's homepage
27   - When I follow "Join" within ".members-block"
  27 + When I follow "Join this community" within ".members-block"
28 28 And I go to mariasilva's control panel
29 29 And I follow "Manage my groups"
30 30 Then I should see "Sample Community"
... ... @@ -42,7 +42,7 @@ Feature:
42 42 Scenario: a not logged in user can log in by members block's button
43 43 Given I am not logged in
44 44 When I go to sample-community's homepage
45   - And I follow "Join" within ".members-block"
  45 + And I follow "Join this community" within ".members-block"
46 46 Then I should see "Username / Email"
47 47  
48 48 Scenario: the join-leave button do not appear if the checkbox show-join-leave-button is not checked
... ... @@ -52,5 +52,5 @@ Feature:
52 52 And I uncheck "Show join leave button"
53 53 And I press "Save"
54 54 When I go to sample-community's homepage
55   - Then I should not see "Join" within ".members-block"
  55 + Then I should not see "Join this community" within ".members-block"
56 56 And I should not see "Leave community" within ".members-block"
... ...
lib/authenticated_system.rb
1 1 module AuthenticatedSystem
  2 +
2 3 protected
  4 +
  5 + # See impl. from http://stackoverflow.com/a/2513456/670229
  6 + def self.included? base
  7 + base.around_filter do
  8 + begin
  9 + User.current = current_user
  10 + yield
  11 + ensure
  12 + # to address the thread variable leak issues in Puma/Thin webserver
  13 + User.current = nil
  14 + end
  15 + end
  16 + end
  17 +
3 18 # Returns true or false if the user is logged in.
4 19 # Preloads @current_user with the user model if they're logged in.
5 20 def logged_in?
... ... @@ -8,7 +23,13 @@ module AuthenticatedSystem
8 23  
9 24 # Accesses the current user from the session.
10 25 def current_user
11   - @current_user ||= (session[:user] && User.find_by_id(session[:user])) || nil
  26 + @current_user ||= begin
  27 + id = session[:user]
  28 + user = User.where(id: id).first if id
  29 + user.session = session if user
  30 + User.current = user
  31 + user
  32 + end
12 33 end
13 34  
14 35 # Store the given user in the session.
... ... @@ -17,9 +38,10 @@ module AuthenticatedSystem
17 38 session.delete(:user)
18 39 else
19 40 session[:user] = new_user.id
  41 + new_user.session = session
20 42 new_user.register_login
21 43 end
22   - @current_user = new_user
  44 + @current_user = User.current = new_user
23 45 end
24 46  
25 47 # Check if the user is authorized.
... ... @@ -121,14 +143,9 @@ module AuthenticatedSystem
121 143 # When called with before_filter :login_from_cookie will check for an :auth_token
122 144 # cookie and log the user back in if apropriate
123 145 def login_from_cookie
124   - return unless cookies[:auth_token] && !logged_in?
125   - user = User.find_by_remember_token(cookies[:auth_token])
126   - if user && user.remember_token?
127   - user.remember_me
128   - self.current_user = user
129   - cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at }
130   - flash[:notice] = "Logged in successfully"
131   - end
  146 + return if cookies[:auth_token].blank? or logged_in?
  147 + user = User.where(remember_token: cookies[:auth_token]).first
  148 + self.current_user = user if user and user.remember_token?
132 149 end
133 150  
134 151 private
... ...
lib/needs_profile.rb
... ... @@ -21,7 +21,11 @@ module NeedsProfile
21 21 protected
22 22  
23 23 def load_profile
24   - @profile ||= environment.profiles.find_by_identifier(params[:profile])
  24 + if params[:profile]
  25 + params[:profile].downcase!
  26 + @profile ||= environment.profiles.where(identifier: params[:profile]).first
  27 + end
  28 +
25 29 if @profile
26 30 profile_hostname = @profile.hostname
27 31 if profile_hostname && profile_hostname != request.host
... ...
lib/noosfero/action_tracker_ext.rb
1 1 Rails.configuration.to_prepare do
2   - ActionTracker::Record.module_eval do
  2 + ActionTracker::Record.class_eval do
3 3 extend CacheCounterHelper
4 4  
5 5 after_create do |record|
... ... @@ -9,6 +9,11 @@ Rails.configuration.to_prepare do
9 9 end
10 10 end
11 11  
  12 + has_many :profile_activities, foreign_key: :activity_id, conditions: {profile_activities: {activity_type: 'ActionTracker::Record'}}, dependent: :destroy
  13 +
  14 + after_create :create_activity
  15 + after_update :update_activity
  16 +
12 17 after_destroy do |record|
13 18 if record.created_at >= ActionTracker::Record::RECENT_DELAY.days.ago
14 19 ActionTracker::Record.update_cache_counter(:activities_count, record.user, -1)
... ... @@ -17,5 +22,17 @@ Rails.configuration.to_prepare do
17 22 end
18 23 end
19 24 end
  25 +
  26 + protected
  27 +
  28 + def create_activity
  29 + target = if self.target.is_a? Profile then self.target else self.target.profile rescue self.user end
  30 + return if self.verb.in? target.exclude_verbs_on_activities
  31 + ProfileActivity.create! profile: target, activity: self
  32 + end
  33 + def update_activity
  34 + ProfileActivity.update_activity self
  35 + end
  36 +
20 37 end
21 38 end
... ...
lib/noosfero/plugin/routes.rb
... ... @@ -19,7 +19,7 @@ Dir.glob(Rails.root.join(plugins_root, &#39;*&#39;, &#39;controllers&#39;)) do |controllers_dir|
19 19 controllers.each do |controller|
20 20 controller_name = controller.gsub("#{plugin_name}_plugin_",'')
21 21 if %w[profile myprofile].include?(folder.to_s)
22   - match "#{prefixes_by_folder[folder]}/#{plugin_name}/#{controller_name}(/:action(/:id))", controller: controller, profile: /#{Noosfero.identifier_format}/, via: :all
  22 + match "#{prefixes_by_folder[folder]}/#{plugin_name}/#{controller_name}(/:action(/:id))", controller: controller, profile: /#{Noosfero.identifier_format}/i, via: :all
23 23 else
24 24 match "#{prefixes_by_folder[folder]}/#{plugin_name}/#{controller_name}(/:action(/:id))", controller: controller, via: :all
25 25 end
... ... @@ -27,7 +27,7 @@ Dir.glob(Rails.root.join(plugins_root, &#39;*&#39;, &#39;controllers&#39;)) do |controllers_dir|
27 27 end
28 28  
29 29 match 'plugin/' + plugin_name + '(/:action(/:id))', controller: plugin_name + '_plugin', via: :all
30   - match 'profile/:profile/plugin/' + plugin_name + '(/:action(/:id))', controller: plugin_name + '_plugin_profile', profile: /#{Noosfero.identifier_format}/, via: :all
31   - match 'myprofile/:profile/plugin/' + plugin_name + '(/:action(/:id))', controller: plugin_name + '_plugin_myprofile', profile: /#{Noosfero.identifier_format}/, via: :all
  30 + match "profile/:profile/plugin/#{plugin_name}(/:action(/:id))", controller: "#{plugin_name}_plugin_profile", profile: /#{Noosfero.identifier_format}/i, via: :all
  31 + match "myprofile/:profile/plugin/#{plugin_name}(/:action(/:id))", controller: "#{plugin_name}_plugin_myprofile", profile: /#{Noosfero.identifier_format}/i, via: :all
32 32 match 'admin/plugin/' + plugin_name + '(/:action(/:id))', controller: plugin_name + '_plugin_admin', via: :all
33 33 end
... ...
lib/noosfero/version.rb
1 1 module Noosfero
2 2 PROJECT = 'noosfero'
3   - VERSION = '1.2~rc1'
  3 + VERSION = '1.2'
4 4 end
5 5  
6 6 root = File.expand_path(File.dirname(__FILE__) + '/../..')
... ...
lib/notify_activity_to_profiles_job.rb
... ... @@ -22,6 +22,12 @@ class NotifyActivityToProfilesJob &lt; Struct.new(:tracked_action_id)
22 22 # Notify all friends
23 23 ActionTrackerNotification.connection.execute("insert into action_tracker_notifications(profile_id, action_tracker_id) select f.friend_id, #{tracked_action.id} from friendships as f where person_id=#{tracked_action.user.id} and f.friend_id not in (select atn.profile_id from action_tracker_notifications as atn where atn.action_tracker_id = #{tracked_action.id})")
24 24  
  25 + if tracked_action.user.is_a? Organization
  26 + ActionTrackerNotification.connection.execute "insert into action_tracker_notifications(profile_id, action_tracker_id) " +
  27 + "select distinct accessor_id, #{tracked_action.id} from role_assignments where resource_id = #{tracked_action.user.id} and resource_type='Profile' " +
  28 + if tracked_action.user.is_a? Enterprise then "union select distinct person_id, #{tracked_action.id} from favorite_enterprise_people where enterprise_id = #{tracked_action.user.id}" else "" end
  29 + end
  30 +
25 31 if target.is_a?(Community)
26 32 ActionTrackerNotification.create(:profile_id => target.id, :action_tracker_id => tracked_action.id) unless NOT_NOTIFY_COMMUNITY.include?(tracked_action.verb)
27 33  
... ...
lib/tasks/ci.rake
... ... @@ -37,6 +37,11 @@ namespace :ci do
37 37 tests << t unless tests.include?(t)
38 38 end
39 39 end
  40 + if f =~ %r{^app/views/(\w*)/}
  41 + controller = $1
  42 + t = "test/functional/#{controller}_controller_test.rb"
  43 + tests << t if File.exists?(t) && !tests.include?(t)
  44 + end
40 45 end
41 46  
42 47 if tests.empty? && features.empty? && changed_plugins.empty?
... ...
lib/tasks/enable_plugins.rake
1 1 namespace :noosfero do
2 2 namespace :plugins do
  3 + desc 'Enable all installed plugins on all environment'
3 4 task :enable_all => :environment do
4 5 Environment.all.each do |env|
5 6 puts "Plugins Activated on #{env.name}" if env.enable_all_plugins
... ...
lib/tasks/gettext.rake
... ... @@ -60,6 +60,8 @@ task :updatepo do
60 60  
61 61 puts 'Extracting strings from source. This may take a while ...'
62 62  
  63 + # XXX this list is duplicated in test/unit/i18n_test.rb; if you change it
  64 + # here, please also update it there.
63 65 files_to_translate = [
64 66 "{app,lib}/**/*.{rb,rhtml,erb}",
65 67 'config/initializers/*.rb',
... ... @@ -98,7 +100,7 @@ Dir.glob(&#39;plugins/*&#39;).each do |plugindir|
98 100 }
99 101 )
100 102 plugin_pot = File.join(po_root, "#{plugin}.pot")
101   - if File.exists?(plugin_pot) && system("LANG=C msgfmt --statistics --output /dev/null #{plugin_pot} 2>&1 | grep -q '^0 translated messages.'")
  103 + if File.exists?(plugin_pot) && system("LANG=C msgfmt --statistics --output /dev/null #{plugin_pot} 2>&1 | grep -q '^0 translated messages.$'")
102 104 rm_f plugin_pot
103 105 end
104 106 sh 'find', po_root, '-type', 'd', '-empty', '-delete'
... ... @@ -106,8 +108,25 @@ Dir.glob(&#39;plugins/*&#39;).each do |plugindir|
106 108 end
107 109 end
108 110  
  111 +def checkpo(po_files)
  112 + max = po_files.map(&:size).max
  113 + po_files.each do |po|
  114 + printf "%#{max}s: ", po
  115 + system "msgfmt --statistics --output /dev/null " + po
  116 + end
  117 +end
  118 +
  119 +desc "checks core translation files"
109 120 task :checkpo do
110   - sh 'for po in po/*/noosfero.po; do echo -n "$po: "; msgfmt --statistics --output /dev/null $po; done'
  121 + checkpo(Dir.glob('po/*/noosfero.po'))
  122 +end
  123 +
  124 +languages = Dir.glob('po/*').select { |d| File.directory?(d) }.map { |d| File.basename(d) }
  125 +languages.each do |lang|
  126 + desc "checks #{lang} translation files"
  127 + task "checkpo:#{lang}" do
  128 + checkpo(Dir.glob("po/#{lang}/*.po") + Dir.glob("plugins/*/po/#{lang}/*.po"))
  129 + end
111 130 end
112 131  
113 132 # vim: ft=ruby
... ...
lib/tasks/plugins_tests.rake
... ... @@ -169,7 +169,7 @@ def test_sequence(plugins, tasks)
169 169 failed[plugin] << task
170 170 end
171 171 end
172   - disable_plugins(plugin)
  172 + disable_plugins
173 173 end
174 174 fail_flag = false
175 175 failed.each do |plugin, tasks|
... ...
lib/tasks/release.rake
... ... @@ -121,6 +121,10 @@ EOF
121 121 desc "uploads the packages to the repository"
122 122 task :upload_packages, :target do |t, args|
123 123 target = args[:target] || 'stable'
  124 + source = Dir['pkg/noosfero-*.tar.gz'].first
  125 + sh "gpg --detach-sign #{source}"
  126 + sh "sha256sum #{source} > #{source}.sha256sum"
  127 + sh "scp #{source}* download.noosfero.org:repos/source/"
124 128 sh "dput --unchecked noosfero-#{target} #{Dir['pkg/*.changes'].first}"
125 129 end
126 130  
... ... @@ -189,6 +193,14 @@ EOF
189 193 abort if missing
190 194 end
191 195  
  196 + task :tag do
  197 + sh "git tag -s -m 'Noosfero #{$version}' #{$version.gsub('~','-')}"
  198 + end
  199 +
  200 + task :pushtag do
  201 + sh "git push origin #{$version.gsub('~','-')}"
  202 + end
  203 +
192 204 desc 'prepares a release tarball'
193 205 task :release, :target do |t, args|
194 206 target = args[:target]
... ... @@ -220,15 +232,14 @@ EOF
220 232 Rake::Task['noosfero:debian_packages'].invoke
221 233  
222 234 if confirm("Create tag for version #{$version}")
223   - sh "git tag #{$version.gsub('~','-')}"
224   -
  235 + Rake::Task['noosfero:tag'].invoke
225 236 if confirm('Push new version tag')
226   - repository = ask('Repository name', 'origin')
227 237 puts "==> Uploading tags..."
228   - sh "git push #{repository} #{$version.gsub('~','-')}"
  238 + Rake::Task['noosfero:pushtag'].invoke
229 239 end
230 240 end
231 241  
  242 + Rake::Task['noosfero:upload'].invoke
232 243 if confirm('Upload the packages')
233 244 puts "==> Uploading debian packages..."
234 245 Rake::Task['noosfero:upload_packages'].invoke(target)
... ... @@ -239,6 +250,9 @@ EOF
239 250 rm_f "tmp/pending-release"
240 251 end
241 252  
  253 + desc "finishes the release"
  254 + task 'release:finish' => ['noosfero:upload_packages', 'noosfero:tag', 'noosfero:pushtag']
  255 +
242 256 desc 'Build Debian packages'
243 257 task :debian_packages => :package do
244 258 target = "pkg/noosfero-#{$version}"
... ...
plugins/analytics/po/pt/analytics.po
... ... @@ -11,12 +11,12 @@
11 11 #
12 12 msgid ""
13 13 msgstr ""
14   -"Project-Id-Version: 1.0-690-gcb6e853\n"
15   -"POT-Creation-Date: 2015-03-05 12:10-0300\n"
  14 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  15 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
16 16 "PO-Revision-Date: 2015-07-21 09:23-0300\n"
17 17 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
18   -"Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero"
19   -"/plugin-solr/pt/>\n"
  18 +"Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero/"
  19 +"plugin-solr/pt/>\n"
20 20 "Language: pt\n"
21 21 "MIME-Version: 1.0\n"
22 22 "Content-Type: text/plain; charset=UTF-8\n"
... ... @@ -24,6 +24,5 @@ msgstr &quot;&quot;
24 24 "Plural-Forms: nplurals=2; plural=n != 1;\n"
25 25 "X-Generator: Weblate 2.3-dev\n"
26 26  
27   -msgid "Select the set of communities and users to track"
28   -msgstr "Seleciona o conjunto de comunidades e usuários para rastrear"
29   -
  27 +#~ msgid "Select the set of communities and users to track"
  28 +#~ msgstr "Seleciona o conjunto de comunidades e usuários para rastrear"
... ...
plugins/anti_spam/po/anti_spam.pot 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +# SOME DESCRIPTIVE TITLE.
  2 +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
  3 +# This file is distributed under the same license as the PACKAGE package.
  4 +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  5 +#
  6 +#, fuzzy
  7 +msgid ""
  8 +msgstr ""
  9 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  10 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
  11 +"PO-Revision-Date: 2015-08-06 17:21-0300\n"
  12 +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  13 +"Language-Team: LANGUAGE <LL@li.org>\n"
  14 +"Language: \n"
  15 +"MIME-Version: 1.0\n"
  16 +"Content-Type: text/plain; charset=UTF-8\n"
  17 +"Content-Transfer-Encoding: 8bit\n"
  18 +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
  19 +
  20 +#: plugins/anti_spam/lib/anti_spam_plugin.rb:8
  21 +msgid ""
  22 +"Tests comments and suggested articles against a spam checking service "
  23 +"compatible with the Akismet API"
  24 +msgstr ""
  25 +
  26 +#: plugins/anti_spam/views/anti_spam_plugin_admin/index.html.erb:1
  27 +msgid "AntiSpam settings"
  28 +msgstr ""
  29 +
  30 +#: plugins/anti_spam/views/anti_spam_plugin_admin/index.html.erb:5
  31 +msgid "Host"
  32 +msgstr ""
  33 +
  34 +#: plugins/anti_spam/views/anti_spam_plugin_admin/index.html.erb:7
  35 +msgid "API key"
  36 +msgstr ""
... ...
plugins/anti_spam/po/de/anti_spam.po
... ... @@ -6,8 +6,8 @@
6 6 #
7 7 msgid ""
8 8 msgstr ""
9   -"Project-Id-Version: 1.1-166-gaf47713\n"
10   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  9 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  10 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
11 11 "PO-Revision-Date: 2014-12-12 14:23+0200\n"
12 12 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
13 13 "Language-Team: German <https://hosted.weblate.org/projects/noosfero/noosfero/"
... ...
plugins/anti_spam/po/pt/anti_spam.po
... ... @@ -11,8 +11,8 @@
11 11 #
12 12 msgid ""
13 13 msgstr ""
14   -"Project-Id-Version: 1.1-166-gaf47713\n"
15   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  14 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  15 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
16 16 "PO-Revision-Date: 2014-12-18 18:40-0200\n"
17 17 "Last-Translator: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>\n"
18 18 "Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero/"
... ...
plugins/breadcrumbs/po/breadcrumbs.pot 0 → 100644
... ... @@ -0,0 +1,46 @@
  1 +# SOME DESCRIPTIVE TITLE.
  2 +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
  3 +# This file is distributed under the same license as the PACKAGE package.
  4 +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  5 +#
  6 +#, fuzzy
  7 +msgid ""
  8 +msgstr ""
  9 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  10 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
  11 +"PO-Revision-Date: 2015-08-06 17:21-0300\n"
  12 +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  13 +"Language-Team: LANGUAGE <LL@li.org>\n"
  14 +"Language: \n"
  15 +"MIME-Version: 1.0\n"
  16 +"Content-Type: text/plain; charset=UTF-8\n"
  17 +"Content-Transfer-Encoding: 8bit\n"
  18 +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
  19 +
  20 +#: plugins/breadcrumbs/lib/breadcrumbs_plugin.rb:8
  21 +msgid "A plugin that add a block to display breadcrumbs."
  22 +msgstr ""
  23 +
  24 +#: plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb:10
  25 +msgid "Content Breadcrumbs"
  26 +msgstr ""
  27 +
  28 +#: plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb:14
  29 +msgid "This block displays breadcrumb trail."
  30 +msgstr ""
  31 +
  32 +#: plugins/breadcrumbs/lib/breadcrumbs_plugin/content_breadcrumbs_block.rb:68
  33 +msgid "Upload Files"
  34 +msgstr ""
  35 +
  36 +#: plugins/breadcrumbs/views/box_organizer/breadcrumbs_plugin/_content_breadcrumbs_block.html.erb:2
  37 +msgid "Show cms action"
  38 +msgstr ""
  39 +
  40 +#: plugins/breadcrumbs/views/box_organizer/breadcrumbs_plugin/_content_breadcrumbs_block.html.erb:3
  41 +msgid "Show profile"
  42 +msgstr ""
  43 +
  44 +#: plugins/breadcrumbs/views/box_organizer/breadcrumbs_plugin/_content_breadcrumbs_block.html.erb:4
  45 +msgid "Show section name"
  46 +msgstr ""
... ...
plugins/breadcrumbs/po/pt/breadcrumbs.po
... ... @@ -11,8 +11,8 @@
11 11 #
12 12 msgid ""
13 13 msgstr ""
14   -"Project-Id-Version: 1.1-166-gaf47713\n"
15   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  14 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  15 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
16 16 "PO-Revision-Date: 2014-12-18 18:40-0200\n"
17 17 "Last-Translator: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>\n"
18 18 "Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero/"
... ...
plugins/breadcrumbs/test/functional/profile_design_controller_test.rb
... ... @@ -30,8 +30,8 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase
30 30 post :save, :id => @block.id, :profile => @profile.identifier, :block => {:title => 'breadcrumbs', :show_cms_action => false, :show_profile => false}
31 31 @block.reload
32 32 assert_equal 'breadcrumbs', @block.title
33   - assert !@block.show_profile
34   - assert !@block.show_cms_action
  33 + refute @block.show_profile
  34 + refute @block.show_cms_action
35 35 end
36 36  
37 37 should 'be able save breadcrumbs block with show_section_name option' do
... ...
plugins/breadcrumbs/test/unit/breadcrumbs_plugin_test.rb
... ... @@ -7,11 +7,11 @@ class BreadcrumbsPluginTest &lt; ActiveSupport::TestCase
7 7 end
8 8  
9 9 should 'has a name' do
10   - assert !BreadcrumbsPlugin.plugin_name.blank?
  10 + refute BreadcrumbsPlugin.plugin_name.blank?
11 11 end
12 12  
13 13 should 'has a description' do
14   - assert !BreadcrumbsPlugin.plugin_description.blank?
  14 + refute BreadcrumbsPlugin.plugin_description.blank?
15 15 end
16 16  
17 17 should 'add a block' do
... ...
plugins/breadcrumbs/test/unit/content_breadcrumbs_block_test.rb
... ... @@ -69,7 +69,7 @@ class ContentBreadcrumbsBlockTest &lt; ActiveSupport::TestCase
69 69 end
70 70  
71 71 should 'not be cacheable' do
72   - assert !@block.cacheable?
  72 + refute @block.cacheable?
73 73 end
74 74  
75 75 end
... ...
plugins/bsc/lib/bsc_plugin/ext/product.rb
... ... @@ -12,4 +12,14 @@ class Product
12 12 def display_supplier_on_search?
13 13 false
14 14 end
  15 +
  16 + def action_tracker_user
  17 + return self.enterprise if self.enterprise.validated
  18 +
  19 + if self.enterprise.bsc
  20 + self.enterprise.bsc
  21 + else
  22 + self.enterprise
  23 + end
  24 + end
15 25 end
... ...
plugins/bsc/po/bsc.pot 0 → 100644
... ... @@ -0,0 +1,351 @@
  1 +# SOME DESCRIPTIVE TITLE.
  2 +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
  3 +# This file is distributed under the same license as the PACKAGE package.
  4 +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  5 +#
  6 +#, fuzzy
  7 +msgid ""
  8 +msgstr ""
  9 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  10 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
  11 +"PO-Revision-Date: 2015-08-06 17:21-0300\n"
  12 +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  13 +"Language-Team: LANGUAGE <LL@li.org>\n"
  14 +"Language: \n"
  15 +"MIME-Version: 1.0\n"
  16 +"Content-Type: text/plain; charset=UTF-8\n"
  17 +"Content-Transfer-Encoding: 8bit\n"
  18 +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
  19 +
  20 +#: plugins/bsc/lib/bsc_plugin.rb:10
  21 +msgid "Adds the Bsc feature"
  22 +msgstr ""
  23 +
  24 +#: plugins/bsc/lib/bsc_plugin.rb:14
  25 +msgid "Create Bsc"
  26 +msgstr ""
  27 +
  28 +#: plugins/bsc/lib/bsc_plugin.rb:15
  29 +msgid "Validate Enterprises"
  30 +msgstr ""
  31 +
  32 +#: plugins/bsc/lib/bsc_plugin.rb:20
  33 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_associated_enterprises.html.erb:1
  34 +msgid "Manage associated enterprises"
  35 +msgstr ""
  36 +
  37 +#: plugins/bsc/lib/bsc_plugin.rb:21 plugins/bsc/lib/bsc_plugin.rb:27
  38 +msgid "Transfer ownership"
  39 +msgstr ""
  40 +
  41 +#: plugins/bsc/lib/bsc_plugin.rb:22
  42 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_contracts.html.erb:1
  43 +msgid "Manage contracts"
  44 +msgstr ""
  45 +
  46 +#: plugins/bsc/lib/bsc_plugin.rb:98
  47 +msgid "Bsc"
  48 +msgstr ""
  49 +
  50 +#: plugins/bsc/lib/bsc_plugin.rb:109
  51 +#: plugins/bsc/views/shared/_fields.html.erb:53
  52 +msgid "Contact"
  53 +msgstr ""
  54 +
  55 +#: plugins/bsc/lib/bsc_plugin/bsc.rb:28
  56 +msgid "Bsc info and settings"
  57 +msgstr ""
  58 +
  59 +#: plugins/bsc/lib/bsc_plugin/associate_enterprise.rb:10
  60 +msgid "BSC association"
  61 +msgstr ""
  62 +
  63 +#: plugins/bsc/lib/bsc_plugin/associate_enterprise.rb:18
  64 +msgid "%{requestor} wants to associate this enterprise with %{linked_subject}."
  65 +msgstr ""
  66 +
  67 +#: plugins/bsc/lib/bsc_plugin/associate_enterprise.rb:35
  68 +msgid "%{enterprise} accepted your request to associate it with %{bsc}."
  69 +msgstr ""
  70 +
  71 +#: plugins/bsc/lib/bsc_plugin/associate_enterprise.rb:39
  72 +msgid "%{enterprise} rejected your request to associate it with %{bsc}."
  73 +msgstr ""
  74 +
  75 +#: plugins/bsc/lib/bsc_plugin/associate_enterprise.rb:41
  76 +msgid ""
  77 +"Here is the reject explanation left by the administrator:\n"
  78 +"\n"
  79 +"%{reject_explanation}"
  80 +msgstr ""
  81 +
  82 +#: plugins/bsc/lib/bsc_plugin/associate_enterprise.rb:46
  83 +msgid "%{requestor} wants assoaciate %{bsc} as your BSC."
  84 +msgstr ""
  85 +
  86 +#: plugins/bsc/lib/bsc_plugin/mailer.rb:7
  87 +msgid "[%s] Bsc management transferred to you."
  88 +msgstr ""
  89 +
  90 +#: plugins/bsc/lib/bsc_plugin/contract.rb:33
  91 +msgid "Opened"
  92 +msgstr ""
  93 +
  94 +#: plugins/bsc/lib/bsc_plugin/contract.rb:33
  95 +msgid "Negotiating"
  96 +msgstr ""
  97 +
  98 +#: plugins/bsc/lib/bsc_plugin/contract.rb:33
  99 +msgid "Executing"
  100 +msgstr ""
  101 +
  102 +#: plugins/bsc/lib/bsc_plugin/contract.rb:33
  103 +msgid "Closed"
  104 +msgstr ""
  105 +
  106 +#: plugins/bsc/lib/bsc_plugin/contract.rb:46
  107 +msgid "Federal"
  108 +msgstr ""
  109 +
  110 +#: plugins/bsc/lib/bsc_plugin/contract.rb:59
  111 +msgid "ProjectA"
  112 +msgstr ""
  113 +
  114 +#: plugins/bsc/lib/bsc_plugin/contract.rb:59
  115 +msgid "ProjectB"
  116 +msgstr ""
  117 +
  118 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:38
  119 +msgid "This Bsc associations were saved successfully."
  120 +msgstr ""
  121 +
  122 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:42
  123 +msgid "This Bsc associations couldn't be saved."
  124 +msgstr ""
  125 +
  126 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:71
  127 +msgid "Enterprise ownership transferred."
  128 +msgstr ""
  129 +
  130 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:85
  131 +msgid "Enterprise was created in association with %s."
  132 +msgstr ""
  133 +
  134 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:117
  135 +msgid "Contract created."
  136 +msgstr ""
  137 +
  138 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:120
  139 +msgid "Contract created but some products could not be added."
  140 +msgstr ""
  141 +
  142 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:131
  143 +msgid "Contract doesn't exists! Maybe it was already removed."
  144 +msgstr ""
  145 +
  146 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:140
  147 +msgid "Could not edit such contract."
  148 +msgstr ""
  149 +
  150 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:170
  151 +msgid "Contract edited."
  152 +msgstr ""
  153 +
  154 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:173
  155 +msgid "Contract edited but some products could not be added."
  156 +msgstr ""
  157 +
  158 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:183
  159 +msgid "Contract removed."
  160 +msgstr ""
  161 +
  162 +#: plugins/bsc/controllers/bsc_plugin_myprofile_controller.rb:185
  163 +msgid "Contract could not be removed. Sorry! ^^"
  164 +msgstr ""
  165 +
  166 +#: plugins/bsc/controllers/bsc_plugin_admin_controller.rb:11
  167 +msgid "Your Bsc was created."
  168 +msgstr ""
  169 +
  170 +#: plugins/bsc/controllers/bsc_plugin_admin_controller.rb:21
  171 +msgid "Enterprises validated."
  172 +msgstr ""
  173 +
  174 +#: plugins/bsc/controllers/bsc_plugin_admin_controller.rb:24
  175 +msgid "Enterprise validations couldn't be saved."
  176 +msgstr ""
  177 +
  178 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_associated_enterprises.html.erb:4
  179 +msgid "Associations awaiting approval:"
  180 +msgstr ""
  181 +
  182 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_associated_enterprises.html.erb:16
  183 +#: plugins/bsc/views/bsc_plugin_admin/validate_enterprises.html.erb:5
  184 +msgid "Type in a search term for enterprise"
  185 +msgstr ""
  186 +
  187 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_associated_enterprises.html.erb:19
  188 +msgid "Add new enterprise"
  189 +msgstr ""
  190 +
  191 +#: plugins/bsc/views/bsc_plugin_myprofile/new_contract.html.erb:1
  192 +#: plugins/bsc/views/bsc_plugin_myprofile/edit_contract.html.erb:1
  193 +msgid "New contract"
  194 +msgstr ""
  195 +
  196 +#: plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb:6
  197 +#: plugins/bsc/views/bsc_plugin_myprofile/view_contract.html.erb:7
  198 +msgid "Client type"
  199 +msgstr ""
  200 +
  201 +#: plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb:7
  202 +#: plugins/bsc/views/bsc_plugin_myprofile/view_contract.html.erb:8
  203 +msgid "Business type"
  204 +msgstr ""
  205 +
  206 +#: plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb:10
  207 +#: plugins/bsc/views/bsc_plugin_myprofile/view_contract.html.erb:11
  208 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_contracts.html.erb:5
  209 +msgid "Status"
  210 +msgstr ""
  211 +
  212 +#: plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb:18
  213 +msgid "Type in search term for enterprise"
  214 +msgstr ""
  215 +
  216 +#: plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb:23
  217 +#: plugins/bsc/views/bsc_plugin_myprofile/view_contract.html.erb:27
  218 +msgid "Quantity"
  219 +msgstr ""
  220 +
  221 +#: plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb:24
  222 +#: plugins/bsc/views/bsc_plugin_myprofile/view_contract.html.erb:28
  223 +msgid "Unit price"
  224 +msgstr ""
  225 +
  226 +#: plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb:27
  227 +#: plugins/bsc/views/bsc_plugin_myprofile/view_contract.html.erb:38
  228 +msgid "Total"
  229 +msgstr ""
  230 +
  231 +#: plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb:31
  232 +msgid "Add new product"
  233 +msgstr ""
  234 +
  235 +#: plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb:35
  236 +#: plugins/bsc/views/bsc_plugin_myprofile/view_contract.html.erb:13
  237 +msgid "Supply period"
  238 +msgstr ""
  239 +
  240 +#: plugins/bsc/views/bsc_plugin_myprofile/_contract_form.html.erb:57
  241 +msgid "Type in a search term for product"
  242 +msgstr ""
  243 +
  244 +#: plugins/bsc/views/bsc_plugin_myprofile/view_contract.html.erb:5
  245 +#: plugins/bsc/views/shared/_fields.html.erb:5
  246 +msgid "Basic information"
  247 +msgstr ""
  248 +
  249 +#: plugins/bsc/views/bsc_plugin_myprofile/view_contract.html.erb:12
  250 +msgid "Number of producers"
  251 +msgstr ""
  252 +
  253 +#: plugins/bsc/views/bsc_plugin_myprofile/view_contract.html.erb:48
  254 +msgid "Annotations"
  255 +msgstr ""
  256 +
  257 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_contracts.html.erb:17
  258 +msgid "Sort by"
  259 +msgstr ""
  260 +
  261 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_contracts.html.erb:18
  262 +msgid "Date(newest first)"
  263 +msgstr ""
  264 +
  265 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_contracts.html.erb:18
  266 +msgid "Date(oldest first)"
  267 +msgstr ""
  268 +
  269 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_contracts.html.erb:19
  270 +msgid "Client name(A-Z)"
  271 +msgstr ""
  272 +
  273 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_contracts.html.erb:19
  274 +msgid "Client name(Z-A)"
  275 +msgstr ""
  276 +
  277 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_contracts.html.erb:24
  278 +msgid "There are no contracts at all."
  279 +msgstr ""
  280 +
  281 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_contracts.html.erb:35
  282 +msgid "Are you sure?"
  283 +msgstr ""
  284 +
  285 +#: plugins/bsc/views/bsc_plugin_myprofile/manage_contracts.html.erb:45
  286 +msgid "Create new contract"
  287 +msgstr ""
  288 +
  289 +#: plugins/bsc/views/bsc_plugin_myprofile/_similar_enterprises.html.erb:2
  290 +msgid "Existing enterprises:"
  291 +msgstr ""
  292 +
  293 +#: plugins/bsc/views/bsc_plugin_myprofile/_similar_enterprises.html.erb:3
  294 +msgid ""
  295 +"Were found %{count} enterprises with similar names on the same city, you can "
  296 +"decide to associate one of them or create the new enterprise confirming the "
  297 +"informations you typed in."
  298 +msgstr ""
  299 +
  300 +#: plugins/bsc/views/bsc_plugin_myprofile/_similar_enterprises.html.erb:20
  301 +msgid "Associate"
  302 +msgstr ""
  303 +
  304 +#: plugins/bsc/views/bsc_plugin_myprofile/transfer_ownership.html.erb:1
  305 +msgid "Transfer Ownership"
  306 +msgstr ""
  307 +
  308 +#: plugins/bsc/views/bsc_plugin_myprofile/transfer_ownership.html.erb:4
  309 +msgid ""
  310 +"This option allows you to transfer this enterprise's management to another "
  311 +"user. This action will remove all the current administrators. Be careful "
  312 +"when confirming this procedure."
  313 +msgstr ""
  314 +
  315 +#: plugins/bsc/views/bsc_plugin_myprofile/transfer_ownership.html.erb:8
  316 +msgid "Current administrators:"
  317 +msgstr ""
  318 +
  319 +#: plugins/bsc/views/bsc_plugin_myprofile/transfer_ownership.html.erb:19
  320 +msgid "Administrator:"
  321 +msgstr ""
  322 +
  323 +#: plugins/bsc/views/bsc_plugin_myprofile/transfer_ownership.html.erb:22
  324 +msgid "Type in a search term for the new administrator"
  325 +msgstr ""
  326 +
  327 +#: plugins/bsc/views/shared/_fields.html.erb:39
  328 +msgid ""
  329 +"You are about to change the address, and this will break external links to "
  330 +"this bsc or to posts inside it. Do you really want to change?"
  331 +msgstr ""
  332 +
  333 +#: plugins/bsc/views/bsc_plugin/mailer/admin_notification.html.erb:1
  334 +msgid "The management of %{bsc} was transferred to you."
  335 +msgstr ""
  336 +
  337 +#: plugins/bsc/views/profile/_profile_tab.html.erb:2
  338 +msgid "Contact phone: "
  339 +msgstr ""
  340 +
  341 +#: plugins/bsc/views/profile/_profile_tab.html.erb:3
  342 +msgid "Email: "
  343 +msgstr ""
  344 +
  345 +#: plugins/bsc/views/bsc_plugin_admin/new.html.erb:2
  346 +msgid "BSC registration"
  347 +msgstr ""
  348 +
  349 +#: plugins/bsc/views/bsc_plugin_admin/validate_enterprises.html.erb:1
  350 +msgid "Validate enterprises"
  351 +msgstr ""
... ...
plugins/bsc/po/de/bsc.po
... ... @@ -6,8 +6,8 @@
6 6 #
7 7 msgid ""
8 8 msgstr ""
9   -"Project-Id-Version: 1.1-166-gaf47713\n"
10   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  9 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  10 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
11 11 "PO-Revision-Date: 2014-12-12 14:23+0200\n"
12 12 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
13 13 "Language-Team: German <https://hosted.weblate.org/projects/noosfero/noosfero/"
... ...
plugins/bsc/po/es/bsc.po
... ... @@ -5,8 +5,8 @@
5 5 #
6 6 msgid ""
7 7 msgstr ""
8   -"Project-Id-Version: 1.1-166-gaf47713\n"
9   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  8 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  9 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
10 10 "PO-Revision-Date: 2014-11-03 15:52+0200\n"
11 11 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
12 12 "Language-Team: Spanish <https://hosted.weblate.org/projects/noosfero/"
... ...
plugins/bsc/po/fr/bsc.po
... ... @@ -4,9 +4,9 @@
4 4 # , 2009.
5 5 msgid ""
6 6 msgstr ""
7   -"Project-Id-Version: 1.1-166-gaf47713\n"
  7 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
8 8 "Report-Msgid-Bugs-To: \n"
9   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  9 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
10 10 "PO-Revision-Date: 2014-12-12 14:22+0200\n"
11 11 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
12 12 "Language-Team: French <https://hosted.weblate.org/projects/noosfero/noosfero/"
... ...
plugins/bsc/po/hy/bsc.po
... ... @@ -5,8 +5,8 @@
5 5 #
6 6 msgid ""
7 7 msgstr ""
8   -"Project-Id-Version: 1.1-166-gaf47713\n"
9   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  8 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  9 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
10 10 "PO-Revision-Date: 2009-10-26 16:20-0300\n"
11 11 "Last-Translator: Anahit Minassian <anahit.minassian@cooperation.net>\n"
12 12 "Language-Team: LANGUAGE <LL@li.org>\n"
... ...
plugins/bsc/po/pt/bsc.po
... ... @@ -11,8 +11,8 @@
11 11 #
12 12 msgid ""
13 13 msgstr ""
14   -"Project-Id-Version: 1.1-166-gaf47713\n"
15   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  14 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  15 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
16 16 "PO-Revision-Date: 2014-12-18 18:40-0200\n"
17 17 "Last-Translator: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>\n"
18 18 "Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero/"
... ...
plugins/bsc/po/ru/bsc.po
... ... @@ -5,8 +5,8 @@
5 5 #
6 6 msgid ""
7 7 msgstr ""
8   -"Project-Id-Version: 1.1-166-gaf47713\n"
9   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  8 +"Project-Id-Version: 1.2~rc2-23-g29aba34\n"
  9 +"POT-Creation-Date: 2015-08-06 18:47-0300\n"
10 10 "PO-Revision-Date: 2014-12-12 14:23+0200\n"
11 11 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
12 12 "Language-Team: Russian <https://hosted.weblate.org/projects/noosfero/"
... ...
plugins/bsc/test/functional/bsc_plugin_admin_controller_test.rb
... ... @@ -73,6 +73,6 @@ class BscPluginAdminControllerTest &lt; ActionController::TestCase
73 73  
74 74 assert e1.validated
75 75 assert e2.validated
76   - assert !e3.validated
  76 + refute e3.validated
77 77 end
78 78 end
... ...
plugins/bsc/test/unit/bsc_plugin/bsc_test.rb
... ... @@ -41,7 +41,7 @@ class BscPlugin::BscTest &lt; ActiveSupport::TestCase
41 41 bsc.enterprise_requests.stubs(:pending).returns([task])
42 42  
43 43 assert bsc.already_requested?(e1)
44   - assert !bsc.already_requested?(e2)
  44 + refute bsc.already_requested?(e2)
45 45 end
46 46  
47 47 should 'return associated enterprises products' do
... ... @@ -68,7 +68,7 @@ class BscPlugin::BscTest &lt; ActiveSupport::TestCase
68 68 end
69 69  
70 70 should 'not be able to create product' do
71   - assert !bsc.create_product?
  71 + refute bsc.create_product?
72 72 end
73 73  
74 74 should 'have many contracts' do
... ...
plugins/bsc/test/unit/bsc_plugin/contract_test.rb
... ... @@ -14,7 +14,7 @@ class BscPlugin::ContractTest &lt; ActiveSupport::TestCase
14 14  
15 15 contract.bsc = BscPlugin::Bsc.new
16 16 contract.valid?
17   - assert !contract.errors.invalid?(:bsc)
  17 + refute contract.errors.invalid?(:bsc)
18 18 end
19 19  
20 20 should 'associate contract with products through sales' do
... ...
plugins/bsc/test/unit/bsc_plugin/sale_test.rb
... ... @@ -18,8 +18,8 @@ class BscPlugin::SaleTest &lt; ActiveSupport::TestCase
18 18 sale.product = product
19 19 sale.contract = contract
20 20  
21   - assert !sale.errors.invalid?(product)
22   - assert !sale.errors.invalid?(contract)
  21 + refute sale.errors.invalid?(product)
  22 + refute sale.errors.invalid?(contract)
23 23 end
24 24  
25 25 should 'validate uniqueness of product and contract composed' do
... ... @@ -43,7 +43,7 @@ class BscPlugin::SaleTest &lt; ActiveSupport::TestCase
43 43  
44 44 sale.quantity = 3
45 45 sale.valid?
46   - assert !sale.errors.invalid?(:quantity)
  46 + refute sale.errors.invalid?(:quantity)
47 47 end
48 48  
49 49 should 'set default price as product price if no price indicated' do
... ...
Conteúdo acessível em Libras usando o VLibras Widget com opções dos Avatares Ícaro, Hosana ou Guga. Conteúdo acessível em Libras usando o VLibras Widget com opções dos Avatares Ícaro, Hosana ou Guga.