Commit 5a4daab12b98929e28442bb59e6106aa6a66b5f6

Authored by Leandro Santos
2 parents c95eb5e5 930a5a02
Exists in staging and in 1 other branch production

Merge branch 'master' into staging

app/controllers/admin/users_controller.rb
... ... @@ -45,7 +45,6 @@ class UsersController < AdminController
45 45 redirect_to :action => :index, :q => params[:q], :filter => params[:filter]
46 46 end
47 47  
48   -
49 48 def destroy_user
50 49 if request.post?
51 50 person = environment.people.find_by id: params[:id]
... ... @@ -58,7 +57,6 @@ class UsersController < AdminController
58 57 redirect_to :action => :index, :q => params[:q], :filter => params[:filter]
59 58 end
60 59  
61   -
62 60 def download
63 61 respond_to do |format|
64 62 format.html
... ... @@ -87,8 +85,11 @@ class UsersController < AdminController
87 85 end
88 86  
89 87 def send_mail
90   - @mailing = environment.mailings.build(params[:mailing])
91 88 if request.post?
  89 + @mailing = environment.mailings.build(params[:mailing])
  90 + @mailing.recipients_roles = []
  91 + @mailing.recipients_roles << "profile_admin" if params[:recipients][:profile_admins].include?("true")
  92 + @mailing.recipients_roles << "environment_administrator" if params[:recipients][:env_admins].include?("true")
92 93 @mailing.locale = locale
93 94 @mailing.person = user
94 95 if @mailing.save
... ...
app/helpers/block_helper.rb
... ... @@ -28,7 +28,7 @@ module BlockHelper
28 28 }</label></td>
29 29 <td>#{button_without_text(:delete, _('Remove'), '#', class: 'delete-highlight', data: {confirm: _('Are you sure you want to remove this highlight')})}</td>
30 30 </tr>
31   - "
  31 + ".html_safe
32 32 end
33 33  
34 34 end
... ...
app/mailers/environment_mailing.rb
1 1 class EnvironmentMailing < Mailing
2 2  
  3 + settings_items :recipients_roles, :type => :array
  4 + attr_accessible :recipients_roles
  5 +
3 6 def recipients(offset=0, limit=100)
4   - source.people.order(:id).offset(offset).limit(limit)
  7 + recipients_by_role.order(:id).offset(offset).limit(limit)
5 8 .joins("LEFT OUTER JOIN mailing_sents m ON (m.mailing_id = #{id} AND m.person_id = profiles.id)")
6 9 .where("m.person_id" => nil)
7 10 end
8 11  
  12 + def recipients_by_role
  13 + if recipients_roles.blank?
  14 + source.people
  15 + else
  16 + roles = Environment::Role.where("key in (?)", self.recipients_roles)
  17 + Person.by_role(roles).where(environment_id: self.source_id)
  18 + end
  19 + end
  20 +
9 21 def each_recipient
10 22 offset = 0
11 23 limit = 100
... ...
app/models/article.rb
... ... @@ -806,11 +806,13 @@ class Article &lt; ApplicationRecord
806 806 end
807 807  
808 808 def body_images_paths
809   - Nokogiri::HTML.fragment(self.body.to_s).css('img[src]').collect do |i|
  809 + paths = Nokogiri::HTML.fragment(self.body.to_s).css('img[src]').collect do |i|
810 810 src = i['src']
811 811 src = URI.escape src if self.new_record? # xss_terminate runs on save
812 812 (self.profile && self.profile.environment) ? URI.join(self.profile.environment.top_url, src).to_s : src
813 813 end
  814 + paths.unshift(URI.join(self.profile.environment.top_url, self.image.public_filename).to_s) if self.image.present?
  815 + paths
814 816 end
815 817  
816 818 def more_comments_label
... ...
app/views/box_organizer/edit.html.erb
1 1 <div class="block-config-options <%= @block.class.name %>-options">
2   - <h2 class="title"><%= _(@block.class.description) %></h2>
  2 + <h2 class="title"><%= _(@block.class.description).html_safe %></h2>
3 3  
4 4 <%= form_tag(:action => 'save', :id => @block.id) do %>
5 5  
... ...
app/views/users/_index_buttons.html.erb
1 1 <% button_bar do %>
2 2 <%= button :'text-plain', _('User list as [CSV]'), :action => 'download.csv' %>
3 3 <%= button :'text-html', _('User list as [XML]'), :action => 'download.xml' %>
4   - <%= button :send, _('Send e-mail to all users'), :action => 'send_mail' %>
  4 + <%= button :send, _('Send e-mail to users'), :action => 'send_mail' %>
