anthonymidili/Recipedia

View on GitHub
app/views/relationships/_form.html.haml

Summary

Maintainability
Test Coverage
- unless is_author?(user, check_admin=false)
  - if !user_signed_in?
    - if defined?(recipe)
      = button_to log_in_recipe_path(recipe),
      class: 'btn btn-outline-secondary btn-lg', method: :get do
        %i.fa.fa-sign-in-alt
        Log in to follow
    - else
      = button_to log_in_user_path(user),
      class: "btn btn-outline-secondary btn-lg", method: :get do
        %i.fa.fa-sign-in-alt
        Log in to follow
  - elsif current_user.following?(user)
    = turbo_frame_tag dom_id(user, "following_form") do
      = render 'relationships/unfollow', user: user
  - else
    = turbo_frame_tag dom_id(user, "following_form") do
      = render 'relationships/follow', user: user