Commit 5ad448c9010408290427edd17b22accece2b4009

Authored by Daniela Feitosa
1 parent 1009c905

Some enhancements to StoaPlugin

- Translating README file to English
- Added config.yml.dist as example
app/views/account/_signup_form.rhtml
... ... @@ -73,8 +73,6 @@
73 73 <%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %>
74 74 <% end %>
75 75  
76   -
77   -
78 76 <%= @plugins.dispatch(:signup_extra_contents).collect { |content| instance_eval(&content) }.join("") %>
79 77  
80 78 <% unless @terms_of_use.blank? %>
... ...
app/views/friends/index.rhtml
... ... @@ -4,17 +4,17 @@
4 4  
5 5 <% cache_timeout(profile.manage_friends_cache_key(params), 4.hours) do %>
6 6 <% if @friends.empty? %>
7   - <p>
8   - <em>
9   - <%= __('You have no friends yet.') %>
10   - <%= link_to _('Do you want to see other people in this environment?'), :controller => 'search', :action => 'assets', :asset => 'people' %>
11   - </em>
12   - </p>
  7 + <p>
  8 + <em>
  9 + <%= __('You have no friends yet.') %>
  10 + <%= link_to _('Do you want to see other people in this environment?'), :controller => 'search', :action => 'assets', :asset => 'people' %>
  11 + </em>
  12 + </p>
13 13 <% else %>
14 14 <% button_bar do %>
15 15 <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %>
16 16 <%= button(:search, _('Find people'), :controller => 'search', :action => 'assets', :asset => 'people') %>
17   - <% if !@plugins.dispatch(:remove_invite_friends_button).include?(true) %>
  17 + <% unless @plugins.dispatch(:remove_invite_friends_button).include?(true) %>
18 18 <%= button(:search, _('Invite people from my e-mail contacts'), :controller => 'invite', :action => 'select_address_book') %>
19 19 <% end %>
20 20 <% end %>
... ... @@ -45,7 +45,7 @@
45 45 <% button_bar do %>
46 46 <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %>
47 47 <%= button(:search, _('Find people'), :controller => 'search', :action => 'assets', :asset => 'people') %>
48   - <% if !@plugins.dispatch(:remove_invite_friends_button).include?(true) %>
  48 + <% unless @plugins.dispatch(:remove_invite_friends_button).include?(true) %>
49 49 <%= button(:search, _('Invite people from my e-mail contacts'), :controller => 'invite', :action => 'select_address_book') %>
50 50 <% end %>
51 51 <% end %>
... ...
app/views/invite/select_friends.rhtml
... ... @@ -20,7 +20,7 @@
20 20 <%= hidden_field_tag(:contact_list, @contact_list.id) %>
21 21  
22 22 <div>
23   - <%= labelled_form_field(_('Enter one e-mail address per line:'), text_area_tag(:manual_import_addresses, (@manual_import_addresses || ''), :cols => 72, :rows => 5)) %>
  23 + <%= labelled_form_field(_('Enter one e-mail address per line:'), text_area_tag(:manual_import_addresses, (@manual_import_addresses || ''), :rows => 5, :style => 'width: 98%;')) %>
24 24 </div>
25 25 <% if @import_from != 'manual' %>
26 26 <div>
... ...
lib/noosfero/plugin.rb
... ... @@ -99,7 +99,7 @@ class Noosfero::Plugin
99 99 # returns = { :title => title, :id => id, :content => content, :start => start }
100 100 # title = name that will be displayed.
101 101 # id = div id.
102   - # content = lambda block that creates a html code.
  102 + # content = lambda block that creates html code.
103 103 # start = boolean that specifies if the tab must come before noosfero tabs (optional).
104 104 def profile_tabs
105 105 nil
... ... @@ -112,7 +112,7 @@ class Noosfero::Plugin
112 112 end
113 113  
114 114 # -> Adds content to calalog item
115   - # returns = lambda block that creates a html code
  115 + # returns = lambda block that creates html code
116 116 def catalog_item_extras(item)
117 117 nil
118 118 end
... ... @@ -124,19 +124,19 @@ class Noosfero::Plugin
124 124 end
125 125  
126 126 # -> Adds content to calalog list item
127   - # returns = lambda block that creates a html code
  127 + # returns = lambda block that creates html code
