From d8b87ccc378ae97b3f67959702c53ed8bb03f1e2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 25 Aug 2015 19:18:56 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=88=B0=E5=BA=95=E9=83=A8=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8B=E9=9D=A210=E6=9D=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 5 +- app/views/users/_user_homework_list.html.erb | 55 ++++++++++++++++ app/views/users/user_homeworks.html.erb | 69 +++++--------------- app/views/users/user_homeworks.js.erb | 4 ++ 4 files changed, 78 insertions(+), 55 deletions(-) create mode 100644 app/views/users/_user_homework_list.html.erb create mode 100644 app/views/users/user_homeworks.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 22d8deb0c..e724f7a9c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -305,10 +305,11 @@ class UsersController < ApplicationController #用户作业列表 def user_homeworks + @page = params[:page] ? params[:page].to_i + 1 : 0 user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" - homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc") - @homework_commons = paginateHelper homework_commons,10 + @homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10) respond_to do |format| + format.js format.html {render :layout => 'new_base_user'} end end diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb new file mode 100644 index 000000000..6476f9e71 --- /dev/null +++ b/app/views/users/_user_homework_list.html.erb @@ -0,0 +1,55 @@ +<% homework_commons.each do |homework_common|%> + <% is_teacher = User.current.allowed_to?(:as_teacher,homework_common.course) %> +
+
+
+ <%=link_to image_tag(url_to_avatar(homework_common.user),width:"90px", height: "90px"), user_activities_path(homework_common.user.id)%> +
+
+
+ <%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%> + TO + <%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%> +
+
+ <%= link_to homework_common.name,student_work_index_path(:homework => homework_common.id),:class => "postGrey"%> +
+ +
+
+ <%= user_for_homework_common homework_common,is_teacher %> +
+
+ <%= l(:label_end_time)%>:<%= homework_common.end_time%> +
+
+
+ <%= homework_common.description.html_safe %> +
+
+ <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %> +
+
+ <% if is_teacher%> +
+
    +
  • +
      +
    • + <%= link_to l(:button_edit),edit_homework_common_path(homework_common), :class => "postOptionLink"%> +
    • +
    • + <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> +
    • +
    +
  • +
+
+ <% end%> +
+
+
+
+<% end%> + + \ No newline at end of file diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb index a6032a60b..19ecf3588 100644 --- a/app/views/users/user_homeworks.html.erb +++ b/app/views/users/user_homeworks.html.erb @@ -1,3 +1,18 @@ + + <% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
@@ -42,56 +57,4 @@
<% end%> -<% @homework_commons.each do |homework_common|%> - <% is_teacher = User.current.allowed_to?(:as_teacher,homework_common.course) %> -
-
-
- <%=link_to image_tag(url_to_avatar(homework_common.user),width:"90px", height: "90px"), user_activities_path(homework_common.user.id)%> -
-
-
- <%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%> - TO - <%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%> -
-
- <%= link_to homework_common.name,student_work_index_path(:homework => homework_common.id),:class => "postGrey"%> -
- -
-
- <%= user_for_homework_common homework_common,is_teacher %> -
-
- <%= l(:label_end_time)%>:<%= homework_common.end_time%> -
-
-
- <%= homework_common.description.html_safe %> -
-
- <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %> -
-
- <% if is_teacher%> -
-
    -
  • -
      -
    • - <%= link_to l(:button_edit),edit_homework_common_path(homework_common), :class => "postOptionLink"%> -
    • -
    • - <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> -
    • -
    -
  • -
