SUSE/hackweek

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

Summary

Maintainability
Test Coverage
- if @users.length > 0
  .row
    .col-sm-12
      %table.table#users_table
        - @users.each do |user|
          %tr
            %td
              = link_to user_path(user) do
                = image_tag(user.gravatar_url(:size => "24"), :class => "img-thumbnail", :title => "#{user.name}", :alt => user.name)
                = user.name
              - if current_user.role? :admin
                = link_to edit_user_path(user) do
                  %i{class: 'fas fa-pencil-alt', title: 'Edit'}
  .row
    .col-md-12
      .text-center
        = paginate @users, :remote => true
- else
  %h3
    No users yet.

:javascript
  $( "#free" ).click(function() {
    $( ".free" ).show();
    $( ".busy" ).hide();
    $( "#free-pill").addClass( "active" );
    $( "#all-pill, #busy-pill").removeClass( "active" );
  });

  $( "#busy" ).click(function() {
    $( ".free" ).hide();
    $( ".busy" ).show();
    $( "#busy-pill").addClass( "active" );
    $( "#all-pill, #free-pill").removeClass( "active" );
  });

  $( "#all" ).click(function() {
    console.log ("show everything");
    $( ".free" ).show();
    $( ".busy" ).show();
    $( "#all-pill").addClass( "active" );
    $( "#busy-pill, #free-pill").removeClass( "active" );
  });

  $("table").addTableFilter({
  });