+ if @review.review.empty? and @review.summary.empty?
+ # If the review and summary are empty, then we go ahead and approve it since there's no text to get in the way.
+ @review.approved = true
+ end
+ if @review.save
+ render(:partial => 'review_thank_you', :layout => 'modal') and return
+ else
+ flash.now[:error] = "Sorry, something went wrong while trying to save your review. Please make sure you chose a star-rating, or try again later. If this problem persists, please feel free to contact us."
+ render(:partial => 'error', :layout => 'modal') and return
+ end
+ else
+ @review = ProductReview.new
+ render(:partial => 'add_review', :layout => 'modal') and return
+ end
+ else
+ flash.now[:error] = "Sorry, we couldn't find the product you're looking to review."
+ render(:partial => 'error', :layout => 'modal') and return
+ end
+ end
+
+ def tell_a_friend
+ if request.post?
+ @product = Product.find(params[:id])
+ if params[:from_name].empty? or params[:from_email].empty? or params[:to_name].empty? or params[:to_email].empty?
+ flash[:error] = "Not all required fields were completed. Please fill them in and try again."
+ <%= link_to "Delete", {:controller => "/admin/reviews", :action => "delete", :id => r.id}, :method => "post", :confirm => "Are you CERTAIN you wish to delete this review? This CANNOT be undone." %>