diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 6b421bf2a..1efbc9c48 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -49,8 +49,11 @@ class CommentsController < ApplicationController # end # # ������ض�̬�ļ�¼add end flash[:notice] = l(:label_comment_added) + course_activity = CourseActivity.where("course_act_type='News' and course_act_id =#{@news.id}").first + course_activity.updated_at = Time.now + course_activity.save user_activity = UserActivity.where("act_type='News' and act_id =#{@news.id}").first - user_activity.updated_at = @comment.created_on + user_activity.updated_at = Time.now user_activity.save end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index b30715a1f..e12d4886a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -8,7 +8,7 @@ class CoursesController < ApplicationController helper :attachments helper :activity_notifys - before_filter :auth_login1, :only => [:show, :feedback] + before_filter :auth_login1, :only => [:show, :course_activity, :feedback] menu_item :overview menu_item :feedback, :only => :feedback menu_item :homework, :only => :homework @@ -610,11 +610,37 @@ class CoursesController < ApplicationController end end + def course_activity + redirect_to course_url(@course, type: params[:type], page: params[:page]) + end + def show - course_activities = @course.course_activities.order("created_at desc") + course_activities = @course.course_activities @canShowRealName = User.current.member_of_course? @course - @course_activities = paginateHelper course_activities,10 + @page = params[:page] ? params[:page].to_i + 1 : 0 + if params[:type].present? + case params[:type] + when "homework" + @course_activities = course_activities.where("course_act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10) + when "news" + @course_activities = course_activities.where("course_act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10) + when "message" + @course_activities = course_activities.where("course_act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) + when "poll" + @course_activities = course_activities.where("course_act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10) + when "attachment" + @course_activities = course_activities.where("course_act_type = 'Attachment'").order('updated_at desc').limit(10).offset(@page * 10) + when "journalsForMessage" + @course_activities = course_activities.where("course_act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10) + else + @course_activities = course_activities.order('updated_at desc').limit(10).offset(@page * 10) + end + else + @course_activities = course_activities.order('updated_at desc').limit(10).offset(@page * 10) + end + @type = params[:type] respond_to do |format| + format.js format.html{render :layout => 'base_courses'} format.api end diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 2c7df84cf..c6ac8b906 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -162,6 +162,9 @@ class MessagesController < ApplicationController @reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] # @reply.reply_id = params[:id] @topic.children << @reply + course_activity = CourseActivity.where("course_act_type='Message' and course_act_id =#{@topic.id}").first + course_activity.updated_at = Time.now + course_activity.save user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first user_activity.updated_at = Time.now user_activity.save diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 77304c1b1..a0ce8d18e 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -53,7 +53,15 @@ class WordsController < ApplicationController :notes => content, :is_readed => false} @jfm = add_reply_adapter options - + @save_succ = true if @jfm.errors.empty? + if @save_succ + course_activity = CourseActivity.where("course_act_type='JournalsForMessage' and course_act_id =#{parent_id}").first + course_activity.updated_at = Time.now + course_activity.save + user_activity = UserActivity.where("act_type='JournalsForMessage' and act_id =#{parent_id}").first + user_activity.updated_at = Time.now + user_activity.save + end respond_to do |format| # format.html { # if @jfm.errors.empty? @@ -63,10 +71,12 @@ class WordsController < ApplicationController # end # render 'test/index' # } - format.js{ - @save_succ = true if @jfm.errors.empty? + format.js { + @user_activity_id = params[:user_activity_id] if + @activity = JournalsForMessage.find(parent_id) } end + end def destroy diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 81ada2f80..dde34abfd 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -185,7 +185,7 @@ class JournalsForMessage < ActiveRecord::Base #课程动态公共表记录 def act_as_course_activity - if self.jour_type == 'Course' + if self.jour_type == 'Course' && self.m_parent_id.nil? self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.jour_id) end end diff --git a/app/models/message.rb b/app/models/message.rb index 2c46857f8..7af59815b 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -194,7 +194,7 @@ class Message < ActiveRecord::Base #课程动态公共表记录 def act_as_course_activity - if self.course + if self.course && self.parent_id.nil? self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.board.course_id) end end diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb new file mode 100644 index 000000000..1a033b372 --- /dev/null +++ b/app/views/courses/_course_activity.html.erb @@ -0,0 +1,108 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %> + +<% course_activities.each do |activity| if course_activities %> + + <% if activity %> + <% act = activity.course_act %> + <% case activity.course_act_type.to_s %> + <% when 'HomeworkCommon' %> + <%= render :partial => 'users/course_homework', :locals => {:activity => act, :user_activity_id => activity.id} %> + <% when 'News' %> + <%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %> + <% when 'Message' %> + <%= render :partial => 'users/course_message', :locals => {:activity => act, :user_activity_id => activity.id} %> + <% when 'Poll' %> + <%= render :partial => 'users/course_poll', :locals => {:activity => act, :user_activity_id => activity.id} %> + <% when 'JournalsForMessage' %> + <%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => activity.id} %> + <% when 'Attachment' %> + <%= render :partial => 'users/course_attachment', :locals => {:activity => act, :user_activity_id => activity.id} %> + <% when 'Course' %> + <%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => activity.id} %> + <% end %> + <% end %> + <% end %> +<% end %> + +<% if course_activities.count == 10 %> +
展开更多<%= link_to "", course_activity_path(@course.id, :type => type, :page => page), :id => "more_course_activities_link", :remote => "true", :class => "none" %>
+<% end %> + + \ No newline at end of file diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index eceb29f34..bc6dcacfa 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -1,83 +1,32 @@ -
-

