1
|
<div class="contextual">
|
2
|
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'add'}, :class => 'icon icon-add' %>
|
3
|
</div>
|
4
|
|
5
|
<h2><%=l(:label_project_plural)%></h2>
|
6
|
|
7
|
<% form_tag({}, :method => :get) do %>
|
8
|
<fieldset><legend><%= l(:label_filter_plural) %></legend>
|
9
|
<label><%= l(:field_status) %> :</label>
|
10
|
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
|
11
|
<label><%= l(:label_project) %>:</label>
|
12
|
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
13
|
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
14
|
</fieldset>
|
15
|
<% end %>
|
16
|
|
17
|
|
18
|
<div class="autoscroll">
|
19
|
<table class="list">
|
20
|
<thead><tr>
|
21
|
<th><%=l(:label_project)%></th>
|
22
|
<th><%=l(:field_description)%></th>
|
23
|
<th><%=l(:field_is_public)%></th>
|
24
|
<th><%=l(:field_created_on)%></th>
|
25
|
<th></th>
|
26
|
</tr></thead>
|
27
|
<tbody>
|
28
|
<% ancestors = [] %>
|
29
|
<% for project in @projects %>
|
30
|
<% rowid = "" %>
|
31
|
<% classes = "" %>
|
32
|
<% spanicon = "" %>
|
33
|
<% openonclick = "" %>
|
34
|
<% showchildren = false %>
|
35
|
<% project.children.each do |child| %>
|
36
|
<% if @projects.include?(child) %>
|
37
|
<% showchildren = true %>
|
38
|
<% break %>
|
39
|
<% end %>
|
40
|
<% end %>
|
41
|
<% if(!project.children.empty? && showchildren) %>
|
42
|
<% classes += " closed parent " + cycle("odd", "even") %>
|
43
|
<% rowid = "id=\""+project.id.to_s+"span\"" %>
|
44
|
<% openonclick = "onclick=\"showHide('"+project.id.to_s+"','"+project.id.to_s+"span')\""%>
|
45
|
<% spanicon = "<span " + openonclick + " class=\"expander\">  </span>" %>
|
46
|
<% else %>
|
47
|
<% classes += " child" %>
|
48
|
<% end %>
|
49
|
<% if(project.parent_id == nil) %>
|
50
|
<% ancestors.clear %>
|
51
|
<% ancestors << project.id %>
|
52
|
<% else %>
|
53
|
<% while (ancestors.any? && !(project.parent_id == ancestors.last)) %>
|
54
|
<% ancestors.pop %>
|
55
|
<% end %>
|
56
|
<% classes += " hide" %>
|
57
|
<% if( !(ancestors.detect {|pid| pid == project.parent_id })) %>
|
58
|
<% prvclasses = "closed show parent " + cycle("odd", "even") %>
|
59
|
<% ancestors.each do |pid| %>
|
60
|
<% prvclasses += " " + pid.to_s %>
|
61
|
<% end %>
|
62
|
<% openonclick = "onclick=\"showHide('"+project.parent_id.to_s+"','"+project.parent_id.to_s+"span')\"" %>
|
63
|
<tr class="<%= prvclasses %>" id="<%= project.parent_id.to_s + "span" %>" >
|
64
|
<td class="name" ><%= "<span style=\"padding-left: " + (2*(ancestors.length-1)).to_s + "em;\"></span>" %><%="<span " + openonclick + " class=\"expander\" >  </span>" %><%= h("<Private Project>") %><span <%= openonclick %> class="empty"> </span></td>
|
65
|
<td <%= openonclick %> >Project is private. </td>
|
66
|
</span>
|
67
|
</tr>
|
68
|
<% ancestors << project.parent_id %>
|
69
|
<% end %>
|
70
|
<% ancestors.each do |pid| %>
|
71
|
<% classes += " " + pid.to_s %>
|
72
|
<% end %>
|
73
|
<% ancestors << project.id %>
|
74
|
<% end %>
|
75
|
<tr class="<%= classes %>" <%= rowid %> >
|
76
|
<td class="name"><%= "<span style=\"padding-left: " + (2*(ancestors.length-1)).to_s + "em;\"></span>" %><%= spanicon %><%= project.active? ? link_to(h(project.name), {:controller => 'projects', :action => 'show', :id => project}, :class => "project") : h(project.name) %></td>
|
77
|
<td <%= openonclick %> ><%= textilizable project.short_description, :project => project %></td>
|
78
|
<td align="center"><%= image_tag 'true.png' if project.is_public? %></td>
|
79
|
<td align="center"><%= format_date(project.created_on) %></td>
|
80
|
<td class="buttons">
|
81
|
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-lock') if project.active? %>
|
82
|
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if !project.active? && (project.parent.nil? || project.parent.active?) %>
|
83
|
<%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
|
84
|
<%= link_to(l(:button_delete), project_destroy_confirm_path(project), :class => 'icon icon-del') %>
|
85
|
</td>
|
86
|
</tr>
|
87
|
<% end %>
|
88
|
</tbody>
|
89
|
</table>
|
90
|
</div>
|
91
|
|
92
|
<% html_title(l(:label_project_plural)) -%>
|