From a8ad7e36f4ccee4fdefa63bc35f301cebf1543d8 Mon Sep 17 00:00:00 2001 From: Toru Takahashi Date: Sat, 23 Jun 2018 10:32:42 +0900 Subject: [PATCH] [phase-16](step 1) add termno macro in init.rb --- init.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/init.rb b/init.rb index 5af0ee1..f641b5a 100644 --- a/init.rb +++ b/init.rb @@ -33,3 +33,17 @@ end 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