<%= l(:label_activity)%>

-
- -<%@course_activities.each do |activity|%> -
- - <%= image_tag(url_to_avatar(activity.user), :width => "42", :height => "42") %> - -
- <%= link_to_user_header(activity.user,false,:class => 'problem_name c_orange fl') %> -   - <%= activity.course_act_type == "Course" ? "创建了课程" : l(:label_new_activity) %>: - <%#= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link, - :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, - 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", - 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> - <%#if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%> - - <%#end%> - <%= link_to course_activity_link activity%> -
-

- <%= course_activity_desc activity%> -
-

- <%= activity.course_act_type == "Course" ? l(:label_create_time) : l(:label_activity_time) %> : <%= format_time(activity.created_at) %> -

- <%= link_to_attachments_course(activity.course_act) if activity.course_act_type.to_s == "News" %> -
-
-
-<% end%> - - -
- + + +
+
+
课程动态
+ +
+ <%= render :partial => 'courses/course_activity', :locals => {:course_activities => @course_activities,:page => 0,:type => @type} %> +
\ No newline at end of file diff --git a/app/views/courses/show.js.erb b/app/views/courses/show.js.erb new file mode 100644 index 000000000..3f82dcf3a --- /dev/null +++ b/app/views/courses/show.js.erb @@ -0,0 +1 @@ +$("#show_more_course_activities").replaceWith("<%= escape_javascript( render :partial => 'courses/course_activity',:locals => {:course_activities => @course_activities, :page => @page,:type => @type} )%>"); diff --git a/app/views/courses/show_old.html.erb b/app/views/courses/show_old.html.erb new file mode 100644 index 000000000..608d41f9d --- /dev/null +++ b/app/views/courses/show_old.html.erb @@ -0,0 +1,83 @@ +
+

<%= l(:label_activity)%>

+
+ +<%@course_activities.each do |activity|%> +
+ + <%= image_tag(url_to_avatar(activity.user), :width => "42", :height => "42") %> + +
+ <%= link_to_user_header(activity.user,false,:class => 'problem_name c_orange fl') %> +   + <%= activity.course_act_type == "Course" ? "创建了课程" : l(:label_new_activity) %>: + <%#= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link, + :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, + 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", + 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> + <%#if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%> + + <%#end%> + <%= link_to course_activity_link activity%> +
+

+ <%= course_activity_desc activity%> +
+

+ <%= activity.course_act_type == "Course" ? l(:label_create_time) : l(:label_activity_time) %> : <%= format_time(activity.created_at) %> +

+ <%= link_to_attachments_course(activity.course_act) if activity.course_act_type.to_s == "News" %> +
+
+
+<% end%> + + +
+ + diff --git a/app/views/forums/_forum_list.html.erb b/app/views/forums/_forum_list.html.erb index 286219356..7934a80fe 100644 --- a/app/views/forums/_forum_list.html.erb +++ b/app/views/forums/_forum_list.html.erb @@ -2,15 +2,15 @@ <% if forums.any? %> <% forums.each do |forum| %>
-
+
<%= link_to image_tag(url_to_avatar(forum.creator),:width=>75,:height => 75 ),user_path( forum.creator) %>
- - <%= link_to forum.name, forum_path(forum),:class=>"f16 linkBlue" %> + <%=forum.name.gsub(/(\r\n)/,'
').html_safe %>
+ <%#= link_to forum.name.gsub(/(\r\n|\s+)/,'
'), forum_path(forum),:class=>"f16 linkBlue" %>
-
<%= textAreailizable forum.description%>
+
<%= textAreailizable forum.description%>
diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb index 366291691..52309912e 100644 --- a/app/views/layouts/base_forums.html.erb +++ b/app/views/layouts/base_forums.html.erb @@ -21,7 +21,7 @@ function edit_desc(){ if(<%=@forum.creator.id == User.current.id%>) { desc = $("#forum_desc_span").html(); - $("#forum_desc_span").html(""); + $("#forum_desc_span").html(""); $("#forum_desc_input").focus(); } } @@ -149,15 +149,14 @@
-
<%= @forum.name%>
+
<%= @forum.name%>
-
<%= @forum.description%> +
<%= @forum.description.html_safe%> <%if @forum.creator.id == User.current.id%> - <%= image_tag('signature_edit.png',{:width=>12,:height=>12})%> <%end%> diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index 807fb2caa..9f77b248d 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -14,7 +14,7 @@ <%= csrf_meta_tag %> <%= favicon %> -<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new',prettify,'users', :media => 'all' %> +<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new','prettify','users', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= javascript_include_tag "avatars",'prettify'%> diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index b86838c0b..7583eb4a4 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -25,7 +25,7 @@ <%= render :partial => 'layouts/unlogin_header' %> <% end%>
- +
diff --git a/app/views/memos/_attachments_links.html.erb b/app/views/memos/_attachments_links.html.erb index 15473e6e7..ca0f41d16 100644 --- a/app/views/memos/_attachments_links.html.erb +++ b/app/views/memos/_attachments_links.html.erb @@ -1,4 +1,4 @@ -
+
<% for attachment in attachments %> @@ -20,43 +20,13 @@
<% else %> - <%= link_to_short_attachment attachment, :class => 'fl FilesName02', :download => true, :length => 32 -%> + <%= link_to_short_attachment attachment, :class => 'fl FilesName02', :download => true, :length => 45 -%> (<%= number_to_human_size attachment.filesize , :precision => 0 %>) <% if options[:deletable] %> - <%#= link_to image_tag('delete.png'), attachment_path(attachment), - :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :class => 'delete', - #:remote => true, - #:id => "attachments_" + attachment.id.to_s, - :title => l(:button_delete) %> <% end %>
<% end %> - - <%# if attachment.is_text? %> - <%#= link_to image_tag('magnifier.png'), - :controller => 'attachments', - :action => 'show', - :id => attachment, - :filename => attachment.filename%> - <%# end %> - - - - - - - - - - - <%#= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author) %> - - - - <% end %> <% if defined?(thumbnails) && thumbnails %> <% images = attachments.select(&:thumbnailable?) %> diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 133a90547..550c7a4fe 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -30,6 +30,14 @@ $(function() { init_activity_KindEditor_data(<%= @memo.id%>,null,"87%"); }); + + function del_confirm(){ + if(confirm('确认删除么?')){ + $("#del_link").click(); + }else{ + + } + }
@@ -43,24 +51,25 @@
  • <%end%> - +
    <%= format_date( @memo.created_at)%>
    <%= render :partial => "memos/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%>
    -
    +
    <%= @memo.content.html_safe%>
    -
    +
    <% if @memo.attachments.any?%> <% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %> <%= render :partial => 'attachments_links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %> diff --git a/app/views/users/_course_attachment.html.erb b/app/views/users/_course_attachment.html.erb index 41961f05b..386e6d177 100644 --- a/app/views/users/_course_attachment.html.erb +++ b/app/views/users/_course_attachment.html.erb @@ -1,28 +1,29 @@
    -
    +
    - <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), 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" %> - + TO + <%= link_to activity.course.name.to_s+" | 课程资源", course_files_path(activity.course), :class => "newsBlue ml15" %>
    -
    - <%=activity.filename.to_s(附件名称)%> +
    + <%= link_to activity.filename, course_files_path(activity.course), :class => "postGrey" %>
    -
    时间:<%= format_date(activity.created_on) %>
    +
    + 文件大小: + <%= number_to_human_size activity.filesize%> +
    +
    上传时间:<%= format_time(activity.created_on) %>
    -
    (附件描述)<%=activity.description.to_s%>
    -