From 4c87071765c721a24366633533e77d4813aa4d5a Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 20 Aug 2015 17:24:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 14 -------- app/controllers/users_controller.rb | 6 ++++ app/views/users/show.html.erb | 52 ++++++++++++++++++++++++----- db/schema.rb | 8 +---- 4 files changed, 50 insertions(+), 30 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 25536615a..acff52dc9 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -419,20 +419,6 @@ class AdminController < ApplicationController def messages_list @memo = Memo.reorder("created_at desc") -=begin - case params[:format] - when 'xml', 'json' - @offset, @limit = api_offset_and_limit({:limit => 30}) - else - @limit = 30#per_page_option - end - - @memo_count = @memo.count - @memo_pages = Paginator.new @memo_count, @limit, params['page'] - @offset ||= @memo_pages.offset - @memo = @memo.limit(@limit).offset(@offset).all -=end - respond_to do |format| format.html end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 058cf971f..2e3ec769d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -534,6 +534,12 @@ class UsersController < ApplicationController end def show + 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 render :layout=>'new_base_user' end diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 4975229eb..5e5082082 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -10,7 +10,7 @@
  • 作业动态
  • 通知动态
  • 论坛动态
  • -
  • 问卷动态
  • +
  • @@ -24,7 +24,40 @@
  • -
    + <% @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'%> +
    +
    用户头像
    +
    + + +
    + +
    截止时间:2015-08-20
    +
    +
    (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
    + +
    +
    +
    + <% end %> + <% end %> + <% end %> +
    用户头像
    @@ -34,7 +67,7 @@
    截止时间:2015-08-20
    (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
    -
    +
    -
    + +
    @@ -139,7 +173,7 @@
    用户头像
    - +
    很开心!
    @@ -147,7 +181,7 @@
    用户头像
    - +
    假期好热,没出去。
    @@ -199,7 +233,7 @@
    用户头像
    - +
    尹教授 2015-08-01删除
    请大家说下软件工程是什么!
    @@ -207,7 +241,7 @@
    用户头像
    - +
    软件工程是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科。它涉及程序设计语言、数据库、软件开发工具、系统平台、标准、设计模式等方面。
    diff --git a/db/schema.rb b/db/schema.rb index 7e3743b0e..c390dc2fe 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -474,13 +474,6 @@ ActiveRecord::Schema.define(:version => 20150820025358) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -893,6 +886,7 @@ ActiveRecord::Schema.define(:version => 20150820025358) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" + t.datetime "updated_on" end add_index "news", ["author_id"], :name => "index_news_on_author_id"