app/helpers/title/title_helper.rb in title-0.0.5 vs app/helpers/title/title_helper.rb in title-0.0.6
- old
+ new
@@ -6,11 +6,11 @@
end
class PageTitle
def initialize(controller_path, action_name, context)
@controller_path = controller_path
- @action_name = action_name
+ @action_name = adjusted_action_name(action_name)
@context = context
end
def to_s
I18n.t(
@@ -45,9 +45,20 @@
while lookup_path.length > 0
defaults << ['titles', *lookup_path, 'default'].join('.').to_sym
lookup_path.pop
end
defaults.reverse
+ end
+
+ def adjusted_action_name(action_name)
+ case action_name
+ when 'create'
+ 'new'
+ when 'update'
+ 'edit'
+ else
+ action_name
+ end
end
end
end
end