ankur1857
(Ankur)
1
Following script is not showing icon after font awesome 5.0 update.
Please help to make changes in the script.
api.decorateWidget('header-buttons:after', helper => {
if (Discourse.User.current()) {
const createTopic = function() {
const Composer = require('discourse/models/composer').default;
const composerController = Discourse.__container__.lookup('controller:composer');
composerController.open({ action: Composer.CREATE_TOPIC, draftKey: Composer.DRAFT });
}
return helper.h('button#create-new', {
className: "btn fa fa-plus",
title: "Create New Topic",
onclick: createTopic
}, '' ); // ''-this is 'text' for the button, change as needed.
}
});
tshenry
(Taylor)
2
Assuming you have your own CSS for styling the button, this should get things pretty much back to the way they were:
<script type="text/discourse-plugin" version="0.8">
const { iconNode } = require("discourse-common/lib/icon-library");
api.decorateWidget('header-buttons:after', helper => {
if (Discourse.User.current()) {
const createTopic = function() {
const Composer = require('discourse/models/composer').default;
const composerController = Discourse.__container__.lookup('controller:composer');
composerController.open({ action: Composer.CREATE_TOPIC, draftKey: Composer.DRAFT });
}
return helper.h('button#create-new', {
className: "btn fa fa-plus no-text",
title: "Create New Topic",
onclick: createTopic
}, iconNode('plus') );
}
});
</script>
3 „Gefällt mir“
ankur1857
(Ankur)
3
It worked perfectly
thanks
2 „Gefällt mir“
system
(system)
Geschlossen,
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.