mirror of
https://github.com/chenasraf/snpr.git
synced 2026-05-18 01:39:01 +00:00
cleans up user_is_user template (#325)
This commit is contained in:
committed by
Helge Rausch
parent
40988cdaab
commit
74b55b18c9
@@ -1,198 +1,231 @@
|
||||
<div class="row">
|
||||
<div class="span3"><h1>Hello <%= @first_name %>!</h1></div>
|
||||
<div class="row">
|
||||
<br/>
|
||||
<div align="right">
|
||||
<%if @user.fitbit_profile != nil%>
|
||||
<%=link_to(image_tag("fitbit-icon.png"),{:controller => "fitbit_profiles", :action => "show", :id => @user.fitbit_profile.id},:rel =>"tooltip",:title => "See your Fitbit data")%>
|
||||
<%end%>
|
||||
<div class="span3">
|
||||
<h1>Hello <%= @first_name %>!</h1>
|
||||
</div>
|
||||
|
||||
<% current_user.achievements.each do |a|%>
|
||||
<a href="/achievements/<%= a.id %>" rel="tooltip" title="Achievement: <%=a.award%>"><%=image_tag("achievements/#{a.short_name}_32px.png",:height=>"20px",:alt => a.award)%></a>
|
||||
<%end%>
|
||||
</div>
|
||||
<div class="row">
|
||||
<br/>
|
||||
<div align="right">
|
||||
<% unless @user.fitbit_profile.nil? %>
|
||||
<%= link_to(image_tag('fitbit-icon.png'), @user.fitbit_profile, :rel => 'tooltip', :title => 'See your Fitbit data') %>
|
||||
<% end %>
|
||||
<% current_user.achievements.each do |a|%>
|
||||
<a href='/achievements/<%= a.id %>' rel='tooltip' title='Achievement: <%= a.award %>'>
|
||||
<%= image_tag('achievements/#{a.short_name}_32px.png', :height=> '20px', :alt => a.award) %>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if current_user.messages.where(:user_has_seen => false) != [] %>
|
||||
<p><a href="#messages">You have messages!</a></p>
|
||||
|
||||
<% unless current_user.messages.where(:user_has_seen => false).empty? %>
|
||||
<p><a href="#messages">You have messages!</a></p>
|
||||
<% end %>
|
||||
<% if @user.description != nil %>
|
||||
<h3>Description of yourself</h3>
|
||||
<p><%= @user.description %></p>
|
||||
|
||||
<% unless @user.description.nil? %>
|
||||
<h3>Description of yourself</h3>
|
||||
<p><%= @user.description %></p>
|
||||
<% end %>
|
||||
|
||||
<div id="tab-container">
|
||||
<ul class="nav nav-tabs">
|
||||
<%if @unentered_phenotypes != []%>
|
||||
<li><a href="#unentered_variations">Variations you did not enter yet (<%=@unentered_phenotypes.length%>)</a></li>
|
||||
<%end%>
|
||||
<%if @user.has_sequence != true%>
|
||||
<li><a href="#snps">Your SNPs</a></li>
|
||||
<%end%>
|
||||
<li><a href="#variations">Your variations</a></li>
|
||||
<li><a href="#messages">Your messages</a></li>
|
||||
<li><a href="#comments">Replies to your comments</a></li>
|
||||
</ul>
|
||||
|
||||
<%if @unentered_phenotypes != []%>
|
||||
<div id="unentered_variations">
|
||||
<p><%= link_to "Go here for the full list of phenotypes!", :controller => "phenotypes", :action => "index" %></p>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name of Phenotype</th>
|
||||
<th>Enter variation</th>
|
||||
<th>Number of users</th>
|
||||
<th>Created at</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%@unentered_phenotypes.each do |i|%>
|
||||
<tr>
|
||||
<td><%=link_to i.characteristic, i%> </td>
|
||||
<td>
|
||||
<%= link_to image_tag("add_variation_small.png", :style => "vertical-align:middle"), '#new_user_phenotype_modal'+i.id.to_s, :'data-toggle' => "modal" %>
|
||||
<%= render partial: "user_phenotypes/new", layout: "layouts/modal", locals: { id: "new_user_phenotype_modal"+i.id.to_s, phenotype: i } %>
|
||||
</td>
|
||||
<td><%= i.number_of_users %> </td>
|
||||
<td><%=link_to i.created_at,i%></td>
|
||||
</tr>
|
||||
|
||||
<%end%>
|
||||
</table>
|
||||
</div>
|
||||
<%end%>
|
||||
|
||||
|
||||
<div id="snps">
|
||||
<%# if @user.has_sequence == true %>
|
||||
<%#= render "snps" %>
|
||||
<%# else %>
|
||||
<%if @user.genotypes.length == 0%>
|
||||
<h2>You haven't uploaded your SNP-set. <%= link_to("Please do so", :controller => "genotypes", :action => "new")%></h2>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="variations">
|
||||
<h3>Variations:</h3> <%= render "variations" %>
|
||||
</div>
|
||||
|
||||
<div id="messages">
|
||||
<h3>Messages</h3>
|
||||
<p><%= link_to "Write a new message", :controller => "messages", :action => "new" %></p>
|
||||
<h4>Received</h4>
|
||||
<% if @received_messages != [] %>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<th>Subject</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<% @received_messages.each do |m| %>
|
||||
<tr>
|
||||
<%if User.find_by_id(m.from_id) != nil %>
|
||||
<td><%=image_tag User.find_by_id(m.from_id).avatar.url(:head),:style => "vertical-align:middle"%><%= link_to(User.find_by_id(m.from_id).name,User.find_by_id(m.from_id)) %></td>
|
||||
<%else%>
|
||||
<td>Deleted User</td>
|
||||
<%end%>
|
||||
<td><%= link_to( m.subject, m ) %></td>
|
||||
<td>
|
||||
<% if m.user_has_seen == false %>
|
||||
<%=link_to(image_tag("email_small.png"),m)%> <b><%=link_to("Unread!",m)%></b>
|
||||
<%else%>
|
||||
<%=link_to(image_tag("email_opened_small.png"),m)%> <%=link_to("Read",m)%>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% else %>
|
||||
You haven't received any messages yet.
|
||||
<% end %>
|
||||
<h3>Sent</h3>
|
||||
<% if @sent_messages != [] %>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>To</th>
|
||||
<th>Subject</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<% @sent_messages.each do |m| %>
|
||||
<tr>
|
||||
<%if User.find_by_id(m.to_id) != nil%>
|
||||
<td><%=image_tag User.find_by_id(m.to_id).avatar.url(:head),:style => "vertical-align:middle"%><%= User.find_by_id(m.to_id).name %></td>
|
||||
<%else%>
|
||||
<td>Deleted User</td>
|
||||
<%end%>
|
||||
<td><%= link_to( m.subject, m ) %></td>
|
||||
<td><%=link_to(image_tag("email_opened_small.png"),m)%> <%=link_to("Read",m)%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% else %>
|
||||
You have not sent any messages yet.
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="comments">
|
||||
<% if @paginated_phenotype_replies == [] and @paginated_snp_replies == [] %>
|
||||
<p>
|
||||
You have not yet received replies on any comments.
|
||||
</p>
|
||||
<ul class="nav nav-tabs">
|
||||
<% unless @unentered_phenotypes.empty? %>
|
||||
<li>
|
||||
<a href="#unentered_variations">Variations you did not enter yet (<%= @unentered_phenotypes.length %>)</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if @paginated_phenotype_replies != [] %>
|
||||
<h4>Latest replies on your comments on Phenotypes</h4>
|
||||
<% if @user.has_sequence != true %>
|
||||
<li>
|
||||
<a href="#snps">Your SNPs</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<li><a href="#variations">Your variations</a></li>
|
||||
<li><a href="#messages">Your messages</a></li>
|
||||
<li><a href="#comments">Replies to your comments</a></li>
|
||||
</ul>
|
||||
|
||||
<table class="table table-striped" id="phenotype_reply_comments">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>On Phenotype</th>
|
||||
<th>Reply from</th>
|
||||
<th>Subject</th>
|
||||
<th>Text</th>
|
||||
<th>Written at</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @paginated_phenotype_replies.each do |pc|%>
|
||||
<tr>
|
||||
<td><%= link_to Phenotype.find_by_id(pc.phenotype_id).characteristic, "/phenotypes/"+Phenotype.find_by_id(pc.phenotype_id).id.to_s+"#comments"%></td>
|
||||
<td><%=image_tag User.find_by_id(pc.user_id).avatar.url(:head)%><%=User.find_by_id(pc.user_id).name%></td>
|
||||
<td><%= pc.subject %></td>
|
||||
<td><%= pc.comment_text %></td>
|
||||
<td><%= pc.created_at%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
<% unless @unentered_phenotypes.empty? %>
|
||||
<div id="unentered_variations">
|
||||
<p>
|
||||
<%= link_to "Go here for the full list of phenotypes!", :controller => "phenotypes", :action => "index" %>
|
||||
</p>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name of Phenotype</th>
|
||||
<th>Enter variation</th>
|
||||
<th>Number of users</th>
|
||||
<th>Created at</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @unentered_phenotypes.each do |i| %>
|
||||
<tr>
|
||||
<td><%= link_to i.characteristic, i %></td>
|
||||
<td>
|
||||
<%= link_to image_tag("add_variation_small.png", :style => "vertical-align:middle"), '#new_user_phenotype_modal'+i.id.to_s, :'data-toggle' => "modal" %>
|
||||
<%= render partial: "user_phenotypes/new", layout: "layouts/modal", locals: { id: "new_user_phenotype_modal"+i.id.to_s, phenotype: i } %>
|
||||
</td>
|
||||
<td><%= i.number_of_users %> </td>
|
||||
<td><%= link_to i.created_at, i %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @paginated_snp_replies != [] %>
|
||||
<h4>Latest replies on your comments on SNPs</h4>
|
||||
<table class="table table-striped" id="snp_reply_comments">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>On SNP</th>
|
||||
<th>Reply from</th>
|
||||
<th>Subject</th>
|
||||
<th>Text</th>
|
||||
<th>Written at:</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @paginated_snp_replies.each do |snp|%>
|
||||
<tr>
|
||||
<td><%= link_to Snp.find_by_id(snp.snp_id).name, "/snps/"+Snp.find_by_id(snp.snp_id).name.to_s+"/#comments" %></td>
|
||||
<td><%=image_tag User.find_by_id(snp.user_id).avatar.url(:head)%><%= User.find_by_id(snp.user_id).name%></td>
|
||||
<td><%= snp.subject %></td>
|
||||
<td><%= snp.comment_text %></td>
|
||||
<td><%= snp.created_at%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
<div id="snps">
|
||||
<% if @user.genotypes.length == 0 %>
|
||||
<h2>You haven't uploaded your SNP-set. <%= link_to("Please do so", :controller => "genotypes", :action => "new") %></h2>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="variations">
|
||||
<h3>Variations:</h3>
|
||||
<%= render "variations" %>
|
||||
</div>
|
||||
|
||||
<div id="messages">
|
||||
<h3>Messages</h3>
|
||||
<p>
|
||||
<%= link_to "Write a new message", :controller => "messages", :action => "new" %>
|
||||
</p>
|
||||
|
||||
<h4>Received</h4>
|
||||
<% unless @received_messages.empty? %>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<th>Subject</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @received_messages.each do |m| %>
|
||||
<tr>
|
||||
<% unless User.find_by_id(m.from_id).nil? %>
|
||||
<td>
|
||||
<%= image_tag User.find_by_id(m.from_id).avatar.url(:head), :style => "vertical-align:middle" %>
|
||||
<%= link_to(User.find_by_id(m.from_id).name,User.find_by_id(m.from_id)) %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td>Deleted User</td>
|
||||
<% end %>
|
||||
<td><%= link_to( m.subject, m ) %></td>
|
||||
<td>
|
||||
<% if m.user_has_seen == false %>
|
||||
<%= link_to(image_tag("email_small.png"),m)%> <b><%=link_to("Unread!", m) %></b>
|
||||
<% else %>
|
||||
<%= link_to(image_tag("email_opened_small.png"),m)%> <%=link_to("Read", m) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<p>You haven't received any messages yet.</p>
|
||||
<% end %>
|
||||
|
||||
<h3>Sent</h3>
|
||||
<% unless @sent_messages.empty? %>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>To</th>
|
||||
<th>Subject</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @sent_messages.each do |m| %>
|
||||
<tr>
|
||||
<% unless User.find_by_id(m.to_id).nil? %>
|
||||
<td>
|
||||
<%=image_tag User.find_by_id(m.to_id).avatar.url(:head), :style => "vertical-align:middle"%>
|
||||
<%= User.find_by_id(m.to_id).name %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td>Deleted User</td>
|
||||
<% end %>
|
||||
<td>
|
||||
<%= link_to( m.subject, m ) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to(image_tag("email_opened_small.png"),m)%> <%=link_to("Read",m) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
You have not sent any messages yet.
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="comments">
|
||||
<% if @paginated_phenotype_replies.empty? and @paginated_snp_replies.empty? %>
|
||||
<p>
|
||||
You have not yet received replies on any comments.
|
||||
</p>
|
||||
<% end %>
|
||||
<% unless @paginated_phenotype_replies.empty? %>
|
||||
<h4>Latest replies on your comments on Phenotypes</h4>
|
||||
|
||||
<table class="table table-striped" id="phenotype_reply_comments">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>On Phenotype</th>
|
||||
<th>Reply from</th>
|
||||
<th>Subject</th>
|
||||
<th>Text</th>
|
||||
<th>Written at</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @paginated_phenotype_replies.each do |pc|%>
|
||||
<tr>
|
||||
<td><%= link_to Phenotype.find_by_id(pc.phenotype_id).characteristic, "/phenotypes/"+Phenotype.find_by_id(pc.phenotype_id).id.to_s+"#comments"%></td>
|
||||
<td><%=image_tag User.find_by_id(pc.user_id).avatar.url(:head)%><%=User.find_by_id(pc.user_id).name%></td>
|
||||
<td><%= pc.subject %></td>
|
||||
<td><%= pc.comment_text %></td>
|
||||
<td><%= pc.created_at%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% if @paginated_snp_replies != [] %>
|
||||
<h4>Latest replies on your comments on SNPs</h4>
|
||||
<table class="table table-striped" id="snp_reply_comments">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>On SNP</th>
|
||||
<th>Reply from</th>
|
||||
<th>Subject</th>
|
||||
<th>Text</th>
|
||||
<th>Written at:</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @paginated_snp_replies.each do |snp|%>
|
||||
<tr>
|
||||
<td><%= link_to Snp.find_by_id(snp.snp_id).name, "/snps/"+Snp.find_by_id(snp.snp_id).name.to_s+"/#comments" %></td>
|
||||
<td><%=image_tag User.find_by_id(snp.user_id).avatar.url(:head)%><%= User.find_by_id(snp.user_id).name%></td>
|
||||
<td><%= snp.subject %></td>
|
||||
<td><%= snp.comment_text %></td>
|
||||
<td><%= snp.created_at%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("[rel=tooltip]").tooltip({placement:'bottom'});
|
||||
|
||||
Reference in New Issue
Block a user