Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jarijokinen committed Jan 15, 2013
1 parent 3320448 commit 1325401
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions app/helpers/simple_resource/base_helper.rb
Expand Up @@ -13,24 +13,24 @@ def resource_title
end

def collection_title
I18n.t("activerecord.models.#{controller_name.singularize}.other",
t("activerecord.models.#{controller_name.singularize}.other",
default: controller_name.humanize)
end

def new_resource_title
I18n.t("simple_resource.titles.new_resource", resource_name: resource_human_name)
t("simple_resource.titles.new_resource", resource_name: resource_human_name)
end

def new_resource_link_title
I18n.t("simple_resource.titles.new_resource", resource_name: resource_human_name)
t("simple_resource.links.new_resource", resource_name: resource_human_name)
end

def new_resource_link
link_to(new_resource_link_title, new_resource_path)
end

def edit_resource_title
I18n.t("simple_resource.titles.edit_resource", resource_name: resource_human_name)
t("simple_resource.titles.edit_resource", resource_name: resource_human_name)
end

def resource_attributes
Expand All @@ -51,7 +51,7 @@ def resource_human_attributes

def attribute_human_name(attribute_name)
attribute_name = attribute_name.to_s
I18n.t("activerecord.attributes.#{controller_name.singularize}.#{attribute_name}",
t("activerecord.attributes.#{controller_name.singularize}.#{attribute_name}",
default: attribute_name.humanize)
end

Expand All @@ -68,7 +68,7 @@ def link_to_action(action_name, title, path)
action_name = action_name.to_sym
if action_name == :delete
link_to(t("simple_resource.#{action_name.to_s}", default: title), path,
method: :delete, confirm: t("simple_resource.messages.delete_confirmation", default: "Are you sure?"))
method: :delete, confirm: t("simple_resource.messages.delete_confirmation"))
else
link_to(t("simple_resource.#{action_name.to_s}", default: title), path)
end
Expand Down
22 changes: 11 additions & 11 deletions spec/helpers/base_helper_spec.rb
Expand Up @@ -238,17 +238,17 @@
end
end

context "when namespace exists" do
before :each do
@controller = Backend::LanguagesController.new
@controller.request = ActionDispatch::TestRequest.new
@controller.instance_variable_set("@language", language)
end

it "returns namespace in array" do
helper.controller_namespaces.should == ["backend"]
end
end
context "when namespace exists" do
before :each do
@controller = Backend::LanguagesController.new
@controller.request = ActionDispatch::TestRequest.new
@controller.instance_variable_set("@language", language)
end

it "returns namespace in array" do
helper.controller_namespaces.should == ["backend"]
end
end
end

describe "#resource_form_path" do
Expand Down

0 comments on commit 1325401

Please sign in to comment.