Project

General

Profile

RE: Projects Tree View Plugin - Version 0.0.1 » show.rhtml

Ez Dakit, 2011-01-18 19:02

 
1
<div class="contextual">
2
        <% if User.current.allowed_to?(:add_subprojects, @project) %>
3
                <%= link_to l(:label_subproject_new), {:controller => 'projects', :action => 'new', :parent_id => @project}, :class => 'icon icon-add' %>
4
        <% end %>
5
</div>
6

    
7
<h2><%=l(:label_overview)%></h2> 
8
	
9
<div class="splitcontentleft">
10
	<div class="wiki">
11
		<%= textilizable @project.description %>
12
	</div>	
13
	<ul>
14
	<% unless @project.homepage.blank? %><li><%=l(:field_homepage)%>: <%= auto_link(h(@project.homepage)) %></li><% end %>
15

    
16
  <% if @subprojects.any? %>
17
	<table class="list">
18
	  <tbody>
19
	  <% ancestors = [] %>
20
	<% for project in @subprojects %>
21
	  <% rowid = "" %>
22
	  <% spanicon = "" %>
23
	  <% openonclick = "" %>
24
	  <% classes = "child " + cycle("odd", "even") %>
25
	  <% if(project.parent_id == nil) %>
26
		<% ancestors.clear %>
27
		<% ancestors << project.id %>
28
	  <% else %>
29
		<% while (ancestors.any? && !(project.parent_id == ancestors.last)) %>
30
				<% ancestors.pop %>
31
		<% end %>
32
		<% if( !(ancestors.detect {|pid| pid == project.parent_id })) %>
33
		  <% prvclasses = "open show parent" %>
34
		  <% ancestors.each do |pid| %>
35
			<% prvclasses += " " + pid.to_s %>
36
		  <% end %>
37
		  <% openonclick = "onclick=\"showHide('"+project.parent_id.to_s+"','"+project.parent_id.to_s+"span')\"" %>
38
		  <tr class="<%= prvclasses %>" id="<%= project.parent_id.to_s + "span" %>" >
39
			<td class="name" style="padding-left: <%= 2*ancestors.length %>em;"><%="<span " + openonclick + " class=\"expander\">&nbsp </span>"%><%= h("Sub Projects") %><span <%= openonclick %> class="empty">&nbsp</span></td>
40
		  </span>
41
		  </tr>
42
		  <% ancestors << project.parent_id %>
43
		<% end %>
44
		<% ancestors.each do |pid| %>
45
		  <% classes += " " + pid.to_s %>
46
		<% end %>
47
		<% ancestors << project.id %>
48
	  <% end %>
49
	  <tr class="<%= classes %>" <%= rowid %> >
50
		<td class="name" style="padding-left: <%= 2*project.level %>em;"><%= spanicon %><%= project.active? ? link_to(h(project.name), {:controller => 'projects', :action => 'show', :id => project}, :class => "project") : h(project.name) %><span <%= openonclick %> class="empty <%=User.current.member_of?(project) ? 'my-project' : nil%>">&nbsp</span></td>
51
	  </tr>
52
	<% end %>
53
	  </tbody>
54
	</table>
55
  <% end %>
56
	<% @project.custom_values.each do |custom_value| %>
57
	<% if !custom_value.value.blank? %>
58
	   <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
59
	<% end %>
60
	<% end %>
61
	</ul>	
62

    
63
  <% if User.current.allowed_to?(:view_issues, @project) %>
64
  <div class="issues box">    
65
    <h3><%=l(:label_issue_tracking)%></h3>
66
    <ul>
67
    <% for tracker in @trackers %>    
68
      <li><%= link_to tracker.name, :controller => 'issues', :action => 'index', :project_id => @project, 
69
                                                :set_filter => 1, 
70
                                                "tracker_id" => tracker.id %>:
71
					<%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i,
72
																										:total => @total_issues_by_tracker[tracker].to_i) %>
73
			</li>
74
    <% end %>
75
    </ul>
76
    <p>
77
    	<%= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 %>
78
	    <% if authorize_global_implemented && User.current.allowed_to?(:view_calendar, @project, :global => true) %>
79
				| <%= link_to(l(:label_calendar), :controller => 'issues', :action => 'calendar', :project_id => @project) %>
80
			<% end %>
81
			<% if authorize_global_implemented && User.current.allowed_to?(:view_gantt, @project, :global => true) %>
82
				| <%= link_to(l(:label_gantt), :controller => 'issues', :action => 'gantt', :project_id => @project) %>
83
			<% end %>
84
		</p>
85
  </div>
86
  <% end %>
87
  <%= call_hook(:view_projects_show_left, :project => @project) %>
88
</div>
89

    
90
<div class="splitcontentright">
91
  <% if @users_by_role.any? %>
92
	<div class="members box">
93
		<h3><%=l(:label_member_plural)%></h3>	
94
		<p><% @users_by_role.keys.sort.each do |role| %>
95
		<%=h role %>: <%= @users_by_role[role].sort.collect{|u| link_to_user u}.join(", ") %><br />
96
		<% end %></p>
97
	</div>
98
	<% end %>
99
    
100
  <% if @news.any? && authorize_for('news', 'index') %>
101
  <div class="news box">
102
    <h3><%=l(:label_news_latest)%></h3>  
103
    <%= render :partial => 'news/news', :collection => @news %>
104
    <p><%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %></p>
105
  </div>  
106
  <% end %>
107
  <%= call_hook(:view_projects_show_right, :project => @project) %>
108
</div>
109

    
110
<% content_for :sidebar do %>
111
    <% if @total_hours && User.current.allowed_to?(:view_time_entries, @project) %>
112
    <h3><%= l(:label_spent_time) %></h3>
113
    <p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p>
114
    <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'details', :project_id => @project}) %> |
115
    <%= link_to(l(:label_report), {:controller => 'timelog', :action => 'report', :project_id => @project}) %></p>
116
    <% end %>
117
    <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %>
118
<% end %>
119

    
120
<% content_for :header_tags do %>
121
<%= auto_discovery_link_tag(:atom, {:action => 'activity', :id => @project, :format => 'atom', :key => User.current.rss_key}) %>
122
<% end %>
123

    
124
<% html_title(l(:label_overview)) -%>
(2-2/2)