ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

project_text_formatting.patch

Riceball LEE, 2011-09-15 01:22 am

Download (2.4 kB)

 
b/app/controllers/wiki_controller.rb
257 257

  
258 258
  # Returns the default content of a new wiki page
259 259
  def initial_page_content(page)
260
    helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting)
260
    # use the project text formatting first hack by riceball
261
    @project = Project.find(params[:project_id]) unless @project
262
    helper = Redmine::WikiFormatting.helper_for(@project.text_formatting || Setting.text_formatting)
261 263
    extend helper unless self.instance_of?(helper)
262 264
    helper.instance_method(:initial_page_content).bind(self).call(page)
263 265
  end
b/app/helpers/application_helper.rb
458 458
    project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
459 459
    only_path = options.delete(:only_path) == false ? false : true
460 460

  
461
    text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr) { |macro, args| exec_macro(macro, obj, args) }
461
    # use the project's wiki format first hack via riceball
462
    text_formatting = options[:text_formatting] || ''
463
    text_formatting = project.text_formatting if text_formatting.empty? && project
464
    text = Redmine::WikiFormatting.to_html(text_formatting || Setting.text_formatting, text, :object => obj, :attribute => attr) { |macro, args| exec_macro(macro, obj, args) }
462 465

  
463 466
    @parsed_headings = []
464 467
    text = parse_non_pre_blocks(text) do |text|
......
937 940
  private
938 941

  
939 942
  def wiki_helper
940
    helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting)
943
    # use the project's wiki format first hack via riceball
944
    text_formatting = @project ? @project.text_formatting : Setting.text_formatting
945
    helper = Redmine::WikiFormatting.helper_for(text_formatting)
941 946
    extend helper
942 947
    return self
943 948
  end
b/app/models/project.rb
532 532
    'custom_field_values',
533 533
    'custom_fields',
534 534
    'tracker_ids',
535
    'text_formatting',
535 536
    'issue_custom_field_ids'