indentlabs/notebook

View on GitHub
app/views/users/content_list.html.erb

Summary

Maintainability
Test Coverage
<% if @content_list.any? %>
  <div class="row">
    <div class="col s12">
      <div class="card">
        <div class="card-image", style="height: 260px; overflow-y: hidden;">
          <%= image_tag "card-headers/#{@content_type.to_s.downcase.pluralize}.webp" %>
          <span class="card-title black lighten-3">
            <i class="material-icons <%= @content_type.text_color %>"><%= @content_type.icon %></i>
            <%= @content_type.to_s.capitalize.pluralize %>
            by
            <i class="material-icons white-text">person</i>
            <%= link_to @user.name, @user, class: 'white-text' %>
          </span>
        </div>
        <div class="card-content">
          <%= render partial: 'content/list/cards', locals: {
            content_list: @content_list,
            content_type: @content_type,
            how_add_another_form: false,
            show_template_editor_form: false,
            show_new_button: false
          } %>
        </div>
        <div class="clearfix" style="padding-bottom: 2em"></div>
        <div class="card-action">
          <%= link_to "Back to #{@user.name}'s profile'", @user %>
        </div>
      </div>
    </div>
  </div>
<% else %>
  <div class="center" style="margin: 50px 0">
    <h4>
      <i class="material-icons <%= User.text_color %>"><%= User.icon %></i>
      <%= link_to(@user.name, @user, class: "#{User.text_color}") %>
      doesn't have any public
      <%= @content_type.name.downcase.pluralize %> yet!
    </h4>
    <h1>
      <i class="material-icons <%= @content_type.text_color %>" style="font-size: 200%">
        <%= @content_type.icon %>
      </i>
    </h1>
    <p>
      <%= t("content_descriptions.#{@content_type.name.downcase}") %>
    </p>
  </div>
<% end %>