Sha256: 829e061504c946c311ba0d93d73dd569f10ca7f5ef6b370060ec4b1a85c881fc

Contents?: true

Size: 724 Bytes

Versions: 2

Compression:

Stored size: 724 Bytes

Contents

class Admin::ReviewsController < Admin::BaseController
  resource_controller

  def index
    @unapproved_reviews = Review.not_approved.find(:all, :order => "created_at DESC")
    @approved_reviews   = Review.approved.find(:all, :order => "created_at DESC")
  end

  create.response do |wants|
    wants.html { redirect_to admin_reviews_path }
  end

  update.response do |wants|
    wants.html { redirect_to admin_reviews_path }
  end

  def approve
    r = Review.find(params[:id])

    if r.update_attribute(:approved, true)
       r.product.recalculate_rating
       flash[:notice] = t("info_approve_review")
    else
       flash[:error] = t("error_approve_review")
    end
    redirect_to admin_reviews_path
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_reviews-0.50.1 app/controllers/admin/reviews_controller.rb
spree_reviews-0.50.0 app/controllers/admin/reviews_controller.rb