修改了用户主页课程列表显示

去掉了作业和关注需求,将关注需求统计显示
This commit is contained in:
huangjingquan 2013-10-31 15:18:42 +08:00
parent c7279c9416
commit 477e299e24
10 changed files with 60 additions and 127 deletions

View File

@ -235,7 +235,7 @@ class UsersController < ApplicationController
#end
def index
@project_type = params[:project_type]
sort_init 'login', 'asc'

View File

@ -75,6 +75,7 @@ class User < Principal
has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'"
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
belongs_to :auth_source
belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang
## added by xianbo for delete
has_many :biding_projects, :dependent => :destroy
##ended by xianbo

View File

@ -63,8 +63,10 @@
<div>
<strong class="font_small_watch"><%=link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%></strong> &nbsp;
<strong class="font_small_watch"><%=link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users(@user.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist" %></strong>
<strong class="font_small_watch"><%=link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users(@user.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist" %></strong>&nbsp;
<strong class="font_small_watch"><%=link_to l(:label_requirement_focus)+"("+Bid.watched_by(@user).where('reward_type = ?', 1).count.to_s+")" ,:controller=>"users", :action=>"watch_bids"%></strong> &nbsp; <!-- added by huang -->
<!-- added by bai 个人签名-->
<% if @user.id == User.current.id %>
<p><%= toggle_link l(:label_brief_introduction), 'introduction', {:focus => 'new_form_user_introduction'} %></p>

View File

@ -0,0 +1,38 @@
<ul class="user_project_sort">
<% for membership in @memberships %>
<li>
<table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(membership.project), :class => 'avatar'), project_path(membership.project) %></td>
<td>
<table width="580" border="0">
<tr>
<td colspan="2" valign="top"><span><%= link_to_project(membership.project) %></span>
<span></span>
<span style="float: right"><%= l(:label_x_base_courses_member, :count => membership.project.members.count) %>(<%= link_to "#{membership.project.members.count}", project_member_path(membership.project), :course =>'1' %>)&nbsp;&nbsp;
<%= l(:label_homework) %> (<span class=""><%= link_to (membership.project.homeworks.count), {:controller => 'projects', :action => 'homework', :id => membership.project.identifier} %></span>)
&nbsp;&nbsp;
<%= l(:label_course_news)%> (<span style="color: #ed8924"><%= link_to (membership.project.news.count), {:controller => 'news', :action => 'index', :project_id => membership.project.identifier} %></span>)
</td>
</tr>
<tr>
<td colspan="2" width="580" >
<p class="font_description">
<%= membership.project.description %>
</p></td>
</tr>
<tr><td>
<span class="font_lighter" style="float: right"><%= l(:label_create_time) %> <%= format_time(membership.created_on) %></span>
</td></tr>
</table></td>
</tr>
</table>
</li>
<% end %>
</ul>
<%= call_hook :view_account_left_bottom, :user => @user %>

View File

@ -5,68 +5,13 @@
<%= l(:label_project_course_un) %>
</p>
<% else %>
<p class="font_description">
<% if @user.user_extensions.identity == 0 %>
<p class="font_description">
<!--teacher could create the course directly-->
<%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
<% else %>
<!--joined the list of the courstlist-->
<%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %>
<% end %>
<%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
</p>
<% end %>
<% else %>
<% unless @user != User.current %>
<% if @user.user_extensions.identity == 0 %>
<p><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %></p>
<% end %>
<% end %>
<ul class="user_project_sort">
<% for membership in @memberships %>
<li>
<% if @user.roles_for_project(membership.project).first.to_s == 'Manager' || @user.roles_for_project(membership.project).first.to_s == 'TA' %>
<table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(membership.project), :class => 'avatar'), project_path(membership.project) %></td>
<td>
<table width="580" border="0">
<tr>
<td colspan="2" valign="top"><span><%= link_to_project(membership.project) %></span>
<span style="float: right"><%= l(:label_homework) %> (<span class=""><%= link_to (membership.project.homeworks.count), {:controller => 'projects', :action => 'homework', :id => membership.project.identifier} %></span>)
&nbsp;&nbsp;&nbsp;
<%= l(:label_course_news)%> (<span style="color: #ed8924"><%= link_to (membership.project.news.count), {:controller => 'news', :action => 'index', :project_id => membership.project.identifier} %></span>)
<!-- <%= l(:label_member)%>(<span style="color: #ed8924"><%= link_to (membership.project.members.count), {:controller => 'news', :action => 'index', :project_id => membership.project.identifier} %></span>) </span> --></td>
</tr>
<tr>
<td colspan="2" width="580" >
<p class="font_description">
<%= membership.project.description%>
</p></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"> <%= format_time(membership.created_on) %></span></td><!-- modified by ming -->
<td align="right" style="font-size: 13px">
<%= l(:role_of_course)%>:
<% if membership.roles.sort.collect(&:to_s).join(', ') =='Manager' %>
<%= l(:label_teacher)%>
<% elsif membership.roles.sort.collect(&:to_s).join(', ') =='Reporter' %>
<%= l(:label_student)%>
<% elsif membership.roles.sort.collect(&:to_s).join(', ') =='TA' %>
<%= l(:label_ta)%>
<% end %>
</td>
</tr>
</table></td>
</tr>
</table><% end %>
</li>
<% end %>
</ul>
<% end %>
<%= call_hook :view_account_left_bottom, :user => @user %>
<% else %>
<p><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %></p>
<%= render :partial => 'course_form' %>
<% end %>
</div>

