sunjam
(sunjam)
July 19, 2020, 4:08pm
1
Hi, is your Unified Login / Sign Up button something you custom coded as a theme component for this forum? I’d love to add it to our Discourse forum as well. Nice work.
leo
(Leo McArdle)
July 20, 2020, 9:17am
2
It uses the JS Plugin API, so it should be pretty easy to adapt it to a theme component:
import { withPluginApi } from 'discourse/lib/plugin-api'
export default {
name: 'log-in-sign-up',
initialize () {
withPluginApi('0.7', api => {
api.reopenWidget('header-buttons', {
html(attrs) {
if (this.currentUser) { return }
return this.attach('button', {
contents: api.h('span.d-button-label', I18n.t('log_in') + " / " + I18n.t('sign_up')),
className: 'btn-primary btn-small login-button',
action: 'showLogin'
})
}
})
})
}
This file has been truncated. show original