|
|
|
@ -1,11 +1,19 @@ |
|
|
|
|
class Widget::Controls::Delete < Widget::Base |
|
|
|
|
def render |
|
|
|
|
return "" if @query.new_record? |
|
|
|
|
button = link_to content_tag(:span, content_tag(:em, l(:button_delete), :class => "button-icon icon-delete")), "#", |
|
|
|
|
:class => 'button secondary', |
|
|
|
|
:id => 'query-icon-delete', |
|
|
|
|
:title => l(:button_delete) |
|
|
|
|
popup = content_tag :div, :id => "delete_form", :class => "button_form" do |
|
|
|
|
render_button + render_popup |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def render_button |
|
|
|
|
link_to(content_tag(:span, content_tag(:em, l(:button_delete), :class => "button-icon icon-delete")), |
|
|
|
|
"#", |
|
|
|
|
:class => 'button secondary', |
|
|
|
|
:id => 'query-icon-delete', |
|
|
|
|
:title => l(:button_delete)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def render_popup |
|
|
|
|
content_tag :div, :id => "delete_form", :class => "button_form", :style => "display:none" do |
|
|
|
|
question = content_tag :p, l(:label_really_delete_question) |
|
|
|
|
options = content_tag :p do |
|
|
|
|
delete_button = content_tag :span do |
|
|
|
@ -19,6 +27,5 @@ class Widget::Controls::Delete < Widget::Base |
|
|
|
|
end |
|
|
|
|
question + options |
|
|
|
|
end |
|
|
|
|
button + popup |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|