Codeminer42/cm42-central

View on GitHub
app/views/projects/index.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title_bar do %>
  <% if policy(Project).new? %>
    <%= link_to t('projects.new project'), new_project_path, class: 'btn btn-primary btn-sm navbar-btn', data: {step: "create-project"} %>
  <% end %>
  <% if policy(TagGroup).new? %>
    <%= link_to t('tag_group.tag_groups'), tag_groups_path, class: 'btn btn-success btn-sm navbar-btn' %>
  <% end %>
<% end %>

<div id="projects" class="projects-list">
  <div class="row item">
    <div class="col-md-12">
      <% if @projects[:joined].empty? %>
        <div class="col-md-6">
          <div class="simple-alert">
            <i class="mi alert-icon">error_outline</i>
            <h4 class="text-center">
              <%= t('projects.no_projects_found') %>
            </h4>
          </div>
        </div>
      <% else %>
        <div class="col-md-6 activity" data-step="activity">
          <% if @activities_group.empty? %>
            <div class="simple-alert">
              <i class="mi alert-icon">error_outline</i>
              <h4 class="text-center"><%= t('projects.no_recent_activity') %></h4>
            </div>
          <% else %>
            <ul class="timeline">
              <%= render 'activities_group', activities_group: @activities_group %>
            </ul>
          <% end %>
        </div>
      <% end %>
      <div
        id="projects-search"
        class="col-md-6 projects"
        data-current_user="<%= current_user.to_json %>"
        data-admin="<%= policy(User).update? %>"
        data-projects_joined="<%= @projects[:joined].to_json %>"
        data-projects_unjoined="<%= @projects[:unjoined].to_json %>"
      >
      </div>
    </div>
  </div>
</div>