aboutsummaryrefslogtreecommitdiff
path: root/data/assets/js/admin/tabs
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-05-24 20:42:20 -0400
committerPaul Duncan <pabs@pablotron.org>2016-05-24 20:42:20 -0400
commitfbff52e48d4591a752d83fbebb49a3a355eef5ae (patch)
tree9549990f151888c98d2b5a2ad338a41f48c3e91e /data/assets/js/admin/tabs
parent83242fd94df0280e7793caef912d7a12b240fcec (diff)
downloadguff-fbff52e48d4591a752d83fbebb49a3a355eef5ae.tar.bz2
guff-fbff52e48d4591a752d83fbebb49a3a355eef5ae.zip
add dropdown class and post type dropdown
Diffstat (limited to 'data/assets/js/admin/tabs')
-rw-r--r--data/assets/js/admin/tabs/posts.js27
1 files changed, 25 insertions, 2 deletions
diff --git a/data/assets/js/admin/tabs/posts.js b/data/assets/js/admin/tabs/posts.js
index 83db403..6fc0afd 100644
--- a/data/assets/js/admin/tabs/posts.js
+++ b/data/assets/js/admin/tabs/posts.js
@@ -30,8 +30,9 @@ jQuery(function($) {
.find('.loading').toggleClass('hidden');
send('post/get_posts', {
- q: $('#posts-q').data('q'),
- page: 1,
+ post_type: $('#posts-filter-type li.active a').data('id'),
+ q: $('#posts-q').data('q'),
+ page: 1,
}).always(function() {
$('#posts-reload').removeClass('disabled')
.find('.loading').toggleClass('hidden');
@@ -98,6 +99,28 @@ jQuery(function($) {
reload();
});
+ $('.posts-filter-menu').on('click', 'a', function() {
+ var data = $(this).data(),
+ ul = $(this).parents('ul'),
+ is_default = (data.id == ul.data('default'));
+
+ ul.find('li').removeClass('active');
+ $(this).parents('li').addClass('active');
+ ul.prev('a')
+ .toggleClass('btn-default', is_default)
+ .toggleClass('btn-primary', !is_default)
+ .find('span').text(data.text);
+
+ // hide dropdown
+ $('body').trigger('click');
+
+ // reload posts
+ reload();
+
+ // stop event
+ return false;
+ });
+
$('#posts').on('click', 'a', function() {
var data = $(this).data();