feat: export complete Discourse themes ecosystem (16 themes, SCSS, JS components and color schemes)
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "Clickable Topic",
|
||||
"about_url": "https://meta.discourse.org/t/clickable-topic/183339",
|
||||
"license_url": "https://github.com/discourse/discourse-clickable-topic/blob/main/LICENSE",
|
||||
"component": true,
|
||||
"assets": {
|
||||
},
|
||||
"color_schemes": {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
.topic-list-item,
|
||||
.latest-topic-list-item {
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
background: rgb(var(--primary-rgb), 0.025);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
import { apiInitializer } from "discourse/lib/api";
|
||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||
|
||||
export default apiInitializer((api) => {
|
||||
api.registerBehaviorTransformer(
|
||||
"topic-list-item-click",
|
||||
({ context, next }) => {
|
||||
const targetElement = context.event.target;
|
||||
const topic = context.topic;
|
||||
|
||||
const clickTargets = [
|
||||
"topic-list-data",
|
||||
"link-bottom-line",
|
||||
"topic-list-item",
|
||||
];
|
||||
|
||||
if (api.container.lookup("service:site").mobileView) {
|
||||
clickTargets.push("topic-item-metadata", "topic-item-stats");
|
||||
}
|
||||
|
||||
if (clickTargets.some((t) => targetElement.classList.contains(t))) {
|
||||
if (wantsNewWindow(event)) {
|
||||
return true;
|
||||
}
|
||||
return context.navigateToTopic(topic, topic.lastUnreadUrl);
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
);
|
||||
});
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { action } from "@ember/object";
|
||||
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
|
||||
import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
|
||||
import { bind } from "discourse/lib/decorators";
|
||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
|
||||
export default class extends Component {
|
||||
@bind
|
||||
clickHandler(event) {
|
||||
const targetElement = event.target;
|
||||
const topic = this.args.outletArgs.topic;
|
||||
|
||||
if (targetElement.tagName === "DIV") {
|
||||
if (wantsNewWindow(event)) {
|
||||
return true;
|
||||
}
|
||||
DiscourseURL.routeTo(topic.lastUnreadUrl || topic.url);
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
registerClickHandler(element) {
|
||||
element.parentElement.addEventListener("click", this.clickHandler);
|
||||
}
|
||||
|
||||
@action
|
||||
removeClickHandler(element) {
|
||||
element.parentElement.removeEventListener("click", this.clickHandler);
|
||||
}
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="hidden"
|
||||
{{didInsert this.registerClickHandler}}
|
||||
{{willDestroy this.removeClickHandler}}
|
||||
></div>
|
||||
</template>
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"id": 43,
|
||||
"name": "Clickable Topic",
|
||||
"user_selectable": false,
|
||||
"color_scheme": null,
|
||||
"fields_count": 4,
|
||||
"files": [
|
||||
{
|
||||
"field_id": 789,
|
||||
"target_id": 0,
|
||||
"target_name": "common",
|
||||
"name": "scss",
|
||||
"filename": "common_scss.scss",
|
||||
"bytes": 131
|
||||
},
|
||||
{
|
||||
"field_id": 790,
|
||||
"target_id": 6,
|
||||
"target_name": "javascript",
|
||||
"name": "discourse/api-initializers/clickable-topic-row.js",
|
||||
"filename": "javascript_discourse_api-initializers_clickable-topic-row.js",
|
||||
"bytes": 849
|
||||
},
|
||||
{
|
||||
"field_id": 791,
|
||||
"target_id": 6,
|
||||
"target_name": "javascript",
|
||||
"name": "discourse/connectors/above-latest-topic-list-item/clickable-topic-row.gjs",
|
||||
"filename": "javascript_discourse_connectors_above-latest-topic-list-item_clickable-topic-row.gjs",
|
||||
"bytes": 1134
|
||||
},
|
||||
{
|
||||
"field_id": 788,
|
||||
"target_id": 9,
|
||||
"target_name": "about",
|
||||
"name": "about",
|
||||
"filename": "about_about.yml",
|
||||
"bytes": 261
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user