##// END OF EJS Templates
Various changes on views. On project summary, members are now grouped by role and subprojects are listed inline....
Jean-Philippe Lang -
r431:183ede84fd80
parent child
Show More
@@ -83,7 +83,7 class ProjectsController < ApplicationController
83 # Show @project
83 # Show @project
84 def show
84 def show
85 @custom_values = @project.custom_values.find(:all, :include => :custom_field)
85 @custom_values = @project.custom_values.find(:all, :include => :custom_field)
86 @members = @project.members.find(:all, :include => [:user, :role], :order => 'position')
86 @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
87 @subprojects = @project.children if @project.children.size > 0
87 @subprojects = @project.children if @project.children.size > 0
88 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
88 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
89 @trackers = Tracker.find(:all, :order => 'position')
89 @trackers = Tracker.find(:all, :order => 'position')
@@ -28,7 +28,7 class RolesController < ApplicationController
28 end
28 end
29
29
30 def list
30 def list
31 @role_pages, @roles = paginate :roles, :per_page => 10, :order => "position"
31 @role_pages, @roles = paginate :roles, :per_page => 25, :order => "position"
32 render :action => "list", :layout => false if request.xhr?
32 render :action => "list", :layout => false if request.xhr?
33 end
33 end
34
34
@@ -101,7 +101,7 class RolesController < ApplicationController
101 end
101 end
102
102
103 def report
103 def report
104 @roles = Role.find :all
104 @roles = Role.find(:all, :order => 'position')
105 @permissions = Permission.find :all, :conditions => ["is_public=?", false], :order => 'sort'
105 @permissions = Permission.find :all, :conditions => ["is_public=?", false], :order => 'sort'
106 if request.post?
106 if request.post?
107 @roles.each do |role|
107 @roles.each do |role|
@@ -26,6 +26,10 class Role < ActiveRecord::Base
26 validates_uniqueness_of :name
26 validates_uniqueness_of :name
27 validates_format_of :name, :with => /^[\w\s\'\-]*$/i
27 validates_format_of :name, :with => /^[\w\s\'\-]*$/i
28
28
29 def <=>(role)
30 position <=> role.position
31 end
32
29 private
33 private
30 def check_integrity
34 def check_integrity
31 raise "Can't delete role" if Member.find(:first, :conditions =>["role_id=?", self.id])
35 raise "Can't delete role" if Member.find(:first, :conditions =>["role_id=?", self.id])
@@ -142,6 +142,10 class User < ActiveRecord::Base
142 token && token.user.active? ? token.user : nil
142 token && token.user.active? ? token.user : nil
143 end
143 end
144
144
145 def <=>(user)
146 lastname <=> user.lastname
147 end
148
145 private
149 private
146 # Return password digest
150 # Return password digest
147 def self.hash_password(clear_password)
151 def self.hash_password(clear_password)
@@ -11,7 +11,7
11 <td style="width:15%"><b><%=l(:field_priority)%> :</b></td><td style="width:35%"><%= @issue.priority.name %></td>
11 <td style="width:15%"><b><%=l(:field_priority)%> :</b></td><td style="width:35%"><%= @issue.priority.name %></td>
12 </tr>
12 </tr>
13 <tr>
13 <tr>
14 <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? @issue.assigned_to.name : "-" %></td>
14 <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td>
15 <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td>
15 <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td>
16 </tr>
16 </tr>
17 <tr>
17 <tr>
@@ -5,7 +5,7
5 <h2><%=l(:label_overview)%></h2>
5 <h2><%=l(:label_overview)%></h2>
6
6
7 <div class="splitcontentleft">
7 <div class="splitcontentleft">
8 <%= simple_format(auto_link(h(@project.description))) %>
8 <%= textilizable @project.description %>
9 <ul>
9 <ul>
10 <% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>
10 <% unless @project.homepage.empty? %><li><%=l(:field_homepage)%>: <%= auto_link @project.homepage %></li><% end %>
11 <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li>
11 <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li>
@@ -40,17 +40,15
40 <div class="splitcontentright">
40 <div class="splitcontentright">
41 <div class="box">
41 <div class="box">
42 <h3 class="icon22 icon22-users"><%=l(:label_member_plural)%></h3>
42 <h3 class="icon22 icon22-users"><%=l(:label_member_plural)%></h3>
43 <% for member in @members %>
43 <% @members_by_role.keys.sort.each do |role| %>
44 <%= link_to_user member.user %> (<%= member.role.name %>)<br />
44 <%= role.name %>: <%= @members_by_role[role].collect(&:user).sort.collect{|u| link_to_user u}.join(", ") %><br />
45 <% end %>
45 <% end %>
46 </div>
46 </div>
47
47
48 <% if @subprojects %>
48 <% if @subprojects %>
49 <div class="box">
49 <div class="box">
50 <h3 class="icon22 icon22-projects"><%=l(:label_subproject_plural)%></h3>
50 <h3 class="icon22 icon22-projects"><%=l(:label_subproject_plural)%></h3>
51 <% for subproject in @subprojects %>
51 <%= @subprojects.collect{|p| link_to(p.name, :action => 'show', :id => p)}.join(", ") %>
52 <%= link_to subproject.name, :action => 'show', :id => subproject %><br />
53 <% end %>
54 </div>
52 </div>
55 <% end %>
53 <% end %>
56
54
General Comments 0
You need to be logged in to leave comments. Login now