2021-07-09 09:33:56 -04:00
|
|
|
import Component from "@ember/component";
|
|
|
|
import { inject as service } from "@ember/service";
|
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
|
|
|
|
|
|
export default Component.extend({
|
|
|
|
router: service("router"),
|
|
|
|
tagName: "",
|
|
|
|
|
|
|
|
@discourseComputed("router.currentRoute.queryParams.cards")
|
|
|
|
showingCards(cardsParam) {
|
2024-01-09 07:44:56 -05:00
|
|
|
return (
|
|
|
|
cardsParam === "yes" ||
|
|
|
|
(cardsParam === undefined && settings.default_view === "cards")
|
|
|
|
);
|
2021-07-09 09:33:56 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
toggleCards() {
|
|
|
|
const newValue = this.showingCards ? "no" : "yes";
|
|
|
|
this.router.transitionTo({ queryParams: { cards: newValue } });
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|