lib/admin_it/helpers/table.rb in admin_it-1.0.7 vs lib/admin_it/helpers/table.rb in admin_it-1.0.8
- old
+ new
@@ -32,32 +32,28 @@
end
if resource.destroyable?
if context.confirm_destroy?
confirm = single.find { |c| c.context_name == :confirm } ||
single.first { |c| c <= ShowContext }
- buttons << if confirm.nil?
- @template.link_to(
+ unless confirm.nil?
+ buttons <<
+ '<a class="btn btn-xs btn-danger" ' +
+ %Q{data-toggle="modal" data-target="#confirm_modal" } +
+ %Q{href="#{confirm.path(entity)}} +
+ '?layout=dialog&confirm=destroy">' +
+ '<i class="fa fa-trash-o"></i></a>'
+ end
+ else
+ show = single.first { |c| c <= ShowContext }
+ unless show.nil?
+ buttons << @template.link_to(
html_safe('<i class="fa fa-trash-o"></i>'),
show.path(entity),
method: :delete,
- confirm: I18n.t('admin_it.confirm.destroy.text'),
class: 'btn btn-xs btn-danger'
)
- else
- '<a class="btn btn-xs btn-danger" ' +
- %Q{data-toggle="modal" data-target="#confirm_modal" } +
- %Q{href="#{confirm.path(entity)}} +
- '?layout=dialog&confirm=destroy">' +
- '<i class="fa fa-trash-o"></i></a>'
end
- else
- buttons << @template.link_to(
- html_safe('<i class="fa fa-trash-o"></i>'),
- show.path(entity),
- method: :delete,
- class: 'btn btn-xs btn-danger'
- )
end
end
html = buttons.join
html = "<div class=\"btn-group\">#{html}</div>" if buttons.size > 1
@@ -75,10 +71,10 @@
default_tag 'tr'
child :cell, Cell
child :actions, ActionsCell
before_capture do
- block = parent.context.class.row
+ block = parent.context.row
unless block.nil?
instance_exec(parent.context.entity, &block)
end
end
end