5 5 <%= button :back, _('Back'), :controller => 'admin_panel' %>
6 6 <% end %>
... ...
app/views/users/send_mail.html.erb
... ... @@ -3,10 +3,19 @@
3 3 <%= error_messages_for :mailing %>
4 4  
5 5 <%= render :file => 'shared/tiny_mce' %>
6   -
7 6 <%= form_for :mailing do |f| %>
  7 + <div class="recipients">
  8 + <%= label_tag(_("Recipients: "), nil, { class: "formlabel" }) %>
  9 + <%= labelled_radio_button(_('All Users'), :send_to, "all", true, { id: "send_to_all" }) %></br>
  10 + <%= labelled_radio_button(_('Only Admins'), :send_to, "admins" , false, { id: "send_to_admins" }) %><br>
  11 + <div class="recipients-checkboxes">
  12 + <%= labelled_check_box(_('Environment Admins'), 'recipients[env_admins]', true, false, { disabled: true, id: "env_admins" }) %>
  13 + <%= labelled_check_box(_('Profile Admins'), 'recipients[profile_admins]', true, false, { disabled: true, id: "profile_admins" }) %>
  14 + </div>
  15 + </div>
8 16 <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %>
9 17 <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'mceEditor')) %>
10 18 <%= submit_button(:send, _('Send')) %>
11 19 <%= button :cancel, _('Cancel e-mail'), :controller => 'users' %>
12 20 <% end %>
  21 +<%= javascript_include_tag "send_email.js" %>
... ...
features/login.feature
... ... @@ -14,6 +14,7 @@ Feature: login
14 14 And I am not logged in
15 15 And I go to the homepage
16 16 And I follow "Login"
  17 + And I wait 0.5 second for popin animation
17 18 And I fill in the following:
18 19 | Username / Email | joaosilva |
19 20 | Password | 123456 |
... ... @@ -33,6 +34,7 @@ Feature: login
33 34 | mariasilva | my home page | true |
34 35 And I go to mariasilva's homepage
35 36 And I follow "Login"
  37 + And I wait 0.5 second for popin animation
36 38 And I fill in the following:
37 39 | Username / Email | joaosilva |
38 40 | Password | 123456 |
... ... @@ -68,6 +70,7 @@ Feature: login
68 70 | mariasilva | my home page | true |
69 71 And I go to mariasilva's homepage
70 72 And I follow "Login"
  73 + And I wait 0.5 second for popin animation
71 74 And I fill in the following:
72 75 | Username / Email | joaosilva |
73 76 | Password | 123456 |
... ... @@ -81,6 +84,7 @@ Feature: login
81 84 And the environment is configured to redirect to site homepage after login
82 85 And I go to joaosilva's homepage
83 86 And I follow "Login"
  87 + And I wait 0.5 second for popin animation
84 88 And I fill in the following:
85 89 | Username / Email | joaosilva |
86 90 | Password | 123456 |
... ... @@ -94,6 +98,7 @@ Feature: login
94 98 And the environment is configured to redirect to user profile page after login
95 99 And I go to the homepage
96 100 And I follow "Login"
  101 + And I wait 0.5 second for popin animation
97 102 And I fill in the following:
98 103 | Username / Email | joaosilva |
99 104 | Password | 123456 |
... ... @@ -123,6 +128,7 @@ Feature: login
123 128 And the environment is configured to redirect to profile control panel after login
124 129 And I go to the homepage
125 130 And I follow "Login"
  131 + And I wait 0.5 second for popin animation
126 132 And I fill in the following:
127 133 | Username / Email | joaosilva |
128 134 | Password | 123456 |
... ... @@ -143,6 +149,7 @@ Feature: login
143 149 | mariasilva | my home page | true |
144 150 And I go to mariasilva's homepage
145 151 And I follow "Login"
  152 + And I wait 0.5 second for popin animation
146 153 And I fill in the following:
147 154 | Username / Email | joaosilva |
148 155 | Password | 123456 |
... ... @@ -157,6 +164,7 @@ Feature: login
157 164 And the profile joaosilva is configured to redirect to site homepage after login
158 165 And I go to joaosilva's homepage
159 166 And I follow "Login"
  167 + And I wait 0.5 second for popin animation
160 168 And I fill in the following:
161 169 | Username / Email | joaosilva |
162 170 | Password | 123456 |
... ... @@ -171,6 +179,7 @@ Feature: login
171 179 And the profile joaosilva is configured to redirect to user profile page after login
172 180 And I go to the homepage
173 181 And I follow "Login"
  182 + And I wait 0.5 second for popin animation
174 183 And I fill in the following:
175 184 | Username / Email | joaosilva |
176 185 | Password | 123456 |
... ... @@ -188,6 +197,7 @@ Feature: login
188 197 And the profile joaosilva is configured to redirect to profile homepage after login
189 198 And I go to the homepage
190 199 And I follow "Login"
  200 + And I wait 0.5 second for popin animation
191 201 And I fill in the following:
192 202 | Username / Email | joaosilva |
193 203 | Password | 123456 |
... ... @@ -202,6 +212,7 @@ Feature: login
202 212 And the profile joaosilva is configured to redirect to profile control panel after login
203 213 And I go to the homepage
204 214 And I follow "Login"
  215 + And I wait 0.5 second for popin animation
