Added ability to sort posts by feature count

This commit is contained in:
rr- 2015-11-24 15:43:20 +01:00
parent 645573a272
commit d49f76c9f1
3 changed files with 15 additions and 12 deletions

View file

@ -176,6 +176,7 @@
{search: 'order:fav_date', description: 'recently added to favorites'},
{search: 'order:comment_date', description: 'recently commented'},
{search: 'order:feature_date', description: 'recently featured'},
{search: 'order:feature_count', description: 'most often featured'},
];
_.each(table, function(row) { %>
<tr>

View file

@ -14,6 +14,7 @@ class PostFilter extends BasicFilter implements IFilter
const ORDER_LAST_COMMENT_TIME = 'lastCommentCreationTime';
const ORDER_LAST_FAV_TIME = 'lastFavTime';
const ORDER_LAST_FEATURE_TIME = 'lastFeatureTime';
const ORDER_FEATURE_COUNT = 'featureCount';
const REQUIREMENT_TAG = 'tag';
const REQUIREMENT_ID = 'id';

View file

@ -117,18 +117,19 @@ class PostSearchParser extends AbstractSearchParser
{
return
[
[['id'], PostFilter::ORDER_ID],
[['random'], PostFilter::ORDER_RANDOM],
[['time', 'date'], PostFilter::ORDER_LAST_EDIT_TIME],
[['score'], PostFilter::ORDER_SCORE],
[['file_size'], PostFilter::ORDER_FILE_SIZE],
[['tag_count', 'tags', 'tag'], PostFilter::ORDER_TAG_COUNT],
[['fav_count', 'fags', 'fav'], PostFilter::ORDER_FAV_COUNT],
[['comment_count', 'comments', 'comment'], PostFilter::ORDER_COMMENT_COUNT],
[['note_count', 'notes', 'note'], PostFilter::ORDER_NOTE_COUNT],
[['fav_time', 'fav_date'], PostFilter::ORDER_LAST_FAV_TIME],
[['comment_time', 'comment_date'], PostFilter::ORDER_LAST_COMMENT_TIME],
[['feature_time', 'feature_date', 'featured', 'feature'], PostFilter::ORDER_LAST_FEATURE_TIME],
[['id'], PostFilter::ORDER_ID],
[['random'], PostFilter::ORDER_RANDOM],
[['time', 'date'], PostFilter::ORDER_LAST_EDIT_TIME],
[['score'], PostFilter::ORDER_SCORE],
[['file_size'], PostFilter::ORDER_FILE_SIZE],
[['tag_count', 'tags', 'tag'], PostFilter::ORDER_TAG_COUNT],
[['fav_count', 'fags', 'fav'], PostFilter::ORDER_FAV_COUNT],
[['comment_count', 'comments', 'comment'], PostFilter::ORDER_COMMENT_COUNT],
[['note_count', 'notes', 'note'], PostFilter::ORDER_NOTE_COUNT],
[['fav_time', 'fav_date'], PostFilter::ORDER_LAST_FAV_TIME],
[['comment_time', 'comment_date'], PostFilter::ORDER_LAST_COMMENT_TIME],
[['feature_time', 'feature_date'], PostFilter::ORDER_LAST_FEATURE_TIME],
[['feature_count', 'features', 'featured'], PostFilter::ORDER_FEATURE_COUNT],
];
}