创建课程发送board

This commit is contained in:
huang 2016-01-18 17:16:33 +08:00
parent ef0a2a54c5
commit b93b86b9a0
5 changed files with 20 additions and 3 deletions

View File

@ -509,7 +509,7 @@ class CoursesController < ApplicationController
if @course if @course
respond_to do |format| respond_to do |format|
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
format.html {redirect_to settings_course_url(@course, :course_type => 1)} format.html {redirect_to course_url(@course)}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) } format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
end end
else else

View File

@ -387,7 +387,10 @@ class Course < ActiveRecord::Base
# 发布新课导语 # 发布新课导语
def add_course_ead def add_course_ead
name = Redmine::Configuration['course_message_lead_subject']
content = Redmine::Configuration['course_message_lead_content']
# message的status状态为0为正常为1表示创建课程时发送的message
Message.create(:subject => name, :content => content, :board_id => self.boards.first.id, :author_id => self.tea_id , :sticky => true, :status => true )
end end
#项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题

View File

@ -43,6 +43,14 @@
<%= activity.parent.content.to_s.html_safe%> <%= activity.parent.content.to_s.html_safe%>
<% end %> <% end %>
</div> </div>
<% if activity.status == 1 %>
<span style="font-family:Calibri;font-size:10.5000pt;"><%= activity.created_on.year %></span>
<span style="font-size:10.5000pt;">年</span>
<span style="font-family:Calibri;font-size:10.5000pt;"><%= activity.created_on.month %></span>
<span style="font-size:10.5000pt;">月</span>
<span style="font-family:Calibri;font-size:10.5000pt;"><%= activity.created_on.day %></span>
<span style="font-size:10.5000pt;">日</span>
<% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div> <div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>

View File

@ -0,0 +1,5 @@
class AddStatusToMessage < ActiveRecord::Migration
def change
add_column :messages, :status, :integer, :default => false
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160118014219) do ActiveRecord::Schema.define(:version => 20160118083751) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -1073,6 +1073,7 @@ ActiveRecord::Schema.define(:version => 20160118014219) do
t.integer "sticky", :default => 0 t.integer "sticky", :default => 0
t.integer "reply_id" t.integer "reply_id"
t.integer "quotes" t.integer "quotes"
t.integer "status", :default => 0
end end
add_index "messages", ["author_id"], :name => "index_messages_on_author_id" add_index "messages", ["author_id"], :name => "index_messages_on_author_id"