[phase-16](step 1) add termno macro in init.rb

This commit is contained in:
Toru Takahashi 2018-06-23 10:32:42 +09:00 committed by TAKAHASHI,Toru
parent 59406d6c43
commit a8ad7e36f4

14
init.rb
View File

@ -33,3 +33,17 @@ end
Redmine::Activity.register :glossary_terms Redmine::Activity.register :glossary_terms
Redmine::WikiFormatting::Macros.register do
desc "create macro which links to glossary term."
macro :termno do |obj, args|
puts "@@@@@@@@@@@@ Macros.register macro block: obj=#{obj.inspect} @@@@@@@@@@@@"
term_id = args.first
term = GlossaryTerm.find(term_id)
link_to term.name, project_glossary_term_path(@project, term)
end
macro :term do |obj, args|
term = GlossaryTerm.find_by(name: args.first)
link_to
end
end