Skip to content

Commit

Permalink
chore: major frontend JS cleanup (#3609)
Browse files Browse the repository at this point in the history
  • Loading branch information
davwheat committed May 7, 2023
1 parent eaa2974 commit ca67ea5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
9 changes: 1 addition & 8 deletions js/src/forum/addLockBadge.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@ import Badge from 'flarum/common/components/Badge';
export default function addLockBadge() {
extend(Discussion.prototype, 'badges', function (badges) {
if (this.isLocked()) {
badges.add(
'locked',
Badge.component({
type: 'locked',
label: app.translator.trans('flarum-lock.forum.badge.locked_tooltip'),
icon: 'fas fa-lock',
})
);
badges.add('locked', <Badge type="locked" label={app.translator.trans('flarum-lock.forum.badge.locked_tooltip')} icon="fas fa-lock" />);
}
});
}
12 changes: 3 additions & 9 deletions js/src/forum/addLockControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ export default function addLockControl() {
if (discussion.canLock()) {
items.add(
'lock',
Button.component(
{
icon: 'fas fa-lock',
onclick: this.lockAction.bind(discussion),
},
app.translator.trans(
discussion.isLocked() ? 'flarum-lock.forum.discussion_controls.unlock_button' : 'flarum-lock.forum.discussion_controls.lock_button'
)
)
<Button icon="fas fa-lock" onclick={this.lockAction.bind(discussion)}>
{app.translator.trans(`flarum-lock.forum.discussion_controls.${discussion.isLocked() ? 'unlock' : 'lock'}_button`)}
</Button>
);
}
});
Expand Down

0 comments on commit ca67ea5

Please sign in to comment.