From e1fb2a6babe5a21eb0ac3dd7d2d6758ddbf7b92c Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 21 Aug 2015 16:07:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=E5=8A=A8?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 11 +- app/views/users/_course_news.html.erb | 36 +++ app/views/users/show.html.erb | 423 +++++++++++++------------- app/views/users/show_chen.erb | 279 +++++++++++++++++ public/stylesheets/new_public.css | 2 +- 5 files changed, 538 insertions(+), 213 deletions(-) create mode 100644 app/views/users/_course_news.html.erb create mode 100644 app/views/users/show_chen.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2e3ec769d..e6e4f96d7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -534,12 +534,13 @@ class UsersController < ApplicationController end def show - if @user == User.current + #if @user == User.current + @user_activities = UserActivity.where("(container_type='Course' and container_id in (select course_id FROM members WHERE user_id=#{@user.id})) or (container_type='Project' and container_id in (SELECT project_id FROM members WHERE user_id=#{@user.id}))").order('created_at desc') -=begin - SELECT * FROM user_activities WHERE (container_type='Course' AND container_id IN (SELECT course_id FROM members WHERE user_id=4)) OR (container_type='Project' AND container_id IN (SELECT project_id FROM members WHERE user_id=4)) -=end - end + + #SELECT * FROM user_activities WHERE (container_type='Course' AND container_id IN (SELECT course_id FROM members WHERE user_id=4)) OR (container_type='Project' AND container_id IN (SELECT project_id FROM members WHERE user_id=4)) + #else + #end render :layout=>'new_base_user' end diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb new file mode 100644 index 000000000..f57e05e34 --- /dev/null +++ b/app/views/users/_course_news.html.erb @@ -0,0 +1,36 @@ +
+
+
+ <%= link_to image_tag(url_to_avatar(@activity.author), :width => "90", :height => "90"), user_path(@activity.author_id), :alt => "用户头像" %> + +
+
+
+ <% if @activity.try(:author).try(:realname) == ' ' %> + <%= link_to @activity.try(:author), user_path(@activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to @activity.try(:author).try(:realname), user_path(@activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= @activity.course.name %>(课程名称) +
+ +
+
发布时间:<%= format_date(@activity.created_on) %>
+
+
(通知描述)<%= @activity.description.html_safe %>
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 5e5082082..416c5485c 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -24,23 +24,81 @@ - <% @user_activities.each do |user_activity| unless @user_activities.nil? %> - <% case user_activity.act_type.to_s%> - <% when 'CourseActivity'%> - <% @course_act= CourseActivity.where("id=#{user_activity.act_id}").first%> - <% case @course_act.course_act_type.to_s %> - <% when 'HomeworkCommon'%> -
-
用户头像
+
+<% @user_activities.each do |user_activity| + unless @user_activities.nil? %> + <% case user_activity.act_type.to_s %> + <% when 'CourseActivity' %> + <% @course_act= CourseActivity.where("id=#{user_activity.act_id}").first %> + <% case @course_act.course_act_type.to_s %> + <% when 'HomeworkCommon' %> + <% @activity=HomeworkCommon.where("id=#{@course_act.course_act_id}").first %> +
+
+
+ <%= link_to image_tag(url_to_avatar(@activity.user), :width => "90", :height => "90"), user_path(@activity.user_id), :alt => "用户头像" %> + +
+
+
+ <% if @activity.try(:user).try(:realname) == ' ' %> + <%= link_to @activity.try(:user), user_path(@activity.user_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to @activity.try(:user).try(:realname), user_path(@activity.user_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= @activity.course.name %>(课程名称) +
+ +
+ +
截止时间:<%= format_date(@activity.end_time) %>
+
+
(作业描述)<%= @activity.description.html_safe %>
+ +
+
+
+
+ <% when 'News' %> + <% @activity=News.where("id=#{@course_act.course_act_id}").first %> + + <% when 'Message'%> + <% @activity=Message.where("id=#{@course_act.course_act_id}").first %> + <% if @activity.parent_id.nil? %> +
+
+
+ 用户头像 +
- - +
+ <% if @activity.try(:author).try(:realname) == ' ' %> + <%= link_to @activity.try(:author), user_path(@activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to @activity.try(:author).try(:realname), user_path(@activity.author_id), :class => "newsBlue mr15" %> + <% end %> + TO + <%= @activity.course.name %>(课程讨论区) +
+
- -
截止时间:2015-08-20
+
时间:<%= format_date(@activity.created_on) %>
-
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
- - <% end %> - <% end %> +
+
+
回复(<%=@activity.replies_count %>)
+
2015-07-31
+ +
+
+ +
+
+ + + +
+
+
+
+ 用户头像 +
+
+
+ 黄井泉 学生 + 2015-08-01删除 +
+
很开心!
+
+
+
+
+
+ 用户头像 +
+
+
+ 陈正东 学生 + 2015-08-02删除 +
+
假期好热,没出去。
+
+
+
+
+
+ <% end %> + <% end %> + <% when 'ForgeActivity' %> + <% @project_act= ForgeActivity.where("id=#{user_activity.act_id}").first %> + <% case @project_act.forge_act_type.to_s %> + <% when 'Issue' %> + <% @activity=Issue.where("id=#{@project_act.forge_act_id}").first %> +
+
+
+ <%= link_to image_tag(url_to_avatar(@activity.author), :width => "90", :height => "90"), user_path(@activity.author_id), :alt => "用户头像" %> + +
+
+
+ <% if @activity.try(:author).try(:realname) == ' ' %> + <%= link_to @activity.try(:author), user_path(@activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to @activity.try(:author).try(:realname), user_path(@activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%=@activity.project.name %>(项目名称)
+
+ <%=@activity.subject %>(缺陷标题)<%=@activity.status.name %> +
+ +
(缺陷描述)<%=@activity.description.html_safe %>
+
+ 文件附件.zip(123KB) +
+
+ 图片附件.png(123KB) +
+ +
+
+
+
+
+
回复(5)
+
2015-07-26
+ +
+
+ +
+
+ + + +
+
+
+
+ 用户头像 +
+
+
+ 尹教授 + 2015-08-01删除 +
+
请大家说下软件工程是什么!
+
+
+
+
+
+ 用户头像 +
+
+
+ Tang 学生 + 2015-08-01删除 +
+
软件工程是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科。它涉及程序设计语言、数据库、软件开发工具、系统平台、标准、设计模式等方面。
+
+
+
+
+
+ <% when 'Message' %> + <% end %> <% end %> -
-
用户头像
-
- - -
- -
截止时间:2015-08-20
-
-
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
- -
-
-
- - -
-
-
-
用户头像
-
- - -
-
时间:2015-07-31
-
-
- -
-
-
-
-
-
-
回复(5)
-
2015-07-31
- -
-
- -
-
- - - -
-
-
-
用户头像
-
- -
很开心!
-
-
-
-
-
用户头像
-
- -
假期好热,没出去。
-
-
-
-
-
-
-
-
用户头像
-
- - -
-
指派给  苏稳
-
时间:2015-08-20
-
-
(缺陷描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
- - -
- -
-
-
-
-
-
-
回复(5)
-
2015-07-26
- -
-
- -
-
- - - -
-
-
-
用户头像
-
-
尹教授 2015-08-01删除
-
请大家说下软件工程是什么!
-
-
-
-
-
用户头像
-
- -
软件工程是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科。它涉及程序设计语言、数据库、软件开发工具、系统平台、标准、设计模式等方面。
-
-
-
-
-
\ No newline at end of file +<% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/show_chen.erb b/app/views/users/show_chen.erb new file mode 100644 index 000000000..74b303fad --- /dev/null +++ b/app/views/users/show_chen.erb @@ -0,0 +1,279 @@ +
+
+
最新动态
+ +
+ +
+
+ 用户头像
+
+ + +
+ +
截止时间:2015-08-20
+
+
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
+ +
+
+
+
+
+
+
+ 用户头像
+
+ + +
+ +
截止时间:2015-08-20
+
+
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
+ +
+
+
+
+ + + +
+
+
+ 用户头像
+
+ + +
+
时间:2015-07-31
+
+
+ +
+
+
+
+
+
+
回复(5)
+
2015-07-31
+ +
+
+ +
+
+ + + +
+
+
+
+ 用户头像 +
+
+
黄井泉 学生 + 2015-08-01删除 +
+
很开心!
+
+
+
+
+
+ 用户头像 +
+
+
陈正东 学生 + 2015-08-02删除 +
+
假期好热,没出去。
+
+
+
+
+
+
+
+
+ 用户头像
+
+ + +
+
指派给  苏稳 +
+
时间:2015-08-20
+
+
(缺陷描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
+
+ 文件附件.zip(123KB) +
+
+ 图片附件.png(123KB) +
+
+ +
+
+
+
+
+
+
回复(5)
+
2015-07-26
+ +
+
+ +
+
+ + + +
+
+
+
+ 用户头像 +
+
+
尹教授 + 2015-08-01删除 +
+
请大家说下软件工程是什么!
+
+
+
+
+
+ 用户头像 +
+
+
Tang 学生 + 2015-08-01删除 +
+
软件工程是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科。它涉及程序设计语言、数据库、软件开发工具、系统平台、标准、设计模式等方面。
+
+
+
+
+
\ No newline at end of file diff --git a/public/stylesheets/new_public.css b/public/stylesheets/new_public.css index 17057eabb..b71ff9604 100644 --- a/public/stylesheets/new_public.css +++ b/public/stylesheets/new_public.css @@ -471,7 +471,7 @@ a.postTypeGrey:hover {color:#15bccf;} .homepagePostTo {font-size:14px; color:#484848; margin-bottom:15px;} .homepagePostTitle {font-size:14px; color:#484848; margin-bottom:15px;} .homepagePostSubmitContainer {height:30px; margin-bottom:15px;} -.homepagePostSubmit {font-size:14px; color:#888888; width:80px; height:30px; text-align:center; vertical-align:middle; line-height:30px; border:1px solid #dddddd; background-color:#eaeaea; float:left; margin-right:20px;} +.homepagePostSubmit {font-size:14px; color:#888888; width:90px; height:30px; text-align:center; vertical-align:middle; line-height:30px; border:1px solid #dddddd; background-color:#eaeaea; float:left; margin-right:20px;} .homepagePostSubmit:hover {background-color:#d8d8d8;} .homepagePostIntro {font-size:12px; color:#888888;} .homepagePostDeadline {font-size:12px; color:#888888; float:left; height:30px; line-height:30px; vertical-align:middle;}