DEV: Convert CategoryReadOnlyBanner to gjs (#30412)

This commit is contained in:
Jarek Radosz 2024-12-23 00:55:49 +01:00 committed by GitHub
parent 59b43b15ee
commit 0ed4c452d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 19 deletions

View File

@ -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>
}

View File

@ -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}}

View File

@ -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;
}
}