Browse Source

Create header of base index, but hide via CSS

master
parent
commit
beea8f2eea
  1. 88
      src/CategoryBase.js
  2. 9
      src/category.css

88
src/CategoryBase.js

@ -20,56 +20,54 @@ function CategoryBase (options, data) {
var name
var a
if (this.id !== 'index') {
this.domHeader = document.createElement('header')
this.dom.appendChild(this.domHeader)
if ('name' in this.data) {
if (typeof this.data.name === 'object') {
name = lang(this.data.name)
} else {
name = this.data.name
}
} else if (('name:' + ui_lang) in this.data) {
name = this.data['name:' + ui_lang]
this.domHeader = document.createElement('header')
this.dom.appendChild(this.domHeader)
if ('name' in this.data) {
if (typeof this.data.name === 'object') {
name = lang(this.data.name)
} else {
name = lang('category:' + this.id)
name = this.data.name
}
} else if (('name:' + ui_lang) in this.data) {
name = this.data['name:' + ui_lang]
} else {
name = lang('category:' + this.id)
}
a = document.createElement('a')
a.appendChild(document.createTextNode(name))
a.href = '#'
a.onclick = this.toggle.bind(this)
this.domHeader.appendChild(a)
a = document.createElement('a')
a.appendChild(document.createTextNode(name))
a.href = '#'
a.onclick = this.toggle.bind(this)
this.domHeader.appendChild(a)
if (this.options.repositoryId && this.options.repositoryId !== 'default') {
a = document.createElement('span')
a.className = 'repoId'
a.appendChild(document.createTextNode(this.options.repositoryId))
this.domHeader.appendChild(a)
}
if (this.options.repositoryId && this.options.repositoryId !== 'default') {
a = document.createElement('span')
a.className = 'repoId'
a.appendChild(document.createTextNode(this.options.repositoryId))
this.domHeader.appendChild(a)
}
if (this.shallShowReload()) {
a = document.createElement('a')
a.appendChild(document.createTextNode('⟳'))
a.title = lang('reload')
a.className = 'reload'
a.onclick = function () {
var id = this.id
var isOpen = this.isOpen
this.reload(function (err, category) {
if (err) {
alert('Error reloading category ' + id + ': ' + err)
}
if (isOpen) {
category.open()
}
})
}.bind(this)
this.domHeader.appendChild(a)
}
if (this.shallShowReload()) {
a = document.createElement('a')
a.appendChild(document.createTextNode('⟳'))
a.title = lang('reload')
a.className = 'reload'
a.onclick = function () {
var id = this.id
var isOpen = this.isOpen
this.reload(function (err, category) {
if (err) {
alert('Error reloading category ' + id + ': ' + err)
}
if (isOpen) {
category.open()
}
})
}.bind(this)
this.domHeader.appendChild(a)
}
this.tools = new tabs.Tabs(this.dom)

9
src/category.css

@ -115,8 +115,13 @@
.category {
margin-left: 1em;
}
.category.baseCategory,
.category.addCategory {
#contentListBaseCategory {
margin-left: -2em;
}
#contentListBaseCategory > .category > header {
display: none;
}
#contentListAddCategories {
margin-left: -1em;
}
.info > table > tr > td:first-of-type,

Loading…
Cancel
Save