From 72881189e8916aaa20e6e6cca6008c7ca1d3ecea Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 21 Sep 2012 21:05:27 -0400 Subject: [PATCH] some fixes for controller names --- app/assets/javascripts/bullseye.js.erb | 2 ++ lib/bullseye/find_parts.rb | 2 +- lib/bullseye/helpers/bullseye_helper.rb | 2 +- lib/bullseye/tilt/bullseye_template.rb | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/bullseye.js.erb b/app/assets/javascripts/bullseye.js.erb index d060094..f226770 100644 --- a/app/assets/javascripts/bullseye.js.erb +++ b/app/assets/javascripts/bullseye.js.erb @@ -38,6 +38,8 @@ this.Bullseye = { break; } + controller = controller.replace('/', '-'); + if (this.targets[controller] && this.targets[controller][action]) { this.targets[controller][action].apply(this.context); } diff --git a/lib/bullseye/find_parts.rb b/lib/bullseye/find_parts.rb index e91e457..a8c6526 100644 --- a/lib/bullseye/find_parts.rb +++ b/lib/bullseye/find_parts.rb @@ -9,7 +9,7 @@ module Bullseye end def parts - @source.split('/') + @parts ||= @source.split('/') end class PartFinder diff --git a/lib/bullseye/helpers/bullseye_helper.rb b/lib/bullseye/helpers/bullseye_helper.rb index 464921f..958b75a 100644 --- a/lib/bullseye/helpers/bullseye_helper.rb +++ b/lib/bullseye/helpers/bullseye_helper.rb @@ -15,7 +15,7 @@ module Bullseye end def __bullseye_controller - @__bullseye_controller || controller_path + @__bullseye_controller || controller_path.gsub('/', '-') end end end diff --git a/lib/bullseye/tilt/bullseye_template.rb b/lib/bullseye/tilt/bullseye_template.rb index 37a4f46..3dd1dbe 100644 --- a/lib/bullseye/tilt/bullseye_template.rb +++ b/lib/bullseye/tilt/bullseye_template.rb @@ -15,7 +15,7 @@ module Bullseye end def evaluate(scope, locals, &block) - @source = scope.logical_path[1..-1] + @source = scope.logical_path.gsub(%r{^[^/]*/}, '') <<-JS Bullseye.target('#{controller}', #{actions.to_json}, function() {