class InsertToSetting < ActiveRecord::Migration
  def up
    ss = Setting.find_all_by_name("plugin_redmine_ckeditor")
    if ss.nil?
      sett = Setting.new
      sett.name = "plugin_redmine_ckeditor"
      sett.value = "--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
        skin: kama
        ui_color: ! '#f4f4f4'
        width: ''
        height: '400'
        enter_mode: '1'
        show_blocks: '1'
        toolbar_can_collapse: '0'
        toolbar_location: top
        toolbar: Source,ShowBlocks,--,Undo,Redo,-,Find,Replace,--,Bold,Italic,Underline,Strike,-,Subscript,Superscript,-,NumberedList,BulletedList,-,Outdent,Indent,Blockquote,-,JustifyLeft,JustifyCenter,JustifyRight,JustifyBlock,-,Link,Unlink,-,richImage,Table,HorizontalRule,/,Styles,Format,Font,FontSize,-,TextColor,BGColor,Cut,Copy,Paste,BidiLtr,BidiRtl,PasteText,PasteFromWord,RemoveFormat,SelectAll"
      sett.save
    end
  end

  def down
    ss = Setting.find_all_by_name("plugin_redmine_ckeditor")
    if ss.nil?
    else
      ss.destroy
    end
  end
end