205 216 And I fill in the following:
206 217 | Username / Email | joaosilva |
207 218 | Password | 123456 |
... ...
features/send_email_to_environment_members.feature
... ... @@ -43,3 +43,29 @@ Feature: send emails to environment members users
43 43 Then I should be on /admin/users/send_mail
44 44 When I follow "Cancel e-mail"
45 45 Then I should be on /admin/users
  46 +
  47 + Scenario: Should display recipients options
  48 + Given I am logged in as admin
  49 + And I go to /admin/users/send_mail
  50 + Then I should see "Recipients"
  51 + Then I should see "All Users"
  52 + Then I should see "Only Admins"
  53 + Then I should see "Environment Admins"
  54 + Then I should see "Profile Admins"
  55 +
  56 + Scenario: All users should be marked as default recipients
  57 + Given I am logged in as admin
  58 + And I go to /admin/users/send_mail
  59 + Then the "send_to_all" radio button should be checked
  60 + Then the "send_to_admins" radio button should not be checked
  61 +
  62 + @selenium
  63 + Scenario: Should disable checkboxes when recipients is set to All users
  64 + Given I am logged in as admin
  65 + And I go to /admin/users/send_mail
  66 + Then the field "#profile_admins" should be disabled
  67 + Then the field "#env_admins" should be disabled
  68 + When I choose "Only Admins"
  69 + Then the field "#profile_admins" should be enabled
  70 + Then the field "#env_admins" should be enabled
  71 +
... ...
lib/noosfero/api/entities.rb
... ... @@ -198,6 +198,7 @@ module Noosfero
198 198 expose :type
199 199 expose :comments, using: CommentBase, :if => lambda{|obj,opt| opt[:params] && ['1','true',true].include?(opt[:params][:show_comments])}
200 200 expose :published
  201 + expose :accept_comments?, as: :accept_comments
201 202 end
202 203  
203 204 class Article < ArticleBase
... ...
lib/noosfero/api/helpers.rb
... ... @@ -122,9 +122,6 @@ require_relative &#39;../../find_by_contents&#39;
122 122 end
123 123 end
124 124  
125   - ARTICLE_TYPES = ['Article'] + Article.descendants.map{|a| a.to_s}
126   - TASK_TYPES = ['Task'] + Task.descendants.map{|a| a.to_s}
127   -
128 125 def find_article(articles, id)
129 126 article = articles.find(id)
130 127 article.display_to?(current_person) ? article : forbidden!
... ... @@ -134,7 +131,7 @@ require_relative &#39;../../find_by_contents&#39;
134 131 return forbidden! unless current_person.can_post_content?(asset)
135 132  
136 133 klass_type = params[:content_type] || params[:article].delete(:type) || TinyMceArticle.name
137   - return forbidden! unless ARTICLE_TYPES.include?(klass_type)
  134 + return forbidden! unless klass_type.constantize <= Article
138 135  
139 136 article = klass_type.constantize.new(params[:article])
140 137 article.last_changed_by = current_person
... ... @@ -178,7 +175,7 @@ require_relative &#39;../../find_by_contents&#39;
178 175  
179 176 def post_task(asset, params)
180 177 klass_type= params[:content_type].nil? ? 'Task' : params[:content_type]
181   - return forbidden! unless TASK_TYPES.include?(klass_type)
  178 + return forbidden! unless klass_type.constantize <= Task
182 179  
183 180 task = klass_type.constantize.new(params[:task])
184 181 task.requestor_id = current_person.id
... ...
plugins/custom_forms/po/es/custom_forms.po
... ... @@ -7,8 +7,8 @@ msgid &quot;&quot;
7 7 msgstr ""
8 8 "Project-Id-Version: 1.3~rc2-1-ga15645d\n"
9 9 "POT-Creation-Date: 2015-10-30 16:35-0300\n"
10   -"PO-Revision-Date: 2016-01-04 15:22+0000\n"
11   -"Last-Translator: María Vecino <mariavecino@ecoalternative.net>\n"
  10 +"PO-Revision-Date: 2016-05-09 16:11+0000\n"
  11 +"Last-Translator: daniel <dtygel@eita.org.br>\n"
12 12 "Language-Team: Spanish <https://hosted.weblate.org/projects/noosfero/plugin-"
13 13 "custom-forms/es/>\n"
14 14 "Language: es\n"
... ... @@ -16,18 +16,16 @@ msgstr &quot;&quot;
16 16 "Content-Type: text/plain; charset=UTF-8\n"
17 17 "Content-Transfer-Encoding: 8bit\n"
18 18 "Plural-Forms: nplurals=2; plural=n != 1;\n"
19   -"X-Generator: Weblate 2.5-dev\n"
  19 +"X-Generator: Weblate 2.7-dev\n"
20 20  
21 21 #: plugins/custom_forms/lib/custom_forms_plugin/form.rb:67
22   -#, fuzzy
23 22 msgid "Invalid string format of access."
24   -msgstr "Nombre nombre de ciudad o estado inválido."
  23 +msgstr "Formato de texto inválido."
25 24  
26 25 #: plugins/custom_forms/lib/custom_forms_plugin/form.rb:71
27 26 #: plugins/custom_forms/lib/custom_forms_plugin/form.rb:76
28   -#, fuzzy
29 27 msgid "There is no profile with the provided id."
30   -msgstr "Hubo problemas con los siguientes archivos:"
  28 +msgstr "No hay perfil con este id."
31 29  
32 30 #: plugins/custom_forms/lib/custom_forms_plugin/form.rb:81
33 31 #, fuzzy
... ...
plugins/push_notification/dependencies.rb
... ... @@ -1 +0,0 @@
1   -require 'gcm'
plugins/push_notification/test/helpers/observers_test_helper.rb
... ... @@ -9,7 +9,8 @@ module ObserversTestHelper
9 9 end
10 10  
11 11 def create_add_member_task
12   - person = fast_create(Person)
  12 + user = fast_create(User)
  13 + person = fast_create(Person, :user_id => user.id)
13 14 community = fast_create(Community)
14 15 return AddMember.create!(:requestor => person, :target => community)
15 16 end
... ...
plugins/statistics/lib/statistics_block.rb
... ... @@ -149,12 +149,4 @@ class StatisticsBlock &lt; Block
149 149 end
150 150 end
151 151  
152   - def content(args={})
153   - block = self
154   -
155   - proc do
156   - render :file => 'statistics_block', :locals => { :block => block }
157   - end
158   - end
159   -
160 152 end
... ...
plugins/statistics/views/blocks/statistics.html.erb 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +<h3 class="block-title">
  2 + <span><%=block.title%></span>
  3 +</h3>
  4 +<div class="statistics-block-data">
  5 + <ul>
  6 + <% if block.is_visible?('user_counter') %>
  7 + <li class="users"><span class="amount"><%= block.users%> </span><span class="label"><%= _('users')%></span></li>
  8 + <% end %>
  9 + <% if block.is_visible?('enterprise_counter') && !block.environment.enabled?('disable_asset_enterprises') %>
  10 + <li class="enterprises"><span class="amount"><%= block.enterprises%> </span><span class="label"><%= _('enterprises')%></span></li>
  11 + <% end %>
  12 + <% if block.is_visible?('product_counter') && block.environment.enabled?('products_for_enterprises') %>
  13 + <li class="products"><span class="amount"><%= block.products%> </span><span class="label"><%= _('products')%></span></li>
  14 + <% end %>
  15 + <% if block.is_visible?('community_counter') %>
  16 + <li class="communities"><span class="amount"><%= block.communities%> </span><span class="label"><%= _('communities')%></span></li>
  17 + <% end %>
  18 + <% if block.is_visible?('category_counter') %>
  19 + <li class="categories"><span class="amount"><%= block.categories%> </span><span class="label"><%= _('categories')%></span></li>
  20 + <% end %>
  21 + <% if block.is_visible?('tag_counter') %>
  22 + <li class="tags"><span class="amount"><%= block.tags%> </span><span class="label"><%= c_('tags')%></span></li>
  23 + <% end %>
  24 + <% if block.is_visible?('comment_counter') %>
  25 + <li class="comments"><span class="amount"><%= block.comments%> </span><span class="label"><%= c_('comments')%></span></li>
  26 + <% end %>
  27 + <% if block.is_visible?('hit_counter') %>
  28 + <li class="hits"><span class="amount"><%= block.hits%> </span><span class="label"><%= _('hits')%></span></li>
  29 + <% end %>
  30 +
  31 + <% if block.owner.kind_of?(Environment) then %>
  32 + <% block.templates.each do |item| %>
  33 + <% if block.is_template_counter_active? item.id %>
  34 + <li class="<%= item.name.to_slug%>"><span class="amount"><%= block.template_counter_count(item.id)%> </span><span class="label"><%= item.name%></span></li>
  35 + <% end %>
  36 + <% end %>
  37 + <% end %>
  38 + </ul>
  39 +</div>
... ...
plugins/statistics/views/statistics_block.html.erb
... ... @@ -1,39 +0,0 @@
1   -<h3 class="block-title">
2   - <span><%=block.title%></span>
3   -</h3>
4   -<div class="statistics-block-data">
5   - <ul>
6   - <% if block.is_visible?('user_counter') %>
7   - <li class="users"><span class="amount"><%= block.users%> </span><span class="label"><%= _('users')%></span></li>
8   - <% end %>
9   - <% if block.is_visible?('enterprise_counter') && !block.environment.enabled?('disable_asset_enterprises') %>
10   - <li class="enterprises"><span class="amount"><%= block.enterprises%> </span><span class="label"><%= _('enterprises')%></span></li>
11   - <% end %>
12   - <% if block.is_visible?('product_counter') && block.environment.enabled?('products_for_enterprises') %>
13   - <li class="products"><span class="amount"><%= block.products%> </span><span class="label"><%= _('products')%></span></li>
14   - <% end %>
15   - <% if block.is_visible?('community_counter') %>
16   - <li class="communities"><span class="amount"><%= block.communities%> </span><span class="label"><%= _('communities')%></span></li>
17   - <% end %>
18   - <% if block.is_visible?('category_counter') %>
19   - <li class="categories"><span class="amount"><%= block.categories%> </span><span class="label"><%= _('categories')%></span></li>
20   - <% end %>
21   - <% if block.is_visible?('tag_counter') %>
22   - <li class="tags"><span class="amount"><%= block.tags%> </span><span class="label"><%= c_('tags')%></span></li>
23   - <% end %>
24   - <% if block.is_visible?('comment_counter') %>
25   - <li class="comments"><span class="amount"><%= block.comments%> </span><span class="label"><%= c_('comments')%></span></li>
26   - <% end %>
27   - <% if block.is_visible?('hit_counter') %>
28   - <li class="hits"><span class="amount"><%= block.hits%> </span><span class="label"><%= _('hits')%></span></li>
29   - <% end %>
30   -
31   - <% if block.owner.kind_of?(Environment) then %>
32   - <% block.templates.each do |item| %>
33   - <% if block.is_template_counter_active? item.id %>
34   - <li class="<%= item.name.to_slug%>"><span class="amount"><%= block.template_counter_count(item.id)%> </span><span class="label"><%= item.name%></span></li>
35   - <% end %>
36   - <% end %>
37   - <% end %>
38   - </ul>
39   -</div>
po/es/noosfero.po
... ... @@ -7,16 +7,16 @@ msgid &quot;&quot;
7 7 msgstr ""
8 8 "Project-Id-Version: 1.3~rc2-8-g01ea9f7\n"
9 9 "POT-Creation-Date: 2015-11-04 12:36-0300\n"
10   -"PO-Revision-Date: 2016-01-07 11:31+0000\n"
11   -"Last-Translator: María Vecino <mariavecino@ecoalternative.net>\n"
12   -"Language-Team: Spanish <https://hosted.weblate.org/projects/noosfero/"
13   -"noosfero/es/>\n"
  10 +"PO-Revision-Date: 2016-05-09 16:09+0000\n"
  11 +"Last-Translator: daniel <dtygel@eita.org.br>\n"
  12 +"Language-Team: Spanish "
  13 +"<https://hosted.weblate.org/projects/noosfero/noosfero/es/>\n"
