Skip to content

Commit

Permalink
Add user id sort to document index
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbennett committed Feb 12, 2019
1 parent 4c89ee9 commit 03478cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/controllers/Document/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public function &run(Router &$router, View &$view, array &$args) {
$order = ['edited_datetime','ASC']; break;
case 'updated-desc':
$order = ['edited_datetime','DESC']; break;
case 'user-id-asc':
$order = [ 'user_id','ASC' ]; break;
case 'user-id-desc':
$order = [ 'user_id','DESC' ]; break;
default:
$order = null;
}
Expand Down
6 changes: 6 additions & 0 deletions src/templates/Document/Index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ require('./header.inc.phtml');
<option value="updated-desc"<?php
if ($order === 'updated-desc') { echo ' selected="selected"';
} ?>>Updated (Descending)</option>
<option value="user-id-asc"<?php
if ($order === 'user-id-asc') { echo ' selected="selected"';
} ?>>User Id (Ascending)</option>
<option value="user-id-desc"<?php
if ($order === 'user-id-desc') { echo ' selected="selected"';
} ?>>User Id (Descending)</option>
</select>
<input type="submit" value="Reorder"/>
</form>
Expand Down

0 comments on commit 03478cd

Please sign in to comment.