Skip to content

Commit

Permalink
Order by subscription fix (#2139)
Browse files Browse the repository at this point in the history
* completed function

* sort by subscription added

* Correction

* fix for current_user

* Headings as links
  • Loading branch information
grvsachdeva authored and jywarren committed Feb 5, 2018
1 parent 8f60c60 commit c091474
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
10 changes: 5 additions & 5 deletions app/controllers/tag_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ def index
.paginate(page: params[:page], per_page: 24)
else
tags = Tag.joins(:node_tag, :node)
.select('node.nid, node.status, term_data.*, community_tags.*')
.where('node.status = ?', 1)
.where('community_tags.date > ?', (DateTime.now - 1.month).to_i)
.group(:name)
.order('name')
.select('node.nid, node.status, term_data.*, community_tags.*')
.where('node.status = ?', 1)
.where('community_tags.date > ?', (DateTime.now - 1.month).to_i)
.group(:name)
.order('name')

followed = []
not_followed = []
Expand Down
14 changes: 3 additions & 11 deletions app/views/tag/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
<th style="width: 50% ;">
<h1 style="font-family:Junction Light;"><%= t('tag.index.popular_tags') %></h1>
</th>
<th style="width: 50% ; text-align: right ;">


<a class="btn btn-default" rel="popover" data-trigger="focus" data-placement="bottom" data-html="true" data-content=" <a href = <%= tags_path(1) %> >Number of uses</a> <br> <a href = <%= tags_path(2) %> >Alphabetically</a><br> <a href = <%= tags_path(3) %> > Subscription </a>">
<i class="fa fa-sort"></i> <%=t('tag.index.sort_by') %>
</a>

</th>
</tr>
</table>
<p><%= t('tag.index.browse_popular_tags') %></p>
Expand All @@ -34,11 +26,11 @@

<table class="table">
<tr>
<th><%= t('tag.index.tag') %></th>
<th><%= t('tag.index.number_of_uses') %></th>
<th><a href = <%= tags_path(2) %> ><%= t('tag.index.tag') %></a></th>
<th><a href = <%= tags_path(1) %> ><%= t('tag.index.number_of_uses') %></a></th>
<th><%= t('tag.index.number_of_subscriptions')%></th>
<% if current_user %>
<th><%= t('tag.index.subscriptions') %></th>
<th><a href = <%= tags_path(3) %> ><%= t('tag.index.subscriptions') %></a></th>
<% end %>
</tr>
<% @tags.each do |tag| %>
Expand Down

0 comments on commit c091474

Please sign in to comment.