14 14 "Language: es\n"
15 15 "MIME-Version: 1.0\n"
16 16 "Content-Type: text/plain; charset=UTF-8\n"
17 17 "Content-Transfer-Encoding: 8bit\n"
18 18 "Plural-Forms: nplurals=2; plural=n != 1;\n"
19   -"X-Generator: Weblate 2.5-dev\n"
  19 +"X-Generator: Weblate 2.7-dev\n"
20 20  
21 21 # Entorno o ambiente?
22 22 #: app/controllers/admin/admin_panel_controller.rb:16
... ... @@ -40,12 +40,10 @@ msgid &quot;Saved the number of news on folders&quot;
40 40 msgstr "Guardado el número de noticias en las carpetas"
41 41  
42 42 #: app/controllers/admin/categories_controller.rb:48
43   -#, fuzzy
44 43 msgid "Category %s saved."
45   -msgstr "En la categoría %s"
  44 +msgstr "En la categoría %s."
46 45  
47 46 #: app/controllers/admin/categories_controller.rb:52
48   -#, fuzzy
49 47 msgid "Could not save category."
50 48 msgstr "Selecciona una categoría:"
51 49  
... ...
public/designs/themes/base/style.scss
... ... @@ -653,8 +653,7 @@ div#notice {
653 653 }
654 654  
655 655 #content .link-list-block li a.link-this-page {
656   - border-radius-topright: 0px;
657   - border-radius-bottomright: 0px;
  656 + border-radius: 4px 0 0 4px;
658 657 background-color: #cecece;
659 658 border-right: 2px solid #555753;
660 659 }
... ...
public/images/calendar_date_select/calendar-16.png 0 → 100644

306 Bytes

public/images/calendar_date_select/calendar-24.png 0 → 100644

340 Bytes

public/images/calendar_date_select/calendar-32.png 0 → 100644

414 Bytes

public/images/calendar_date_select/calendar.gif

581 Bytes

public/images/calendar_date_select/calendar.png

1.74 KB

