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
|
# accept_rss_auth :index, :show
|
||||||
|
|
||||||
helper :activities
|
helper :activities
|
||||||
|
helper :attachments
|
||||||
def index
|
def index
|
||||||
query = nil
|
query = nil
|
||||||
if @course
|
if @course
|
||||||
|
|
|
@ -34,6 +34,20 @@ class CommentsController < ApplicationController
|
||||||
ids = params[:asset_id].split(',')
|
ids = params[:asset_id].split(',')
|
||||||
update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT
|
update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT
|
||||||
end
|
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)
|
flash[:notice] = l(:label_comment_added)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,21 @@ class NewsController < ApplicationController
|
||||||
ids = params[:asset_id].split(',')
|
ids = params[:asset_id].split(',')
|
||||||
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
|
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
|
||||||
end
|
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)
|
render_attachment_warning_if_needed(@news)
|
||||||
flash[:notice] = l(:notice_successful_create)
|
flash[:notice] = l(:notice_successful_create)
|
||||||
redirect_to course_news_index_url(@course)
|
redirect_to course_news_index_url(@course)
|
||||||
|
|
|
@ -19,6 +19,14 @@ class Comment < ActiveRecord::Base
|
||||||
include Redmine::SafeAttributes
|
include Redmine::SafeAttributes
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
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 :commented, :polymorphic => true, :counter_cache => true
|
||||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||||
validates_presence_of :commented, :author, :comments
|
validates_presence_of :commented, :author, :comments
|
||||||
|
@ -38,4 +46,17 @@ class Comment < ActiveRecord::Base
|
||||||
def delete_kindeditor_assets
|
def delete_kindeditor_assets
|
||||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::COMMENT
|
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::COMMENT
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -30,6 +30,8 @@ class News < ActiveRecord::Base
|
||||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||||
|
|
||||||
validates_presence_of :title, :description
|
validates_presence_of :title, :description
|
||||||
validates_length_of :title, :maximum => 60
|
validates_length_of :title, :maximum => 60
|
||||||
validates_length_of :summary, :maximum => 255
|
validates_length_of :summary, :maximum => 255
|
||||||
|
@ -85,6 +87,19 @@ class News < ActiveRecord::Base
|
||||||
#description
|
#description
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def add_author_as_watcher
|
def add_author_as_watcher
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<div class="ping_distop">
|
<div class="ping_distop">
|
||||||
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
||||||
<span>
|
<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>
|
||||||
<span class="c_grey fr">
|
<span class="c_grey fr">
|
||||||
<%= format_time(journal.created_on) %>
|
<%= format_time(journal.created_on) %>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<div class="ping_discon" style="width: 85%;">
|
<div class="ping_discon" style="width: 85%;">
|
||||||
<div class="ping_distop">
|
<div class="ping_distop">
|
||||||
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
<!-- <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>
|
<div class="cl"></div>
|
||||||
<!--<p><%#= textilizable journal.notes%></p>-->
|
<!--<p><%#= textilizable journal.notes%></p>-->
|
||||||
<p><%=journal.notes.html_safe%></p>
|
<p><%=journal.notes.html_safe%></p>
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="recall_con">
|
<div class="recall_con">
|
||||||
<% id = 'project_respond_form_'+ reply.id.to_s %>
|
<% 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)%>
|
<%= l(:label_reply_to)%>
|
||||||
<% if show_name %>
|
<% 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 %>
|
<% else %>
|
||||||
<%= l(:label_anonymous) %>
|
<%= l(:label_anonymous) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue