# encoding:utf-8
class KeyWordPush< ActiveRecord::Base
  has_paper_trail
  self.table_name = "key_word_pushs"
  validates_presence_of :key_word, :push_type, :remark
  belongs_to :wx_gongzhonghao
  PUSH_TYPE_ENUM = [["图片","image"], ["文字","text"], ["图文","article"]]

  rails_admin do
    navigation_label '公众号管理'
    weight -350

    list do
      filters [:id, :key_word]
      field :id
      field :key_word
      field :push_title
      field :push_type, :enum do
        enum do
          PUSH_TYPE_ENUM
        end
      end
      field :cover
      field :word
      field :url
      field :remark
      field :wx_gongzhonghao_id
      field :wx_gongzhonghao
      field :created_at
      field :updated_at
    end

    show do
      field :id
      field :key_word
      field :push_title
      field :push_type, :enum do
        enum do
          PUSH_TYPE_ENUM
        end
      end
      field :cover
      field :word
      field :url
      field :remark
      field :wx_gongzhonghao_id
      field :wx_gongzhonghao
      field :created_at
      field :updated_at
    end

    edit do
      field :key_word
      field :push_title
      field :push_type, :enum do
        enum do
          PUSH_TYPE_ENUM
        end
      end
      field :cover
      field :word
      field :url
      field :remark
      field :wx_gongzhonghao
    end
  end

end
