From: Jean-Philippe Lang Date: Sun, 8 Apr 2007 17:44:54 +0000 (+0000) Subject: Various changes on views. On project summary, members are now grouped by role and... X-Git-Tag: 0.5.0~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=183ede84fd80c8d4592869dfb631ec6c2ad58543;p=redmine.git Various changes on views. On project summary, members are now grouped by role and subprojects are listed inline. git-svn-id: http://redmine.rubyforge.org/svn/trunk@434 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6bbf7efce..c3170bf5e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -83,7 +83,7 @@ class ProjectsController < ApplicationController # Show @project def show @custom_values = @project.custom_values.find(:all, :include => :custom_field) - @members = @project.members.find(:all, :include => [:user, :role], :order => 'position') + @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role} @subprojects = @project.children if @project.children.size > 0 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") @trackers = Tracker.find(:all, :order => 'position') diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 0eba46d1e..57398f323 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -28,7 +28,7 @@ class RolesController < ApplicationController end def list - @role_pages, @roles = paginate :roles, :per_page => 10, :order => "position" + @role_pages, @roles = paginate :roles, :per_page => 25, :order => "position" render :action => "list", :layout => false if request.xhr? end @@ -101,7 +101,7 @@ class RolesController < ApplicationController end def report - @roles = Role.find :all + @roles = Role.find(:all, :order => 'position') @permissions = Permission.find :all, :conditions => ["is_public=?", false], :order => 'sort' if request.post? @roles.each do |role| diff --git a/app/models/role.rb b/app/models/role.rb index 7798f3bc6..a60319c55 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -26,6 +26,10 @@ class Role < ActiveRecord::Base validates_uniqueness_of :name validates_format_of :name, :with => /^[\w\s\'\-]*$/i + def <=>(role) + position <=> role.position + end + private def check_integrity raise "Can't delete role" if Member.find(:first, :conditions =>["role_id=?", self.id]) diff --git a/app/models/user.rb b/app/models/user.rb index 514517de6..60baa72da 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -141,7 +141,11 @@ class User < ActiveRecord::Base token = Token.find_by_value(key) token && token.user.active? ? token.user : nil end - + + def <=>(user) + lastname <=> user.lastname + end + private # Return password digest def self.hash_password(clear_password) diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index dc386d597..759c54f5e 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -11,7 +11,7 @@ <%=l(:field_priority)%> :<%= @issue.priority.name %> - <%=l(:field_assigned_to)%> :<%= @issue.assigned_to ? @issue.assigned_to.name : "-" %> + <%=l(:field_assigned_to)%> :<%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %> <%=l(:field_category)%> :<%=h @issue.category ? @issue.category.name : "-" %> diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml index 98259f1f8..bc18a4752 100644 --- a/app/views/projects/show.rhtml +++ b/app/views/projects/show.rhtml @@ -5,7 +5,7 @@

<%=l(:label_overview)%>

- <%= simple_format(auto_link(h(@project.description))) %> + <%= textilizable @project.description %>