add cause release fields

This commit is contained in:
Angus McLeod
2019-04-03 12:32:24 +11:00
parent b7ee6a1b25
commit 44410fa375
5 changed files with 84 additions and 2 deletions
@@ -23,4 +23,14 @@
<label>{{i18n 'discourse_donations.cause.maintainers.setting_label'}}</label>
{{input value=category.custom_fields.donations_maintainers_label}}
</section>
<section class='field'>
<label>{{i18n 'discourse_donations.cause.release_latest.label'}}</label>
{{input value=category.custom_fields.donations_release_latest}}
</section>
<section class='field'>
<label>{{i18n 'discourse_donations.cause.release_oldest.label'}}</label>
{{input value=category.custom_fields.donations_release_oldest}}
</section>
{{/if}}
@@ -2,6 +2,7 @@ import { createWidget } from 'discourse/widgets/widget';
import { h } from 'virtual-dom';
import { avatarFor } from 'discourse/widgets/post';
import { userPath } from "discourse/lib/url";
import { iconNode } from "discourse-common/lib/icon-library";
function donationDisplay(amount, type) {
return h(`div.donations-${type}`, [
@@ -68,6 +69,44 @@ createWidget('category-header-widget', {
);
}
if (category.donations_release_oldest) {
let releaseArray = category.donations_release_oldest.split('/');
let label = releaseArray[releaseArray.length - 1];
metadata.push(
h('div.donations-release-oldest', [
h('span', '>'),
this.attach('link', {
href: category.donations_release_oldest,
icon: 'tag',
rawLabel: label,
omitSpan: true,
attributes: {
target: '_blank'
}
})
])
)
}
if (category.donations_release_latest) {
let releaseArray = category.donations_release_latest.split('/');
let label = releaseArray[releaseArray.length - 1];
metadata.push(
h('div.donations-release-latest', [
h('span', '<'),
this.attach('link', {
href: category.donations_release_latest,
icon: 'tag',
rawLabel: label,
omitSpan: true,
attributes: {
target: '_blank'
}
})
])
)
}
if (metadata.length) {
contents.push(h('div.donations-category-metadata', metadata));
}