Module: ReportHelper

Defined in:
app/helpers/report_helper.rb

Overview

Motiro - A project tracking tool

Copyright (C) 2006-2007  Thiago Arrais

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Instance Method Summary collapse

Instance Method Details

#ref(change) ⇒ Object



38
39
40
# File 'app/helpers/report_helper.rb', line 38

def ref(change)
  "change" + change.summary.hash.to_s
end

#render_diff(change) ⇒ Object



20
21
22
23
24
25
26
27
# File 'app/helpers/report_helper.rb', line 20

def render_diff(change)
  return '' unless change.chunked_diff
  Builder::XmlMarkup.new.div(:id => ref(change),
                             :class => "diff-window") do |b|
    b.h2 'Changes to %s' / change.resource_name
    b << render_diff_table(change.chunked_diff)
  end
end

#render_summary(change) ⇒ Object



29
30
31
32
33
34
35
36
# File 'app/helpers/report_helper.rb', line 29

def render_summary(change)
  summary = html_escape(change.summary)
  if (change.has_diff?)
    "<a href='\#' onClick=\"showOnly('#{ref(change)}')\">#{summary}</a>"
  else
    summary
  end
end