redmine_glossary/lib/term_link_helper.rb @ 7d0b6b7f
| 0819898b | Martin Denizet | require 'redmine'
|
||
require 'cgi'
|
||||
module ActionView
|
||||
module Helpers
|
||||
module TermLinkHelper
|
||||
def term_link_new(name, proj)
|
||||
link_to(name + '?',
|
||||
| 04643542 | Martin DENIZET | {:controller => 'glossary', :action => 'new', :project_id => proj,
|
||
| 0819898b | Martin Denizet | :new_term_name => CGI::escapeHTML(name)},
|
||
{:class=>'new'})
|
||||
end
|
||||
def term_link(term)
|
||||
| b8dc04a8 | Massimo Rossello | str = link_to(term.name, :controller => 'glossary', :action => 'show', :project_id => term.project,
|
||
:id => term.id)
|
||||
| 0819898b | Martin Denizet | unless (term.abbr_whole.empty?)
|
||
str = content_tag(:abbr, str, :title=>term.abbr_whole)
|
||||
end
|
||||
unless (term.rubi.empty?)
|
||||
str = content_tag(:ruby) {
|
||||
tstr = content_tag(:rb, str)
|
||||
tstr += content_tag(:rp, '(')
|
||||
tstr += content_tag(:rt, term.rubi)
|
||||
tstr += content_tag(:rp, ')')
|
||||
}
|
||||
end
|
||||
str
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|