include RepositoriesHelper
include ProjectsHelper
- def index
- list
- render :action => 'list' unless request.xhr?
- end
-
# Lists visible projects
- def list
+ def index
projects = Project.find :all,
:conditions => Project.visible_by(User.current),
:include => :parent
--- /dev/null
+<div class="contextual">
+ <%= link_to l(:label_issue_view_all), { :controller => 'issues' } %> |
+ <%= link_to l(:label_overall_activity), { :controller => 'projects', :action => 'activity' }%>
+</div>
+
+<h2><%=l(:label_project_plural)%></h2>
+
+<% @project_tree.keys.sort.each do |project| %>
+<h3><%= link_to h(project.name), {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %></h3>
+<%= textilizable(project.short_description, :project => project) %>
+
+<% if @project_tree[project].any? %>
+ <p><%= l(:label_subproject_plural) %>:
+ <%= @project_tree[project].sort.collect {|subproject|
+ link_to(h(subproject.name), {:action => 'show', :id => subproject}, :class => (User.current.member_of?(subproject) ? "icon icon-fav" : ""))}.join(', ') %></p>
+<% end %>
+<% end %>
+
+<% if User.current.logged? %>
+<div class="contextual">
+<span class="icon icon-fav"><%= l(:label_my_projects) %></span>
+</div>
+<% end %>
+
+<% html_title(l(:label_project_plural)) -%>
+++ /dev/null
-<div class="contextual">
- <%= link_to l(:label_issue_view_all), { :controller => 'issues' } %> |
- <%= link_to l(:label_overall_activity), { :controller => 'projects', :action => 'activity' }%>
-</div>
-
-<h2><%=l(:label_project_plural)%></h2>
-
-<% @project_tree.keys.sort.each do |project| %>
-<h3><%= link_to h(project.name), {:action => 'show', :id => project}, :class => (User.current.member_of?(project) ? "icon icon-fav" : "") %></h3>
-<%= textilizable(project.short_description, :project => project) %>
-
-<% if @project_tree[project].any? %>
- <p><%= l(:label_subproject_plural) %>:
- <%= @project_tree[project].sort.collect {|subproject|
- link_to(h(subproject.name), {:action => 'show', :id => subproject}, :class => (User.current.member_of?(subproject) ? "icon icon-fav" : ""))}.join(', ') %></p>
-<% end %>
-<% end %>
-
-<% if User.current.logged? %>
-<div class="contextual">
-<span class="icon icon-fav"><%= l(:label_my_projects) %></span>
-</div>
-<% end %>
-
-<% html_title(l(:label_project_plural)) -%>
def test_index
get :index
assert_response :success
- assert_template 'list'
- end
-
- def test_list
- get :list
- assert_response :success
- assert_template 'list'
+ assert_template 'index'
assert_not_nil assigns(:project_tree)
# Root project as hash key
assert assigns(:project_tree).has_key?(Project.find(1))