Project

General

Profile

Patch #13696 » projects.html.erb

our overriden version (based on redmine V2.6.0) - Jérôme BATAILLE, 2016-03-19 00:58

 
1
<div class="contextual">
2
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>
3
</div>
4

    
5
<%
6
  ############################################################
7
  # Smile specific : #156114 Projects admin, show issues count
8
  # TODO jebat to put in an index overriden controller method
9
  if params[:parent].present?
10
    parent_project = Project.find_by_name(params[:parent])
11
    if parent_project.present?
12
      @projects = @projects.select{ |p|
13
        p.ancestors.include?(parent_project)
14
      }
15
    else
16
      @projects = []
17
    end
18
  end
19

    
20
  display_counts = params[:parent].present? || params[:name].present?
21
  # END -- Smile specific : #156114 Projects admin, show issues count
22
  ###################################################################
23

    
24
  # Smile specific : #156114 Projects admin, show issues count
25
-%>
26
<%= title "#{l(:label_project_plural)} (#{@projects.size})" %>
27

    
28
<%= form_tag({}, :method => :get) do %>
29
<fieldset><legend><%= l(:label_filter_plural) %></legend>
30
<label for='status'><%= l(:field_status) %> :</label>
31
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;"  %>
32
<label for='name'><%= l(:label_project) %>:</label>
33
<%= text_field_tag 'name', params[:name], :size => 30 %>
34
<%
35
  # Smile specific : #156114 Projects admin, show issues count
36
-%>
37
<br/>
38
<label><%=l(:field_parent)%> :</label>
39
<%= text_field_tag 'parent', params[:parent], :size => 60 %>
40
<%
41
  # END -- Smile specific : #156114 Projects admin, show issues count
42
-%>
43
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
44
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
45
</fieldset>
46
<% end %>
47
&nbsp;
48

    
49
<div class="autoscroll">
50
<table class="list">
51
  <thead><tr>
52
  <th><%=l(:label_project)%></th>
53
  <th><%=l(:field_identifier)%></th>
54
  <th><%=l(:field_is_public)%></th>
55
<%
56
  ##########################################################
57
  # Smile specific #156114 Projects admin, show issues count
58
  # Smile specific #416615 Projects admin, show parent project if projects filtered
59
  if display_counts then
60
-%>
61
    <th><%=l(:label_issue_plural) %> (<%= l(:label_open_issues_plural) %>)<br/><%= l(:label_member_plural) %> / <%= l(:label_subproject_plural) %></th>
62
    <th><%=l(:field_parent) %></th>
63
<%
64
  end
65
  # END -- Smile specific #156114 Projects admin, show issues count
66
  #################################################################
67
-%>
68
  <th><%=l(:field_created_on)%></th>
69
  <th></th>
70
  </tr></thead>
71
  <tbody>
72
<% project_tree(@projects) do |project, level| %>
73
  <tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
74
  <td class="name"><span><%= link_to_project_settings(project, {}, :title => project.short_description) %></span></td>
75
  <td style="text-align:left"><%= project.identifier %></td>
76
  <td><%= checked_image project.is_public? %></td>
77
<%
78
  ##########################################################
79
  # Smile specific #156114 Projects admin, show issues count
80
  if display_counts then
81
    p_children_count = project.descendants.count
82
    label_children_count = p_children_count.to_s
83
    if p_children_count > 0
84
      label_children_count = "<b><font color=\"red\">#{label_children_count}</font></b>".html_safe
85
    end
86
-%>
87
  <td><b><%=  Issue.where(:project_id => project.id).count %></b> (<%= Issue.open.where(:project_id => project.id).count %>)<br/><%= project.members.count %> / <%= label_children_count %></td>
88
  <td>
89
<%
90
    # Smile specific #416615 Projects admin, show parent project if projects filtered
91
    if project.parent
92
-%>
93
    <span><%= link_to_project_settings(project.parent, {}, :title => project.parent.short_description) %></span>
94
<%
95
    end
96
-%>
97
  </td>
98
<%
99
  end
100
  # END -- Smile specific : #156114 Projects admin, show issues count
101
  ###################################################################
102
-%>
103
  <td><%= format_date(project.created_on) %></td>
104
  <td class="buttons">
105
<%
106
  # Smile specific #416800 Admin projets : archiver / désarchiver ne reste pas sur les filtres courants
107
  # Smile specific : params added name, parent
108
-%>
109
    <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status], :name => params[:name], :parent => params[:parent] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
110
<%
111
  # Smile specific #416800 Admin projets : archiver / désarchiver ne reste pas sur les filtres courants
112
  # Smile specific : params added name, parent
113
-%>
114
    <%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status], :name => params[:name], :parent => params[:parent] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
115
    <%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
116
    <%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %>
117
  </td>
118
  </tr>
119
<% end %>
120
  </tbody>
121
</table>
122
</div>
123

    
124
<% html_title(l(:label_project_plural)) -%>
(5-5/5)