Commit 5735d977 authored by azul's avatar azul

Merge pull request #103 from azul/bugfix/page-tweaks

js: remove deleted vote option - fixes #8339
parents c87b72d8 31867250
...@@ -131,6 +131,11 @@ module Common::Ui::JavascriptHelper ...@@ -131,6 +131,11 @@ module Common::Ui::JavascriptHelper
"$('%s').toggle();".html_safe % id "$('%s').toggle();".html_safe % id
end end
def remove(id, extra=nil)
id = dom_id(id,extra) if id.is_a?(ActiveRecord::Base)
"$('%s').remove();".html_safe % id
end
def hide_spinner(id) def hide_spinner(id)
"$('%s').hide();" % spinner_id(id) "$('%s').hide();" % spinner_id(id)
end end
......
...@@ -6,7 +6,7 @@ form_id = "#{possible_edit_id}_form" ...@@ -6,7 +6,7 @@ form_id = "#{possible_edit_id}_form"
possible_show_id = "#{possible_id}_show" possible_show_id = "#{possible_id}_show"
close_click = hide(possible_edit_id) + show(possible_show_id) close_click = hide(possible_edit_id) + show(possible_show_id)
possible_url = ranked_vote_possible_url(possible, page_id: @page) possible_url = ranked_vote_possible_url(possible, page_id: @page)
delete_click = remote_function(url: possible_url, method: :delete, confirm: I18n.t('vote.really_remove_this'), success: hide(possible) ) delete_click = remote_function(url: possible_url, method: :delete, confirm: I18n.t('vote.really_remove_this'), success: remove(possible) )
-%> -%>
<%= form_tag possible_url, remote: true, method: :put, html: {id: form_id} do -%> <%= form_tag possible_url, remote: true, method: :put, html: {id: form_id} do -%>
<%# text_field 'possible', 'name', size: 70 %> <%# text_field 'possible', 'name', size: 70 %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment