summaryrefslogtreecommitdiff
path: root/app/views/search/index.html.erb
blob: 877ccb3c4af576ea5913f9beab16e93b50f9e72c (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
<% provide(:title, "#{@search}") -%>
<div class="row">
  <div class="col">
    <ul class="nav nav-tabs">
      <li class="nav-item"><a class="nav-link active" href="#tab1" data-toggle="tab">Creations</a></li>
      <li class="nav-item"><a class="nav-link" href="#tab2" data-toggle="tab">Tutorials</a></li>
      <li class="nav-item"><a class="nav-link" href="#tab3" data-toggle="tab">Artists</a></li>
    </ul>
    <div class="tab-content">
      <div class="tab-pane show active" id="tab1">
        <% if @creations.any? %>
        <table class="table table-striped">
          <thead>
            <th></th>
            <th>Artist</th>
            <th>Name</th>
            <th>Description</th>
          </thead>
          <tbody>
          <% @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><%= link_to creation.user.name, profile_path(creation.user) %></td>
              <td><%= creation.name %></td>
              <td><%= creation.story %></td>
            </tr>
            <% end %>
          <% end %>
          </tbody>
        </table>
        <% else %>
          <p>No creations found.</p>
        <% end %>
      </div>
      <div class="tab-pane" id="tab2">
        <% if @tutorials.any? %>
        <table class="table table-striped">
          <thead>
            <th>Name</th>
            <th>Description</th>
          </thead>
          <tbody>
          <% @tutorials.each_with_index do |tutorial, index| %>
            <% cache tutorial do %>
            <tr>
              <td><%= link_to tutorial.heading, tutorial_path(tutorial) %></td>
              <td><%= tutorial.description %></td>
            </tr>
            <% end %>
          <% end %>
          </tbody>
        </table>
        <% else %>
          <p>No tutorials found.</p>
        <% end %>
      </div>
      <div class="tab-pane" id="tab3">
        <% if @members.any? %>
        <table class="table table-striped">
          <thead>
            <th>Artists</th>
            <th>Name</th>
          </thead>
          <tbody>
          <% @members.each_with_index do |artist, index| %>
            <tr>
              <td>
                <%= link_to profile_path(artist) do %>
                  <%= avatar_for(artist, size: 65) %>
                <% end %>
              </td>
              <td><%= link_to artist.name, profile_path(artist) %></td>
              <td><%= link_to artist.website, artist.website if artist.website %></td>
              <td><%= link_to artist.twitter, "https://twitter.com/#{artist.twitter}" if artist.twitter.present? %></td>
              <td><%= link_to artist.facebook, artist.facebook if artist.facebook %></td>
              <td><%= artist.city %></td>
            </tr>
          <% end %>
          </tbody>
        </table>
        <% else %>
          <p>No artists found.</p>
        <% end %>
      </div>
    </div>
  </div>
</div>