-
Notifications
You must be signed in to change notification settings - Fork 4
/
show.html.erb
48 lines (44 loc) · 2.1 KB
/
show.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<aside>
<%= image_tag("http://i.imgur.com/aT2G7y7.jpg", class: "aside-image", alt: "booger") %>
</aside>
<section>
<h4><%= @user.first_name %> <%= @user.last_name %></h4>
<div class="container animate fadeIn">
<div class="row">
<%= link_to "Log Out", logout_path, class: "btn spaced-btn centered small-view" %>
<div class="form-box clearfix">
<div id="events-container" class="col s6">
<% if !@user.is_prof && current_user == @user %>
<button class="btn" id="new-event-button"><%= link_to 'New Entry', '/users/' + current_user.user_name + '/events/new'%></button>
<h3><%= @user.professional_id && current_user.id == @user.professional_id ? @user.first_name + "'s" : "Your" %> Entries</h3>
<div id="nav"><%= paginate @events if @events %></div>
<% end %>
<ul>
<% for event in @events %>
<li id="event-lists">
<p>
<%= link_to event.created_at.strftime("%b. %d, %Y"), '/users/' + @user.user_name + '/events/' + event.id.to_s %><br>
Triggering Event: <%= truncate(event.trigger) %><br>
Behavior: <%= truncate(event.behavior) %>
</p>
</li>
<hr>
<% end %>
</ul>
</div>
<div class="col <%= @user.is_prof && @user == current_user ? 's8 offset-s3' : 's6'%>" id="#prof-container">
<% if !@user.professional && !@user.is_prof %>
<p>You aren't sharing with a professional yet. If your doctor is listed below, you may select them to share your events with.</p>
<%= simple_form_for @user, url: '/users/' + @user.user_name, method: 'patch' do |f| %>
<%= f.input :professional_id, collection: @profs %>
<%= f.button :submit, 'Choose' %>
<% end %>
<% elsif !@user.is_prof && current_user == @user %>
<h5> Your professional is <%= User.find_by_id(@user.professional_id).first_name + " " + User.find_by_id(@user.professional_id).last_name %> </h5>
<% end %>
<%= render partial: "admin_show" if @user.is_prof? %>
</div>
</div>
</div>
</div>
</section>