diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 72301754d..53fb21b8c 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -68,7 +68,7 @@ class BoardsController < ApplicationController end def show - #¶Ӧforge_messagesviewedֶ + # 讨论区消息状态更新(已读和未读) if @project query_forge_messages = @board.messages query_forge_messages.each do |query_forge_message| diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 770c36a58..4088d4156 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -34,20 +34,20 @@ class CommentsController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT end - # ������ض�̬�ļ�¼add start - if( @comment.id && @news.course ) - if(@news.author_id != User.current.id) - notify = ActivityNotify.new() - notify.activity_container_id = @news.course.id - notify.activity_container_type = 'Course' - notify.activity_id = @comment.id - notify.activity_type = 'Comment' - notify.notify_to = @news.author_id - notify.is_read = 0 - notify.save() - end - end - # ������ض�̬�ļ�¼add end + # # ������ض�̬�ļ�¼add start + # if( @comment.id && @news.course ) + # if(@news.author_id != User.current.id) + # notify = ActivityNotify.new() + # notify.activity_container_id = @news.course.id + # notify.activity_container_type = 'Course' + # notify.activity_id = @comment.id + # notify.activity_type = 'Comment' + # notify.notify_to = @news.author_id + # notify.is_read = 0 + # notify.save() + # end + # end + # # ������ض�̬�ļ�¼add end flash[:notice] = l(:label_comment_added) end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index c73e6bc93..b3624b14d 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -119,12 +119,14 @@ class IssuesController < ApplicationController end # 缺陷状态更新 query_journals = @issue.journals - if User.current.id == @issue.author_id query_journals.each do |query_journal| - query_journal.forge_messages.update_all(:viewed => true) + query_journal.forge_messages.each do |f| + if User.current.id == f.user_id + f.update_attributes(:viewed => true) + end + end end - end - # + # end @journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all @journals.each_with_index {|j,i| j.indice = i+1} @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 11d1d6e18..27e0d472f 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -115,10 +115,24 @@ class MemosController < ApplicationController REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE) def show - #更新贴吧帖子留言对应的memo_messages的viewed字段 + # 更新贴吧帖子留言对应的memo_messages的viewed字段 + unless @memo.children.blank? + @memo.children.each do |child| + child.memo_messages.each do |memo_message| + if User.current.id == memo_message.user_id + memo_message.update_attributes(:viewed => true) + end + end + end + end query_memo_messages = @memo.memo_messages - pre_count = REPLIES_PER_PAGE + query_memo_messages.each do |query_memo_message| + if User.current.id == query_memo_message.user_id + query_memo_message.update_attributes(:viewed => true) + end + end + pre_count = REPLIES_PER_PAGE @memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示 @memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1)) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index d445fc77c..d5c248f77 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -99,30 +99,32 @@ class NewsController < ApplicationController end def show - #更新news对应的forge_messages的viewed字段 - query_forge_news = @news.forge_messages - query_forge_news.each do |query| - if User.current.id == query.user_id - query.update_attributes(:viewed => true) - end + # 更新news对应的forge_messages的消息viewed字段 + if @project + query_message_news = @news.forge_messages + else + query_message_news = @news.course_messages end - #更新news对应的course_messages的viewed字段 - query_course_news = @news.course_messages - query_course_news.each do |query| - if User.current.id == query.user_id - query.update_attributes(:viewed => true) - end + query_message_news.each do |query| + if User.current.id == query.user_id + query.update_attributes(:viewed => true) + end end - #更新项目新闻的评阅的viewed字段 - current_forge_comments = @news.comments - current_forge_comments.each do |current_forge_comment| - query_forge_comment = current_forge_comment.forge_messages - query_forge_comment.each do |query| + # 更新项目新闻的评阅的消息viewed字段 + current_message_comments = @news.comments + current_message_comments.each do |current_message_comment| + if @project + query_message_comment = current_message_comment.forge_messages + else + query_message_comment = current_message_comment.course_messages + end + query_message_comment.each do |query| if User.current.id == query.user_id query.update_attributes(:viewed => true) end end end + # end cs = CoursesService.new result = cs.show_course_news params,User.current diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 1bbcf9bb4..a8f2a11f1 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -28,6 +28,7 @@ class PollController < ApplicationController render_403 return end + # 问卷消息状态更新 query_course_poll = @poll.course_messages query_course_poll.each do |query| if User.current.id == query.user_id diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ea4dc25a3..281924f55 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -126,46 +126,41 @@ class UsersController < ApplicationController end when 'homework' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") - @message_alls_count = @message_alls.count when 'course_message' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'forge_message' - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") - @message_alls_count = @message_alls.count + # when 'forge_message' + # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") + # @message_alls_count = @message_alls.count when 'course_news' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc") - @message_alls_count = @message_alls.count + # 课程通知包含发布的通知和回复的通知 + @message_alls = CourseMessage.where("course_message_type =? or course_message_type =?", "News", "Comment").where("user_id =?", @user).order("created_at desc") #@user_course_messages_count = @user_course_messages.count - when 'forge_news' - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'course_news_reply' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc") - when 'forge_news_reply' - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'poll' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'works_reviewers' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'works_reply' - @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") - @message_alls_count = @message_alls.count + # when 'forge_news' + # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") + # @message_alls_count = @message_alls.count + # when 'course_news_reply' + # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc") + # when 'forge_news_reply' + # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc") + # @message_alls_count = @message_alls.count + # when 'poll' + # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") + # @message_alls_count = @message_alls.count + # when 'works_reviewers' + # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") + # @message_alls_count = @message_alls.count + # when 'works_reply' + # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") + # @message_alls_count = @message_alls.count when 'issue' - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc") - @message_alls_count = @message_alls.count - when 'issue_update' # 缺陷状态更新、留言 - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") - @message_alls_count = @message_alls.count + @message_alls = ForgeMessage.where("forge_message_type =? or forge_message_type =?" , "Issue", "Journal").where("user_id=?", @user).order("created_at desc") + # when 'issue_update' # 缺陷状态更新、留言 + # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") + # @message_alls_count = @message_alls.count when 'forum' @message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") - @message_alls_count = @message_alls.count when 'user_feedback' @message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") - @message_alls_count = @message_alls.count else render_404 return @@ -542,6 +537,15 @@ class UsersController < ApplicationController # modified by fq def user_newfeedback + # 更新用户留言消息状态 + @user.journals_for_messages.each do |jour_message| + jour_message.user_feedback_messages.each do |userfeedback_message| + if User.current.id == userfeedback_message.user_id + userfeedback_message.update_attributes(:viewed => true) + end + end + end + # end jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') if User.current == @user jours.update_all(:is_readed => true, :status => false) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fcf28506a..ad9322cbc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -760,7 +760,8 @@ module ApplicationHelper options = args.extract_options! text = distance_of_time_in_words(Time.now, time) if @project - link_to(text, {:controller => 'activities', :action => 'index', :id => @project, :from => User.current.time_to_date(time)},options.reverse_merge(:title => format_time(time))) + content_tag('acronym', text, options.reverse_merge(:title => format_time(time))) + # link_to(text, {:controller => 'activities', :action => 'index', :id => @project, :from => User.current.time_to_date(time)},options.reverse_merge(:title => format_time(time))) else content_tag('acronym', text, options.reverse_merge(:title => format_time(time))) end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index b9f762f69..269630ec3 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -544,6 +544,10 @@ module UsersHelper #获取指定用户作为老师的课程 def get_as_teacher_courses user type = [] + option = [] + option << "请选择发布作业的课程" + option << -1 + type << option user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| option = [] option << course.name+"("+course.time.to_s+course.term+")" diff --git a/app/models/attachment.rb b/app/models/attachment.rb index f7fb9b1aa..47ab30cb1 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -73,7 +73,7 @@ class Attachment < ActiveRecord::Base cattr_accessor :thumbnails_storage_path @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") - before_save :files_to_final_location,:act_as_course_activity + before_save :files_to_final_location,:act_as_course_activity,:act_as_forge_activity after_create :office_conver, :be_user_score,:act_as_forge_activity after_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 6f775e7a2..c44b1aeee 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -202,24 +202,24 @@ class JournalsForMessage < ActiveRecord::Base # 用户留言消息通知 def act_as_user_feedback_message # 主留言 - receivers = [] - if self.reply_id == 0 - if self.user_id != self.jour_id # 过滤自己给自己的留言消息 - receivers << self.jour - end - else # 留言回复 - reply_to = User.find(self.reply_id) - if self.user_id != self.reply_id # 添加我回复的那个人 - receivers << reply_to - end - if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发 - receivers << self.parent.jour - end - end if self.jour_type == 'Principal' - receivers.each do |r| - self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false) + receivers = [] + if self.reply_id == 0 + if self.user_id != self.jour_id # 过滤自己给自己的留言消息 + receivers << self.jour end + else # 留言回复 + reply_to = User.find(self.reply_id) + if self.user_id != self.reply_id # 添加我回复的那个人 + receivers << reply_to + end + if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发 + receivers << self.parent.jour + end + end + receivers.each do |r| + self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false) + end end end diff --git a/app/models/user_feedback_message.rb b/app/models/user_feedback_message.rb index 1dda157d6..02335b8e2 100644 --- a/app/models/user_feedback_message.rb +++ b/app/models/user_feedback_message.rb @@ -8,7 +8,7 @@ class UserFeedbackMessage < ActiveRecord::Base validates :user_id,presence: true validates :journals_for_message_id,presence: true validates :journals_for_message_type, presence: true - after_create :add_user_message + after_save :add_user_message def add_user_message self.message_alls << MessageAll.new(:user_id => self.user_id) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index b8bbf3d63..f117acd7f 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -37,7 +37,7 @@ <% @topics.each do |topic| %>
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> -
+
<% author = topic.author.to_s %>
<%= link_to User.current.member_of_course?(@board.course) ? "#{topic.author.show_name}(#{topic.author.login})" : "#{topic.author}" , user_path(topic.author), @@ -48,7 +48,7 @@

  <%= h(topic.subject) %>

