[wip] Handle macros outside Rails' view_context

This presents a more graceful notice, rather than rendering an error.

Signed-off-by: Alex Coles <alex@alexbcoles.com>
pull/1550/head
Alex Coles 10 years ago
parent 9ac4f6e877
commit 5203f2efa2
  1. 8
      lib/open_project/wiki_formatting/macros/timelines_wiki_macro.rb
  2. 2
      lib/redmine/wiki_formatting.rb

@ -40,8 +40,12 @@ module OpenProject
view = options[:view]
view.render :partial => '/timelines/timeline',
:locals => {:timeline => timeline}
if view.respond_to?(:render)
view.render :partial => '/timelines/timeline',
:locals => {:timeline => timeline}
else
raise NotImplementedError, 'Timeline rendering is not supported'
end
end
end
end

@ -104,6 +104,8 @@ module Redmine
macros_runner.call(macro, args)
rescue => e
"<div class=\"flash error\">Error executing the <strong>#{macro}</strong> macro (#{e})</div>"
rescue NotImplementedError
"<div class=\"macro-unavailable\">Macro <strong>#{macro}</strong> cannot be displayed.</div>"
end || all
else
all

Loading…
Cancel
Save