Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: Refactor to separate files, and remove broken widget reopen #32

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
256 changes: 0 additions & 256 deletions common/header.html

This file was deleted.

44 changes: 44 additions & 0 deletions javascripts/discourse/api-initializers/init-ghost.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import $ from "jquery";
import { apiInitializer } from "discourse/lib/api";

export default apiInitializer("0.8.0", (api) => {
api.modifyClass("component:topic-list", {
pluginId: "ghost",
tagName: "ul",
});

api.modifyClass("component:topic-list-item", {
pluginId: "ghost",
tagName: "li",
});

if (api.container.lookup("service:site").mobileView) {
api.modifyClass("controller:admin-site-settings", {
pluginId: "ghost",
actions: {
toggleMenu() {
$(".admin-nav").toggleClass("mobile-open");
$(".admin-detail").toggleClass("mobile-closed mobile-open");
},
},
});
api.modifyClass("controller:admin-plugins", {
pluginId: "ghost",
actions: {
toggleMenu() {
$(".admin-nav").toggleClass("mobile-open");
$(".admin-detail").toggleClass("mobile-closed mobile-open");
},
},
});
api.modifyClass("controller:admin-watched-words", {
pluginId: "ghost",
actions: {
toggleMenu() {
$(".admin-nav").toggleClass("mobile-open");
$(".admin-detail").toggleClass("mobile-closed mobile-open");
},
},
});
}
});
4 changes: 4 additions & 0 deletions javascripts/discourse/raw-templates/list/activity-column.hbr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<{{tagName}} class="{{class}} {{cold-age-class topic.createdAt startDate=topic.bumpedAt class=""}} activity post-activity topic-list-data" href="{{topic.lastPostUrl}}" title="{{{topic.bumpedAtTitle}}}">
{{~raw-plugin-outlet name="topic-list-before-relative-date"~}}
{{~format-date topic.bumpedAt format="tiny" noTitle="true"~}}
</{{tagName}}>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<{{view.tagName}} class='posts-map posts {{view.likesHeat}} topic-list-data' title='{{view.title}}'>
<a href class='num posts-map badge-posts {{view.likesHeat}}'>
{{d-icon "far-comment"}}
{{raw-plugin-outlet name="topic-list-before-reply-count"}}
{{number topic.replyCount noTitle="true"}}
</a>
</{{view.tagName}}>
3 changes: 3 additions & 0 deletions javascripts/discourse/raw-templates/list/posters-column.hbr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#each posters as |poster|}}
<a href="{{poster.user.path}}" data-user-card="{{poster.user.username}}" class="{{poster.extraClasses}}">{{avatar poster avatarTemplatePath="user.avatar_template" usernamePath="user.username" namePath="user.name" imageSize="small"}}</a>
{{/each}}
51 changes: 51 additions & 0 deletions javascripts/discourse/raw-templates/list/topic-list-item.hbr
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{#if bulkSelectEnabled}}
<td class="bulk-select topic-list-data">
<input type="checkbox" class="bulk-select">
</td>
{{/if}}

{{!--
The `~` syntax strip spaces between the elements, making it produce
`<a class=topic-post-badges>Some text</a><span class=topic-post-badges>`,
with no space between them.
This causes the topic-post-badge to be considered the same word as "text"
at the end of the link, preventing it from line wrapping onto its own line.
--}}
<span class="main-link topic-list-data">
<span class='link-top-line'>
{{~raw-plugin-outlet name="topic-list-before-status"}}
{{~raw "topic-status" topic=topic}}
{{~topic-link topic class="raw-link raw-topic-link"}}
{{~#if topic.featured_link}}
{{~topic-featured-link topic}}
{{~/if}}
{{~raw-plugin-outlet name="topic-list-after-title"}}
{{~#if showTopicPostBadges}}
{{~raw "topic-post-badges" unread=topic.unread unseen=topic.unseen url=topic.lastUnreadUrl newDotText=newDotText}}
{{~/if}}
</span>
<span class="link-bottom-line">
{{#unless hideCategory}}
{{#unless topic.isPinnedUncategorized}}
{{category-link topic.category}}
{{/unless}}
{{/unless}}
{{raw "list/activity-column" topic=topic class="num" tagName="a"}}
{{raw "list/posts-count-column" topic=topic}}
<span class="num views {{topic.viewsHeat}}">
{{d-icon "far-eye"}}
{{number topic.views numberKey="views_long"}}
</span>
{{discourse-tags topic mode="list" tagsForUser=tagsForUser}}
{{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
</span>
{{#if expandPinned}}
{{raw "list/topic-excerpt" topic=topic}}
{{/if}}
</span>
<span class="fill topic-list-data"></span>
<span class="secondary topic-list-data">
{{#if showPosters}}
{{raw "list/posters-column" posters=topic.featuredUsers}}
{{/if}}
</span>
3 changes: 3 additions & 0 deletions javascripts/discourse/raw-templates/list/visited-line.hbr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#if view.isLastVisited}}
<hr class='topic-list-item-separator' data-message="{{i18n 'topics.new_messages_marker'}}"></hr>
{{/if}}
Loading
Loading