-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathindex.html.erb
63 lines (58 loc) · 2.69 KB
/
index.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<%= render :partial => "sidebar/featured" %>
<div class="col-md-9">
<table style="width:100%">
<tr>
<th style="width: 50% ;">
<h1 style="font-family:Junction Light;"><%= t('tag.index.popular_tags') %></h1>
</th>
</tr>
</table>
<p><%= t('tag.index.browse_popular_tags') %></p>
<!-- Search Bar -->
<input class="form-control" type="text" id="myInput" placeholder="Search for tags..">
<script>
$('#myInput').keypress(function (e) {
var key = e.which;
if(key == 13) // the enter key code
{
var pre = document.getElementById("myInput").value ;
window.location.href = " <%= tags_path %>"+"/"+pre
}
});
</script>
<br><br>
<table class="table">
<tr>
<th><a href = "<%= tags_path %>?sort=name"><%= t('tag.index.tag') %></a></th>
<th><a href = "<%= tags_path %>?sort=uses"><%= t('tag.index.number_of_uses') %></a></th>
<th><%= t('tag.index.number_of_subscriptions')%></th>
<% if current_user %>
<th><a href = "<%= tags_path %>?sort=subscribers"><%= t('tag.index.subscriptions') %></a></th>
<% end %>
</tr>
<% @tags.each do |tag| %>
<tr>
<td><i class="fa fa-tag"></i> <a href="/tag/<%= tag.name %>"><%= tag.name %></a></td>
<td><%= tag.count %></td>
<td><a class="btn btn-default btn-sm" rel="popover" data-placement="right" data-html="true" data-title="<%= t('tag.show.users_following_tag') %>" data-content="<% Tag.followers(tag.name).each do |user| %><i class='fa fa-star-o'></i> <a href='/profile/<%= user.username %>'><%= user.username %></a><br /><% end %><% if Tag.follower_count(tag.name) == 0 %><i><%= t('tag.show.none') %></i><% end %>"><%= Tag.follower_count(tag.name) %> <i class="fa fa-user"></i> <span class="caret"></span></a></td>
<script type="text/javascript">
//show one popover at a time
$('.btn').on('click', function (e) {
$('.btn').not(this).popover('hide');
});
</script>
<% if current_user %>
<td>
<% if current_user.following(tag.name) %>
<a rel="tooltip" title="<%= t('tag.show.unfollow') %>" class="btn btn-default btn-sm active" href="/unsubscribe/tag/<%= tag.name %>"><i class="fa fa-eye"></i> <%= t('tag.show.following') %></a>
<% else %>
<a class="btn btn-default btn-sm" href="/subscribe/tag/<%= tag.name %>"><i class="fa fa-eye"></i> <%= t('tag.show.follow') %></a>
<% end %>
</td>
<% end %>
</tr>
<% end %>
</table>
<%= will_paginate @tags, :renderer => BootstrapPagination::Rails if @paginated %>
<hr />
</div>