mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
add chronological and random sorting
This commit is contained in:
parent
d4fe136498
commit
35c248a419
@ -173,6 +173,8 @@ class PageCollectionsController < ApplicationController
|
||||
@pages = @pages.reorder('cached_content_name ASC')
|
||||
when 'chronological'
|
||||
@pages = @pages.reorder('accepted_at ASC')
|
||||
when 'shuffle'
|
||||
@pages = @pages.shuffle
|
||||
when 'recent'
|
||||
@pages = @pages.reorder('accepted_at DESC')
|
||||
when nil
|
||||
|
||||
@ -5,12 +5,20 @@
|
||||
Trending
|
||||
<% end %>
|
||||
-->
|
||||
<%= link_to params.permit(:sort).merge({sort: 'alphabetical'}), class: 'btn btn-flat' do %>
|
||||
<%= link_to params.permit(:sort).merge({sort: 'alphabetical'}), class: 'btn btn-flat tooltipped', data: { tooltip: "Show pages in this collection alphabetically, by name" } do %>
|
||||
<i class="material-icons left">sort</i>
|
||||
Alphabetical
|
||||
<% end %>
|
||||
<%= link_to params.permit(:sort).merge({sort: 'recent'}), class: 'btn btn-flat' do %>
|
||||
<%= link_to params.permit(:sort).merge({sort: 'chronological'}), class: 'btn btn-flat tooltipped', data: { tooltip: "Show pages in this collection in the order they were added" } do %>
|
||||
<i class="material-icons left">sort</i>
|
||||
Chronological
|
||||
<% end %>
|
||||
<%= link_to params.permit(:sort).merge({sort: 'recent'}), class: 'btn btn-flat tooltipped', data: { tooltip: "Sort pages in this collection most-recently-added-first" } do %>
|
||||
<i class="material-icons left">sort</i>
|
||||
Recently added
|
||||
<% end %>
|
||||
<%= link_to params.permit(:sort).merge({sort: 'shuffle'}), class: 'btn btn-flat tooltipped', data: { tooltip: "Show pages in this collection in a random order" } do %>
|
||||
<i class="material-icons left">sort</i>
|
||||
Shuffle
|
||||
<% end %>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user