From bb4c265337f0c9f497e10017e832bcfcd1d88867 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 8 May 2013 18:44:04 -0400 Subject: [PATCH] some new things --- lib/semantic_rails_view_helpers/capybara.rb | 8 ++++++++ lib/semantic_rails_view_helpers/view_helpers.rb | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/semantic_rails_view_helpers/capybara.rb b/lib/semantic_rails_view_helpers/capybara.rb index ddc2708..a4ee103 100644 --- a/lib/semantic_rails_view_helpers/capybara.rb +++ b/lib/semantic_rails_view_helpers/capybara.rb @@ -20,6 +20,14 @@ def has_attribute?(name, value) attribute.text == value end +def find_first(search) + omatch = Capybara.match + Capybara.match = :first + result = find(search) + Capybara.match = omatch + result +end + def find_input(name, additional_search = '', type = '') search = "[#{name}]" if name[/\[\]$/] diff --git a/lib/semantic_rails_view_helpers/view_helpers.rb b/lib/semantic_rails_view_helpers/view_helpers.rb index f18654b..bfed2f4 100644 --- a/lib/semantic_rails_view_helpers/view_helpers.rb +++ b/lib/semantic_rails_view_helpers/view_helpers.rb @@ -26,8 +26,9 @@ module SemanticRailsViewHelpers def link_to_collection(route, options = {}) collection = route.last + options[:label] ||= t(".#{collection}") - link_to t(".#{collection}"), polymorphic_url(route), semantic_link_data(collection).merge(options) + link_to options[:label], polymorphic_url(route), semantic_link_data(collection).merge(options) end def link_to_model(model, options = {})