2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2019-11-07 16:38:28 -05:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2014-04-10 01:53:31 -04:00
|
|
|
|
2019-10-23 12:30:52 -04:00
|
|
|
export default Component.extend({
|
2017-11-21 05:53:09 -05:00
|
|
|
pluginApiIdentifiers: ["pinned-button"],
|
2017-09-11 13:14:22 -04:00
|
|
|
descriptionKey: "help",
|
2017-10-19 15:51:08 -04:00
|
|
|
classNames: "pinned-button",
|
|
|
|
classNameBindings: ["isHidden"],
|
2017-11-21 05:53:09 -05:00
|
|
|
layoutName: "select-kit/templates/components/pinned-button",
|
2014-04-10 01:53:31 -04:00
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("topic.pinned_globally", "pinned")
|
2017-09-11 13:14:22 -04:00
|
|
|
reasonText(pinnedGlobally, pinned) {
|
|
|
|
const globally = pinnedGlobally ? "_globally" : "";
|
|
|
|
const pinnedKey = pinned ? `pinned${globally}` : "unpinned";
|
|
|
|
const key = `topic_statuses.${pinnedKey}.help`;
|
|
|
|
return I18n.t(key);
|
2017-07-26 16:33:17 -04:00
|
|
|
},
|
2014-04-10 01:53:31 -04:00
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("pinned", "topic.deleted", "topic.unpinned")
|
2017-10-19 15:51:08 -04:00
|
|
|
isHidden(pinned, deleted, unpinned) {
|
2017-09-11 19:03:16 -04:00
|
|
|
return deleted || (!pinned && !unpinned);
|
2014-04-10 01:53:31 -04:00
|
|
|
}
|
|
|
|
});
|