publiclab/spectral-workbench

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

Summary

Maintainability
Test Coverage
<div class="container">

<h2>
  <%= @user.login %> 
  <small>(<%= @user.spectrum_count %> spectra and <%= @user.set_count %> sets) 
  | <a class="btn btn-mini" href="/spectra/feed/<%= @user.login %>">RSS</a> 
  | <a href="http://publiclab.org/profile/<%= @user.login %>">Public Lab profile &raquo;</a>
  </small>
</h2>

<hr />

<div class="row-fluid">
  <div class="span4">
    <%= render :partial => 'spectrums/search' %>

    <% if logged_in? %>
    <hr />

    <% if current_user.id == @user.id || current_user.role == 'admin' %>
      <div class="container">
        <h4>API token for <%= @user.login %></h4>
        <p>Don't share this with anyone!</p>
        <input type="text" value="<%= @user.token %>" />
      </div>
    <% end %>

    <div class="container">
      <h4>Send a direct message:</h4>
      <form method="post" class="form" action="/message">
        <input type='hidden' name='authenticity_token' value="<%= form_authenticity_token %>"/>
        <input type="hidden" name="user_id" value="<%= @user.id %>" />
        <input placeholder="Title" type="text" name="title" /><br />
        <textarea placeholder="Message" name="body"></textarea><br />
        <button type="submit" class="btn">Send</button>
      </form>
    </div>
    <% end %>

    <div class="container" style="padding-left:10px;">
      <% if logged_in? && current_user.role == "admin" %>
        <br />
        <b>Email:</b>
        <%=h @user.email %>
      <% end %>
      <br />
      <b>Signed up:</b>
      <%=h time_ago_in_words(@user.created_at) %> ago
      <br />
      <b>Tags added:</b>
      <%=h Tag.where(:user_id => @user.id).count %>
    </div>
    <hr />

    <%= render :partial => 'spectrums/sets' %>
    <%= will_paginate @sets, :param_name => :set_page, renderer: BootstrapPagination::Rails %>

  </div>

  <div class="span8">
    <%= render :partial => 'spectrums/list', locals: { spectrums: @spectrums } %>
    <%= will_paginate @spectrums, renderer: BootstrapPagination::Rails %>
  </div>
</div>
</div>