Project

General

Profile

Feature #34863 » 0001-Set-common_mark-as-default-text-formatting.diff

Marius BĂLTEANU, 2022-09-27 23:33

View differences:

config/settings.yml
95 95
plain_text_mail:
96 96
  default: 0
97 97
text_formatting:
98
  default: textile
98
  default: common_mark
99 99
cache_formatted_text:
100 100
  default: 0
101 101
wiki_compression:
db/migrate/017_create_settings.rb
4 4
      t.column "name", :string, :limit => 30, :default => "", :null => false
5 5
      t.column "value", :text
6 6
    end
7

  
8
    # Persist text_formatting default setting for new installations
9
    setting = Setting.new(:name => "text_formatting", :value => Setting.text_formatting)
10
    setting.save!
7 11
  end
8 12

  
9 13
  def self.down
db/migrate/20220625172805_ensure_text_formatting_setting_is_stored_in_db.rb
1
class EnsureTextFormattingSettingIsStoredInDb < ActiveRecord::Migration[6.1]
2
  def change
3
    unless Setting.where(name: "text_formatting").exists?
4
      setting = Setting.new(:name => "text_formatting", :value => 'textile')
5
      setting.save!
6
    end
7
  end
8
end
test/functional/attachments_controller_test.rb
219 219
    get(:show, :params => {:id => a.id})
220 220
    assert_response :success
221 221
    assert_equal 'text/html', @response.media_type
222
    assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n\n<h2>Header 2</h2>\n\n<h3>Header 3</h3>"
222
    assert_select 'div.wiki', :html => "<h1>Header 1</h1>\n<h2>Header 2</h2>\n<h3>Header 3</h3>"
223 223
  end
224 224

  
225 225
  def test_show_text_file_formatted_textile
test/unit/setting_test.rb
145 145
      end
146 146
    end
147 147
  end
148

  
149
  def test_default_text_formatting_for_new_installations_is_common_mark
150
    assert_equal 'common_mark', Setting.text_formatting
151
    assert_equal 'common_mark', Setting.find_by(:name => 'text_formatting').value
152
  end
148 153
end
(6-6/7)