Added aliases for date-based searches

This commit is contained in:
Marcin Kurczewski 2014-10-12 13:59:09 +02:00
parent 7f560d96d4
commit 5a4d5797d8
4 changed files with 13 additions and 13 deletions

View file

@ -159,17 +159,17 @@
var table = [ var table = [
{search: 'order:random', description: 'as random as it can get'}, {search: 'order:random', description: 'as random as it can get'},
{search: 'order:id', description: 'highest to lowest post ID (default browse view)'}, {search: 'order:id', description: 'highest to lowest post ID (default browse view)'},
{search: 'order:time', description: 'newest to oldest (pretty much same as above)'}, {search: 'order:date', description: 'newest to oldest (pretty much same as above)'},
{search: '-order:time', description: 'oldest to newest'}, {search: '-order:date', description: 'oldest to newest'},
{search: 'order:time,asc', description: 'oldest to newest (ascending order, default = descending)'}, {search: 'order:date,asc', description: 'oldest to newest (ascending order, default = descending)'},
{search: 'order:score', description: 'highest scored'}, {search: 'order:score', description: 'highest scored'},
{search: 'order:file_size', description: 'largest files first'}, {search: 'order:file_size', description: 'largest files first'},
{search: 'order:tag_count', description: 'with most tags'}, {search: 'order:tag_count', description: 'with most tags'},
{search: 'order:fav_count', description: 'loved by most'}, {search: 'order:fav_count', description: 'loved by most'},
{search: 'order:comment_count', description: 'most commented first'}, {search: 'order:comment_count', description: 'most commented first'},
{search: 'order:fav_time', description: 'recently added to favorites'}, {search: 'order:fav_date', description: 'recently added to favorites'},
{search: 'order:comment_time', description: 'recently commented'}, {search: 'order:comment_date', description: 'recently commented'},
{search: 'order:feature_time', description: 'recently featured'}, {search: 'order:feature_date', description: 'recently featured'},
]; ];
_.each(table, function(row) { %> _.each(table, function(row) { %>
<tr> <tr>
@ -181,7 +181,7 @@
</table> </table>
<p>As shown with <a <p>As shown with <a
href="#/posts/query=-order:time"><code>-order:time</code></a>, any of them href="#/posts/query=-order:date"><code>-order:date</code></a>, any of them
can be reversed in the same way as negating other tags: by placing a dash can be reversed in the same way as negating other tags: by placing a dash
before the tag.</p> before the tag.</p>
</div> </div>

View file

@ -109,7 +109,7 @@ class PostSearchParser extends AbstractSearchParser
elseif ($tokenText === 'id') elseif ($tokenText === 'id')
return PostFilter::ORDER_ID; return PostFilter::ORDER_ID;
elseif ($tokenText === 'time') elseif ($tokenText === 'time' or $tokenText === 'date')
return PostFilter::ORDER_LAST_EDIT_TIME; return PostFilter::ORDER_LAST_EDIT_TIME;
elseif ($tokenText === 'score') elseif ($tokenText === 'score')
@ -127,13 +127,13 @@ class PostSearchParser extends AbstractSearchParser
elseif ($tokenText === 'comment_count') elseif ($tokenText === 'comment_count')
return PostFilter::ORDER_COMMENT_COUNT; return PostFilter::ORDER_COMMENT_COUNT;
elseif ($tokenText === 'fav_time') elseif ($tokenText === 'fav_time' or $tokenText === 'fav_date')
return PostFilter::ORDER_LAST_FAV_TIME; return PostFilter::ORDER_LAST_FAV_TIME;
elseif ($tokenText === 'comment_time') elseif ($tokenText === 'comment_time' or $tokenText === 'comment_date')
return PostFilter::ORDER_LAST_COMMENT_TIME; return PostFilter::ORDER_LAST_COMMENT_TIME;
elseif ($tokenText === 'feature_time') elseif ($tokenText === 'feature_time' or $tokenText === 'feature_date')
return PostFilter::ORDER_LAST_FEATURE_TIME; return PostFilter::ORDER_LAST_FEATURE_TIME;
else else

View file

@ -31,7 +31,7 @@ class TagSearchParser extends AbstractSearchParser
elseif ($tokenText === 'name') elseif ($tokenText === 'name')
return TagFilter::ORDER_NAME; return TagFilter::ORDER_NAME;
elseif ($tokenText === 'creation_time') elseif ($tokenText === 'creation_time' or $tokenText === 'creation_date')
return TagFilter::ORDER_CREATION_TIME; return TagFilter::ORDER_CREATION_TIME;
elseif ($tokenText === 'usage_count') elseif ($tokenText === 'usage_count')

View file

@ -28,7 +28,7 @@ class UserSearchParser extends AbstractSearchParser
if ($tokenText === 'name') if ($tokenText === 'name')
return UserFilter::ORDER_NAME; return UserFilter::ORDER_NAME;
elseif ($tokenText === 'registration_time') elseif ($tokenText === 'registration_time' or $tokenText === 'registration_date')
return UserFilter::ORDER_REGISTRATION_TIME; return UserFilter::ORDER_REGISTRATION_TIME;
else else