waibu-bootstrap 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ async function appLauncher () {
|
|
|
21
21
|
launcher += '<c:navbar padding="y-0">\n<c:nav tag="ul" dim="width:100" flex="justify-content:end">\n'
|
|
22
22
|
for (const t of toolbar) {
|
|
23
23
|
if (t === 'home') launcher += '<c:nav-item href="/" icon="house" padding="end-2" />\n'
|
|
24
|
-
if (t === 'user') launcher += '<c:nav-dropdown-user padding="end-2" />\n'
|
|
24
|
+
if (t === 'user' && this.plugin.app.sumba) launcher += '<c:sumba-nav-dropdown-user padding="end-2" />\n'
|
|
25
25
|
if (t === '-') launcher += '<c:nav-divider />\n'
|
|
26
26
|
if (t === 'fullscreen') launcher += '<c:nav-toggle-fullscreen padding="end-2" />\n'
|
|
27
27
|
if (t === 'darkmode') launcher += '<c:nav-dropdown-darkmode padding="end-2" dropdown-menudir="end" />\n'
|
|
@@ -36,7 +36,7 @@ async function navToggleFullscreen () {
|
|
|
36
36
|
}
|
|
37
37
|
}`
|
|
38
38
|
this.params.noTag = true
|
|
39
|
-
this.params.html = await this.component.buildTag({ tag: 'navItem', attr: this.params.attr })
|
|
39
|
+
this.params.html = await this.component.buildTag({ tag: 'navItem', attr: this.params.attr, noEscape: true })
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
async function navDropdownUser () {
|
|
2
|
-
return class NavDropdownUser extends this.baseFactory {
|
|
3
|
-
build = async () => {
|
|
4
|
-
if (!this.plugin.app.sumba) {
|
|
5
|
-
this.params.noTag = true
|
|
6
|
-
this.params.html = ''
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
const { has, omit } = this.plugin.lib._
|
|
10
|
-
const { routePath } = this.plugin.app.waibu
|
|
11
|
-
const { req } = this.component
|
|
12
|
-
const icon = this.component.req.iconset ? await this.component.buildTag({ tag: 'icon', attr: { name: 'person' } }) : ''
|
|
13
|
-
let text = ''
|
|
14
|
-
if (has(this.params.attr, 'title')) {
|
|
15
|
-
if (req.user) {
|
|
16
|
-
if (this.params.attr.title === 'short') text = `${req.user.firstName} ${req.user.lastName[0]}.`
|
|
17
|
-
else if (['firstName', 'lastName', 'username'].includes(this.params.attr.title)) text = req.user[this.params.attr.title]
|
|
18
|
-
else text = `${req.user.firstName} ${req.user.lastName}`
|
|
19
|
-
} else text = req.t('guest')
|
|
20
|
-
}
|
|
21
|
-
const html = []
|
|
22
|
-
const attr = omit(this.params.attr, ['text'])
|
|
23
|
-
attr.dropdown = true
|
|
24
|
-
attr.content = `${icon} ${text}`
|
|
25
|
-
if (this.params.attr.noMenu) {
|
|
26
|
-
delete attr.dropdown
|
|
27
|
-
delete attr.dropdownMenu
|
|
28
|
-
attr.href = routePath(this.component.req.user ? 'sumba:/your-stuff/profile' : 'sumba:/signin')
|
|
29
|
-
} else {
|
|
30
|
-
if (req.user) {
|
|
31
|
-
if (this.params.attr.fancyProfile) {
|
|
32
|
-
const replacer = 'sumba.asset:/user-profile.png'
|
|
33
|
-
const profile = await this.component.buildSentence(`
|
|
34
|
-
<div>
|
|
35
|
-
<c:dropdown-item href="sumba:/your-stuff/profile">
|
|
36
|
-
<c:img src="dobo:/attachment/SumbaUser/${req.user.id}/profile/main.png?notfound=${replacer}" responsive rounded />
|
|
37
|
-
<c:div margin="top-1" text="align:center">${req.user.firstName} ${req.user.lastName}</c:div>
|
|
38
|
-
</c:dropdown-item>
|
|
39
|
-
</div>
|
|
40
|
-
`)
|
|
41
|
-
html.push(profile)
|
|
42
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
|
|
43
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/your-stuff/change-password') }, html: this.component.req.t('changePassword') }))
|
|
44
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signout') }, html: this.component.req.t('signout') }))
|
|
45
|
-
} else {
|
|
46
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/your-stuff/profile') }, html: this.component.req.t('yourProfile') }))
|
|
47
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/your-stuff/change-password') }, html: this.component.req.t('changePassword') }))
|
|
48
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
|
|
49
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signout') }, html: this.component.req.t('signout') }))
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signin') }, html: this.component.req.t('signin') }))
|
|
53
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
|
|
54
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/user/signup') }, html: this.component.req.t('signup') }))
|
|
55
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/user/forgot-password') }, html: this.component.req.t('forgotPassword') }))
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
this.params.noTag = true
|
|
59
|
-
this.params.html = await this.component.buildTag({ tag: 'navItem', attr, html: html.join('\n') })
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default navDropdownUser
|