Permalink
Browse files

allow admin to hide feedbacks

  • Loading branch information...
1 parent e3e2f56 commit 6db676a1f40fac48eb0228936dd517e661fabc6a @feedbackmine committed Apr 23, 2009
@@ -8,6 +8,14 @@ def destroy
redirect_to :back
end
+ def hide
+ @feedback = Feedback.find(params[:id])
+ @feedback.hidden = true
+ @feedback.save!
+
+ redirect_to :back
+ end
+
#reclassify
def edit
@feedback = Feedback.find(params[:id])
View
@@ -12,9 +12,9 @@ class Feedback < ActiveRecord::Base
named_scope :sentiment, lambda { |source, polarity|
if polarity == 'all'
- {:conditions => { :source => source_name2int(source) } }
+ {:conditions => { :source => source_name2int(source), :hidden => nil } }
else
- {:conditions => { :source => source_name2int(source), :polarity => polarity_name2int(polarity) } }
+ {:conditions => { :source => source_name2int(source), :hidden => nil, :polarity => polarity_name2int(polarity) } }
end
}
@@ -69,6 +69,7 @@ What the Community is Saying about '<%= @project.name %>' :
<% end %>
<% if current_user %>
+ <%= link_to 'Hide', {:controller => 'feedbacks', :action => 'hide', :id => feedback} %>
<%= link_to 'Delete', {:controller => 'feedbacks', :action => 'destroy', :id => feedback}, :method => :delete %>
<%= link_to 'Reclassify', {:controller => 'feedbacks', :action => 'edit', :id => feedback} %>
<% end %>
@@ -0,0 +1,9 @@
+class AddHiddenToFeedback < ActiveRecord::Migration
+ def self.up
+ add_column :feedbacks, :hidden, :boolean
+ end
+
+ def self.down
+ remove_column :feedbacks, :hidden
+ end
+end
View
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20090414044947) do
+ActiveRecord::Schema.define(:version => 20090423051419) do
create_table "feedbacks", :force => true do |t|
t.string "url"
@@ -25,6 +25,7 @@
t.integer "source"
t.string "url_id"
t.string "title"
+ t.boolean "hidden"
end
add_index "feedbacks", ["url_id"], :name => "index_feedbacks_on_url_id", :unique => true

0 comments on commit 6db676a

Please sign in to comment.