Skip to content

Commit

Permalink
fix bulk feedback checkbox bug caused by change in processing order
Browse files Browse the repository at this point in the history
  • Loading branch information
emiddleton committed Jul 31, 2009
1 parent c99a2d8 commit 95c04d0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/controllers/admin/feedback_controller.rb
Expand Up @@ -107,7 +107,8 @@ def bulkops
items = Feedback.find(ids)
@unexpired = true

case params[:bulkop]
bulkop = params[:bulkop_top].empty? ? params[:bulkop_bottom] : params[:bulkop_top]
case bulkop
when 'Delete Checked Items'
count = 0
ids.each do |id|
Expand Down
4 changes: 2 additions & 2 deletions app/models/sidebar.rb
Expand Up @@ -74,8 +74,8 @@ def value_for(choice)

class CheckBoxField < self
def input_html(sidebar)
check_box_tag(input_name(sidebar), 1, sidebar.config[key], options)+
hidden_field_tag(input_name(sidebar),0)
hidden_field_tag(input_name(sidebar),0)+
check_box_tag(input_name(sidebar), 1, sidebar.config[key], options)
end

def line_html(sidebar)
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/feedback/_button.html.erb
@@ -1,7 +1,7 @@
<p>
<%= hidden_field_tag "confirmed", params[:confirmed] %>
<%= hidden_field_tag "published", params[:published] %>
<%= hidden_field_tag "bulkop", "",{:id=>"bulkop"} %>
<%= hidden_field_tag "bulkop_#{position}", "",{:id=>"bulkop"} %>
<%= submit_tag _("Delete Checked Items"), {:class => 'submit',:onclick=>"getElementById('bulkop').value='Delete Checked Items'"} %> &nbsp;
<%= submit_tag _("Mark Checked Items as Ham"), {:class => 'submit',:onclick=>"getElementById('bulkop').value='Mark Checked Items as Ham'"} %>
<%= submit_tag _("Mark Checked Items as Spam"), {:class => 'submit',:onclick=>"getElementById('bulkop').value='Mark Checked Items as Spam'"} %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/feedback/index.html.erb
Expand Up @@ -11,7 +11,7 @@

<div class="list">
<% form_tag({:action => 'bulkops'}, :method => :post) do %>
<%= render :partial => 'button' %>
<%= render :partial => 'button', :locals => { :position => 'top' } %>
<%= hidden_field_tag "search", params[:search]%>
<%= hidden_field_tag "page", params[:page]%>
Expand All @@ -31,7 +31,7 @@
<tr><td class="paginate" colspan="9"><%= will_paginate @feedback %></td></tr>
</table>

<%= render :partial => 'button' %>
<%= render :partial => 'button', :locals => { :position => 'bottom' } %>
<% end %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/admin/feedback_controller_spec.rb
Expand Up @@ -296,7 +296,7 @@ def feedback_from_not_own_article
describe '#bulkops action' do

before :each do
post :bulkops, :bulkop => 'Delete all spam'
post :bulkops, :bulkop_top => 'Delete all spam'
end

it 'should redirect to action' do
Expand Down

0 comments on commit 95c04d0

Please sign in to comment.