Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-26 11:00:28 +01:00
implemented similar topics UI via ember components
Dieser Commit ist enthalten in:
Ursprung
194389c9be
Commit
d47770de88
6 geänderte Dateien mit 51 neuen und 8 gelöschten Zeilen
|
@ -48,6 +48,8 @@ export default WizardFieldValidator.extend({
|
||||||
|
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
closeMessage(){}
|
closeMessage(){
|
||||||
|
this.set('showMessage', false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
22
assets/javascripts/wizard/helpers/date-node.js.es6
Normale Datei
22
assets/javascripts/wizard/helpers/date-node.js.es6
Normale Datei
|
@ -0,0 +1,22 @@
|
||||||
|
import { registerUnbound } from "discourse-common/lib/helpers";
|
||||||
|
import { longDate, number, relativeAge } from "discourse/lib/formatter";
|
||||||
|
|
||||||
|
export default registerUnbound("date-node", function (dt) {
|
||||||
|
if (typeof dt === "string") {
|
||||||
|
dt = new Date(dt);
|
||||||
|
}
|
||||||
|
if (dt) {
|
||||||
|
const attributes = {
|
||||||
|
title: longDate(dt),
|
||||||
|
"data-time": dt.getTime(),
|
||||||
|
"data-format": "tiny",
|
||||||
|
};
|
||||||
|
|
||||||
|
const finalString = `<span class="relative-date" title="${
|
||||||
|
attributes["title"]
|
||||||
|
}" data-time="${attributes["data-time"]}" data-format="${
|
||||||
|
attributes["data-format"]
|
||||||
|
}">${relativeAge(dt)}</span>`;
|
||||||
|
return new Handlebars.SafeString(finalString);
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,10 +1,9 @@
|
||||||
{{#if similarTopics}}
|
{{#if similarTopics}}
|
||||||
<a href {{action 'closeMessage' message}} class="close">{{d-icon "times"}}</a>
|
<h3>{{i18n 'realtime_validations.similar_topics_heading'}}</h3>
|
||||||
<h3>{{i18n "composer.similar_topics"}}</h3>
|
<div class="wizard-similar-topics">
|
||||||
|
{{#each similarTopics as |similarTopic|}}
|
||||||
|
{{wizard-similar-topic topic=similarTopic}}
|
||||||
<ul class="topics">
|
{{/each}}
|
||||||
{{mount-widget widget="search-result-topic" args=(hash results=similarTopics)}}
|
</div>
|
||||||
</ul>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<a href="{{topic.url}}" target="_blank">
|
||||||
|
<span class="title">{{html-safe topic.fancy_title}}</span>
|
||||||
|
<div class="blurb">{{date-node topic.created_at}} - {{html-safe topic.blurb}}</div>
|
||||||
|
</a>
|
|
@ -156,3 +156,17 @@
|
||||||
min-width: 220px;
|
min-width: 220px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wizard-similar-topics {
|
||||||
|
background-color: var(--tertiary-low);
|
||||||
|
padding: 5px;
|
||||||
|
.title {
|
||||||
|
color: var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.blurb {
|
||||||
|
margin-left: 0.5em;
|
||||||
|
color: var(--primary-high);
|
||||||
|
font-size: $font-down-1;
|
||||||
|
}
|
||||||
|
}
|
|
@ -520,3 +520,5 @@ en:
|
||||||
yourself_confirm:
|
yourself_confirm:
|
||||||
title: "Did you forget to add recipients?"
|
title: "Did you forget to add recipients?"
|
||||||
body: "Right now this message is only being sent to yourself!"
|
body: "Right now this message is only being sent to yourself!"
|
||||||
|
realtime_validations:
|
||||||
|
similar_topics_heading: "Your topic is similar to..."
|
||||||
|
|
Laden …
In neuem Issue referenzieren