give proper block to link_to_ordering (closes #201)

This commit is contained in:
wvengen 2013-12-11 22:58:45 +01:00
parent e25570d870
commit b53cb36714
2 changed files with 9 additions and 9 deletions

View file

@ -9,7 +9,7 @@ module GroupOrdersHelper
# Returns a link to the page where a group_order can be edited.
# If the option :show is true, the link is for showing the group_order.
def link_to_ordering(order, options = {})
def link_to_ordering(order, options = {}, &block)
group_order = order.group_order(current_user.ordergroup)
path = if options[:show] and group_order
group_order_path(group_order)
@ -19,7 +19,7 @@ module GroupOrdersHelper
new_group_order_path(:order_id => order.id)
end
options.delete(:show)
name = block_given? ? yield(order, group_order) : order.name
name = block_given? ? capture(&block) : order.name
path ? link_to(name, path, options) : name
end

View file

@ -22,7 +22,7 @@
%td= "#{show_user group_order.updated_by} (#{format_time(group_order.updated_on)})"
%td.numeric
= link_to_ordering(order, show: true) do
- number_to_currency(group_order.price)
= number_to_currency(group_order.price)
- else
%td{:colspan => 2}
- if total > 0