View File

@ -1,71 +1,18 @@
<div class="content_frame">
<% if @memberships.empty? %>
<% if @memberships.empty? %>
<% if @user != User.current %>
<p class="font_description">
<%= l(:label_project_course_un) %>
</p>
<% else %>
<p class="font_description">
<% if @user.user_extensions.identity == 0 %>
<%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
<% else %>
<%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %>
<% end %>
<%= l(:label_project_cousre_studentun) %><%= link_to"#{l(:label_course_join_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %>
</p>
<% end %>
<% else %>
<% unless @user != User.current %>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
<% else %>
<p><%= link_to"#{l(:label_course_view_student)}",{:controller=>'projects',:action=>'course', :course => 1}, :class => 'icon icon-add' %></p>
<%= render :partial => 'course_form' %>
<% end %>
<% end %>
<ul class="user_project_sort">
<% for membership in @memberships %>
<li>
<% if @user.roles_for_project(membership.project).first.to_s == 'Reporter' %>
<table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(membership.project), :class => 'avatar'), project_path(membership.project) %></td>
<td>
<table width="580" border="0">
<tr>
<td colspan="2" valign="top"><span><%= link_to_project(membership.project) %></span>
<span style="float: right"><%= l(:label_homework) %> (<span class=""><%= link_to (membership.project.homeworks.count), {:controller => 'projects', :action => 'homework', :id => membership.project.identifier} %></span>)
&nbsp;&nbsp;&nbsp;
<%= l(:label_course_news)%> (<span style="color: #ed8924"><%= link_to (membership.project.news.count), {:controller => 'news', :action => 'index', :project_id => membership.project.identifier} %></span>)
<!-- <%= l(:label_member)%>(<span style="color: #ed8924"><%= link_to (membership.project.members.count), {:controller => 'news', :action => 'index', :project_id => membership.project.identifier} %></span>) </span> --></td>
</tr>
<tr>
<td colspan="2" width="580" >
<p class="font_description">
<%= membership.project.description%>
</p></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"> <%= format_time(membership.created_on) %></span></td><!-- modified by ming -->
<td align="right" style="font-size: 13px">
课程角色:
<% if membership.roles.sort.collect(&:to_s).join(', ') =='Manager' %>
老师
<% elsif membership.roles.sort.collect(&:to_s).join(', ') =='Reporter' %>
学生
<% elsif membership.roles.sort.collect(&:to_s).join(', ') =='TA' %>
助教
<% end %>
</td>
</tr>
</table></td>
</tr>
</table><% end %>
</li>
<% end %>
</ul>
<% end %>
<%= call_hook :view_account_left_bottom, :user => @user %>
</div>

View File

@ -1,4 +1,3 @@
<!-- added by fq -->
<!--huang-->
<% if @user.user_extensions.identity == 0 %> <!-- for teacher-->
<%= render :partial => 'my_course' %>

View File

@ -1552,6 +1552,7 @@ zh:
label_course: 课程
label_course_new: 新建课程
label_course_join_student: 加入课程
label_course_view_student: 查看其他课程
label_public_info: 若不公开,仅项目成员可见该项目
label_course_student: 学生
label_homework: 课程作业

View File

@ -99,7 +99,7 @@ RedmineApp::Application.routes.draw do
end
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
match 'users/:id/user_projects', :controller => 'users', :action => 'user_projects', :via => :get
#match 'user/:id/watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post]
#end
match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post]

View File

@ -330,9 +330,9 @@ end
Redmine::MenuManager.map :user_menu do |menu|
menu.push :activity, {:controller => 'users', :action => 'show' }
menu.push :user_course, {:controller => 'users', :action => 'user_courses'}
menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'}
#menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang
menu.push :user_project, {:controller => 'users', :action => 'user_projects'}
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'}
# menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback'}
end