Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit dafa853e authored by Julie Thezenas's avatar Julie Thezenas
Browse files

to zero

parent 94e34239
No related branches found
No related tags found
No related merge requests found
// import Component from "@ember/component";
// import discourseComputed, { observes } from "discourse-common/utils/decorators";
// import { inject as service } from "@ember/service";
// import { defaultHomepage } from "discourse/lib/utilities";
// import { and } from "@ember/object/computed";
// import {
// navigateToTopic,
// showEntrance,
// } from "discourse/components/topic-list-item";
// import discourseComputed from "discourse-common/utils/decorators";
// export default Component.extend({
// router: service(),
// tagName: "",
// didInsertElement() {
// attributeBindings: ["topic.id:data-topic-id"],
// classNameBindings: [":latest-topic-list-item", "unboundClassNames"],
// showEntrance,
// navigateToTopic,
// this._super(...arguments);
// this._updateBodyClasses();
// },
// willDestroyElement() {
// this._super(...arguments);
// this._updateBodyClasses();
// },
// @observes("shouldShow")
// _updateBodyClasses() {
// const shouldCleanup = this.isDestroying || this.isDestroyed;
// if (!shouldCleanup && this.shouldShow && settings.show_as_sidebar) {
// document.body.classList.add("showcased-categories-sidebar");
// } else {
// document.body.classList.remove("showcased-categories-sidebar");
// }
// },
// // get categoriesLoaded() {
// // return Category.list().length !== 0;
// // },
// // //tests 4 derniers posts et 4 top sujets
// // get category1() {
// // if (!this.categoriesLoaded) return false;
// // return Category.findById(settings.feed_one_category);
// // },
// // get category2() {
// // if (!this.categoriesLoaded) return false;
// // return Category.findById(settings.feed_two_category);
// // },
// get topicLoaded() {
// return navigateToTopic.list().length !== 0;
// },
// //tests 4 derniers posts et 4 top sujets
// get category1() {
// if (!this.topicLoaded) return false;
// return navigateToTopic.findById(settings.feed_one_category);
// },
// get category2() {
// if (!this.topicLoaded) return false;
// return navigateToTopic.findById(settings.feed_two_category);
// },
// // @discourseComputed("router.currentRouteName")
// // shouldShow(currentRouteName) {
// // let showSidebar =
// // settings.show_as_sidebar && currentRouteName === "discovery.latest";
// // return currentRouteName === `discovery.${defaultHomepage()}` || showSidebar;
// // },
// showTopicLists: and("shouldShow", "category1", "category2")
// /////
// click(e) {
// // for events undefined has a different meaning than false
// if (this.showEntrance(e) === false) {
// return false;
// }
// return this.unhandledRowClick(e, this.topic);
// },
// // Can be overwritten by plugins to handle clicks on other parts of the row
// unhandledRowClick() {},
// @discourseComputed("topic")
// unboundClassNames(topic) {
// let classes = [];
// if (topic.get("category")) {
// classes.push("category-" + topic.get("category.fullSlug"));
// }
// if (topic.get("tags")) {
// topic.get("tags").forEach((tagName) => classes.push("tag-" + tagName));
// }
// ["liked", "archived", "bookmarked", "pinned", "closed", "visited"].forEach(
// (name) => {
// if (topic.get(name)) {
// classes.push(name);
// }
// }
// );
// return classes.join(" ");
// },
// });
// Initial commit :
import Component from "@ember/component";
import Category from "discourse/models/category";
import discourseComputed, { observes } from "discourse-common/utils/decorators";
import { inject as service } from "@ember/service";
import { defaultHomepage } from "discourse/lib/utilities";
import { and } from "@ember/object/computed";
import {
navigateToTopic,
showEntrance,
} from "discourse/components/topic-list-item";
import discourseComputed from "discourse-common/utils/decorators";
export default Component.extend({
router: service(),
tagName: "",
didInsertElement() {
attributeBindings: ["topic.id:data-topic-id"],
classNameBindings: [":latest-topic-list-item", "unboundClassNames"],
showEntrance,
navigateToTopic,
this._super(...arguments);
this._updateBodyClasses();
},
......@@ -37,81 +147,26 @@ export default Component.extend({
}
},
// get categoriesLoaded() {
// return Category.list().length !== 0;
// },
// //tests 4 derniers posts et 4 top sujets
// get category1() {
// if (!this.categoriesLoaded) return false;
// return Category.findById(settings.feed_one_category);
// },
// get category2() {
// if (!this.categoriesLoaded) return false;
// return Category.findById(settings.feed_two_category);
// },
get topicLoaded() {
return navigateToTopic.list().length !== 0;
get categoriesLoaded() {
return Category.list().length !== 0;
},
//tests 4 derniers posts et 4 top sujets
get category1() {
if (!this.topicLoaded) return false;
return navigateToTopic.findById(settings.feed_one_category);
if (!this.categoriesLoaded) return false;
return Category.findById(settings.feed_one_category);
},
get category2() {
if (!this.topicLoaded) return false;
return navigateToTopic.findById(settings.feed_two_category);
if (!this.categoriesLoaded) return false;
return Category.findById(settings.feed_two_category);
},
// @discourseComputed("router.currentRouteName")
// shouldShow(currentRouteName) {
// let showSidebar =
// settings.show_as_sidebar && currentRouteName === "discovery.latest";
// return currentRouteName === `discovery.${defaultHomepage()}` || showSidebar;
// },
showTopicLists: and("shouldShow", "category1", "category2")
/////
click(e) {
// for events undefined has a different meaning than false
if (this.showEntrance(e) === false) {
return false;
}
return this.unhandledRowClick(e, this.topic);
@discourseComputed("router.currentRouteName")
shouldShow(currentRouteName) {
let showSidebar =
settings.show_as_sidebar && currentRouteName === "discovery.latest";
return currentRouteName === `discovery.${defaultHomepage()}` || showSidebar;
},
// Can be overwritten by plugins to handle clicks on other parts of the row
unhandledRowClick() {},
@discourseComputed("topic")
unboundClassNames(topic) {
let classes = [];
if (topic.get("category")) {
classes.push("category-" + topic.get("category.fullSlug"));
}
if (topic.get("tags")) {
topic.get("tags").forEach((tagName) => classes.push("tag-" + tagName));
}
["liked", "archived", "bookmarked", "pinned", "closed", "visited"].forEach(
(name) => {
if (topic.get(name)) {
classes.push(name);
}
}
);
return classes.join(" ");
},
showTopicLists: and("shouldShow", "category1", "category2")
});
show_as_sidebar:
type: bool
default: false
description: "If enabled, the showcased categories will only be rendered in a sidebar on the latest page."
featured_topic_lists_title:
type: string
default: "Showcased Categories"
description: "Title for showcased categories lists section"
feed_one_title:
type: string
default: "Custom List One"
description: "Title for left area of topics on homepage"
feed_one_category:
type: list
list_type: latest-topic-list-item
default: "latest-topic-list-item"
description: "Choose only ONE category for the Feed One topic list"
feed_two_title:
type: string
default: "Custom List Two"
description: "Title for right area of topics on homepage"
feed_two_category:
type: list
list_type: latest-topic-list-item
default: "latest-topic-list-item"
description: "Choose only ONE category for the Feed Two topic list"
max_list_length:
type: integer
default: 4
min: 1
max: 4
description: "How many topics should appear in the custom lists?"
plugin_outlet:
type: enum
default: "above-main-container"
choices:
- "above-main-container"
- "below-site-header"
description: "Advanced setting for additional customization"
# /////////////////////////////////////////////////////
# /////////////////////////////////////////////////////
# /////////////////////////////////////////////////////
# show_as_sidebar:
# show_as_sidebar:
# type: bool
# default: false
# description: "If enabled, the showcased categories will only be rendered in a sidebar on the latest page."
......@@ -54,8 +12,8 @@ plugin_outlet:
# description: "Title for left area of topics on homepage"
# feed_one_category:
# type: list
# list_type: category
# default: ""
# list_type: latest-topic-list-item
# default: "latest-topic-list-item"
# description: "Choose only ONE category for the Feed One topic list"
# feed_two_title:
# type: string
......@@ -63,14 +21,14 @@ plugin_outlet:
# description: "Title for right area of topics on homepage"
# feed_two_category:
# type: list
# list_type: category
# default: ""
# list_type: latest-topic-list-item
# default: "latest-topic-list-item"
# description: "Choose only ONE category for the Feed Two topic list"
# max_list_length:
# type: integer
# default: 5
# default: 4
# min: 1
# max: 5
# max: 4
# description: "How many topics should appear in the custom lists?"
# plugin_outlet:
# type: enum
......@@ -78,4 +36,46 @@ plugin_outlet:
# choices:
# - "above-main-container"
# - "below-site-header"
# description: "Advanced setting for additional customization"
\ No newline at end of file
# description: "Advanced setting for additional customization"
# /////////////////////////////////////////////////////
# /////////////////////////////////////////////////////
# /////////////////////////////////////////////////////
show_as_sidebar:
type: bool
default: false
description: "If enabled, the showcased categories will only be rendered in a sidebar on the latest page."
featured_topic_lists_title:
type: string
default: "Showcased Categories"
description: "Title for showcased categories lists section"
feed_one_title:
type: string
default: "Custom List One"
description: "Title for left area of topics on homepage"
feed_one_category:
type: list
list_type: category
default: ""
description: "Choose only ONE category for the Feed One topic list"
feed_two_title:
type: string
default: "Custom List Two"
description: "Title for right area of topics on homepage"
feed_two_category:
type: list
list_type: category
default: ""
description: "Choose only ONE category for the Feed Two topic list"
max_list_length:
type: integer
default: 5
min: 1
max: 5
description: "How many topics should appear in the custom lists?"
plugin_outlet:
type: enum
default: "above-main-container"
choices:
- "above-main-container"
- "below-site-header"
description: "Advanced setting for additional customization"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment