app/views/users/show.html.erb
<div class="flexbox">
<div class="item item1">
<div id="attributes-panel">
<div class="break_words content">
<div class="title-section">
<h2><%= user_tag(@user) -%>
<%= sessions_current_user_id == @user.id ? content_tag(:span, 'You!', class: [:feedback, 'feedback-success', 'feedback-thin']) : content_tag(:span, 'NOT YOU!', class: [:feedback, 'feedback-danger', 'feedback-thin']) -%>
</h2>
</div>
<div class="attributes">
<%= button_to 'Edit', edit_user_path(@user), method: :get, class: 'button-default' %><br>
<%= render 'attributes' %>
</div>
<% if sessions_current_user.is_administrator? %>
<h2> Administration (not visible to user)</h2>
<div>
<h3> User's projects </h3>
<ul>
<% if @user.projects.any? %>
<%= @user.projects.pluck(:name).collect{|n| tag.li n}.join.html_safe %>
<% else %>
<li><i>None</i></li>
<% end %>
</ul>
<h3> User's data in projects (quick, not comprehensive) </h3>
<% p = @user.data_in_projects %>
<ul>
<% if p.count > 0 %>
<%= p.collect{|n| tag.li n}.join.html_safe %>
<% else %>
<li><i>Not found in core data</i></li>
<% end %>
</ul>
</div>
<% end %>
</div>
</div>
</div>
<div class="item item2">
<div class="content">
<h2>Preferences</h2>
<h3>General</h3>
<%= form_for @user, url: reset_preferences_user_path(@user), method: :patch do |f| %>
<%= f.submit "Reset" , class: 'button-submit' %> <%= tag.span 'Warning, this will reset all preferences aross all projects!', class: [:feedback, 'feedback-thin', 'feedback-danger'] %>
<% end %>
<%= ap(@user.preferences).html_safe %>
<h3>Favorites</h3>
<% if sessions_current_project_id %>
<%= form_for @user, url: reset_hub_favorites_user_path(@user), method: :patch do |f| %>
<%= f.submit "Reset (for #{sessions_current_project.name})" , class: 'button-submit' %> <%= tag.span "Clears your favorite cards for this project", class: [:feedback, 'feedback-thin', 'feedback-info'] %>
<% end %>
<% end %>
<%= ap(@user.hub_favorites).html_safe %>
</div>
</div>
</div>