mirror of
https://github.com/discourse/discourse.git
synced 2025-01-04 10:33:47 +08:00
DEV: Convert CategoryReadOnlyBanner to gjs (#30412)
This commit is contained in:
parent
59b43b15ee
commit
0ed4c452d0
|
@ -0,0 +1,25 @@
|
||||||
|
import Component from "@glimmer/component";
|
||||||
|
import { service } from "@ember/service";
|
||||||
|
import { htmlSafe } from "@ember/template";
|
||||||
|
|
||||||
|
export default class CategoryReadOnlyBanner extends Component {
|
||||||
|
@service currentUser;
|
||||||
|
|
||||||
|
get shouldShow() {
|
||||||
|
return (
|
||||||
|
this.args.category?.read_only_banner &&
|
||||||
|
this.args.readOnly &&
|
||||||
|
this.currentUser
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
<template>
|
||||||
|
{{#if this.shouldShow}}
|
||||||
|
<div class="row">
|
||||||
|
<div class="alert alert-info category-read-only-banner">
|
||||||
|
{{htmlSafe @category.read_only_banner}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</template>
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
{{#if this.shouldShow}}
|
|
||||||
<div class="row">
|
|
||||||
<div class="alert alert-info category-read-only-banner">
|
|
||||||
{{html-safe this.category.read_only_banner}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
|
@ -1,12 +0,0 @@
|
||||||
import Component from "@ember/component";
|
|
||||||
import { and } from "@ember/object/computed";
|
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
|
|
||||||
export default class CategoryReadOnlyBanner extends Component {
|
|
||||||
@and("category.read_only_banner", "readOnly", "user") shouldShow;
|
|
||||||
|
|
||||||
@discourseComputed
|
|
||||||
user() {
|
|
||||||
return this.currentUser;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user