Skip to content

Commit 95c04d0

Browse files
committed
fix bulk feedback checkbox bug caused by change in processing order
1 parent c99a2d8 commit 95c04d0

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

app/controllers/admin/feedback_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def bulkops
107107
items = Feedback.find(ids)
108108
@unexpired = true
109109

110-
case params[:bulkop]
110+
bulkop = params[:bulkop_top].empty? ? params[:bulkop_bottom] : params[:bulkop_top]
111+
case bulkop
111112
when 'Delete Checked Items'
112113
count = 0
113114
ids.each do |id|

app/models/sidebar.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def value_for(choice)
7474

7575
class CheckBoxField < self
7676
def input_html(sidebar)
77-
check_box_tag(input_name(sidebar), 1, sidebar.config[key], options)+
78-
hidden_field_tag(input_name(sidebar),0)
77+
hidden_field_tag(input_name(sidebar),0)+
78+
check_box_tag(input_name(sidebar), 1, sidebar.config[key], options)
7979
end
8080

8181
def line_html(sidebar)

app/views/admin/feedback/_button.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<p>
22
<%= hidden_field_tag "confirmed", params[:confirmed] %>
33
<%= hidden_field_tag "published", params[:published] %>
4-
<%= hidden_field_tag "bulkop", "",{:id=>"bulkop"} %>
4+
<%= hidden_field_tag "bulkop_#{position}", "",{:id=>"bulkop"} %>
55
<%= submit_tag _("Delete Checked Items"), {:class => 'submit',:onclick=>"getElementById('bulkop').value='Delete Checked Items'"} %> &nbsp;
66
<%= submit_tag _("Mark Checked Items as Ham"), {:class => 'submit',:onclick=>"getElementById('bulkop').value='Mark Checked Items as Ham'"} %>
77
<%= submit_tag _("Mark Checked Items as Spam"), {:class => 'submit',:onclick=>"getElementById('bulkop').value='Mark Checked Items as Spam'"} %>

app/views/admin/feedback/index.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<div class="list">
1313
<% form_tag({:action => 'bulkops'}, :method => :post) do %>
14-
<%= render :partial => 'button' %>
14+
<%= render :partial => 'button', :locals => { :position => 'top' } %>
1515

1616
<%= hidden_field_tag "search", params[:search]%>
1717
<%= hidden_field_tag "page", params[:page]%>
@@ -31,7 +31,7 @@
3131
<tr><td class="paginate" colspan="9"><%= will_paginate @feedback %></td></tr>
3232
</table>
3333

34-
<%= render :partial => 'button' %>
34+
<%= render :partial => 'button', :locals => { :position => 'bottom' } %>
3535
<% end %>
3636
</div>
3737

spec/controllers/admin/feedback_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def feedback_from_not_own_article
296296
describe '#bulkops action' do
297297

298298
before :each do
299-
post :bulkops, :bulkop => 'Delete all spam'
299+
post :bulkops, :bulkop_top => 'Delete all spam'
300300
end
301301

302302
it 'should redirect to action' do

0 commit comments

Comments
 (0)