|
21 | 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
22 | 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
23 | 23 | module ExceptionNotifierHelper |
24 | | - EXCEPTION_NOTIFIER_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..')) |
25 | | - VIEW_PATH = "views/exception_notifier" |
26 | | - RAILS_VIEW_PATH = "#{RAILS_ROOT}/app/#{VIEW_PATH}" |
27 | 24 | PARAM_FILTER_REPLACEMENT = "[FILTERED]" |
28 | 25 |
|
29 | 26 | def render_section(section) |
30 | 27 | RAILS_DEFAULT_LOGGER.info("rendering section #{section.inspect}") |
31 | | - summary = render_overridable(section).strip |
| 28 | + summary = render("exception_notifier/#{section}").strip |
32 | 29 | unless summary.blank? |
33 | | - title = render_overridable(:title, :locals => { :title => section }).strip |
| 30 | + title = render("exception_notifier/title", :locals => { :title => section }).strip |
34 | 31 | "#{title}\n\n#{summary.gsub(/^/, " ")}\n\n" |
35 | 32 | end |
36 | 33 | end |
37 | 34 |
|
38 | | - def render_overridable(partial, options={}) |
39 | | - paths = partial_paths(partial) |
40 | | - if path = paths.find {|p| File.exist?(p) } |
41 | | - render(options.merge(:file => path, :use_full_path => false)) |
42 | | - else |
43 | | - "" |
44 | | - end |
45 | | - end |
46 | | - |
47 | | - def partial_paths(partial) |
48 | | - exts = %w{ rhtml html.erb } |
49 | | - exts.map {|ext| |
50 | | - [ "#{RAILS_VIEW_PATH}/_#{partial}.#{ext}", |
51 | | - "#{EXCEPTION_NOTIFIER_PATH}/#{VIEW_PATH}/_#{partial}.#{ext}"] |
52 | | - }.flatten |
53 | | - end |
54 | | - |
55 | 35 | def inspect_model_object(model, locals={}) |
56 | | - render_overridable(:inspect_model, |
| 36 | + render('exception_notifier/inspect_model', |
57 | 37 | :locals => { :inspect_model => model, |
58 | 38 | :show_instance_variables => true, |
59 | 39 | :show_attributes => true }.merge(locals)) |
|
0 commit comments