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,8 +73,6 @@
73 <%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %> 73 <%= render :partial => 'profile_editor/person_form', :locals => {:f => f} %>
74 <% end %> 74 <% end %>
75 75
76 -  
77 -  
78 <%= @plugins.dispatch(:signup_extra_contents).collect { |content| instance_eval(&content) }.join("") %> 76 <%= @plugins.dispatch(:signup_extra_contents).collect { |content| instance_eval(&content) }.join("") %>
79 77
80 <% unless @terms_of_use.blank? %> 78 <% unless @terms_of_use.blank? %>
app/views/friends/index.rhtml
@@ -4,17 +4,17 @@ @@ -4,17 +4,17 @@
4 4
5 <% cache_timeout(profile.manage_friends_cache_key(params), 4.hours) do %> 5 <% cache_timeout(profile.manage_friends_cache_key(params), 4.hours) do %>
6 <% if @friends.empty? %> 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 <% else %> 13 <% else %>
14 <% button_bar do %> 14 <% button_bar do %>
15 <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> 15 <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %>
16 <%= button(:search, _('Find people'), :controller => 'search', :action => 'assets', :asset => 'people') %> 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 <%= button(:search, _('Invite people from my e-mail contacts'), :controller => 'invite', :action => 'select_address_book') %> 18 <%= button(:search, _('Invite people from my e-mail contacts'), :controller => 'invite', :action => 'select_address_book') %>
19 <% end %> 19 <% end %>
20 <% end %> 20 <% end %>
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 <% button_bar do %> 45 <% button_bar do %>
46 <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> 46 <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %>
47 <%= button(:search, _('Find people'), :controller => 'search', :action => 'assets', :asset => 'people') %> 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 <%= button(:search, _('Invite people from my e-mail contacts'), :controller => 'invite', :action => 'select_address_book') %> 49 <%= button(:search, _('Invite people from my e-mail contacts'), :controller => 'invite', :action => 'select_address_book') %>
50 <% end %> 50 <% end %>
51 <% end %> 51 <% end %>
app/views/invite/select_friends.rhtml
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 <%= hidden_field_tag(:contact_list, @contact_list.id) %> 20 <%= hidden_field_tag(:contact_list, @contact_list.id) %>
21 21
22 <div> 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 </div> 24 </div>
25 <% if @import_from != 'manual' %> 25 <% if @import_from != 'manual' %>
26 <div> 26 <div>
lib/noosfero/plugin.rb
@@ -99,7 +99,7 @@ class Noosfero::Plugin @@ -99,7 +99,7 @@ class Noosfero::Plugin
99 # returns = { :title => title, :id => id, :content => content, :start => start } 99 # returns = { :title => title, :id => id, :content => content, :start => start }
100 # title = name that will be displayed. 100 # title = name that will be displayed.
101 # id = div id. 101 # id = div id.
102 - # content = lambda block that creates a html code. 102 + # content = lambda block that creates html code.
103 # start = boolean that specifies if the tab must come before noosfero tabs (optional). 103 # start = boolean that specifies if the tab must come before noosfero tabs (optional).
104 def profile_tabs 104 def profile_tabs
105 nil 105 nil
@@ -112,7 +112,7 @@ class Noosfero::Plugin @@ -112,7 +112,7 @@ class Noosfero::Plugin
112 end 112 end
113 113
114 # -> Adds content to calalog item 114 # -> Adds content to calalog item
115 - # returns = lambda block that creates a html code 115 + # returns = lambda block that creates html code
116 def catalog_item_extras(item) 116 def catalog_item_extras(item)
117 nil 117 nil
118 end 118 end
@@ -124,19 +124,19 @@ class Noosfero::Plugin @@ -124,19 +124,19 @@ class Noosfero::Plugin
124 end 124 end
125 125
126 # -> Adds content to calalog list item 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 def catalog_list_item_extras(item) 128 def catalog_list_item_extras(item)
129 nil 129 nil
130 end 130 end
131 131
132 # -> Adds content to products info 132 # -> Adds content to products info
133 - # returns = lambda block that creates a html code 133 + # returns = lambda block that creates html code
134 def product_info_extras(product) 134 def product_info_extras(product)
135 nil 135 nil
136 end 136 end
137 137
138 # -> Adds content to products on asset list 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 def asset_product_extras(product, enterprise) 140 def asset_product_extras(product, enterprise)
141 nil 141 nil
142 end 142 end
@@ -239,13 +239,13 @@ class Noosfero::Plugin @@ -239,13 +239,13 @@ class Noosfero::Plugin
239 end 239 end
240 240
241 # -> Adds fields to the signup form 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 def signup_extra_contents 243 def signup_extra_contents
244 nil 244 nil
245 end 245 end
246 246
247 # -> Adds adicional content to profile info 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 def profile_info_extra_contents 249 def profile_info_extra_contents
250 nil 250 nil
251 end 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 stoa: 17 stoa:
7 adapter: mysql 18 adapter: mysql
8 host: db2.stoa.usp.br 19 host: db2.stoa.usp.br
9 database: usp 20 database: usp
10 username: <usuario> 21 username: <usuario>
11 password: <senha> 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 @@ @@ -0,0 +1 @@
  1 +salt: '123456789'
plugins/stoa/lib/ext/person.rb
@@ -7,7 +7,7 @@ class Person @@ -7,7 +7,7 @@ class Person
7 7
8 def usp_id_or_invitation 8 def usp_id_or_invitation
9 if usp_id.blank? && (invitation_code.blank? || !invitation_task) 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 end 11 end
12 end 12 end
13 13
plugins/stoa/lib/stoa_plugin/usp_user.rb
@@ -9,11 +9,11 @@ class StoaPlugin::UspUser &lt; ActiveRecord::Base @@ -9,11 +9,11 @@ class StoaPlugin::UspUser &lt; ActiveRecord::Base
9 alias_attribute :birth_date, :dtanas 9 alias_attribute :birth_date, :dtanas
10 10
11 def self.exists?(usp_id) 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 end 13 end
14 14
15 def self.matches?(usp_id, field, value) 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 return false if user.nil? || !user.respond_to?(field) || value.blank? 17 return false if user.nil? || !user.respond_to?(field) || value.blank?
18 case field.to_sym 18 case field.to_sym
19 when :cpf 19 when :cpf
public/stylesheets/application.css
@@ -6548,7 +6548,6 @@ h1#agenda-title { @@ -6548,7 +6548,6 @@ h1#agenda-title {
6548 #signup-form #user_password, 6548 #signup-form #user_password,
6549 #signup-form #user_password_confirmation, 6549 #signup-form #user_password_confirmation,
6550 #signup-form .filled-in, 6550 #signup-form .filled-in,
6551 -#signup-form .passwords_match,  
6552 #signup-form .invalid, 6551 #signup-form .invalid,
6553 #signup-form .checking { 6552 #signup-form .checking {
6554 border-width: 2px; 6553 border-width: 2px;