Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop

This commit is contained in:
xianbo 2013-10-31 17:29:04 +08:00
commit c7d96dd183
5 changed files with 158 additions and 143 deletions

View File

@ -17,12 +17,18 @@ module CoursesHelper
# 根据角色查询
def searchCountByRoles project, roles_id
count = -1
people = searchPeopleByRoles project, roles_id
people.count
end
# 根据角色查人
def searchPeopleByRoles project, roles_id
people = []
begin
count = project.members.joins(:member_roles).where("member_roles.role_id = :role_id", {:role_id => roles_id }).count
people = project.members.joins(:member_roles).where("member_roles.role_id = :role_id", {:role_id => roles_id })
rescue Exception => e
logger.error "[CoursesHelper] ===> #{e}"
end
count
people
end
end

View File

@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>

View File

@ -1,73 +1,73 @@
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
<% end %>
<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %>
<div class="project-search-block">
<table width="100%" valign="center">
<tr>
<td width="16%"><span style="margin-left:0px"><%= l(:label_project_plural)%></span></td>
<td valign="center"><%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %></td>
<td align="right">
<div class="project-search">
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "small", :name => nil %>
</div></td>
</tr>
</table>
</div>
<% end %>
<%= sort_project(@s_type, @project_type) %>
<!--end-->
<!-- <div class="pagination_list">
<ul>
<li>
<%= link_to l(:label_sort_by_time), projects_path(:project_sort_type => '0'),:class=>"test_new" %>
</li>
<li>
<%= link_to l(:label_sort_by_active), projects_path(:project_sort_type => '1'),:class=>"test_new" %>
</li>
<li>
<%= link_to l(:label_sort_by_influence), projects_path(:project_sort_type => '2'),:class=>"test_new" %>
</li>
</ul>
</div> -->
<div id="projects-index">
<%= render_project_hierarchy(@projects)%>
</div>
<div class="pagination">
<ul>
<%= pagination_links_full @project_pages %>
</ul>
</div>
<% if User.current.logged? %>
<p style="text-align:right;">
<span class="my-project"><%= l(:label_my_projects) %></span>
</p>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<% end %>
<% content_for :sidebar do %>
<%= form_tag({}, :method => :get) do %>
<h3><%= l(:label_project_plural) %></h3>
<label for="closed"><%= check_box_tag 'closed', 1, params[:closed] %> <%= l(:label_show_closed_projects) %></label>
<p>
<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>
</p>
<% end %>
<% end %>
<% html_title(l(:label_project_plural)) -%>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
<% end %>
<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %>
<div class="project-search-block">
<table width="100%" valign="center">
<tr>
<td width="16%"><span style="margin-left:0px"><%= l(:label_project_plural)%></span></td>
<td valign="center"><%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %></td>
<td align="right">
<div class="project-search">
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "small", :name => nil %>
</div></td>
</tr>
</table>
</div>
<% end %>
<%= sort_project(@s_type, @project_type) %>
<!--end-->
<!-- <div class="pagination_list">
<ul>
<li>
<%= link_to l(:label_sort_by_time), projects_path(:project_sort_type => '0'),:class=>"test_new" %>
</li>
<li>
<%= link_to l(:label_sort_by_active), projects_path(:project_sort_type => '1'),:class=>"test_new" %>
</li>
<li>
<%= link_to l(:label_sort_by_influence), projects_path(:project_sort_type => '2'),:class=>"test_new" %>
</li>
</ul>
</div> -->
<div id="projects-index">
<%= render_project_hierarchy(@projects)%>
</div>
<div class="pagination">
<ul>
<%= pagination_links_full @project_pages %>
</ul>
</div>
<% if User.current.logged? %>
<p style="text-align:right;">
<span class="my-project"><%= l(:label_my_projects) %></span>
</p>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<% end %>
<% content_for :sidebar do %>
<%= form_tag({}, :method => :get) do %>
<h3><%= l(:label_project_plural) %></h3>
<label for="closed"><%= check_box_tag 'closed', 1, params[:closed] %> <%= l(:label_show_closed_projects) %></label>
<p>
<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>
</p>
<% end %>
<% end %>
<% html_title(l(:label_project_plural)) -%>

View File

@ -5,8 +5,10 @@
</div>
<div class="member_content">
<%= error_messages_for 'member' %>
<% roles = Role.find_all_givable
members = @project.member_principals.includes(:roles, :principal).all.sort %>
<% roles = Role.find_all_givable %>
<% members = @project.member_principals.includes(:roles, :principal).all.sort %>
<% members = searchPeopleByRoles(@project, 3).sort if params[:role] == '1' %>
<% members = searchPeopleByRoles(@project, 5).sort if params[:role] == '2' %>
<% if @project.project_type == 1 %>
<%= render :partial => 'member_list', :locals => {:members => members} %>
<% else %>

