Skip to content

Commit

Permalink
Complete the unfinished TabbedPane widget.
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Hanks committed Oct 19, 2011
1 parent 370c406 commit 77c9fb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion r2/r2/lib/pages/pages.py
Expand Up @@ -2910,7 +2910,7 @@ def __init__(self, tabs):
for tab_name, title, pane in tabs:
buttons.append(JsButton(title, onclick="return select_tab_menu(this, '%s');" % tab_name))

self.tabmenu = JsNavMenu(buttons, type = 'tabpane')
self.tabmenu = JsNavMenu(buttons, type = 'tabmenu')
self.tabs = tabs

Templated.__init__(self)
Expand Down
10 changes: 10 additions & 0 deletions r2/r2/public/static/js/reddit.js
Expand Up @@ -33,6 +33,16 @@ function close_menus(event) {

function hover_open_menu(menu) { };

function select_tab_menu(tab_link, tab_name) {
var target = "tabbedpane-" + tab_name;
var menu = $(tab_link).parent().parent().parent();
menu.find(".tabmenu li").removeClass("selected");
$(tab_link).parent().addClass("selected");
menu.find(".tabbedpane").each(function() {
this.style.display = (this.id == target) ? "block" : "none";
});
}

function update_user(form) {
try {
var user = $(form).find('input[name="user"]').val();
Expand Down

0 comments on commit 77c9fb6

Please sign in to comment.