summaryrefslogtreecommitdiff
path: root/app/views/admin/users/show.html.erb
blob: 7c2e5b29b516defe31f203c8194762405f49217e (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<%= provide(:search_path, admin_users_path) %>

<div class="row">
  <div class="col-3">
    <%= render partial: "my/shared/my_nav" %>
  </div>
  <div class="col-9">
    <h1><%= link_to @user.name, profile_path(@user) %> <small>(<a href="#edit-user-modal-<%= @user.id %>" role="button" data-toggle="modal">edit</a>)</small></h1>
    <%= render partial: 'edit_modal', locals: { user: @user } %>
    <div class="row">
      <div class="col">
        <%= avatar_for(@user) %>
      </div>
      <div class="col">
        <p>name: <%= link_to @user.name, admin_user_path(@user) %></p>
        <p>email: <%= mail_to @user.email %></p>
        <p>address: <%= mail_to @user.full_address %></p>
        <p>city: <%= mail_to @user.city %></p>
        <p>website: <%= link_to @user.website, @user.website if @user.website %></p>
        <p>twitter: <%= @user.twitter %></p>
        <p>facebook: <%= link_to @user.facebook, @user.facebook if @user.facebook %></p>
        <p>reset password token: <%= @user.reset_password_token %></p>
        <p>reset password sent at: <%= @user.reset_password_sent_at %></p>
        <p>created at: <%= @user.created_at %></p>
        <p>updated at: <%= @user.updated_at %></p>
      </div>
    </div>

    <h2>sessions</h2>
    <table class="table table-striped table-condensed">
      <thead>
        <tr>
          <th>ip</th>
          <th>user agent</th>
          <th>accessed at</th>
          <th>revoked at</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        <%- @user.user_sessions.each do |user_session| %>
          <tr>
            <td><%= link_to user_session.user.name, admin_user_path(user_session.user) %></td>
            <td><%= user_session.ip %></td>
            <td><%= user_session.user_agent %></td>
            <td><%= time_ago_in_words(user_session.accessed_at) %></td>
            <td><%= time_ago_in_words(user_session.revoked_at) if user_session.revoked_at %></td>
            <td><%= link_to "Revoke", admin_session_path(user_session), method: :delete, class: 'btn btn-danger' %></td>
          </tr>
        <% end %>
      </tbody>
    </table>

    <h2>cakes</h2>
    <table class="table table-striped">
      <thead>
        <th></th>
        <th>Name</th>
        <th>Description</th>
      </thead>
      <tbody>
      <%- @user.creations.each_with_index do |creation, index| %>
        <% cache creation do %>
        <tr>
          <td>
            <%= link_to cake_path(creation) do %>
              <%= image_tag creation.primary_image.url_for(:thumb), class: 'thumbnail', style: "width:65px;" %>
            <% end %>
          </td>
          <td><%= creation.name %></td>
          <td>
            <%= creation.story %>
            <%= creation.tags.map(&:name) if creation.tags.any? %>
          </td>
        </tr>
        <% end %>
      <% end %>
      </tbody>
    </table>

    <h2>tutorials</h2>
    <table class="table table-striped">
      <thead>
        <th>Heading</th>
        <th>Url</th>
      </thead>
      <tbody>
      <%- @user.tutorials.each_with_index do |tutorial, index| %>
        <tr>
          <td><%= link_to tutorial.heading, tutorial_path(tutorial) %></td>
          <td><%= tutorial.description %></td>
        </tr>
      <% end %>
      </tbody>
    </table>
  </div>
</div>