cleaned up kb

This commit is contained in:
Rushabh Mehta
2012-02-24 15:07:39 +05:30
parent 2886b95da0
commit b73fa49f34
18 changed files with 1009 additions and 255 deletions

View File

@@ -14,25 +14,20 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript.onload_questions = function() {
var w = page_body.pages['questions'];
pscript.onload_questions = function(wrapper) {
body = $(wrapper).find('.layout-main-section').get(0);
var tab = make_table(w, 1, 2, '100%', ['75%', '25%'], {});
var body = $a($td(tab,0,0),'div','layout_wrapper');
new PageHeader(body, 'Knowledge Base');
// kb
var kb = new KnowledgeBase(body);
// sidebar
$y($td(tab, 0, 1), {paddingTop:'53px'});
this.sidebar = new wn.widgets.PageSidebar($td(tab, 0, 1), {
this.sidebar = new wn.widgets.PageSidebar($(wrapper).find('.layout-side-section').get(0), {
sections: [
{
title: 'Top Tags',
render: function(body) {
new wn.widgets.TagCloud(body, 'Question', function(tag) { kb.set_tag_filter(tag) });
new wn.widgets.TagCloud(body, 'Question', function(tag)
{ kb.set_tag_filter(tag) });
}
}
]
@@ -50,11 +45,14 @@ function KnowledgeBase(w) {
this.tag_filter_dict = {};
this.make_search_bar = function() {
this.search = $a($a(w,'div','kb-search-wrapper'), 'textarea');
this.search = $(w).find('.kb-search-wrapper textarea').get(0);
var div = $a(w,'div','kb-btn-wrapper');
$btn(div, 'Search', function() { me.run() }, {fontSize:'14px'});
$btn(div, 'Ask', function() { me.ask() }, {fontSize:'14px'});
$(w).find('.btn.search').click(function() {
me.run();
})
$(w).find('.btn.ask').click(function() {
me.ask();
})
}
// ask a new question