<% if topic.course_editable_by?(User.current) %> - <%= l(:button_edit) %> <% end %> @@ -120,7 +120,7 @@ <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %>
- <%= l(:button_reply) %> + <%= l(:button_reply) %>
@@ -171,7 +171,7 @@

- <%= format_time(message.created_on) %> + <%= format_time(message.created_on) %> <%= link_to( l(:button_delete), @@ -179,13 +179,13 @@ :method => :post, :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete), - :class => ' c_dblue fr f14' + :class => ' linkBlue fr f12' ) if message.course_destroyable_by?(User.current) %> <%= link_to( l(:button_reply), 'javascript:;', :nhname =>'showbtn_child_reply', - :class => ' c_dblue fr f14', + :class => ' linkBlue fr f12', :style => 'margin-right: 10px;', 'data-topic-id' =>message.id, :title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %> diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index cedc05f4b..c90dbf724 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -11,9 +11,11 @@ div.recall_con{width:570px;} div.recall_con .reply_btn{margin-left:525px;margin-top:5px;} -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> -
- <%# reply_allow = JournalsForMessage.create_by_user? User.current %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %> + +

<%= l(:label_leave_message) %>

<% if !User.current.logged?%> @@ -23,21 +25,15 @@
<% else %> - <%= form_for('new_form', :method => :post, - :url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%> - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%#= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;", - :placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%> - -

- <% end %> -
-
-
- 取  消 - - <%= l(:button_leave_meassge)%> - +
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'},:method => "post") do |f|%> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + +

+
+ 取消 + 留言 + <% end%>
<% end %>
@@ -54,106 +50,6 @@ diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index f5fb595e1..6fc0fff0e 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,16 +1,17 @@ -<% content_for :header_tags do %> - <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> - <%= javascript_include_tag 'homework','baiduTemplate' %> -<% end %> - +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> <%= error_messages_for 'homework_common' %> - +
+

+ <%= l(:label_course_homework_new)%> +

+
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> <%= hidden_field_tag "course",@course.id%> - <%= render :partial => 'homework_common/new_homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + 提交 + <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> <% end%>
- -
diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index a2ff03dd2..a68aa7575 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -50,19 +50,18 @@
<% count=0 %>
回复( - <% if activity.parent_id.nil? %> - <% count=activity.replies_count%> - <%=count %> - <% else %> - <% count=activity.parent.replies_count%> - <%=count %> + <% if activity.parent %> + <% count=activity.parent.children.count%> + <% else %> + <% count=activity.children.count%> <% end %> + <%= count %> )
<%#=format_date(activity.updated_on)%>
- <%if count>2 %> + <%if count > 2 %> <% end %> @@ -83,9 +82,9 @@
- <% activity= activity.parent_id.nil? ? activity:activity.parent%> + <% activity= activity.parent ? activity.parent : activity%> <% replies_all_i = 0 %> - <% unless activity.children.empty? %> + <% if count > 0 %>
    <% activity.children.reorder("created_on desc").each do |reply|%> @@ -102,17 +101,10 @@ <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_date(reply.created_on) %> - <%#= link_to( - l(:button_delete), - {:controller => 'messages', :action => 'destroy', :id => reply.id, :board_id => reply.board_id, :is_board => 'false'}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete), - :class => 'replyGrey fr ml10' - ) if reply.course_destroyable_by?(User.current) %> -
-
<%= reply.content.html_safe %>
+
+ <%= reply.content.html_safe %> +
diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 42475fde1..b01bdb791 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -18,29 +18,26 @@
发布时间:<%= format_date(activity.created_on) %>
-
通知描述:<%= activity.description.html_safe %>
- -
- +
+ 通知描述: + <%= activity.description.html_safe %>
- <% count=activity.comments_count %> -
回复(<%= count %>)
+ <% count=activity.comments.count %> +
+ 回复(<%= count %>) +
<%#= format_date(activity.updated_on) %>
<%if count>2 %> - + <% end %>
@@ -59,12 +56,12 @@
<% replies_all_i = 0 %> - <% unless activity.comments.empty? %> + <% if count > 0 %>
<%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> - <%= get_issue_priority(activity.priority_id)[1] %> + + <%= get_issue_priority(activity.priority_id)[1] %> +
指派给   @@ -26,7 +28,10 @@ <% end %> <% end %>
-
时间:<%=format_date(activity.created_on) %>
+
+ 时间: + <%=format_date(activity.created_on) %> +
缺陷描述: <% if activity.description? %> @@ -55,30 +60,21 @@ <% end %> <% end %>
-
- <% count=activity.journals.count %> + <% count = activity.journals.count %>
回复(<%= count %>)
<%#= format_date(activity.updated_on) %>
- <% if count>2 %> + <% if count > 2 %> + + 展开更多 + +
<% end %>
@@ -97,11 +93,11 @@ <% replies_all_i = 0 %> - <% unless activity.journals.empty? %> + <% if count > 0 %>
diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 7d563bdf7..7a6060433 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -33,34 +33,23 @@ <%= activity.parent.content.to_s.html_safe%> <% end %> -
-
<% count=0 %> +
+ <% count = 0 %>
回复( - <% if activity.parent_id.nil? %> - <% count=activity.replies_count%> - <%=count %> + <% if activity.parent %> + <% count=activity.parent.children.count%> <% else %> - <% count=activity.parent.replies_count%> - <%=count %> + <% count=activity.children.count%> <% end %> + <%=count %> )
<%#=format_date(activity.updated_on)%>
<%if count>2 %> - + <% end %>
@@ -81,7 +70,7 @@ <% activity= activity.parent_id.nil? ? activity : activity.parent %> <% replies_all_i = 0 %> - <% unless activity.children.empty? %> + <% if count > 0 %>
    <% activity.children.reorder("created_on desc").each do |reply| %> @@ -98,15 +87,6 @@ <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_date(reply.created_on) %> - <%#= link_to( - l(:button_delete), - {:controller => 'messages', :action => 'destroy', :id => reply.id, :board_id => reply.board_id, :is_board => 'false'}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete), - :class => 'replyGrey fr ml10' - ) if reply.course_destroyable_by?(User.current) %> -
<%= reply.content.html_safe %>
diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 661e0eade..f1529ffb8 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -9,6 +9,7 @@ span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} div.ke-toolbar .ke-outline{border:none;} .ke-inline-block{display: none;} + .ke-container{height: 40px !important;} <% user_activities.each do |user_activity| if user_activities %> @@ -60,5 +61,7 @@ <% end %> <% end %> <% end %> - -<%= link_to "点击展开更多",user_activities_path(@user.id),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> + +<% if user_activities.count == 10%> + <%= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%> +<% end%> diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index c6c17edf9..7be8811a4 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -1,6 +1,6 @@ <% content_for :header_tags do %> - <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> - <%= javascript_include_tag 'homework','baiduTemplate' %> + <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> + <%= javascript_include_tag 'homework','baiduTemplate' %> <% end %>
@@ -15,9 +15,12 @@
<%= calendar_for('homework_end_time')%> +
+

+
-
- - diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index fc6e723f2..076383607 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -52,6 +52,6 @@ <% end%> - - -<%= link_to "加载更多",user_homeworks_user_path(User.current.id),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%> \ No newline at end of file +<% if homework_commons.count == 10%> + <%= link_to "加载更多",user_homeworks_user_path(User.current.id,:page => page),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%> +<% end%> \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 76599739c..c1cd3723f 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,5 +1,4 @@ -
最新动态
-
-<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0} %> \ No newline at end of file +<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type} %> diff --git a/app/views/users/show.js.erb b/app/views/users/show.js.erb index f870b38b9..eb5de9c6a 100644 --- a/app/views/users/show.js.erb +++ b/app/views/users/show.js.erb @@ -1,4 +1,2 @@ -$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page} )%>"); -<% if @user_activities.count < 10%> -$("#show_more_activities").hide(); -<% end%> +$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type} )%>"); + diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb index 3e2a0abe7..e925ccd6b 100644 --- a/app/views/users/user_homeworks.html.erb +++ b/app/views/users/user_homeworks.html.erb @@ -12,16 +12,13 @@ } +
+
作业
+
+
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%> -
-
-
发布作业
-
-
-
-
<% homework = HomeworkCommon.new %> <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %> @@ -30,14 +27,6 @@
<% end%> - -<%else%> -
-
-
作业
-
-
-
<% 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 index a2e778a21..b6703dd43 100644 --- a/app/views/users/user_homeworks.js.erb +++ b/app/views/users/user_homeworks.js.erb @@ -1,4 +1,2 @@ $("#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%> + diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 207572a1c..d965c92e7 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -1,5 +1,4 @@ -
-
+
消息
  • @@ -20,15 +19,14 @@ <%# 项目相关消息 %> - +
  • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %>
  • <%# 系统贴吧 %> - +
  • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %>
-
<% if @message_alls.count >0 %> @@ -63,7 +61,7 @@
  • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
  • <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布了作业:
  • - <%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),:class => "newsGrey", :title => "#{ma.course_message.name}" %>
  • + <%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.name}" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -83,8 +81,9 @@
  • <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
  • <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>"><%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %>
  • - <%=link_to ma.course_message.subject.html_safe, course_boards_path(ma.course_message.course,:parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, - :topic_id => ma.course_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}", + <%= link_to ma.course_message.parent_id.nil? ? ma.course_message.subject.html_safe : ma.course_message.content.html_safe, + course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id), + :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.subject.html_safe}" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -96,7 +95,7 @@
  • <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>"><%= ma.status == 0 ? "评阅了作品:" : "重新评阅了作品:" %>
  • <% unless ma.content.nil? %> - <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),:class=>"newsGrey",:title => "#{ma.content.html_safe}" %>
  • + <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",:title => "#{ma.content.html_safe}" %> <% end %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -106,7 +105,7 @@
  • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
  • <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">回复了作品评论:
  • - <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id),:class=>"newsGrey",:title => "#{ma.course_message.notes}" %>
  • + <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",:title => "#{ma.course_message.notes}" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -152,7 +151,7 @@
  • <%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher" %> "><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %>
  • - <%=link_to ma.forge_message.subject.html_safe, project_boards_path(ma.forge_message.project, + <%=link_to ma.forge_message.parent_id.nil? ? ma.forge_message.subject.html_safe : ma.forge_message.content.html_safe, project_boards_path(ma.forge_message.project, :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id, :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}", :title => "#{ma.forge_message.subject.html_safe}" %>
  • @@ -169,7 +168,7 @@ ">发布了新闻:
  • - <%= link_to ("#{ma.forge_message.title.html_safe}"), {:controller => 'news', :action => 'show', :id => ma.forge_message.id}, :class => "newsGrey", :title => "#{ma.forge_message.title.html_safe}" %> + <%= link_to ("#{ma.forge_message.title.html_safe}"), {:controller => 'news', :action => 'show', :id => ma.forge_message.id}, :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.forge_message.title.html_safe}" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -198,7 +197,7 @@ " ><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %>
  • - <%= link_to ma.memo.subject, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id),:class => "newsGrey" , :title => "#{ma.memo.content.html_safe}" %> + <%= link_to ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content}" %>
  • <%= time_tag(ma.memo.created_at).html_safe %>
  • @@ -216,9 +215,10 @@ "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
  • - <%= link_to ma.journals_for_message.notes.html_safe, feedback_path(ma.journals_for_message.jour_id), :class => "newsGrey", :title => "#{ma.journals_for_message.notes}" %> + <%= link_to ma.journals_for_message.notes.html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.journals_for_message.notes}" %>
  • <%= time_tag(ma.journals_for_message.created_on).html_safe %>
  • + <% end %> <% end %> @@ -246,4 +246,3 @@ - diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index c8196c90f..60e630959 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -10,11 +10,10 @@ div.ke-toolbar .ke-outline{border:none;}
    -
    -
    +
    留言
    -
    +
    diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index c0049db88..096d6e8f5 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -42,8 +42,7 @@ $("#upload_form").submit(); } -
    -
    +
    资源库
    • @@ -67,7 +66,7 @@
    -
    +
    diff --git a/app/views/users/user_select_homework.js.erb b/app/views/users/user_select_homework.js.erb index 945da4c9a..a18fdacc8 100644 --- a/app/views/users/user_select_homework.js.erb +++ b/app/views/users/user_select_homework.js.erb @@ -5,3 +5,4 @@ $("#homework_end_time").val("<%= @homework.end_time%>"); $("#course_id").val("<%= @homework.course_id%>"); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework })%>"); homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>"); +$("#homework_editor").show(); diff --git a/db/migrate/20150831070611_about_memo_message.rb b/db/migrate/20150831070611_about_memo_message.rb new file mode 100644 index 000000000..fde94d2f9 --- /dev/null +++ b/db/migrate/20150831070611_about_memo_message.rb @@ -0,0 +1,36 @@ +class AboutMemoMessage < ActiveRecord::Migration + def up + Memo.all.each do |memo| + transaction do + # 贴吧帖子 + receivers = [] + u = User.find(6) + receivers << u + # 主贴 + if memo.parent_id.nil? + if memo.author_id != memo.forum.creator_id # 发帖人不是吧主 + receivers << memo.forum.creator + end + else # 回帖 + # 添加吧主 + if memo.author_id != memo.forum.creator_id + receivers << memo.forum.creator + end + # 添加发帖人 + unless memo.parent.nil? + if memo.author_id != memo.parent.author_id + receivers << memo.parent.author + puts memo.id + end + end + end + receivers.each do |r| + memo.memo_messages << MemoMessage.new(:user_id => r.id, :forum_id => memo.forum_id, :memo_id => memo.id, :memo_type => "Memo", :viewed => true) + end + end + end + end + + def down + end +end diff --git a/db/migrate/20150831093918_about_user_feedback_message.rb b/db/migrate/20150831093918_about_user_feedback_message.rb new file mode 100644 index 000000000..d021bc3ad --- /dev/null +++ b/db/migrate/20150831093918_about_user_feedback_message.rb @@ -0,0 +1,36 @@ +class AboutUserFeedbackMessage < ActiveRecord::Migration + def up + JournalsForMessage.all.each do |jour_for_message| + transaction do + # 主留言 + if jour_for_message.jour_type == 'Principal' + receivers = [] + if jour_for_message.reply_id == 0 + if jour_for_message.user_id != jour_for_message.jour_id # 过滤自己给自己的留言消息 + receivers << jour_for_message.jour + end + else # 留言回复 + reply_to = User.find(jour_for_message.reply_id) + if jour_for_message.user_id != jour_for_message.reply_id # 添加我回复的那个人 + receivers << reply_to + end + unless jour_for_message.parent.nil? + if jour_for_message.user_id != jour_for_message.parent.jour_id && jour_for_message.reply_id != jour_for_message.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发 + receivers << jour_for_message.parent.jour + end + end + end + unless receivers.blank? + receivers.each do |r| + puts jour_for_message.id + jour_for_message.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => jour_for_message.id, :journals_for_message_type => "Principal", :viewed => true) + end + end + end + end + end + end + + def down + end +end diff --git a/db/migrate/20150901004812_update_memo_message_time.rb b/db/migrate/20150901004812_update_memo_message_time.rb new file mode 100644 index 000000000..e512282a0 --- /dev/null +++ b/db/migrate/20150901004812_update_memo_message_time.rb @@ -0,0 +1,26 @@ +class UpdateMemoMessageTime < ActiveRecord::Migration + def up + memo_count = Memo.all.count / 30 + 1 + transaction do + for i in 1 ... memo_count do i + MemoMessage.page(i).per(30).each do |memo_message| + if memo_message.memo + if memo_message.memo.respond_to?("created_at") + memo_message.created_at = memo_message.memo.created_at + elsif memo_message.memo.respond_to?("created_on") + memo_message.created_at = memo_message.memo.created_on + end + memo_message.save + + memo_messages = MessageAll.where("message_type = '#{memo_message.class.to_s}' and message_id = '#{memo_message.id}'").first + memo_messages.created_at = memo_message.created_at + memo_messages.save + end + end + end + end + end + + def down + end +end diff --git a/db/migrate/20150901004910_update_userfeeback_message_time.rb b/db/migrate/20150901004910_update_userfeeback_message_time.rb new file mode 100644 index 000000000..686bc496e --- /dev/null +++ b/db/migrate/20150901004910_update_userfeeback_message_time.rb @@ -0,0 +1,27 @@ +class UpdateUserfeebackMessageTime < ActiveRecord::Migration + def up + user_feedback_count = UserFeedbackMessage.all.count / 30 + 1 + transaction do + for i in 1 ... user_feedback_count do i + UserFeedbackMessage.page(i).per(30).each do |ufm| + if ufm.journals_for_message + if ufm.journals_for_message.respond_to?("created_at") + ufm.created_at = ufm.journals_for_message.created_at + elsif ufm.journals_for_message.respond_to?("created_on") + ufm.created_at = ufm.journals_for_message.created_on + end + puts ufm.id + ufm.save + + user_feedback_messages = MessageAll.where("message_type = '#{ufm.class.to_s}' and message_id = '#{ufm.id}'").first + user_feedback_messages.created_at = ufm.created_at + user_feedback_messages.save + end + end + end + end + end + + def down + end +end diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index 98dfc470b..26cd088c4 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -3536,8 +3536,8 @@ function _getInitHtml(themesPath, bodyClass, cssPath, cssData) { (_direction === '' ? '' : ''), '', '