Commit cbd744979ec558beac1f0b8002d195f6363c898d

Authored by Antonio Terceiro
2 parents d818aa8e cb62ddad

Merge branch 'master' into next

app/models/block.rb
... ... @@ -23,7 +23,7 @@ class Block < ActiveRecord::Base
23 23 end
24 24  
25 25 def get_limit
26   - [0,limit].max
  26 + [0,limit.to_i].max
27 27 end
28 28  
29 29 def embed_code
... ...
app/models/highlights_block.rb
... ... @@ -26,8 +26,16 @@ class HighlightsBlock < Block
26 26 end
27 27  
28 28 def featured_images
29   - block_images = images.select{|i| !i[:image_src].nil? }.sort { |x, y| x[:position] <=> y[:position] }
30   - shuffle ? block_images.shuffle : block_images
  29 + images = get_images
  30 + shuffle ? images.shuffle : images
  31 + end
  32 +
  33 + def get_images
  34 + images.select do |i|
  35 + !i[:image_src].nil?
  36 + end.sort do |x, y|
  37 + x[:position] <=> y[:position]
  38 + end
31 39 end
32 40  
33 41 def content(args={})
... ...
app/views/user_mailer/profiles_suggestions_email.html.erb
... ... @@ -10,8 +10,8 @@
10 10 <% @people_suggestions.each do |person| %>
11 11 <li><a href="<%= url_for(person.public_profile_url) %>"><%= person.name %></a></li>
12 12 <% end %>
13   - <ul>
14   - <%= _("To see the full list of friends suggestions, follow the link: %s") % @people_suggestions_url %>
  13 + </ul>
  14 + <%= _("To see the full list of friends suggestions, follow the link: %s") % url_for(@people_suggestions_url) %>
15 15 <% end %>
16 16  
17 17 <% unless @communities_suggestions.empty? %>
... ... @@ -21,13 +21,15 @@
21 21 <% @communities_suggestions.each do |community| %>
22 22 <li><a href="<%= url_for(community.public_profile_url) %>"><%= community.name %></a></li>
23 23 <% end %>
24   - <ul>
25   - <%= _("To see the full list of communities suggestions, follow the link: %s") % @communities_suggestions_url %>
  24 + </ul>
  25 + <%= _("To see the full list of communities suggestions, follow the link: %s") % url_for(@communities_suggestions_url) %>
26 26 <% end %>
27 27  
28 28  
29 29 <%= _("Greetings,") %>
30 30  
31   ---
32   -<%= _('%s team.') % @environment %>
  31 +<p><%= _("Greetings,") %></p>
  32 +
  33 +--<br/>
  34 +<%= _('%s team.') % @environment %><br/>
33 35 <%= @url %>
... ...
features/signup.feature
... ... @@ -267,32 +267,6 @@ Feature: signup
267 267 Then I should be on the homepage
268 268  
269 269 @selenium
270   - Scenario: join community on signup
271   - Given the following users
272   - | login | name |
273   - | mariasilva | Maria Silva |
274   - And the following communities
275   - | name | identifier | owner |
276   - | Free Software | freesoftware | mariasilva |
277   - And feature "skip_new_user_email_confirmation" is disabled on environment
278   - And I am on /freesoftware
279   - When I follow "Join"
280   - And I follow "New user"
281   - And I fill in the following within ".no-boxes":
282   - | e-Mail | josesilva@example.com |
283   - | Username | josesilva |
284   - | Password | secret |
285   - | Password confirmation | secret |
286   - | Full name | José da Silva |
287   - And wait for the captcha signup time
288   - And I press "Create my account"
289   - And I go to josesilva's confirmation URL
290   - And I fill in "Username" with "josesilva"
291   - And I fill in "Password" with "secret"
292   - And I press "Log in"
293   - Then "José da Silva" should be a member of "Free Software"
294   -
295   - @selenium
296 270 Scenario: user registration is moderated by admin
297 271 Given feature "admin_must_approve_new_users" is enabled on environment
298 272 And feature "skip_new_user_email_confirmation" is disabled on environment
... ...
plugins/event/po/pt/event.po
... ... @@ -5,8 +5,8 @@
5 5 #
6 6 msgid ""
7 7 msgstr ""
8   -"Project-Id-Version: 1.0-690-gcb6e853\n"
9   -"POT-Creation-Date: 2015-03-05 12:09-0300\n"
  8 +"Project-Id-Version: 1.1~rc4\n"
  9 +"POT-Creation-Date: 2015-04-20 19:44-0300\n"
10 10 "PO-Revision-Date: 2015-01-30 00:18-0000\n"
11 11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 12 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -16,61 +16,53 @@ msgstr &quot;&quot;
16 16 "Content-Transfer-Encoding: 8bit\n"
17 17 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
18 18  
  19 +#: plugins/event/lib/event_plugin.rb:4
  20 +msgid "Event Extras"
  21 +msgstr "Extras para Eventos"
  22 +
  23 +#: plugins/event/lib/event_plugin.rb:8
  24 +msgid ""
  25 +"Include a new block to show the environment's or profiles' events information"
  26 +msgstr ""
  27 +"Adiciona um novo bloco para apresentar as informações de eventos do ambiente "
  28 +"ou dos perfis"
  29 +
19 30 #: plugins/event/lib/event_plugin/event_block.rb:12
20 31 msgid "Events"
21 32 msgstr "Eventos"
22 33  
23 34 #: plugins/event/lib/event_plugin/event_block.rb:16
24 35 msgid "Show the profile events or all environment events."
25   -msgstr "Mostrar todos os eventos."
  36 +msgstr "Mostra todos os eventos de um perfil ou do ambiente."
26 37  
27 38 #: plugins/event/lib/event_plugin/event_block.rb:65
28   -#, fuzzy
29 39 msgid "One month ago"
30 40 msgid_plural "%d months ago"
31   -msgstr[0] "Iniciou a um mês atrás."
32   -msgstr[1] "Iniciou a %d meses atrás."
  41 +msgstr[0] "Um mês atrás"
  42 +msgstr[1] "%d meses atrás."
33 43  
34 44 #: plugins/event/lib/event_plugin/event_block.rb:67
35 45 msgid "Yesterday"
36 46 msgid_plural "%d days ago"
37   -msgstr[0] ""
38   -msgstr[1] ""
  47 +msgstr[0] "Ontem"
  48 +msgstr[1] "%d dias atrás"
39 49  
40 50 #: plugins/event/lib/event_plugin/event_block.rb:69
41 51 msgid "Today"
42   -msgstr ""
  52 +msgstr "Hoje"
43 53  
44 54 #: plugins/event/lib/event_plugin/event_block.rb:71
45 55 msgid "Tomorrow"
46 56 msgid_plural "%d days left to start"
47   -msgstr[0] ""
48   -msgstr[1] ""
  57 +msgstr[0] "Amanhã"
  58 +msgstr[1] "%d dias para começar"
49 59  
50 60 #: plugins/event/lib/event_plugin/event_block.rb:73
51   -#, fuzzy
52 61 msgid "One month left to start"
53 62 msgid_plural "%d months left to start"
54 63 msgstr[0] "Um mês para iniciar"
55 64 msgstr[1] "% meses para iniciar"
56 65  
57   -#: plugins/event/lib/event_plugin.rb:4
58   -msgid "Event Extras"
59   -msgstr "Eventos"
60   -
61   -#: plugins/event/lib/event_plugin.rb:8
62   -msgid ""
63   -"Include a new block to show the environment's or profiles' events information"
64   -msgstr ""
65   -"Adiciona um novo bloco para apresentar as informações de eventos do ambiente "
66   -"ou de perfis"
67   -
68   -#: plugins/event/views/event_plugin/event_block_item.html.erb:6
69   -msgid "Duration: 1 day"
70   -msgid_plural "Duration: %s days"
71   -msgstr[0] ""
72   -msgstr[1] ""
73   -
74 66 #: plugins/event/views/profile_design/event_plugin/_event_block.html.erb:1
75 67 msgid "Limit of items"
76 68 msgstr "Limite de itens"
... ... @@ -94,12 +86,17 @@ msgstr &quot;Mostrar apenas eventos futuros&quot;
94 86  
95 87 #: plugins/event/views/profile_design/event_plugin/_event_block.html.erb:22
96 88 msgid "Limit of days to display"
97   -msgstr "Limite de dias de distância para mostrar eventos"
  89 +msgstr "Limite de dias para mostrar"
