-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.ejs
36 lines (36 loc) · 1.16 KB
/
sidebar.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<form class="form-search">
<div class="input-append">
<input type="text" class="span2 search-query">
<button type="submit" class="btn">Search</button>
</div>
</form>
<div id="posted_blogs">
<b>Recent Posts</b>
<ul id="recent_blogs" class="tag_list">
</ul>
<b>Articles by categories</b>
<ul id="article_by_tags" class="tag_list">
</ul>
</div>
<script>
function showBlog(data){
$('#blog_container').html(data);
}
$(function(){
$.get('/admin/ajax_aggregate_blog.cgi', function(data){
var html = $('<div>').append($.parseHTML(data));
$('#recent_blogs').html(html.find('div.recent_blogs').html());
$('#article_by_tags').html(html.find('div.article_by_tags').html());
$('#posted_blogs a').on('click', function(event){
$('#posted_blogs a').css('font-weight', 'normal');
var $this = $(this);
$this.css('font-weight', 'bold');
if($this.attr('blogid')){
$.get('/admin/ajax_blog_view.cgi?id=' + $this.attr('blogid'), showBlog);
}else{
$.get('/admin/ajax_blog_view.cgi?tag=' + $this.attr('tagid'), showBlog);
}
});
});
});
</script>