anthonymidili/Recipedia

View on GitHub
app/views/reviews/_reviews.html.haml

Summary

Maintainability
Test Coverage
= turbo_stream_from "reviews"

.row
  .col-12
    %h4#reviews_header
      = render "reviews/count", recipe: recipe

    - if user_signed_in?
      .callout
        = turbo_frame_tag "new_review" do
          = render 'reviews/form', recipe: recipe, review: review
    - else
      %p
        = link_to log_in_recipe_path(@recipe) do
          %i.fa.fa-sign-in-alt
          Log in to create a review

    #reviews.flex-d.flex-column
      = turbo_frame_tag "#{dom_id(recipe)}_reviews" do
        - recipe.reviews.each do |review|
          = render review if review.persisted?