View File

@ -1,66 +1,72 @@
<p>
<% if @events_by_day.size >0 %>
<div style="padding-left: 8px">
<h3><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3>
<p class="subtitle">
<%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>
</p>
<div id="activity">
<% @events_by_day.keys.sort.reverse.each do |day| %>
<h3></h3>
<div>
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
<div class="issue-note">
<table width="660px" border="0" align="center" style="font-size: 14px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(e.event_author), :class => "avatar")%></td>
<td>
<table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong> <%= h(e.project) if @project.nil? || @project.id != e.project.id %></strong><span class="font_lighter"> <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> <%= l(:label_new_activity) %> </span> <%= link_to format_activity_title(e.event_title), e.event_url %> </td>
</tr>
<tr>
<td colspan="2" width="580px" >
<p class="font_description">
<!-- modify by nyan -->
<%= textilizable( stringCut240(e.event_description) ) %>
</p></td>
</tr>
<tr>
<td align="left"><a class="font_lighter"> <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %></a></td>
<% if e.event_type == "issue" %>
<td align="right"><span> <%= link_to l(:label_find_all_comments), issue_path(e) %> </span><span class="font_lighter"><%= l(:label_comments_count, :count => e.journals.count)%></span></td>
<% end %>
</tr>
</table></td>
</tr>
</table>
</div>
<% end %>
</div>
<% end -%>
<div class="pagination">
<ul>
<%= pagination_links_full @events_pages%>
</ul>
</div>
</div>
</div>
<% else %>
<p class="font_description">
<table width="660">
<tr>
<td><%= link_to image_tag(url_to_avatar(@user), :class => "avatar"), user_path(@user)%></td>
<td colspan="2">
<table width="580">
<tr>
<td > <%= link_to (h @user.lastname+@user.firstname), user_path(@user) %> <%= l(:label_user_create_project) %> <%= link_to @project.name %><strong> !</strong></td>
</tr>
<tr>
<td class="font_lighter" style="float: right"><%= format_time(@project.created_on) %>
</table></td>
</tr>
</table>
</p>
<% end %>
<p>
<% if @events_by_day.size >0 %>
<div style="padding-left: 8px">
<h3><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3>
<p class="subtitle">
<%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>
</p>
<div id="activity">
<% @events_by_day.keys.sort.reverse.each do |day| %>
<h3></h3>
<div>
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
<div class="issue-note">
<table width="660px" border="0" align="center" style="font-size: 14px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(e.event_author), :class => "avatar")%></td>
<td>
<table width="580px" border="0">
<tr>
<td colspan="2" valign="top">
<strong> <%= h(e.project) if @project.nil? || @project.id != e.project.id %></strong>
<span class="font_lighter">
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
<%= l(:label_new_activity) %> </span>
<%= link_to format_activity_title(e.event_title), e.event_url %>
</td>
</tr>
<tr>
<td colspan="2" width="580px" >
<p class="font_description">
<!-- modify by nyan -->
<%= textilizable( stringCut240(e.event_description) ) %>
</p></td>
</tr>
<tr>
<td align="left"><a class="font_lighter"> <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %></a></td>
<% if e.event_type == "issue" %>
<td align="right"><span> <%= link_to l(:label_find_all_comments), issue_path(e) %> </span><span class="font_lighter"><%= l(:label_comments_count, :count => e.journals.count)%></span></td>
<% end %>
</tr>
</table></td>
</tr>
</table>
</div>
<% end %>
</div>
<% end -%>
<div class="pagination">
<ul>
<%= pagination_links_full @events_pages%>
</ul>
</div>
</div>
</div>
<% else %>
<p class="font_description">
<table width="660">
<tr>
<td><%= link_to image_tag(url_to_avatar(@user), :class => "avatar"), user_path(@user)%></td>
<td colspan="2">
<table width="580">
<tr>
<td > <%= link_to (h @user.lastname+@user.firstname), user_path(@user) %> <%= l(:label_user_create_project) %> <%= link_to @project.name %><strong> !</strong></td>
</tr>
<tr>
<td class="font_lighter" style="float: right"><%= format_time(@project.created_on) %>
</table></td>
</tr>
</table>
</p>
<% end %>
</p>