You are here: Home > Latest news from Darcs > Small refactoring to ApplicationHelper to avoid duplication

Revision 20080507212232-9043f-ef9b95...

Small refactoring to ApplicationHelper to avoid duplication

app/helpers/application_helper.rb

Changes to application_helper.rb

37
  
  
37
38
  def pagetext(title, revision=nil, &block)
  def pagetext(title, revision=nil, &block)
38
39
    content = capture(&block)
    content = capture(&block)
39
40
    b = Builder::XmlMarkup.new
 
41
    xml = b.div(:class => 'pagetext') do
    xml = b.div(:class => 'pagetext') do
40
42
      b.a(:href => url_for(:controller => 'wiki', :action => 'history',
      b.a(:href => url_for(:controller => 'wiki', :action => 'history',
41
43
                           :page_name => @page.name, :locale => @locale,
                           :page_name => @page.name, :locale => @locale,
42
41 more lines
85
  end
  end
84
86
  
  
85
87
  def render_diff_table(chunks)
  def render_diff_table(chunks)
86
88
    Builder::XmlMarkup.new.table :class => 'diff', :cellspacing => '0' do |b|
    b.table :class => 'diff', :cellspacing => '0' do |b|
87
89
      b.colgroup do
      b.colgroup do
88
90
        b.col :class => 'line_number'
        b.col :class => 'line_number'
89
91
        b.col :class => 'left'
        b.col :class => 'left'
90
25 more lines
117
    end
    end
116
118
  end
  end
117
119
118
 
private
119
 
120
 
  def b
121
 
    @markup ||= Builder::XmlMarkup.new
122
 
  end
123
 
124
120
end
end
125
121
126
122
class NullUser
class NullUser
127