]> source.dussan.org Git - redmine.git/commitdiff
Set @project so macros will work on the welcome and project list. #5781
authorEric Davis <edavis@littlestreamsoftware.com>
Wed, 30 Jun 2010 03:32:18 +0000 (03:32 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Wed, 30 Jun 2010 03:32:18 +0000 (03:32 +0000)
Contributed by Holger Just

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3824 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/projects_helper.rb
app/views/welcome/index.rhtml

index e3a020818bdfbaacbfefa36129b29f5929db4f27..044ccfb77369231adc387eb088c73e4371149fff 100644 (file)
@@ -56,7 +56,10 @@ module ProjectsHelper
     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 @@ module ProjectsHelper
         ancestors << project
       end
       s << ("</li></ul>\n" * ancestors.size)
+      @project = original_project
     end
     s
   end
index 279c3542165623fb0fb1320a88216f921639ae17..a0ada7ccea0d1e319e1debc4979642713468ef06 100644 (file)
        <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 %>