Revision 956:fa2a1b6cda26 app
| app/controllers/sys_controller.rb | ||
|---|---|---|
| 21 | 21 |
def projects |
| 22 | 22 |
p = Project.active.has_module(:repository).find(:all, :include => :repository, :order => 'identifier') |
| 23 | 23 |
# extra_info attribute from repository breaks activeresource client |
| 24 |
render :xml => p.to_xml(:only => [:id, :identifier, :name, :is_public, :status], :include => {:repository => {:only => [:id, :url]}})
|
|
| 24 |
render :xml => p.to_xml(:only => [:id, :identifier, :name, :is_public, :status], :include => {:repository => {:only => [:id, :url, :is_external, :external_url]}})
|
|
| 25 | 25 |
end |
| 26 | 26 |
|
| 27 | 27 |
def create_project_repository |
| app/helpers/application_helper.rb | ||
|---|---|---|
| 291 | 291 |
def principals_check_box_tags(name, principals) |
| 292 | 292 |
s = '' |
| 293 | 293 |
principals.sort.each do |principal| |
| 294 |
s << "<label>#{ check_box_tag name, principal.id, false } #{link_to_user principal}</label>\n"
|
|
| 294 |
|
|
| 295 |
if principal.type == "User": |
|
| 296 |
s << "<label>#{ check_box_tag name, principal.id, false } #{link_to_user principal}</label>\n"
|
|
| 297 |
else |
|
| 298 |
s << "<label>#{ check_box_tag name, principal.id, false } #{h principal} (Group)</label>\n"
|
|
| 299 |
end |
|
| 300 |
|
|
| 295 | 301 |
end |
| 296 | 302 |
s.html_safe |
| 297 | 303 |
end |
| app/models/mailer.rb | ||
|---|---|---|
| 32 | 32 |
{ :host => h, :protocol => Setting.protocol }
|
| 33 | 33 |
end |
| 34 | 34 |
|
| 35 |
# todo: luisf: 2Aug2012 - refactor... |
|
| 36 |
def added_to_project(member, project) |
|
| 37 |
principal = Principal.find(member.user_id) |
|
| 35 | 38 |
|
| 39 |
if principal.type == "User" |
|
| 40 |
user = User.find(member.user_id) |
|
| 41 |
user_add_to_project(user, project) |
|
| 42 |
else |
|
| 43 |
users = Principal.find(member.user_id).users |
|
| 44 |
users.map {|user| user_add_to_project(user, project) }
|
|
| 45 |
end |
|
| 46 |
end |
|
| 36 | 47 |
|
| 37 | 48 |
# Builds a tmail object used to email the specified user that he was added to a project |
| 38 | 49 |
# |
| 39 | 50 |
# Example: |
| 40 |
# add_to_project(user) => tmail object |
|
| 41 |
# Mailer.deliver_add_to_project(user) => sends an email to the registered user |
|
| 42 |
def added_to_project(member, project) |
|
| 43 |
|
|
| 44 |
user = User.find(member.user_id) |
|
| 45 |
|
|
| 51 |
# user_add_to_project(user, project) => tmail object |
|
| 52 |
# Mailer.deliver_add_to_project(user, project) => sends an email to the registered user |
|
| 53 |
def user_add_to_project(user, project) |
|
| 46 | 54 |
set_language_if_valid user.language |
| 47 | 55 |
recipients user.mail |
| 48 | 56 |
subject l(:mail_subject_added_to_project, Setting.app_title) |
| ... | ... | |
| 50 | 58 |
:project_name => project.name |
| 51 | 59 |
render_multipart('added_to_project', body)
|
| 52 | 60 |
end |
| 53 |
|
|
| 54 |
|
|
| 55 | 61 |
|
| 56 | 62 |
# Builds a tmail object used to email recipients of the added issue. |
| 57 | 63 |
# |
Also available in: Unified diff