From bf12692de42d0a5320750570d7d4ff6c89786a65 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 27 May 2014 17:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8D=3D=3D=E3=80=8B?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7/=E9=82=AE=E7=AE=B1=20=E8=80=81=E5=B8=88?= =?UTF-8?q?=E5=9C=A8=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81=E4=B8=AD=E7=9C=8B?= =?UTF-8?q?=E5=88=B0=E5=AD=A6=E7=94=9F=E7=9C=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 5 +++++ app/helpers/application_helper.rb | 9 +++++++-- app/views/projects/show.html.erb | 14 ++++++++++++-- config/locales/en.yml | 2 +- config/locales/zh.yml | 2 +- .../redpenny-master/stylesheets/application.css | 2 +- 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a6dd7cf35..1cf14a830 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -716,6 +716,11 @@ class ProjectsController < ApplicationController @document = @project.documents.build # @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| format.html{render :layout => 'base_courses' if @base_courses_tag==1} format.api diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 76da3b684..7dc4b5556 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -58,9 +58,14 @@ module ApplicationHelper end # 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) - name = h(user.name(options[:format])) + if canShowRealName + name = h(user.realname(options[:format])) + else + name = h(user.name(options[:format])) + end + 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 else diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index eb66efc73..dfe8a10b9 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -18,7 +18,7 @@ <%= h(e.project) if @project.nil? || @project.id != e.project.id %> - <%= 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) %> <%= 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 @@ <% if format_date(day) == format_date(@date_to - @days) %> +

Test

@@ -80,7 +81,16 @@
- +
<%= link_to (h @user.try(:name)), user_path(@user) if @user %> <%= l(:label_user_create_project) %> <%= link_to @project.name %> ! + <% + #判断是否显示真名 + 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 %> !
<%= l :label_update_time %>: <%= format_time(@project.created_on) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index fd4368be8..22422c42b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -266,7 +266,7 @@ en: field_is_public: Public field_parent: Subproject of field_is_in_roadmap: Issues displayed in roadmap - field_login: Login + field_login: Account/Email field_mail_notification: Email notifications field_admin: Administrator field_last_login_on: Last connection diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 96b37e768..39749b698 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -284,7 +284,7 @@ zh: field_is_public: 公开 field_parent: 上级项目 field_is_in_roadmap: 在路线图中显示 - field_login: 登录名 + field_login: 账户/邮箱 field_mail_notification: 邮件通知 field_admin: 管理员 field_last_login_on: 最后登录 diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index a94ee45ba..7de766ce5 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -1001,7 +1001,7 @@ ol li ol li ol li padding:25px 28px; background:#fff; text-align:left; - width:410px; + width:420px; margin:10px auto; font-family:lucida grande,verdana; font-size:12px;