|
@ -3,6 +3,8 @@ module Semantic |
|
|
class ActionView < LogSubscriber |
|
|
class ActionView < LogSubscriber |
|
|
include AnsiColors |
|
|
include AnsiColors |
|
|
|
|
|
|
|
|
|
|
|
REGEX_BASEDIR = %r{^#{Rails.root}/(.*)} |
|
|
|
|
|
|
|
|
attr_reader :logger |
|
|
attr_reader :logger |
|
|
|
|
|
|
|
|
def initialize |
|
|
def initialize |
|
@ -11,19 +13,34 @@ module Semantic |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def render_partial(event) |
|
|
def render_partial(event) |
|
|
# logger.info {'Rendered partial'} |
|
|
|
|
|
|
|
|
identifier = pathname(event.payload[:identifier]) |
|
|
|
|
|
# logger.debug("Rendered partial #{identifier}", event.payload[:locals]) if identifier |
|
|
|
|
|
logger.debug("Rendered partial #{identifier}") if identifier |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def render_template(event) |
|
|
def render_template(event) |
|
|
logger.debug { 'Rendered template' } |
|
|
|
|
|
|
|
|
layout = event.payload[:layout] |
|
|
|
|
|
return unless layout |
|
|
|
|
|
|
|
|
|
|
|
identifier = pathname(event.payload[:identifier]) |
|
|
|
|
|
logger.debug { "Rendered template #{identifier}" } if identifier |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def render_collection(event) |
|
|
def render_collection(event) |
|
|
logger.debug { 'Rendered collection' } |
|
|
|
|
|
|
|
|
identifier = pathname(event.payload[:identifier]) |
|
|
|
|
|
logger.debug { "Rendered collection #{identifier}" } if identifier |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def render_layout(event) |
|
|
def render_layout(event) |
|
|
logger.debug { 'Rendered layout' } |
|
|
|
|
|
|
|
|
identifier = pathname(event.payload[:identifier]) |
|
|
|
|
|
logger.debug { "Rendered layout #{identifier}" } if identifier |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
def pathname(location) |
|
|
|
|
|
m = REGEX_BASEDIR.match(location) |
|
|
|
|
|
m[1] if m |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|