98 90  
99 91 #: plugins/event/views/profile_design/event_plugin/_event_block.html.erb:24
100   -#, fuzzy
101 92 msgid "Only show events in this interval of days."
102   -msgstr "Mostar somente eventos que acontecem dentro do limite de dias"
  93 +msgstr "Mostar somente os eventos nesse intervalo de dias"
  94 +
  95 +#: plugins/event/views/event_plugin/event_block_item.html.erb:6
  96 +msgid "Duration: 1 day"
  97 +msgid_plural "Duration: %s days"
  98 +msgstr[0] "Duração: 1 dia"
  99 +msgstr[1] "Duração: %s dias"
103 100  
104 101 #~ msgid "Started one day ago."
105 102 #~ msgid_plural "Started %d days ago."
... ...
script/production
... ... @@ -85,7 +85,7 @@ environments_loop() {
85 85 }
86 86  
87 87 do_running() {
88   - pids=$(sed "s/.*/& /" tmp/pids/thin.*.pid | tr -d '\n' 2>/dev/null || true)
  88 + pids=$(sed "s/.*/& /" tmp/pids/thin.*.pid 2>/dev/null | tr -d '\n')
89 89 # passes if any of $pids exist, fails otherwise
90 90 kill -0 $pids > /dev/null 2>&1
91 91 }
... ...
test/unit/block_test.rb
... ... @@ -330,4 +330,11 @@ class BlockTest &lt; ActiveSupport::TestCase
330 330 block.save!
331 331 assert !block.display_to_user?(person_friend)
332 332 end
  333 +
  334 + should 'get limit as a number when limit is string' do
  335 + block = RecentDocumentsBlock.new
  336 + block.settings[:limit] = '5'
  337 + assert block.get_limit.is_a?(Fixnum)
  338 + end
  339 +
333 340 end
... ...
test/unit/highlights_block_test.rb
... ... @@ -109,33 +109,14 @@ class HighlightsBlockTest &lt; ActiveSupport::TestCase
109 109 end
110 110  
111 111 should 'list images randomically' do
112   - f1 = mock()
113   - f1.expects(:public_filename).returns('address')
114   - UploadedFile.expects(:find).with(1).returns(f1)
115   - f2 = mock()
116   - f2.expects(:public_filename).returns('address')
117   - UploadedFile.expects(:find).with(2).returns(f2)
118   - f3 = mock()
119   - f3.expects(:public_filename).returns('address')
120   - UploadedFile.expects(:find).with(3).returns(f3)
121   - f4 = mock()
122   - f4.expects(:public_filename).returns('address')
123   - UploadedFile.expects(:find).with(4).returns(f4)
124   - f5 = mock()
125   - f5.expects(:public_filename).returns('address')
126   - UploadedFile.expects(:find).with(5).returns(f5)
127 112 block = HighlightsBlock.new
128   - i1 = {:image_id => 1, :address => '/address', :position => 3, :title => 'address'}
129   - i2 = {:image_id => 2, :address => '/address', :position => 1, :title => 'address'}
130   - i3 = {:image_id => 3, :address => '/address', :position => 2, :title => 'address'}
131   - i4 = {:image_id => 4, :address => '/address', :position => 5, :title => 'address'}
132   - i5 = {:image_id => 5, :address => '/address', :position => 4, :title => 'address'}
133   - block.images = [i1,i2,i3,i4,i5]
134 113 block.shuffle = true
135   - block.save!
136   - block.reload
137   - assert_equal [i1,i2,i3,i4,i5], block.images
138   - assert_not_equal [i2,i3,i1,i4,i5], block.featured_images
  114 +
  115 + images = []
  116 + block.expects(:get_images).returns(images)
  117 + images.expects(:shuffle).returns(images)
  118 +
  119 + block.featured_images
139 120 end
140 121  
141 122 [Environment, Profile].each do |klass|
... ...
test/unit/user_mailer_test.rb
... ... @@ -18,6 +18,14 @@ class UserMailerTest &lt; ActiveSupport::TestCase
18 18 end
19 19 end
20 20  
  21 + should 'deliver profiles suggestions email' do
  22 + person = create_user('some-user').person
  23 + ProfileSuggestion.create!(:person => person, :suggestion =>
  24 +fast_create(Person))
  25 + email = UserMailer.profiles_suggestions_email(person).deliver
  26 + assert_match /profile\/some-user\/friends\/suggest/, email.body.to_s
  27 + end
  28 +
21 29 private
22 30  
23 31 def read_fixture(action)
... ...