public/images/calendar_date_select/calendar.svg 0 → 100644
... ... @@ -0,0 +1,162 @@
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<!-- Created with Inkscape (http://www.inkscape.org/) -->
  3 +
  4 +<svg
  5 + xmlns:dc="http://purl.org/dc/elements/1.1/"
  6 + xmlns:cc="http://creativecommons.org/ns#"
  7 + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  8 + xmlns:svg="http://www.w3.org/2000/svg"
  9 + xmlns="http://www.w3.org/2000/svg"
  10 + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
  11 + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
  12 + width="16"
  13 + height="16"
  14 + id="svg2"
  15 + version="1.1"
  16 + inkscape:version="0.48.3.1 r9886"
  17 + sodipodi:docname="calendar.svg"
  18 + inkscape:export-filename="/home/aurium/noosfero/public/images/calendar_date_select/calendar-16.png"
  19 + inkscape:export-xdpi="90"
  20 + inkscape:export-ydpi="90">
  21 + <defs
  22 + id="defs4" />
  23 + <sodipodi:namedview
  24 + id="base"
  25 + pagecolor="#ffffff"
  26 + bordercolor="#666666"
  27 + borderopacity="1.0"
  28 + inkscape:pageopacity="0.0"
  29 + inkscape:pageshadow="2"
  30 + inkscape:zoom="15.09375"
  31 + inkscape:cx="24.5"
  32 + inkscape:cy="2.3627199"
  33 + inkscape:document-units="px"
  34 + inkscape:current-layer="layer1"
  35 + showgrid="true"
  36 + inkscape:snap-bbox="true"
  37 + inkscape:window-width="1366"
  38 + inkscape:window-height="681"
  39 + inkscape:window-x="0"
  40 + inkscape:window-y="27"
  41 + inkscape:window-maximized="1">
  42 + <inkscape:grid
  43 + type="xygrid"
  44 + id="grid2985"
  45 + empspacing="8"
  46 + visible="true"
  47 + enabled="true"
  48 + snapvisiblegridlinesonly="true"
  49 + originx="0.5px"
  50 + originy="0.5px" />
  51 + </sodipodi:namedview>
  52 + <metadata
  53 + id="metadata7">
  54 + <rdf:RDF>
  55 + <cc:Work
  56 + rdf:about="">
  57 + <dc:format>image/svg+xml</dc:format>
  58 + <dc:type
  59 + rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
  60 + <dc:title></dc:title>
  61 + </cc:Work>
  62 + </rdf:RDF>
  63 + </metadata>
  64 + <g
  65 + inkscape:label="Camada 1"
  66 + inkscape:groupmode="layer"
  67 + id="layer1"
  68 + transform="translate(0,-1036.3622)">
  69 + <path
  70 + transform="translate(0,1036.3622)"
  71 + style="fill:#ffffff;fill-rule:evenodd;stroke:#b3b3b3;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;color:#000000;fill-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
  72 + d="m 14.5,5 0,9.5 -13,0 0,-9.5"
  73 + id="rect2989"
  74 + inkscape:connector-curvature="0"
  75 + sodipodi:nodetypes="cccc" />
  76 + <path
  77 + id="path3761"
  78 + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.35294118"
  79 + d="m 9.5,1042.8622 0,6 m -3,-6 0,6 m -3,-3 9,0 m -9,-3 9,0 0,6 -9,0 z"
  80 + inkscape:connector-curvature="0" />
  81 + <g
  82 + id="g3841"
  83 + inkscape:export-filename="/home/aurium/noosfero/public/images/calendar_date_select/calendar-24.png"
  84 + inkscape:export-xdpi="90"
  85 + inkscape:export-ydpi="90">
  86 + <rect
  87 + inkscape:export-ydpi="90"
  88 + inkscape:export-xdpi="90"
  89 + inkscape:export-filename="/home/aurium/noosfero/public/images/calendar_date_select/alendar-32.png"
  90 + transform="translate(0,1036.3622)"
  91 + y="0.5"
  92 + x="16.5"
  93 + height="23"
  94 + width="23"
  95 + id="rect3767"
  96 + style="fill:none;stroke:#ff00ff;stroke-opacity:0" />
  97 + <path
  98 + style="fill:#ffffff;fill-rule:evenodd;stroke:#b3b3b3;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
  99 + d="m 38.5,1043.3622 0,15.5 -21,0 0,-15.5"
  100 + id="path3769"
  101 + inkscape:connector-curvature="0"
  102 + sodipodi:nodetypes="cccc" />
  103 + <path
  104 + sodipodi:nodetypes="ccccccc"
  105 + inkscape:connector-curvature="0"
  106 + id="rect3771"
  107 + d="m 17.5,1039.8622 c 0,-1 1,-2 2,-2 l 17,0 c 1,0 2,1 2,2 l 0,3 -21,0 z"
  108 + style="fill:#80b3ff;fill-opacity:1;stroke:#5f8dd3;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
  109 + inkscape:export-xdpi="90"
  110 + inkscape:export-ydpi="90" />
  111 + <path
  112 + inkscape:connector-curvature="0"
  113 + d="m 30.5,1045.8622 0,10 m -5,-10 0,10 m -5,-5 15,0 m -15,-5 15,0 0,10 -15,0 z"
  114 + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.35294118"
  115 + id="path3857"
  116 + sodipodi:nodetypes="ccccccccccc" />
  117 + </g>
  118 + <g
  119 + inkscape:export-ydpi="90"
  120 + inkscape:export-xdpi="90"
  121 + inkscape:export-filename="/home/aurium/noosfero/public/images/calendar_date_select/calendar-32.png"
  122 + id="g3847"
  123 + transform="translate(24,0)">
  124 + <rect
  125 + style="fill:none;stroke:#ff00ff;stroke-opacity:0"
  126 + id="rect3849"
  127 + width="31"
  128 + height="31"
  129 + x="16.5"
  130 + y="0.5"
  131 + transform="translate(0,1036.3622)"
  132 + inkscape:export-filename="/home/aurium/noosfero/public/images/calendar_date_select/alendar-32.png"
  133 + inkscape:export-xdpi="90"
  134 + inkscape:export-ydpi="90" />
  135 + <path
  136 + sodipodi:nodetypes="cccc"
  137 + inkscape:connector-curvature="0"
  138 + id="path3851"
  139 + d="m 46.5,1043.3622 0,23.5 -29,0 0,-23.5"
  140 + style="fill:#ffffff;fill-rule:evenodd;stroke:#b3b3b3;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
  141 + <path
  142 + style="fill:#80b3ff;fill-opacity:1;stroke:#5f8dd3;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
  143 + d="m 17.5,1040.8622 c 0,-2 1,-3 3,-3 l 23,0 c 2,0 3,1 3,3 l 0,2 -29,0 z"
  144 + id="path3853"
  145 + inkscape:connector-curvature="0"
  146 + sodipodi:nodetypes="ccccccc" />
  147 + <path
  148 + d="m 19.5,1049.8622 25,0 m 0,5 -25,0 m 20,-10 0,20 m -5,-20 0,20 m -5,-20 0,20 m -5,-20 0,20 m -5,-5 25,0 m -25,-15 25,0 0,20 -25,0 z"
  149 + style="color:#000000;fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.35294118;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
  150 + id="path3855"
  151 + inkscape:connector-curvature="0" />
  152 + </g>
  153 + <path
  154 + sodipodi:nodetypes="ccccccc"
  155 + inkscape:connector-curvature="0"
  156 + id="rect3771-8"
  157 + d="m 1.5,1038.8622 c 0,-1 1,-1 1,-1 l 11,0 c 0,0 1,0 1,1 l 0,2 -13,0 z"
  158 + style="fill:#80b3ff;fill-opacity:1;stroke:#5f8dd3;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
  159 + inkscape:export-xdpi="90"
  160 + inkscape:export-ydpi="90" />
  161 + </g>
  162 +</svg>
... ...
public/images/icons-mime/event.png
1   -../calendar_date_select/calendar.png
2 1 \ No newline at end of file
  2 +../calendar_date_select/calendar-24.png
3 3 \ No newline at end of file
... ...
public/javascripts/send_email.js 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +var all_users_radio_btn = document.getElementById("send_to_all");
  2 +var admins_radio_btn = document.getElementById("send_to_admins");
  3 +var env_admins_checkbox = document.getElementById("env_admins");
  4 +var profile_admins_checkbox = document.getElementById("profile_admins");
  5 +
  6 +admins_radio_btn.onchange = function() {
  7 + change_checkbox_state("admins");
  8 +};
  9 +
  10 +all_users_radio_btn.onchange = function() {
  11 + change_checkbox_state("all_users");
  12 +};
  13 +
  14 +function change_checkbox_state (recipients) {
  15 + if(recipients == "all_users"){
  16 + env_admins_checkbox.disabled = true;
  17 + profile_admins_checkbox.disabled = true;
  18 + }else {
  19 + env_admins_checkbox.disabled = false;
  20 + profile_admins_checkbox.disabled = false;
  21 + }
  22 +};
... ...
public/stylesheets/content/event.scss
... ... @@ -14,10 +14,10 @@ ul.event-data {
14 14 font-weight: bold;
15 15 padding-right: 0.25em;
16 16 }
17   -li.event-dates span {
  17 +.event-dates span {
18 18 display: none;
19 19 }
20   -li.event-dates {
  20 +.event-dates {
21 21 padding: 5px;
22 22 float: right;
23 23 font-style: italic;
... ...
test/functional/users_controller_test.rb
... ... @@ -141,4 +141,36 @@ class UsersControllerTest &lt; ActionController::TestCase
141 141 assert_redirected_to :action => 'index'
142 142 end
143 143  
  144 + should 'redirect to index after send email with success' do
  145 + post :send_mail, mailing: { subject: "Subject", body: "Body" }, recipients: { profile_admins: "false", env_admins: "false" }
  146 + assert_redirected_to :action => 'index'
  147 + assert_match /The e-mails are being sent/, session[:notice]
  148 + end
  149 +
  150 + should 'mailing recipients_roles should be empty when none is set' do
  151 + post :send_mail, mailing: { subject: "Subject", body: "Body" }, recipients: { profile_admins: "false", env_admins: "false" }
  152 + mailing = EnvironmentMailing.last
  153 + assert_equal mailing.recipients_roles, []
  154 + end
  155 +
  156 + should 'mailing recipients_roles should be set correctly' do
  157 + post :send_mail, mailing: { subject: "Subject", body: "Body" }, recipients: { profile_admins: "true", env_admins: "true" }
  158 + mailing = EnvironmentMailing.last
  159 + assert_equal mailing.recipients_roles, ["profile_admin", "environment_administrator"]
  160 + end
  161 +
  162 + should 'send mail to admins recipients' do
  163 + admin_user = create_user('new_admin').person
  164 + admin_user_2 = create_user('new_admin_2').person
  165 +
  166 + environment.add_admin admin_user
  167 + environment.add_admin admin_user_2
  168 +
  169 + assert_equal 2, environment.admins.count
  170 + assert_difference "MailingSent.count", 2 do
  171 + post :send_mail, mailing: { subject: "UnB", body: "Hail UnB" }, recipients: { profile_admins: "false", env_admins: "true" }
  172 + process_delayed_job_queue
  173 + end
  174 + end
  175 +
144 176 end
... ...
test/integration/safe_strings_test.rb
... ... @@ -2,6 +2,14 @@ require_relative &quot;../test_helper&quot;
2 2  
3 3 class SafeStringsTest < ActionDispatch::IntegrationTest
4 4  
  5 + def setup
  6 + @user = create_user('safestring', :password => 'test', :password_confirmation => 'test')
  7 + @user.activate
  8 + @person = user.person
  9 + end
  10 +
  11 + attr_accessor :user, :person
  12 +
5 13 should 'not escape link to admins on profile page' do
6 14 person = fast_create Person
7 15 community = fast_create Community
... ... @@ -135,4 +143,24 @@ class SafeStringsTest &lt; ActionDispatch::IntegrationTest
135 143 }
136 144 end
137 145  
  146 + should 'not escape block title when edit a block' do
  147 + class OtherBlock < Block
  148 + def self.description
  149 + _("<p class='other-block'>Other Block</p>")
  150 + end
  151 + end
  152 + login user.login, 'test'
  153 + block = OtherBlock.new
  154 + person.boxes.first.blocks << block
  155 + get url_for(action: :edit, controller: :profile_design, profile: person.identifier, id: block.id)
  156 + assert_select '.block-config-options .other-block'
  157 + end
  158 +
  159 + should 'not escape edit settings in highlight block' do
  160 + login user.login, 'test'
  161 + block = HighlightsBlock.new
  162 + person.boxes.first.blocks << block
  163 + get url_for(action: :edit, controller: :profile_design, profile: person.identifier, id: block.id)
  164 + assert_select '.block-config-options .image-data-line'
  165 + end
138 166 end
... ...
test/support/performance_helper.rb
... ... @@ -17,7 +17,7 @@ module PerformanceHelper
17 17 # On the travis/gitlab CI this can vary with servers' IO load, so
18 18 # we soften to avoid failures
19 19 #
20   - NON_LINEAR_FACTOR = unless ENV['CI'] then 1.8 else 1.0 end
  20 + NON_LINEAR_FACTOR = unless ENV['CI'] then 1.8 else 0 end
21 21  
22 22 end
23 23  
... ...
test/unit/article_test.rb
... ... @@ -1483,6 +1483,17 @@ class ArticleTest &lt; ActiveSupport::TestCase
1483 1483 assert_includes a.body_images_paths, 'http://test.com/noosfero.png'
1484 1484 end
1485 1485  
  1486 + should 'always put article image first in images paths list in article body' do
  1487 + Environment.any_instance.stubs(:default_hostname).returns('noosfero.org')
  1488 + a = create(TinyMceArticle, :name => 'test', :image_builder => {
  1489 + :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')
  1490 + }, :profile_id => @profile.id)
  1491 + a.save!
  1492 + a.body = 'Noosfero <img src="http://noosfero.com/test.png" /> test <img src="http://test.com/noosfero.png" />'
  1493 + a.image.stubs(:public_filename).returns('/files/rails.png')
  1494 + assert_equal 'http://noosfero.org/files/rails.png', a.body_images_paths[0]
  1495 + end
  1496 +
1486 1497 should 'escape utf8 characters correctly' do
1487 1498 Environment.any_instance.stubs(:default_hostname).returns('noosfero.org')
1488 1499 a = build TinyMceArticle, profile: @profile
... ...
test/unit/environment_mailing_test.rb
... ... @@ -82,6 +82,49 @@ class EnvironmentMailingTest &lt; ActiveSupport::TestCase
82 82 assert_equal [person_1], mailing.recipients(0, 1)
83 83 end
84 84  
  85 + should 'return all environment admins when recipients_roles is set to environment_administrator' do
  86 + environment.add_admin person_1
  87 +
  88 + mailing = create_mailing(environment, :locale => 'pt', :person => person_1)
  89 + mailing.recipients_roles = ["environment_administrator"]
  90 + mailing.save
  91 +
  92 + assert_equivalent(environment.admins, mailing.recipients)
  93 + end
  94 +
  95 + should 'return all people with role profile_admin when recipients_roles is set to profile_admin' do
  96 + environment.add_admin person_1
  97 +
  98 + mailing = create_mailing(environment, :locale => 'pt', :person => person_1)
  99 + mailing.recipients_roles = ["profile_admin"]
  100 + mailing.save
  101 + role = Role.find_by(key: 'profile_admin', environment_id: environment)
  102 + profile_admins = Person.by_role(role).where(environment_id: environment)
  103 +
  104 + assert_equivalent(profile_admins, mailing.recipients)
  105 + end
  106 +
  107 + should 'return all people when recipients_roles is not set' do
  108 + environment.add_admin person_1
  109 +
  110 + mailing = create_mailing(environment, :locale => 'pt', :person => person_1)
  111 + mailing.save
  112 +
  113 + assert_equivalent(environment.people, mailing.recipients)
  114 + end
  115 +
  116 + should 'return profile_admins and environment admins when both roles are set as recipients' do
  117 + environment.add_admin person_1
  118 +
  119 + mailing = create_mailing(environment, :locale => 'pt', :person => person_1)
  120 + mailing.recipients_roles = ["profile_admin", "environment_administrator"]
  121 + mailing.save
  122 + role = Role.find_by(key: 'profile_admin', environment_id: environment)
  123 + profile_admins = Person.by_role(role).where(environment_id: environment)
  124 +
  125 + assert_equivalent(profile_admins+environment.admins, mailing.recipients)
  126 + end
  127 +
85 128 should 'return true if already sent mailing to a recipient' do
86 129 mailing = create_mailing(environment, :person => person_1)
87 130 process_delayed_job_queue
... ...