Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Set @project so macros will work on the welcome and project list. #5781

Contributed by Holger Just

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3824 e93f8b46-1217-0410-a6f0-8f06a7374b81
  • Loading branch information...
commit 64d2221db526f695919eb9aba370e22ed3dc09f8 1 parent 43bbda1
@edavis10 edavis10 authored
Showing with 6 additions and 0 deletions.
  1. +4 −0 app/helpers/projects_helper.rb
  2. +2 −0  app/views/welcome/index.rhtml
View
4 app/helpers/projects_helper.rb
@@ -56,7 +56,10 @@ def render_project_hierarchy(projects)
s = ''
if projects.any?
ancestors = []
+ original_project = @project
projects.each do |project|
+ # set the project environment to please macros.
+ @project = project
if (ancestors.empty? || project.is_descendant_of?(ancestors.last))
s << "<ul class='projects #{ ancestors.empty? ? 'root' : nil}'>\n"
else
@@ -75,6 +78,7 @@ def render_project_hierarchy(projects)
ancestors << project
end
s << ("</li></ul>\n" * ancestors.size)
+ @project = original_project
end
s
end
View
2  app/views/welcome/index.rhtml
@@ -18,11 +18,13 @@
<h3><%=l(:label_project_latest)%></h3>
<ul>
<% for project in @projects %>
+ <% @project = project %>
<li>
<%= link_to h(project.name), :controller => 'projects', :action => 'show', :id => project %> (<%= format_time(project.created_on) %>)
<%= textilizable project.short_description, :project => project %>
</li>
<% end %>
+ <% @project = nil %>
</ul>
</div>
<% end %>
Please sign in to comment.
Something went wrong with that request. Please try again.