mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 11:20:57 -06:00
DEV: Add data-topic-id to more elements containing titles.
This commit is contained in:
parent
8837fe47d7
commit
1f9f00a629
@ -66,9 +66,9 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
_formatReplyToTopic(link) {
|
||||
return `<a class="topic-link" href="${link.href}">${
|
||||
link.anchor
|
||||
}</a>`.htmlSafe();
|
||||
return `<a class="topic-link" href="${link.href}" data-topic-id="${this.get(
|
||||
"model.topic.id"
|
||||
)}">${link.anchor}</a>`.htmlSafe();
|
||||
},
|
||||
|
||||
_formatReplyToUserPost(avatar, link) {
|
||||
|
@ -11,6 +11,6 @@ registerUnbound("topic-link", (topic, args) => {
|
||||
args.class.split(" ").forEach(c => classes.push(c));
|
||||
}
|
||||
|
||||
const result = `<a href='${url}' class='${classes.join(" ")}'>${title}</a>`;
|
||||
const result = `<a href='${url}' class='${classes.join(" ")}' data-topic-id='${topic.id}'>${title}</a>`;
|
||||
return new Handlebars.SafeString(result);
|
||||
});
|
||||
|
@ -44,7 +44,7 @@
|
||||
</div>
|
||||
|
||||
{{else}}
|
||||
<h1>
|
||||
<h1 data-topic-id="{{unbound model.id}}">
|
||||
{{#unless model.is_warning}}
|
||||
{{#if siteSettings.enable_personal_messages}}
|
||||
<a href={{pmPath}}>
|
||||
|
@ -40,6 +40,7 @@ export default createWidget("header-topic-info", {
|
||||
className: "topic-link",
|
||||
action: "jumpToTopPost",
|
||||
href,
|
||||
attributes: { "data-topic-id": topic.get("id") },
|
||||
contents: () => titleHTML
|
||||
})
|
||||
);
|
||||
|
@ -35,12 +35,18 @@ export default createWidget("link", {
|
||||
},
|
||||
|
||||
buildAttributes(attrs) {
|
||||
return {
|
||||
const ret = {
|
||||
href: this.href(attrs),
|
||||
title: attrs.title
|
||||
? I18n.t(attrs.title, attrs.titleOptions)
|
||||
: this.label(attrs)
|
||||
};
|
||||
if (attrs.attributes) {
|
||||
Object.keys(attrs.attributes).forEach(
|
||||
k => (ret[k] = attrs.attributes[k])
|
||||
);
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
|
||||
label(attrs) {
|
||||
|
@ -464,7 +464,11 @@ createWidget("post-article", {
|
||||
},
|
||||
|
||||
buildAttributes(attrs) {
|
||||
return { "data-post-id": attrs.id, "data-user-id": attrs.user_id };
|
||||
return {
|
||||
"data-post-id": attrs.id,
|
||||
"data-topic-id": attrs.topicId,
|
||||
"data-user-id": attrs.user_id
|
||||
};
|
||||
},
|
||||
|
||||
html(attrs, state) {
|
||||
|
Loading…
Reference in New Issue
Block a user