This commit is contained in:
baiyu 2014-01-09 10:58:05 +08:00
parent f728061d05
commit db1874fa07
4 changed files with 38 additions and 4 deletions

View File

@ -30,11 +30,11 @@ class UsersController < ApplicationController
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info,
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects]
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score]
#edit has been deleted by huang, 2013-9-23
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks,
:destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info,
:watch_projects]
:watch_projects, :show_score]
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
#william
@ -86,6 +86,10 @@ class UsersController < ApplicationController
end
end
def show_score
end
##added by fq
def watch_bids
cond = 'bids.reward_type <> 1'

View File

@ -25,6 +25,23 @@ class UserExtensions < ActiveRecord::Base
return self.brief_introduction
end
# added by bai
def show_identity
if self.identity == 0
user_identity = '教师'
elsif self.identity == 1
user_identity = '学生'
elsif self.identity == 2
user_identity = '企业'
elsif self.identity == 3
user_identity = '开发者'
else
user_identity = ''
end
return user_identity
end
# end
def self.introduction(user, message)
unless user.user_extensions.nil?
info = user.user_extensions
@ -37,4 +54,7 @@ class UserExtensions < ActiveRecord::Base
info.save
end
end
end

View File

@ -62,14 +62,23 @@
<td align="center"> <% unless User.current == @user %>
<%= watcher_link(@user, User.current) %>
<% else %>
<%= link_to(l(:label_user_edit), my_account_path(@user)) if User.current %><% end %></td>
<%= link_to(l(:label_user_edit), my_account_path(@user)) if User.current %>
<% end %></td>
</tr>
<!-- added by bai 增加个人得分 -->
<tr><td class="buttons_for_course" style="margin-top:30px;margin-left:144px"><%= link_to(l(:label_user_grade), {:controller => 'users', :action => 'show_score', :remote => true, :id => @user.id})%>: <span style="color:#ec6300"><%= @user.user_status.grade %></span></td></tr>
<!-- end -->
</table></td>
</tr>
</table>
<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>&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.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 %>

View File

@ -113,6 +113,7 @@ RedmineApp::Application.routes.draw do
match 'user_courses', :to => 'users#user_courses', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
match 'watch_projects', :to => 'users#watch_projects', :via => :get
match 'show_score', :to => 'users#show_score', :via => :get
end
end
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"