This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/app/controllers/static.js
Roman Rizzi 7a2e8d3ead
DEV: Add the missing app subdirectory (#9499)
* DEV: Add missing  directory to the Discourse ember app

* DEV: Resolve imports correctly
2020-04-23 10:07:54 -03:00

33 lines
874 B
JavaScript

import discourseComputed from "discourse-common/utils/decorators";
import { equal } from "@ember/object/computed";
import Controller, { inject as controller } from "@ember/controller";
import { ajax } from "discourse/lib/ajax";
import { userPath } from "discourse/lib/url";
export default Controller.extend({
application: controller(),
showLoginButton: equal("model.path", "login"),
@discourseComputed("model.path")
bodyClass: path => `static-${path}`,
@discourseComputed("model.path")
showSignupButton() {
return (
this.get("model.path") === "login" && this.get("application.canSignUp")
);
},
actions: {
markFaqRead() {
const currentUser = this.currentUser;
if (currentUser) {
ajax(userPath("read-faq"), { type: "POST" }).then(() => {
currentUser.set("read_faq", true);
});
}
}
}
});