Module: ReportHelper

Defined in:
app/helpers/report_helper.rb

Overview

Motiro - A project tracking tool

Copyright (C) 2006-2008  Thiago Arrais

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation; either version 3 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 Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Instance Method Summary collapse

Instance Method Details



41
42
43
44
45
# File 'app/helpers/report_helper.rb', line 41

def headline_link(headline)
  link_to( h(headline.title(Translator.for(@locale))),
           @reporter.params_for(headline.rid),
           page_link_handler.extra_link_attributes_for(headline.rid) )
end

#ref(change) ⇒ Object



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

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

#render_diff(change) ⇒ Object



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

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



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

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