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) {
|
_formatReplyToTopic(link) {
|
||||||
return `<a class="topic-link" href="${link.href}">${
|
return `<a class="topic-link" href="${link.href}" data-topic-id="${this.get(
|
||||||
link.anchor
|
"model.topic.id"
|
||||||
}</a>`.htmlSafe();
|
)}">${link.anchor}</a>`.htmlSafe();
|
||||||
},
|
},
|
||||||
|
|
||||||
_formatReplyToUserPost(avatar, link) {
|
_formatReplyToUserPost(avatar, link) {
|
||||||
|
|
|
@ -11,6 +11,6 @@ registerUnbound("topic-link", (topic, args) => {
|
||||||
args.class.split(" ").forEach(c => classes.push(c));
|
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);
|
return new Handlebars.SafeString(result);
|
||||||
});
|
});
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<h1>
|
<h1 data-topic-id="{{unbound model.id}}">
|
||||||
{{#unless model.is_warning}}
|
{{#unless model.is_warning}}
|
||||||
{{#if siteSettings.enable_personal_messages}}
|
{{#if siteSettings.enable_personal_messages}}
|
||||||
<a href={{pmPath}}>
|
<a href={{pmPath}}>
|
||||||
|
|
|
@ -40,6 +40,7 @@ export default createWidget("header-topic-info", {
|
||||||
className: "topic-link",
|
className: "topic-link",
|
||||||
action: "jumpToTopPost",
|
action: "jumpToTopPost",
|
||||||
href,
|
href,
|
||||||
|
attributes: { "data-topic-id": topic.get("id") },
|
||||||
contents: () => titleHTML
|
contents: () => titleHTML
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -35,12 +35,18 @@ export default createWidget("link", {
|
||||||
},
|
},
|
||||||
|
|
||||||
buildAttributes(attrs) {
|
buildAttributes(attrs) {
|
||||||
return {
|
const ret = {
|
||||||
href: this.href(attrs),
|
href: this.href(attrs),
|
||||||
title: attrs.title
|
title: attrs.title
|
||||||
? I18n.t(attrs.title, attrs.titleOptions)
|
? I18n.t(attrs.title, attrs.titleOptions)
|
||||||
: this.label(attrs)
|
: this.label(attrs)
|
||||||
};
|
};
|
||||||
|
if (attrs.attributes) {
|
||||||
|
Object.keys(attrs.attributes).forEach(
|
||||||
|
k => (ret[k] = attrs.attributes[k])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
label(attrs) {
|
label(attrs) {
|
||||||
|
|
|
@ -464,7 +464,11 @@ createWidget("post-article", {
|
||||||
},
|
},
|
||||||
|
|
||||||
buildAttributes(attrs) {
|
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) {
|
html(attrs, state) {
|
||||||
|
|
Loading…
Reference in New Issue