Project

General

Profile

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

Terence Mill, 2011-03-01 10:39

 
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
	</ul>
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("Unterprojekte") %><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
	<ul>
57
	<% @project.visible_custom_field_values.each do |custom_value| %>
58
	<% if !custom_value.value.blank? %>
59
	   <li><%= custom_value.custom_field.name%>: <%=h show_value(custom_value) %></li>
60
	<% end %>
61
	<% end %>
62
	</ul>
63

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

    
91
<div class="splitcontentright">
92
  <%= render :partial => 'members_box' %>
93
    
94
  <% if @news.any? && authorize_for('news', 'index') %>
95
  <div class="news box">
96
    <h3><%=l(:label_news_latest)%></h3>  
97
    <%= render :partial => 'news/news', :collection => @news %>
98
    <p><%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %></p>
99
  </div>  
100
  <% end %>
101
  <%= call_hook(:view_projects_show_right, :project => @project) %>
102
</div>
103

    
104
<% content_for :sidebar do %>
105
    <% if @total_hours && User.current.allowed_to?(:view_time_entries, @project) %>
106
    <h3><%= l(:label_spent_time) %></h3>
107
    <p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p>
108
    <p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> |
109
    <%= link_to(l(:label_report), {:controller => 'time_entry_reports', :action => 'report', :project_id => @project}) %></p>
110
    <% end %>
111
    <%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %>
112
<% end %>
113

    
114
<% content_for :header_tags do %>
115
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %>
116
<% end %>
117

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