课程导语发送这改成课堂使者

This commit is contained in:
huang 2016-03-17 15:12:28 +08:00
parent dcadadae03
commit 42d89c7ed0
5 changed files with 28 additions and 35 deletions

View File

@ -71,7 +71,8 @@ class CourseActivity < ActiveRecord::Base
name = lead_message.subject
content = lead_message.content
# message的status状态为0为正常为1表示创建课程时发送的message
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true )
# author_id 默认为课程使者创建
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => 1 , :sticky => true, :status => true )
# 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直
message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) if message.course_acts.first
end

View File

@ -34,11 +34,7 @@
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @topic.id%>').show();" onmouseout="$('#message_setting_<%= @topic.id%>').hide();">
<div class="postThemeContainer">
<div class="postDetailPortrait">
<% if @topic.status == 1 %>
<%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %>
<% else %>
<%= link_to image_tag(url_to_avatar(@topic.author), :width => 50, :height => 50,:alt=>'图像' ), user_path(@topic.author) %>
<% end %>
<%= link_to image_tag(url_to_avatar(@topic.author), :width => 50, :height => 50,:alt=>'图像' ), user_path(@topic.author) %>
</div>
<div class="postThemeWrap">
<% if User.current.logged? %>
@ -74,16 +70,11 @@
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @topic.subject%></a>
</div>
<div class="cl"></div>
<div class="postDetailCreater">
<% if @topic.status == 1 %>
<span class="fontBlue2">确实团队</span>
<% if @topic.try(:author).try(:realname) == ' ' %>
<%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% else %>
<% if @topic.try(:author).try(:realname) == ' ' %>
<%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% else %>
<%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% end %>
<%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% end %>
</div>
<div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div>

View File

@ -1,23 +1,15 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" onmouseover="$('#message_setting_<%= user_activity_id%>').show();" onmouseout="$('#message_setting_<%= user_activity_id%>').hide();">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<% if activity.status == 1 %>
<%= image_tag("/images/trustie_logo1.png", width: "50px", height: "50px") %>
<% else %>
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
<% end %>
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
<% if activity.status == 1 %>
<span class="fontBlue2">确实团队</span>
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<% else %>
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<% end %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>

View File

@ -0,0 +1,8 @@
class UpdateCourseLead < ActiveRecord::Migration
def up
Message.where("status =? ", 1).update_all(:author_id => 1)
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160225031230) do
ActiveRecord::Schema.define(:version => 20160317070611) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -432,9 +432,11 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
t.integer "resource_num"
t.integer "journal_num"
t.integer "journal_reply_num"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "total_score"
t.integer "homework_journal_num", :default => 0
t.integer "news_num", :default => 0
end
create_table "course_groups", :force => true do |t|
@ -506,6 +508,7 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
t.integer "is_excellent", :default => 0
t.integer "excellent_option", :default => 0
t.integer "is_copy", :default => 0
t.integer "visits", :default => 0
end
create_table "custom_fields", :force => true do |t|
@ -1282,6 +1285,7 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "allow_guest_download", :default => true
t.integer "visits", :default => 0
end
create_table "phone_app_versions", :force => true do |t|
@ -1441,6 +1445,7 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
t.integer "acts_count", :default => 0
t.integer "journals_count", :default => 0
t.integer "boards_reply_count", :default => 0
t.integer "visits", :default => 0
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -1900,6 +1905,7 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64
t.integer "gid"
t.integer "visits", :default => 0
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
@ -2013,11 +2019,6 @@ ActiveRecord::Schema.define(:version => 20160225031230) do
add_index "wikis", ["project_id"], :name => "wikis_project_id"
create_table "wlcs", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "workflows", :force => true do |t|
t.integer "tracker_id", :default => 0, :null => false
t.integer "old_status_id", :default => 0, :null => false