anthonymidili/Recipedia

View on GitHub
app/views/users/show.html.haml

Summary

Maintainability
Test Coverage
- provide :title, 'The Cook'

.row
  .col-12
    = link_to new_recipe_path, class: 'float-end btn btn-danger mb-3' do
      %i.fa.fa-plus-circle
      Add a recipe
.row
  .col-12
    .callout-transparent
      - if is_author?(@user)
        .row
          .col-12
            = link_to edit_user_path(@user), class: "float-end" do
              %i.fas.fa-edit
              Edit about you
      .row
        .col-12
          .center-text
            %h1.no-background #{@user.username}'s Cookbook
      .row
        .col-md-5.col-lg-3
          .center-text
            = render 'users/profile_stats', user: @user, size: 150
        .col-md-7.col-lg-9
          .center-on-md
            .mb-3
              = render 'relationships/form', user: @user
            .mb-3
              = link_to user_path(@user, anchor: 'submitted') do
                Submitted:
                = @user.recipes.by_published.count
              %br/
              = link_to user_path(@user, anchor: 'favorites') do
                Favorites:
                = @user.favorite_recipes.count
          .autolinks= simple_format(@user.info.body) if @user.info
- if @user == current_user && @user.recipes.by_unpublished.any?
  .row
    .col-12
      %h3 Unpublished Drafts
      .row
        = render @user.recipes.by_unpublished
- if @user.recipes.by_published.any?
  .row
    .col-12
      %h3#submitted Submitted Recipes
      .row
        = render @user.recipes.by_published
- if @user.favorite_recipes.any?
  .row
    .col-12
      %h3#favorites Favorites
      .row
        = render @user.favorite_recipes