128 128 def catalog_list_item_extras(item)
129 129 nil
130 130 end
131 131  
132 132 # -> Adds content to products info
133   - # returns = lambda block that creates a html code
  133 + # returns = lambda block that creates html code
134 134 def product_info_extras(product)
135 135 nil
136 136 end
137 137  
138 138 # -> Adds content to products on asset list
139   - # returns = lambda block that creates a html code
  139 + # returns = lambda block that creates html code
140 140 def asset_product_extras(product, enterprise)
141 141 nil
142 142 end
... ... @@ -239,13 +239,13 @@ class Noosfero::Plugin
239 239 end
240 240  
241 241 # -> Adds fields to the signup form
242   - # returns = lambda block that creates a html code
  242 + # returns = lambda block that creates html code
243 243 def signup_extra_contents
244 244 nil
245 245 end
246 246  
247 247 # -> Adds adicional content to profile info
248   - # returns = lambda block that creates a html code
  248 + # returns = lambda block that creates html code
249 249 def profile_info_extra_contents
250 250 nil
251 251 end
... ...
plugins/stoa/README
1   -Banco de Dados
2   -==============
  1 +README - Stoa (Stoa Plugin)
  2 +================================
  3 +
  4 +Plugin that includes features to Stoa, USP's social network
  5 +
  6 +More informartion about Stoa: http://wiki.stoa.usp.br/Stoa:Sobre
  7 +
  8 +DATABASE
  9 +========
  10 +
  11 +First you need to configure Noosfero to connect with the database users from USP.
  12 +For that, add a section setting the connection on file config/database.yml with the the identifier "stoa".
  13 +
  14 +Example:
  15 +--------
3 16  
4   -É preciso adicionar uma seção definindo a conexão com o banco de usuários da USP, no arquivo config/database.yml com identificador stoa.
5   -``
6 17 stoa:
7 18 adapter: mysql
8 19 host: db2.stoa.usp.br
9 20 database: usp
10 21 username: <usuario>
11 22 password: <senha>
12   -``
  23 +
  24 +CONFIGURATION
  25 +=============
  26 +
  27 +Copy config.yml.dist to config.yml on Stoa plugin's folder.
  28 +You need to customize this configuration, adding a Salt ( http://en.wikipedia.org/wiki/Salt_(cryptography) ).
... ...
plugins/stoa/config.yml.dist 0 → 100644
... ... @@ -0,0 +1 @@
  1 +salt: '123456789'
... ...
plugins/stoa/lib/ext/person.rb
... ... @@ -7,7 +7,7 @@ class Person
7 7  
8 8 def usp_id_or_invitation
9 9 if usp_id.blank? && (invitation_code.blank? || !invitation_task)
10   - errors.add(:usp_id, "can't register without usp_id or invitation")
  10 + errors.add(:usp_id, "can't register without usp_id or a valid invitation code")
11 11 end
12 12 end
13 13  
... ...
plugins/stoa/lib/stoa_plugin/usp_user.rb
... ... @@ -9,11 +9,11 @@ class StoaPlugin::UspUser &lt; ActiveRecord::Base
9 9 alias_attribute :birth_date, :dtanas
10 10  
11 11 def self.exists?(usp_id)
12   - !StoaPlugin::UspUser.find(:first, :conditions => {:codpes => usp_id.to_i}).nil?
  12 + StoaPlugin::UspUser.find_by_codpes(usp_id.to_i)
13 13 end
14 14  
15 15 def self.matches?(usp_id, field, value)
16   - user = StoaPlugin::UspUser.find(:first, :conditions => {:codpes => usp_id.to_i})
  16 + user = StoaPlugin::UspUser.find_by_codpes(usp_id.to_i)
17 17 return false if user.nil? || !user.respond_to?(field) || value.blank?
18 18 case field.to_sym
19 19 when :cpf
... ...
public/stylesheets/application.css
... ... @@ -6548,7 +6548,6 @@ h1#agenda-title {
6548 6548 #signup-form #user_password,
6549 6549 #signup-form #user_password_confirmation,
6550 6550 #signup-form .filled-in,
6551   -#signup-form .passwords_match,
6552 6551 #signup-form .invalid,
6553 6552 #signup-form .checking {
6554 6553 border-width: 2px;
... ...