2012-01-30 20:39:34 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
2011-03-10 11:35:46 +00:00
|
|
|
module ProjectsHelper
|
2011-11-22 18:58:23 +00:00
|
|
|
def git_repo_url(name)
|
|
|
|
if current_user
|
2012-03-31 17:36:32 +01:00
|
|
|
"#{request.protocol}#{current_user.uname}@#{request.host_with_port}/#{name}.git"
|
2011-11-10 09:04:24 +00:00
|
|
|
else
|
2012-03-31 17:36:32 +01:00
|
|
|
"#{request.protocol}#{request.host_with_port}/#{name}.git"
|
2011-11-10 09:04:24 +00:00
|
|
|
end
|
2011-10-26 21:57:51 +01:00
|
|
|
end
|
2012-02-29 14:45:04 +00:00
|
|
|
|
|
|
|
def options_for_collaborators_roles_select
|
|
|
|
options_for_select(
|
|
|
|
Relation::ROLES.collect { |role|
|
|
|
|
[t("layout.collaborators.role_names.#{ role }"), role]
|
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
2012-03-07 21:34:49 +00:00
|
|
|
|
|
|
|
def visibility_icon(visibility)
|
|
|
|
visibility == 'open' ? 'unlock.png' : 'lock.png'
|
|
|
|
end
|
2012-03-29 17:27:33 +01:00
|
|
|
|
|
|
|
def participant_class(alone_member, project)
|
|
|
|
c = alone_member ? 'user' : 'group'
|
|
|
|
c = 'user_owner' if project.owner == current_user
|
|
|
|
c = 'group_owner' if project.owner.in? current_user.groups
|
|
|
|
return c
|
|
|
|
end
|
|
|
|
|
|
|
|
def alone_member?(project)
|
2012-03-30 15:51:57 +01:00
|
|
|
Relation.by_target(project).by_object(current_user).size > 0
|
2012-03-29 17:27:33 +01:00
|
|
|
end
|
2012-04-09 18:11:39 +01:00
|
|
|
|
|
|
|
def participant_path(participant)
|
|
|
|
participant.kind_of?(User) ? user_path(participant) : group_path(participant)
|
|
|
|
end
|
2011-03-10 11:35:46 +00:00
|
|
|
end
|