个人主页:姓名、工作单位

课程主页:课程名称、教师单位
项目主页:项目名称
竞赛主页:竞赛名称
主页:课程列=>单位名称
修复部分个人主页报错问题
This commit is contained in:
z9hang 2014-06-17 17:41:59 +08:00
parent ab486aa811
commit 1cb1eeeb1d
6 changed files with 24 additions and 8 deletions

View File

@ -801,6 +801,11 @@ class UsersController < ApplicationController
else
@user = User.find(params[:id])
end
if @user.user_score.nil?
us = UserScore.new
us.user_id = @user.id
us.save
end
rescue ActiveRecord::RecordNotFound
render_404
end

View File

@ -73,7 +73,8 @@
<td>
<table>
<tr>
<td class="info-course"><%= @project.name %></td>
<!-- modified by zjc 课程名称添加超链接 -->
<td class="info-course"><%= link_to @project.name,project_path(@project) %></td>
</tr>
<tr>
<td align="center">
@ -180,7 +181,8 @@
<% unless @course.teacher.user_extensions.nil? %>
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td>
<td class="font_lighter_sidebar"><%= @course.teacher.user_extensions.school %></td>
<!-- modified by zjc 教师单位添加超链接 -->
<td class="font_lighter_sidebar"><%= link_to @course.teacher.user_extensions.school,options={:controller => 'welcome',:action => 'course',:school_id => @course.teacher.user_extensions.school.id}, html_options={:method => 'get'} %></td>
</tr>
<% else %>
<tr>

View File

@ -62,7 +62,7 @@
<td>
<table>
<tr>
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @contest.name %></td>
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= link_to @contest.name, show_contest_contest_path(@contest) %></td>
</tr>
<% if User.current.login? %>
<tr colspan='3'>

View File

@ -57,7 +57,7 @@
<td><%= image_tag(url_to_avatar(@project), :class => 'avatar2') %></td>
<td>
<div class="info-course">
<%= @project.name %>
<%= link_to @project.name, project_path(@project)%>
</div>
<div>
<!-- added by bai 增加项目得分 -->

View File

@ -56,7 +56,9 @@
<td>
<table>
<tr>
<td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= h (@user.name) %> <!-- added by bai -->
<!-- added by bai -->
<!-- modified by zjc 姓名添加超链接 -->
<td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= link_to h (@user.name) %>
<%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%></td>
</tr>
<tr>
@ -92,7 +94,8 @@
<% comments_score = comments_count * 0.1 %>
<% finall_influence_score = news_score + wiki_contents_score + comments_score %>
<% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
<!-- modified by zjc 新得分显示 -->
<tr><td class="score">
<%= l(:label_user_grade)%>:
<%= link_to(format("%.2f" , @user.user_score.total_score).to_f, {:controller => 'users',
@ -102,6 +105,7 @@
}, :style => 'color :#E8770D;') %>
</td>
</tr>
<!-- end -->
<tr><td class="score">
<%= l(:label_user_grade)%>:
<%= link_to(format("%.2f" , finall_user_score).to_f, {:controller => 'users',
@ -174,12 +178,13 @@
-->
<!-- added by bai 在个人主页里显示“工作单位”“地区”"教师的职称"-->
<!-- modified by linchun 在个人主页里显示“加入时间”,“最后登录”,“邮件地址”后面添加冒号-->
<!-- modified by zjc 高校添加超链接 -->
<% unless @user.user_extensions.nil? %>
<% unless @user.user_extensions.identity == 2 %>
<tr>
<td style="padding-left: 5px" width="70px"><%= l(:field_occupation) %></td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<% unless @user.user_extensions.school.nil? %>
<%= @user.user_extensions.school.name %>
<%= link_to @user.user_extensions.school.name, options={:controller => 'welcome',:action => 'course',:school_id => @user.user_extensions.school.id}, html_options={:method => 'get'} %>
<% end %>
</td>
</tr>

View File

@ -18,7 +18,11 @@
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
<!-- <%= @admin.first.user.user_extensions.occupation %> -->
<%# unless @project.course_extra.school.nil? %>
<%= @project.course_extra.teacher.user_extensions.school.try(:name) %>
<!-- modified by zjc 单位名称添加超链接 -->
<% unless @project.course_extra.teacher.user_extensions.school.nil? %>
<%= link_to @project.course_extra.teacher.user_extensions.school.try(:name),options={:controller => 'welcome',:action => 'course',:school_id => @project.course_extra.teacher.user_extensions.school.id}, html_options={:method => 'get'}%>
<% end %>
<%# end %>
<% end %>
</p>