diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 279975c77..43a49c7d9 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -509,7 +509,7 @@ class CoursesController < ApplicationController if @course respond_to do |format| 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) } end else diff --git a/app/models/course.rb b/app/models/course.rb index 13e6be0ae..433a5801e 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -387,7 +387,10 @@ class Course < ActiveRecord::Base # 发布新课导语 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 #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index d8268d698..7d732bc8e 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -43,6 +43,14 @@ <%= activity.parent.content.to_s.html_safe%> <% end %> + <% if activity.status == 1 %> + <%= activity.created_on.year %> + + <%= activity.created_on.month %> + + <%= activity.created_on.day %> + + <% end %>
diff --git a/db/migrate/20160118083751_add_status_to_message.rb b/db/migrate/20160118083751_add_status_to_message.rb new file mode 100644 index 000000000..46d63de3a --- /dev/null +++ b/db/migrate/20160118083751_add_status_to_message.rb @@ -0,0 +1,5 @@ +class AddStatusToMessage < ActiveRecord::Migration + def change + add_column :messages, :status, :integer, :default => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 601b09561..1cad3bd21 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| t.integer "act_id", :null => false @@ -1073,6 +1073,7 @@ ActiveRecord::Schema.define(:version => 20160118014219) do t.integer "sticky", :default => 0 t.integer "reply_id" t.integer "quotes" + t.integer "status", :default => 0 end add_index "messages", ["author_id"], :name => "index_messages_on_author_id"