2007-03-30 04:36:52 +00:00
|
|
|
module ProjectsHelper
|
|
|
|
|
|
2013-03-05 14:04:01 +01:00
|
|
|
def show_project_name(project)
|
|
|
|
|
if source_view_is :project
|
|
|
|
|
content_tag(:span, :id => "project_name"){project.name}
|
|
|
|
|
else
|
|
|
|
|
link_to_project( project )
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def show_project_settings(project)
|
|
|
|
|
content_tag(:div, :id => dom_id(project, "container"), :class=>"list") do
|
|
|
|
|
render :partial => "projects/project_settings", :object => project
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2007-03-30 04:36:52 +00:00
|
|
|
def project_next_prev
|
2013-03-10 20:38:10 +01:00
|
|
|
content_tag(:div, :id=>"project-next-prev") do
|
|
|
|
|
html = ""
|
|
|
|
|
html << link_to_project(@previous_project, "« #{@previous_project.shortened_name}".html_safe) if @previous_project
|
|
|
|
|
html << " | " if @previous_project && @next_project
|
|
|
|
|
html << link_to_project(@next_project, "#{@next_project.shortened_name} »".html_safe) if @next_project
|
|
|
|
|
html.html_safe
|
|
|
|
|
end
|
2007-03-30 04:36:52 +00:00
|
|
|
end
|
2011-09-28 13:54:50 +02:00
|
|
|
|
2008-04-19 19:15:07 +00:00
|
|
|
def project_next_prev_mobile
|
2012-05-12 13:37:36 +02:00
|
|
|
prev_project,next_project= "", ""
|
2012-07-18 11:42:26 +02:00
|
|
|
prev_project = content_tag(:li, link_to_project_mobile(@previous_project, "5", @previous_project.shortened_name), :class=>"prev") if @previous_project
|
|
|
|
|
next_project = content_tag(:li, link_to_project_mobile(@next_project, "6", @next_project.shortened_name), :class=>"next") if @next_project
|
|
|
|
|
return content_tag(:ul, "#{prev_project}#{next_project}".html_safe, :class=>"next-prev-project")
|
2008-04-19 19:15:07 +00:00
|
|
|
end
|
2013-09-13 15:40:09 +03:00
|
|
|
|
2012-04-19 15:31:18 +02:00
|
|
|
def project_summary(project)
|
2011-05-01 12:48:32 +02:00
|
|
|
project_description = ''
|
2013-09-13 15:40:09 +03:00
|
|
|
project_description += Tracks::Utils.render_text( project.description ) if project.description.present?
|
2011-09-28 13:54:50 +02:00
|
|
|
project_description += content_tag(:p,
|
2012-04-20 14:38:00 +02:00
|
|
|
"#{count_undone_todos_phrase(p)}. #{t('projects.project_state', :state => project.state)}".html_safe
|
2011-05-01 12:48:32 +02:00
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
|
2011-09-15 20:52:24 -04:00
|
|
|
def needsreview_class(item)
|
2011-09-16 23:34:09 -04:00
|
|
|
raise "item must be a Project " unless item.kind_of? Project
|
2011-09-28 13:54:50 +02:00
|
|
|
return item.needs_review?(current_user) ? "needsreview" : "needsnoreview"
|
2011-09-15 20:52:24 -04:00
|
|
|
end
|
|
|
|
|
|
2013-05-05 20:32:32 +02:00
|
|
|
def link_to_delete_project(project, descriptor = sanitize(project.name))
|
|
|
|
|
link_to_delete(:project, project, descriptor)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def link_to_edit_project (project, descriptor = sanitize(project.name))
|
|
|
|
|
link_to_edit(:project, project, descriptor)
|
|
|
|
|
end
|
|
|
|
|
|
2007-03-30 04:36:52 +00:00
|
|
|
end
|