系统消息发布添加标题功能

This commit is contained in:
huang 2015-09-17 16:23:09 +08:00
parent d00ad2e14d
commit 9324d45e2c
5 changed files with 14 additions and 3 deletions

View File

@ -39,6 +39,7 @@ class SystemMessagesController < ApplicationController
end
@system_messages = SystemMessage.new
@system_messages.description = params[:system_message][:description]
@system_messages.subject = params[:system_message][:subject]
@system_messages.user_id = User.current.id
respond_to do |format|
if @system_messages.save

View File

@ -1,7 +1,8 @@
class SystemMessage < ActiveRecord::Base
attr_accessible :content, :id, :user_id, :description
attr_accessible :content, :id, :user_id, :description, :subject
belongs_to :user
validates :description, presence: true
validates :subject, presence: true
# validates :description, presence: true
validates_length_of :description, maximum: 10000
end

View File

@ -4,6 +4,9 @@
</h3><br/>
<div style="padding-top: 20px; padding-left: 5px;">
<%= form_for(@admin_messages, :html => {:id =>'system_messages-form'}) do |f| %>
<div class="field">
<%= f.text_area :subject %>
</div>
<div class="field">
<%= f.kindeditor :description,:width=>'87%',:editor_id=>'system_message_editor' %>
<p id="content_notice_span" class="ml55"></p>

View File

@ -0,0 +1,5 @@
class AddSubjectToSystemMessage < ActiveRecord::Migration
def change
add_column :system_messages, :subject, :string
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 => 20150915063302) do
ActiveRecord::Schema.define(:version => 20150917081214) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1365,6 +1365,7 @@ ActiveRecord::Schema.define(:version => 20150915063302) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.text "description"
t.string "subject"
end
create_table "taggings", :force => true do |t|