Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Roland Koller
redmine_trafficlights_macro
Commits
9f8adb8d
Commit
9f8adb8d
authored
Nov 09, 2017
by
Taiki IKEGAME
Browse files
Enabled to show graph in preview.
parent
98160ef5
Changes
2
Hide whitespace changes
Inline
Side-by-side
init.rb
View file @
9f8adb8d
...
...
@@ -4,7 +4,7 @@ Redmine::Plugin.register :redmine_mermaid_macro do
name
'Redmine Mermaid Macro plugin'
author
'Taiki IKEGAME'
description
'Add mermaid graphs to your wiki.'
version
'0.0
.1
'
version
'
1.
0.0'
url
'https://github.com/taikii/redmine_mermaid_macro'
author_url
'https://taikii.github.io'
...
...
@@ -21,8 +21,10 @@ Redmine::Plugin.register :redmine_mermaid_macro do
" C-->D;
\n
"
+
"}}"
macro
:mermaid
do
|
obj
,
args
,
text
|
divid
=
"mermaid_"
+
SecureRandom
.
urlsafe_base64
(
8
)
out
=
''
.
html_safe
out
<<
content_tag
(
'div'
,
text
,
:class
=>
'mermaid'
)
out
<<
content_tag
(
:div
,
text
,
id:
divid
,
class:
'mermaid'
)
out
<<
javascript_tag
(
"if (typeof mermaidInitialized != 'undefined') {mermaid.init(undefined, $('#"
+
divid
+
"'));};"
)
out
end
end
...
...
lib/mermaid_macro_hook.rb
View file @
9f8adb8d
...
...
@@ -5,7 +5,7 @@ class MermaidMacroHookListener < Redmine::Hook::ViewListener
def
view_layouts_base_body_bottom
(
context
=
{})
html
=
""
html
<<
javascript_include_tag
(
Setting
.
plugin_redmine_mermaid_macro
[
'mermaid_url'
])
html
<<
javascript_tag
(
"mermaid.initialize({startOnLoad:true});"
)
html
<<
javascript_tag
(
"mermaid.initialize({startOnLoad:true});
var mermaidInitialized = 1;
"
)
return
html
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment