Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
a894326227
|
@ -6,6 +6,7 @@ class ActivityNotifysController < ApplicationController
|
|||
# accept_rss_auth :index, :show
|
||||
|
||||
helper :activities
|
||||
helper :attachments
|
||||
def index
|
||||
query = nil
|
||||
if @course
|
||||
|
|
|
@ -34,6 +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
|
||||
flash[:notice] = l(:label_comment_added)
|
||||
end
|
||||
|
||||
|
|
|
@ -141,6 +141,21 @@ class NewsController < ApplicationController
|
|||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
|
||||
end
|
||||
# 与我相关动态的记录add start
|
||||
teachers = searchTeacherAndAssistant(@course)
|
||||
for teacher in teachers
|
||||
if(teacher.user_id != User.current.id)
|
||||
notify = ActivityNotify.new()
|
||||
notify.activity_container_id = @course.id
|
||||
notify.activity_container_type = 'Course'
|
||||
notify.activity_id = @news.id
|
||||
notify.activity_type = 'News'
|
||||
notify.notify_to = teacher.user_id
|
||||
notify.is_read = 0
|
||||
notify.save()
|
||||
end
|
||||
end
|
||||
# 与我相关动态的记录add end
|
||||
render_attachment_warning_if_needed(@news)
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to course_news_index_url(@course)
|
||||
|
|
|
@ -19,6 +19,14 @@ class Comment < ActiveRecord::Base
|
|||
include Redmine::SafeAttributes
|
||||
include ApplicationHelper
|
||||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
||||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
acts_as_event :datetime => :updated_on,
|
||||
:description => :comments,
|
||||
:type => 'news',
|
||||
:title=>Proc.new {|o| "RE: #{o.commented.title}" },
|
||||
:url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.commented.id} }
|
||||
|
||||
belongs_to :commented, :polymorphic => true, :counter_cache => true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
validates_presence_of :commented, :author, :comments
|
||||
|
@ -38,4 +46,17 @@ class Comment < ActiveRecord::Base
|
|||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::COMMENT
|
||||
end
|
||||
|
||||
def set_notify_id(notify_id)
|
||||
@notify_id= notify_id
|
||||
end
|
||||
def get_notify_id()
|
||||
return @notify_id
|
||||
end
|
||||
def set_notify_is_read(notify_is_read)
|
||||
@notify_is_read = notify_is_read
|
||||
end
|
||||
def get_notify_is_read()
|
||||
return @notify_is_read
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,6 +30,8 @@ class News < ActiveRecord::Base
|
|||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
|
||||
validates_presence_of :title, :description
|
||||
validates_length_of :title, :maximum => 60
|
||||
validates_length_of :summary, :maximum => 255
|
||||
|
@ -85,6 +87,19 @@ class News < ActiveRecord::Base
|
|||
#description
|
||||
end
|
||||
|
||||
def set_notify_id(notify_id)
|
||||
@notify_id= notify_id
|
||||
end
|
||||
def get_notify_id()
|
||||
return @notify_id
|
||||
end
|
||||
def set_notify_is_read(notify_is_read)
|
||||
@notify_is_read = notify_is_read
|
||||
end
|
||||
def get_notify_is_read()
|
||||
return @notify_is_read
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_author_as_watcher
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="ping_distop">
|
||||
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
||||
<span>
|
||||
<%= link_to journal.user.show_name, user_path(journal.user),:class => 'c_blue fb fl mb10', :target => "_blank"%>
|
||||
<%= link_to "#{journal.user.show_name}(#{journal.user.login})", user_path(journal.user),:class => 'c_blue fb fl mb10', :target => "_blank"%>
|
||||
</span>
|
||||
<span class="c_grey fr">
|
||||
<%= format_time(journal.created_on) %>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="ping_discon" style="width: 85%;">
|
||||
<div class="ping_distop">
|
||||
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
||||
<span><%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(journal.created_on) %></span>
|
||||
<span><%= link_to "#{journal.user.show_name}(#{journal.user.login})", user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(journal.created_on) %></span>
|
||||
<div class="cl"></div>
|
||||
<!--<p><%#= textilizable journal.notes%></p>-->
|
||||
<p><%=journal.notes.html_safe%></p>
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
</div>
|
||||
<div class="recall_con">
|
||||
<% id = 'project_respond_form_'+ reply.id.to_s %>
|
||||
<%= link_to reply.user.show_name, user_path(reply.user) %>
|
||||
<%= link_to "#{reply.user.show_name}(#{reply.user.login})", user_path(reply.user) %>
|
||||
<%= l(:label_reply_to)%>
|
||||
<% if show_name %>
|
||||
<%= link_to parent_jour.user.show_name, user_path(parent_jour.user) %>
|
||||
<%= link_to "#{parent_jour.user.show_name}(#{parent_jour.user.login})", user_path(parent_jour.user) %>
|
||||
<% else %>
|
||||
<%= l(:label_anonymous) %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue