Bold the current tab in the settings. #968

This commit is contained in:
Nicolas Stepien 2013-03-26 01:10:42 +01:00
parent 1f1709d86a
commit 7cfd5e9d5d
2 changed files with 11 additions and 6 deletions

View File

@ -259,6 +259,9 @@ a[href="javascript:;"] {
-webkit-flex: 1; -webkit-flex: 1;
flex: 1; flex: 1;
} }
.tab-selected {
font-weight: 700;
}
.section-container { .section-container {
-webkit-flex: 1; -webkit-flex: 1;
flex: 1; flex: 1;

View File

@ -242,17 +242,15 @@ Settings =
links = [] links = []
for section in Settings.sections for section in Settings.sections
link = $.el 'a', link = $.el 'a',
className: "tab-#{section.hyphenatedTitle}"
textContent: section.title textContent: section.title
href: 'javascript:;' href: 'javascript:;'
$.on link, 'click', Settings.openSection.bind section $.on link, 'click', Settings.openSection.bind section
links.push link, $.tn ' | ' links.push link, $.tn ' | '
sectionToOpen = link if section.title is openSection sectionToOpen = link if section.title is openSection
links.pop() links.pop()
if sectionToOpen
sectionToOpen.click()
else
links[0].click()
$.add $('.sections-list', overlay), links $.add $('.sections-list', overlay), links
(if sectionToOpen then sectionToOpen else links[0]).click()
$.on $('.close', overlay), 'click', Settings.close $.on $('.close', overlay), 'click', Settings.close
$.on overlay, 'click', Settings.close $.on overlay, 'click', Settings.close
@ -272,11 +270,15 @@ Settings =
addSection: (title, open) -> addSection: (title, open) ->
if typeof title isnt 'string' if typeof title isnt 'string'
{title, open} = title.detail {title, open} = title.detail
Settings.sections.push {title, open} hyphenatedTitle = title.toLowerCase().replace /\s+/g, '-'
Settings.sections.push {title, hyphenatedTitle, open}
openSection: -> openSection: ->
if selected = $ '.tab-selected', Settings.dialog
$.rmClass selected, 'tab-selected'
$.addClass $(".tab-#{@hyphenatedTitle}", Settings.dialog), 'tab-selected'
section = $ 'section', Settings.dialog section = $ 'section', Settings.dialog
section.innerHTML = null section.innerHTML = null
section.className = "section-#{@title.toLowerCase().replace /\s+/g, '-'}" section.className = "section-#{@hyphenatedTitle}"
@open section, g @open section, g
section.scrollTop = 0 section.scrollTop = 0