diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 3bdd074b8..fac4f5b68 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -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 diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 7c83ce275..711d47e96 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -2,6 +2,7 @@ + <%= h html_title %> <%= csrf_meta_tag %> diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index b9f70cfd4..d24eba8c7 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -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 %> -
- - - - - - - - -
<%= l(:label_project_plural)%><%= 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) %> -
-
-<% end %> - -<%= sort_project(@s_type, @project_type) %> - - - - - -
- <%= render_project_hierarchy(@projects)%> -
- - - -<% if User.current.logged? %> -

- <%= l(:label_my_projects) %> -

-<% 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 %> -

<%= l(:label_project_plural) %>

- -

- <%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %> -

-<% 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 %> +
+ + + + + + + + +
<%= l(:label_project_plural)%><%= 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) %> +
+
+<% end %> + +<%= sort_project(@s_type, @project_type) %> + + + + + +
+ <%= render_project_hierarchy(@projects)%> +
+ + + +<% if User.current.logged? %> +

+ <%= l(:label_my_projects) %> +

+<% 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 %> +

<%= l(:label_project_plural) %>

+ +

+ <%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %> +

+<% end %> +<% end %> + +<% html_title(l(:label_project_plural)) -%> diff --git a/app/views/projects/member.html.erb b/app/views/projects/member.html.erb index 944fa33be..d70831279 100644 --- a/app/views/projects/member.html.erb +++ b/app/views/projects/member.html.erb @@ -5,8 +5,10 @@
<%= 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 %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 903ad70ff..23061be39 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,66 +1,72 @@ -

- <% if @events_by_day.size >0 %> -

-

<%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %>

-

- <%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %> -

-
- <% @events_by_day.keys.sort.reverse.each do |day| %> -

-
- <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> -
- - - - - -
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar")%> - - - - - - - - - - <% if e.event_type == "issue" %> - - <% end %> - -
<%= h(e.project) if @project.nil? || @project.id != e.project.id %> <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title(e.event_title), e.event_url %>
-

- - <%= textilizable( stringCut240(e.event_description) ) %> -

<%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %> <%= link_to l(:label_find_all_comments), issue_path(e) %> <%= l(:label_comments_count, :count => e.journals.count)%>
-
- <% end %> -
- <% end -%> - -
-
- <% else %> -

- - - - - -
<%= link_to image_tag(url_to_avatar(@user), :class => "avatar"), user_path(@user)%> - - - - - -
<%= link_to (h @user.lastname+@user.firstname), user_path(@user) %> <%= l(:label_user_create_project) %> <%= link_to @project.name %> !
<%= format_time(@project.created_on) %> -
-

-<% end %> +

+ <% if @events_by_day.size >0 %> +

+

<%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %>

+

+ <%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %> +

+
+ <% @events_by_day.keys.sort.reverse.each do |day| %> +

+
+ <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> +
+ + + + + +
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar")%> + + + + + + + + + + <% if e.event_type == "issue" %> + + <% end %> + +
+ <%= h(e.project) if @project.nil? || @project.id != e.project.id %> + + <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> + <%= l(:label_new_activity) %> + <%= link_to format_activity_title(e.event_title), e.event_url %> +
+

+ + <%= textilizable( stringCut240(e.event_description) ) %> +

<%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %> <%= link_to l(:label_find_all_comments), issue_path(e) %> <%= l(:label_comments_count, :count => e.journals.count)%>
+
+ <% end %> +
+ <% end -%> + +
+
+ <% else %> +

+ + + + + +
<%= link_to image_tag(url_to_avatar(@user), :class => "avatar"), user_path(@user)%> + + + + + +
<%= link_to (h @user.lastname+@user.firstname), user_path(@user) %> <%= l(:label_user_create_project) %> <%= link_to @project.name %> !
<%= format_time(@project.created_on) %> +
+

+<% end %>

\ No newline at end of file