Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
f5de071191
|
@ -13,11 +13,11 @@
|
|||
<% course=Course.find(activity.jour_id) %>
|
||||
<%= link_to course.name.to_s+" | 课程留言", course_feedback_path(course), :class => "newsBlue ml15" %>
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word">
|
||||
<div class="homepagePostTitle break_word list_style upload_img">
|
||||
<% if activity.m_parent_id.nil? %>
|
||||
<%= link_to activity.notes.to_s, course_feedback_path(course), :class => "postGrey" %>
|
||||
<%= link_to activity.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
|
||||
<% else %>
|
||||
<%= link_to activity.parent.notes.to_s, course_feedback_path(course), :class => "postGrey" %>
|
||||
<%= link_to activity.parent.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostDate">
|
||||
|
@ -62,7 +62,7 @@
|
|||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style"><%= comment.notes.html_safe %></div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img"><%= comment.notes.html_safe %></div>
|
||||
<% fetch_user_leaveWord_reply(comment).each do |reply| unless fetch_user_leaveWord_reply(comment).nil? %>
|
||||
<div class="recall">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
|
@ -83,7 +83,7 @@
|
|||
<% end %>
|
||||
<%= format_time reply.created_on %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style"><%= reply.notes.html_safe %></div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img"><%= reply.notes.html_safe %></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style">
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img">
|
||||
<%= reply.content.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<% end %>
|
||||
<%= format_time(comment.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style"><%= comment.comments.html_safe %></div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img"><%= comment.comments.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word">
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img">
|
||||
<% if reply.details.any? %>
|
||||
<% details_to_strings(reply.details).each do |string| %>
|
||||
<p><%= string %></p>
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style"><%= reply.content.html_safe %></div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img"><%= reply.content.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
class AlterActivities < ActiveRecord::Migration
|
||||
def up
|
||||
UserActivity.all.each do |activity|
|
||||
if activity.act_type == 'JournalsForMessage'
|
||||
if activity.act
|
||||
unless activity.act.m_parent_id.nil?
|
||||
parent_act = UserActivity.where("act_id = #{activity.act.parent.id} and act_type='JournalsForMessage' and container_type='Course'").first
|
||||
if parent_act
|
||||
parent_act.created_at = activity.act.parent.children.maximum("created_on")
|
||||
parent_act.save
|
||||
activity.destroy
|
||||
end
|
||||
end
|
||||
else
|
||||
activity.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
CourseActivity.all.each do |activity|
|
||||
if activity.course_act_type == 'JournalsForMessage'
|
||||
if activity.course_act
|
||||
unless activity.course_act.m_parent_id.nil?
|
||||
parent_act = CourseActivity.where("course_act_id = #{activity.course_act.parent.id} and course_act_type='JournalsForMessage'").first
|
||||
if parent_act
|
||||
parent_act.created_at = activity.course_act.parent.children.maximum("created_on")
|
||||
parent_act.save
|
||||
activity.destroy
|
||||
end
|
||||
end
|
||||
else
|
||||
activity.destroy
|
||||
end
|
||||
elsif activity.course_act_type == 'Message'
|
||||
if activity.course_act
|
||||
unless activity.course_act.parent_id.nil?
|
||||
parent_act = CourseActivity.where("course_act_id = #{activity.course_act.parent.id} and course_act_type='Message'").first
|
||||
if parent_act
|
||||
parent_act.created_at = activity.course_act.parent.children.maximum("created_on")
|
||||
parent_act.save
|
||||
activity.destroy
|
||||
end
|
||||
end
|
||||
else
|
||||
activity.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
class UpdateCourseActivitiesUpdatedAt < ActiveRecord::Migration
|
||||
def up
|
||||
count = CourseActivity.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
CourseActivity.page(i).per(30).each do |activity|
|
||||
activity.updated_at = activity.created_at
|
||||
activity.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
1724
db/schema.rb
1724
db/schema.rb
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue