登录名==》账号/邮箱

老师在课程动态中看到学生真名
This commit is contained in:
z9hang 2014-05-27 17:04:29 +08:00
parent ddf5590c54
commit bf12692de4
6 changed files with 27 additions and 7 deletions

View File

@ -716,6 +716,11 @@ class ProjectsController < ApplicationController
@document = @project.documents.build @document = @project.documents.build
# #
@base_courses_tag = @project.project_type @base_courses_tag = @project.project_type
#判断能否显示真名(当前用户为课程的教师时显示真名)
if @project.project_type == Project::ProjectType_course
@teachers= searchTeacherAndAssistant(@project)
@canShowRealName = isCourseTeacher(User.current.id)
end
respond_to do |format| respond_to do |format|
format.html{render :layout => 'base_courses' if @base_courses_tag==1} format.html{render :layout => 'base_courses' if @base_courses_tag==1}
format.api format.api

View File

@ -58,9 +58,14 @@ module ApplicationHelper
end end
# Displays a link to user's account page if active # Displays a link to user's account page if active
def link_to_user(user, options={}) def link_to_user(user, canShowRealName = false, options={})
if user.is_a?(User) if user.is_a?(User)
if canShowRealName
name = h(user.realname(options[:format]))
else
name = h(user.name(options[:format])) name = h(user.name(options[:format]))
end
if user.active? || (User.current.admin? && user.logged?) if user.active? || (User.current.admin? && user.logged?)
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes
else else

View File

@ -18,7 +18,7 @@
<td colspan="2" valign="top"> <td colspan="2" valign="top">
<strong> <%= h(e.project) if @project.nil? || @project.id != e.project.id %></strong> <strong> <%= h(e.project) if @project.nil? || @project.id != e.project.id %></strong>
<span class="font_lighter"> <span class="font_lighter">
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> <%= link_to_user(e.event_author,@canShowRealName) if e.respond_to?(:event_author) %>
<%= l(:label_new_activity) %> </span> <%= l(:label_new_activity) %> </span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Project)) ? project_files_path(e.container) : e.event_url %> <%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Project)) ? project_files_path(e.container) : e.event_url %>
@ -46,6 +46,7 @@
<!-- Added by Longjun 在最后一页显示创建信息 --> <!-- Added by Longjun 在最后一页显示创建信息 -->
<% if format_date(day) == format_date(@date_to - @days) %> <% if format_date(day) == format_date(@date_to - @days) %>
<h1>Test</h1>
<div > <div >
<table width="660"> <table width="660">
<tr> <tr>
@ -80,7 +81,16 @@
<td colspan="2"> <td colspan="2">
<table width="580"> <table width="580">
<tr> <tr>
<td > <%= link_to (h @user.try(:name)), user_path(@user) if @user %> <%= l(:label_user_create_project) %> <%= link_to @project.name %><strong> !</strong></td> <td >
<%
#判断是否显示真名
if @canShowRealName
%>
<%= link_to (h @user.try(:realname)), user_path(@user) if @user %>
<% else %>
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>
<% end %>
<%= l(:label_user_create_project) %> <%= link_to @project.name %><strong> !</strong></td>
</tr> </tr>
<tr> <tr>
<td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@project.created_on) %> <td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@project.created_on) %>

View File

@ -266,7 +266,7 @@ en:
field_is_public: Public field_is_public: Public
field_parent: Subproject of field_parent: Subproject of
field_is_in_roadmap: Issues displayed in roadmap field_is_in_roadmap: Issues displayed in roadmap
field_login: Login field_login: Account/Email
field_mail_notification: Email notifications field_mail_notification: Email notifications
field_admin: Administrator field_admin: Administrator
field_last_login_on: Last connection field_last_login_on: Last connection

View File

@ -284,7 +284,7 @@ zh:
field_is_public: 公开 field_is_public: 公开
field_parent: 上级项目 field_parent: 上级项目
field_is_in_roadmap: 在路线图中显示 field_is_in_roadmap: 在路线图中显示
field_login: 登录名 field_login: 账户/邮箱
field_mail_notification: 邮件通知 field_mail_notification: 邮件通知
field_admin: 管理员 field_admin: 管理员
field_last_login_on: 最后登录 field_last_login_on: 最后登录

View File

@ -1001,7 +1001,7 @@ ol li ol li ol li
padding:25px 28px; padding:25px 28px;
background:#fff; background:#fff;
text-align:left; text-align:left;
width:410px; width:420px;
margin:10px auto; margin:10px auto;
font-family:lucida grande,verdana; font-family:lucida grande,verdana;
font-size:12px; font-size:12px;