2007-03-30 04:36:52 +00:00
|
|
|
module ProjectsHelper
|
|
|
|
|
|
|
|
|
|
def project_next_prev
|
2012-05-12 14:48:56 +02:00
|
|
|
html = ""
|
2012-07-18 11:42:26 +02:00
|
|
|
html << link_to_project(@previous_project, "« #{@previous_project.shortened_name}".html_safe) if @previous_project
|
2012-05-12 14:48:56 +02:00
|
|
|
html << " | " if @previous_project && @next_project
|
2012-07-18 11:42:26 +02:00
|
|
|
html << link_to_project(@next_project, "#{@next_project.shortened_name} »".html_safe) if @next_project
|
|
|
|
|
return html.html_safe
|
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
|
2011-02-09 20:41:34 +01:00
|
|
|
|
|
|
|
|
def link_to_delete_project(project, descriptor = sanitize(project.name))
|
|
|
|
|
link_to(
|
|
|
|
|
descriptor,
|
|
|
|
|
project_path(project, :format => 'js'),
|
|
|
|
|
{
|
|
|
|
|
:id => "delete_project_#{project.id}",
|
2012-01-27 10:55:39 +01:00
|
|
|
:class => "delete_project_button icon",
|
2011-02-09 20:41:34 +01:00
|
|
|
:x_confirm_message => t('projects.delete_project_confirmation', :name => project.name),
|
|
|
|
|
:title => t('projects.delete_project_title')
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
end
|
2011-05-01 12:48:32 +02:00
|
|
|
|
2012-03-21 18:09:20 +01:00
|
|
|
def link_to_edit_project (project, descriptor = sanitize(project.name))
|
2012-07-12 13:14:21 +02:00
|
|
|
link_to(descriptor, edit_project_path(project),
|
2012-03-21 18:09:20 +01:00
|
|
|
{
|
|
|
|
|
:id => "link_edit_#{dom_id(project)}",
|
|
|
|
|
:class => "project_edit_settings icon"
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
2012-04-19 15:31:18 +02:00
|
|
|
def project_summary(project)
|
2011-05-01 12:48:32 +02:00
|
|
|
project_description = ''
|
2012-04-12 12:47:25 +02:00
|
|
|
project_description += Tracks::Utils.render_text( project.description ) unless project.description.blank?
|
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
|
|
|
|
|
|
2007-03-30 04:36:52 +00:00
|
|
|
end
|