-
- <% end%> -
-
-
-
-<% end%> +<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0} %> diff --git a/app/views/users/user_homeworks.js.erb b/app/views/users/user_homeworks.js.erb new file mode 100644 index 000000000..a2e778a21 --- /dev/null +++ b/app/views/users/user_homeworks.js.erb @@ -0,0 +1,4 @@ +$("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'users/user_homework_list',:locals => {:homework_commons => @homework_commons, :page => @page} )%>"); +<% if @homework_commons.count < 10%> + $(window).off("scroll", scrollHandler); +<% end%> From bd00870eba121c542a1030136c0de0f5bf100ebb Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 25 Aug 2015 19:24:23 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 20 +++++- app/views/users/_course_attachment.html.erb | 39 ++++++++++++ app/views/users/_course_create.html.erb | 29 +++++++++ .../users/_course_journalsformessage.html.erb | 29 +++++++++ app/views/users/_course_poll.html.erb | 39 ++++++++++++ app/views/users/_project_attachment.html.erb | 29 +++++++++ app/views/users/_project_create.html.erb | 29 +++++++++ app/views/users/_project_document.html.erb | 29 +++++++++ app/views/users/_project_journal.html.erb | 29 +++++++++ app/views/users/_project_news.html.erb | 29 +++++++++ app/views/users/show.html.erb | 62 +++++++++++++------ db/schema.rb | 8 +-- 12 files changed, 344 insertions(+), 27 deletions(-) create mode 100644 app/views/users/_course_attachment.html.erb create mode 100644 app/views/users/_course_create.html.erb create mode 100644 app/views/users/_course_journalsformessage.html.erb create mode 100644 app/views/users/_course_poll.html.erb create mode 100644 app/views/users/_project_attachment.html.erb create mode 100644 app/views/users/_project_create.html.erb create mode 100644 app/views/users/_project_document.html.erb create mode 100644 app/views/users/_project_journal.html.erb create mode 100644 app/views/users/_project_news.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 22d8deb0c..919093556 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -550,9 +550,27 @@ class UsersController < ApplicationController def show @page = (params[:page] || -1).to_i + 1 + @type = params[:type] user_project_ids = "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")" user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" - @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids}) or (container_type = 'Course' and container_id in #{user_course_ids})").order('created_at desc').limit(10).offset(@page * 10) + if @type + case @type + when "course_homework" + @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('created_at desc').limit(10).offset(@page * 10) + when "course_news" + @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('created_at desc').limit(10).offset(@page * 10) + when "course_message" + @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) + when "project_issue" + @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10) + when "project_message" + @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) + end + else + course_types = "('Message','News','HomeworkCommon')" + project_types = "('Message','Issue')" + @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) + end # @user_activities = paginateHelper @user_activities,500 render :layout=>'new_base_user' end diff --git a/app/views/users/_course_attachment.html.erb b/app/views/users/_course_attachment.html.erb new file mode 100644 index 000000000..d58ef5655 --- /dev/null +++ b/app/views/users/_course_attachment.html.erb @@ -0,0 +1,39 @@ +
+
+
+ + <%= 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 + <%= link_to activity.course.name.to_s+"(课程名称)", course_path(activity.container_id), :class => "newsBlue ml15", :style=>"word-break:break-all" %> + +
+ +
+
时间:<%= format_date(activity.created_on) %>
+
+
(附件描述)<%=activity.description.to_s%>
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/users/_course_create.html.erb b/app/views/users/_course_create.html.erb new file mode 100644 index 000000000..4d26b523a --- /dev/null +++ b/app/views/users/_course_create.html.erb @@ -0,0 +1,29 @@ +
+
+
+ 用户头像
+
+ + +
+ +
截止时间:2015-08-20
+
+
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb new file mode 100644 index 000000000..6b53d44eb --- /dev/null +++ b/app/views/users/_course_journalsformessage.html.erb @@ -0,0 +1,29 @@ +
+
+
+ 用户头像
+
+ + +
+ +
截止时间:2015-08-20
+
+
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb new file mode 100644 index 000000000..f76b6d0ae --- /dev/null +++ b/app/views/users/_course_poll.html.erb @@ -0,0 +1,39 @@ +
+
+
+ + <%= 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 + <%= link_to Course.find(activity.polls_group_id).name.to_s+"(课程名称)", course_path(activity.polls_group_id), :class => "newsBlue ml15", :style=>"word-break:break-all" %> + +
+ +
+
时间:<%= format_date(activity.created_at) %>
+
+
(问卷描述)<%=activity.polls_description.to_s%>
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/users/_project_attachment.html.erb b/app/views/users/_project_attachment.html.erb new file mode 100644 index 000000000..742d9acd4 --- /dev/null +++ b/app/views/users/_project_attachment.html.erb @@ -0,0 +1,29 @@ +
+
+
+ 用户头像
+
+ + +
+ +
截止时间:2015-08-20
+
+
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/users/_project_create.html.erb b/app/views/users/_project_create.html.erb new file mode 100644 index 000000000..795c8f2a8 --- /dev/null +++ b/app/views/users/_project_create.html.erb @@ -0,0 +1,29 @@ +
+
+
+ 用户头像
+
+ + +
+ +
截止时间:2015-08-20
+
+
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/users/_project_document.html.erb b/app/views/users/_project_document.html.erb new file mode 100644 index 000000000..082963d36 --- /dev/null +++ b/app/views/users/_project_document.html.erb @@ -0,0 +1,29 @@ +
+
+
+ 用户头像
+
+ + +
+ +
截止时间:2015-08-20
+
+
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/users/_project_journal.html.erb b/app/views/users/_project_journal.html.erb new file mode 100644 index 000000000..f16b09c66 --- /dev/null +++ b/app/views/users/_project_journal.html.erb @@ -0,0 +1,29 @@ +
+
+
+ 用户头像
+
+ + +
+ +
截止时间:2015-08-20
+
+
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb new file mode 100644 index 000000000..8bc1b5422 --- /dev/null +++ b/app/views/users/_project_news.html.erb @@ -0,0 +1,29 @@ +
+
+
+ 用户头像
+
+ + +
+ +
截止时间:2015-08-20
+
+
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index b30a51c4b..5189017ba 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -7,17 +7,22 @@
  • @@ -27,28 +32,47 @@ <% @user_activities.each do |user_activity| unless @user_activities.nil? %> - <% act= user_activity.act %> - <% case user_activity.act_type.to_s %> - <% when 'CourseActivity' %> + <% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %> + <% case user_activity.container_type.to_s %> + <% when 'Course' %> <% if act %> - <% activity= act.course_act %> - <% case act.course_act_type.to_s %> + <% case user_activity.act_type.to_s %> <% when 'HomeworkCommon' %> - <%= render :partial => 'course_homework', :locals => {:activity => activity,:user_activity =>user_activity} %> + <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity =>user_activity} %> <% when 'News' %> - <%= render :partial => 'course_news', :locals => {:activity => activity,:user_activity =>user_activity} %> + <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity =>user_activity} %> <% when 'Message'%> - <%= render :partial => 'course_message', :locals => {:activity => activity,:user_activity =>user_activity} %> + <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'Course'%> + <%#= render :partial => 'course_create', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'Attachment' %> + <%#= render :partial => 'course_attachment', :locals => {:activity => act, :user_activity => user_activity} %> + <%# when 'JournalsForMessage' %> + <%#= render :partial => 'course_journalsformessage', :locals => {:activity => act, :user_activity => user_activity} %> + <%# when 'Poll' %> + <%#= render :partial => 'course_poll', :locals => {:activity => act, :user_activity => user_activity} %> <% end %> <% end %> - <% when 'ForgeActivity' %> - <% activity= act.forge_act unless act.forge_act_type == "ProjectCreateInfo" %> - <% case act.forge_act_type.to_s %> + <% when 'Project' %> + <% case user_activity.act_type.to_s %> <% when 'Issue' %> - <%= render :partial => 'project_issue', :locals => {:activity => activity,:user_activity =>user_activity} %> + <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity =>user_activity} %> <% when 'Message' %> - <%= render :partial => 'project_message', :locals => {:activity => activity,:user_activity =>user_activity} %> + <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'Journal' %> + <%#= render :partial => 'project_journal', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'News' %> + <%#= render :partial => 'project_news', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'Document' %> + <%#= render :partial => 'project_document', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'Attachment' %> + <%#= render :partial => 'project_attachment', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'ProjectCreateInfo' %> + <%#= render :partial => 'project_create', :locals => {:activity => act,:user_activity =>user_activity} %> <% end %> <% end %> <% end %> -<% end %> \ No newline at end of file +<% end %> + \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 1c77ff04b..4639c07ec 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 @@ -903,6 +896,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" From fce523606c486de99f07be4dade361b2f8986959 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 25 Aug 2015 20:08:52 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 11 ++-- app/views/users/_user_activities.html.erb | 44 ++++++++++++++++ app/views/users/show.html.erb | 61 ++++++----------------- app/views/users/show.js.erb | 4 ++ 4 files changed, 71 insertions(+), 49 deletions(-) create mode 100644 app/views/users/_user_activities.html.erb create mode 100644 app/views/users/show.js.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 505a3dd9a..a12fa37e4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -552,10 +552,10 @@ class UsersController < ApplicationController end def show - @page = (params[:page] || -1).to_i + 1 + @page = params[:page] ? params[:page].to_i + 1 : 0 @type = params[:type] - user_project_ids = "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")" - user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" + user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")" + user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" if @type case @type when "course_homework" @@ -575,7 +575,10 @@ class UsersController < ApplicationController @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) end # @user_activities = paginateHelper @user_activities,500 - render :layout=>'new_base_user' + respond_to do |format| + format.js + format.html {render :layout => 'new_base_user'} + end end def show_old diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb new file mode 100644 index 000000000..60992c384 --- /dev/null +++ b/app/views/users/_user_activities.html.erb @@ -0,0 +1,44 @@ +<% user_activities.each do |user_activity| + unless user_activities.nil? %> + <% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %> + <% case user_activity.container_type.to_s %> + <% when 'Course' %> + <% if act %> + <% case user_activity.act_type.to_s %> + <% when 'HomeworkCommon' %> + <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity =>user_activity} %> + <% when 'News' %> + <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity =>user_activity} %> + <% when 'Message'%> + <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'Course'%> + <%#= render :partial => 'course_create', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'Attachment' %> + <%#= render :partial => 'course_attachment', :locals => {:activity => act, :user_activity => user_activity} %> + <%# when 'JournalsForMessage' %> + <%#= render :partial => 'course_journalsformessage', :locals => {:activity => act, :user_activity => user_activity} %> + <%# when 'Poll' %> + <%#= render :partial => 'course_poll', :locals => {:activity => act, :user_activity => user_activity} %> + <% end %> + <% end %> + <% when 'Project' %> + <% case user_activity.act_type.to_s %> + <% when 'Issue' %> + <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity =>user_activity} %> + <% when 'Message' %> + <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'Journal' %> + <%#= render :partial => 'project_journal', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'News' %> + <%#= render :partial => 'project_news', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'Document' %> + <%#= render :partial => 'project_document', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'Attachment' %> + <%#= render :partial => 'project_attachment', :locals => {:activity => act,:user_activity =>user_activity} %> + <%# when 'ProjectCreateInfo' %> + <%#= render :partial => 'project_create', :locals => {:activity => act,:user_activity =>user_activity} %> + <% end %> + <% end %> + <% end %> +<% end %> + \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 5189017ba..e650130ff 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,3 +1,18 @@ + +
    最新动态
    @@ -30,49 +45,5 @@
    -<% @user_activities.each do |user_activity| - unless @user_activities.nil? %> - <% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %> - <% case user_activity.container_type.to_s %> - <% when 'Course' %> - <% if act %> - <% case user_activity.act_type.to_s %> - <% when 'HomeworkCommon' %> - <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity =>user_activity} %> - <% when 'News' %> - <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity =>user_activity} %> - <% when 'Message'%> - <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity =>user_activity} %> - <%# when 'Course'%> - <%#= render :partial => 'course_create', :locals => {:activity => act,:user_activity =>user_activity} %> - <%# when 'Attachment' %> - <%#= render :partial => 'course_attachment', :locals => {:activity => act, :user_activity => user_activity} %> - <%# when 'JournalsForMessage' %> - <%#= render :partial => 'course_journalsformessage', :locals => {:activity => act, :user_activity => user_activity} %> - <%# when 'Poll' %> - <%#= render :partial => 'course_poll', :locals => {:activity => act, :user_activity => user_activity} %> - <% end %> - <% end %> - <% when 'Project' %> - <% case user_activity.act_type.to_s %> - <% when 'Issue' %> - <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity =>user_activity} %> - <% when 'Message' %> - <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity =>user_activity} %> - <%# when 'Journal' %> - <%#= render :partial => 'project_journal', :locals => {:activity => act,:user_activity =>user_activity} %> - <%# when 'News' %> - <%#= render :partial => 'project_news', :locals => {:activity => act,:user_activity =>user_activity} %> - <%# when 'Document' %> - <%#= render :partial => 'project_document', :locals => {:activity => act,:user_activity =>user_activity} %> - <%# when 'Attachment' %> - <%#= render :partial => 'project_attachment', :locals => {:activity => act,:user_activity =>user_activity} %> - <%# when 'ProjectCreateInfo' %> - <%#= render :partial => 'project_create', :locals => {:activity => act,:user_activity =>user_activity} %> - <% end %> - <% end %> -<% end %> -<% end %> - \ No newline at end of file +<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => @page} %> \ No newline at end of file diff --git a/app/views/users/show.js.erb b/app/views/users/show.js.erb new file mode 100644 index 000000000..0ce84cf0e --- /dev/null +++ b/app/views/users/show.js.erb @@ -0,0 +1,4 @@ +$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page} )%>"); +<% if @user_activities.count < 10%> +$(window).off("scroll", scrollHandler); +<% end%> From cccc0577c7a79794c0d9f5e621ff7c75a1cd2156 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 26 Aug 2015 08:51:39 +0800 Subject: [PATCH 4/4] =?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/views/users/show.html.erb | 4 +++- public/stylesheets/new_user.css | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index e650130ff..d0e8351ee 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -3,7 +3,8 @@ if ($(window).scrollTop() == $(document).height() - $(window).height()) { $.get( '<%= user_activities_path(@user.id)%>', - { page : $("#show_more_activities").val()}, + { page : $("#show_more_activities").val(), + type: $("#user_activities_type").val()}, function (data) { } @@ -13,6 +14,7 @@ $(window).scroll(scrollHandler); +
    最新动态
    diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index a526b0266..fb16d39c5 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -578,7 +578,7 @@ a.postOptionLink:hover {color:#ffffff; background-color:#15bccf;} .homepagePostReplyDes {float:left; width:595px; margin-left:15px;} .homepagePostReplyPublisher {font-size:12px; color:#484848; margin-bottom:12px;} .homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;} -.homepagePostProjectState {width:42px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;} +.homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;} .homepagePostAssignTo {float:left; font-size:14px; color:#15bccf; height:30px; line-height:30px; vertical-align:middle;} .homepagePostFileAtt {height:22px; line-height:22px; vertical-align:middle; background:url(../images/homepage_icon.png) -85px -150px no-repeat; padding-left:35px; font-size:14px; margin-right:25px;} .homepagePostImageAtt {height:22px; line-height:22px; vertical-align:middle; background:url(../images/homepage_icon.png) -86px -195px no-repeat; padding-left:35px; font-size:14px; margin-right:25px;}