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
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def bulkops
items = Feedback.find(ids) items = Feedback.find(ids)
@unexpired = true @unexpired = true


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


class CheckBoxField < self class CheckBoxField < self
def input_html(sidebar) 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 end


def line_html(sidebar) def line_html(sidebar)
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/feedback/_button.html.erb
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
<p> <p>
<%= hidden_field_tag "confirmed", params[:confirmed] %> <%= hidden_field_tag "confirmed", params[:confirmed] %>
<%= hidden_field_tag "published", params[:published] %> <%= 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 _("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 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'"} %> <%= 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
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


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


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


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


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


it 'should redirect to action' do it 'should redirect to action' do
Expand Down

0 comments on commit 95c04d0

Please sign in to comment.