diff --git a/assets/javascripts/discourse/connectors/category-custom-settings/donations_category_settings.hbs b/assets/javascripts/discourse/connectors/category-custom-settings/donations_category_settings.hbs
index ca19e34..c448fec 100644
--- a/assets/javascripts/discourse/connectors/category-custom-settings/donations_category_settings.hbs
+++ b/assets/javascripts/discourse/connectors/category-custom-settings/donations_category_settings.hbs
@@ -23,4 +23,14 @@
{{input value=category.custom_fields.donations_maintainers_label}}
+
+
+
+ {{input value=category.custom_fields.donations_release_latest}}
+
+
+
+
+ {{input value=category.custom_fields.donations_release_oldest}}
+
{{/if}}
diff --git a/assets/javascripts/discourse/widgets/donations-category-header-widget.js.es6 b/assets/javascripts/discourse/widgets/donations-category-header-widget.js.es6
index 6a468b5..2f227f4 100644
--- a/assets/javascripts/discourse/widgets/donations-category-header-widget.js.es6
+++ b/assets/javascripts/discourse/widgets/donations-category-header-widget.js.es6
@@ -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));
}
diff --git a/assets/stylesheets/discourse-donations.scss b/assets/stylesheets/discourse-donations.scss
index 938c147..317b7ff 100644
--- a/assets/stylesheets/discourse-donations.scss
+++ b/assets/stylesheets/discourse-donations.scss
@@ -140,7 +140,7 @@ div.stripe-errors {
}
.donations-category-metadata {
- width: 500px;
+ max-width: 700px;
margin: 0 auto;
padding-bottom: 20px;
display: flex;
@@ -166,6 +166,15 @@ div.stripe-errors {
margin-right: 4px;
}
}
+
+ .donations-release-latest, .donations-release-oldest {
+ display: flex;
+ align-items: center;
+
+ span:first-of-type {
+ margin-right: 8px;
+ }
+ }
}
.donations-category-users {
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 984bab2..2f796f3 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -58,6 +58,10 @@ en:
setting_label: "Maintainers label"
amounts:
setting_label: "Show donation amounts"
+ release_latest:
+ label: "Latest Release Supported"
+ release_oldest:
+ label: "Oldest Release Supported"
subscription:
cancel:
title: "Cancel Recurring Donation"
diff --git a/plugin.rb b/plugin.rb
index 4e67504..b4a950f 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -113,6 +113,22 @@ after_initialize do
nil
end
end
+
+ def donations_release_latest
+ if custom_fields['donations_release_latest']
+ custom_fields['donations_release_latest']
+ else
+ nil
+ end
+ end
+
+ def donations_release_oldest
+ if custom_fields['donations_release_oldest']
+ custom_fields['donations_release_oldest']
+ else
+ nil
+ end
+ end
end
[
@@ -124,7 +140,9 @@ after_initialize do
'donations_maintainers',
'donations_maintainers_label',
'donations_github',
- 'donations_meta'
+ 'donations_meta',
+ 'donations_release_latest',
+ 'donations_release_oldest'
].each do |key|
Site.preloaded_category_custom_fields << key if Site.respond_to? :preloaded_category_custom_fields
end
@@ -145,6 +163,8 @@ after_initialize do
add_to_serializer(:basic_category, :include_donations_maintainers_label?) { object.donations_maintainers_label.present? }
add_to_serializer(:basic_category, :donations_github) { object.donations_github }
add_to_serializer(:basic_category, :donations_meta) { object.donations_meta }
+ add_to_serializer(:basic_category, :donations_release_latest) { object.donations_release_latest }
+ add_to_serializer(:basic_category, :donations_release_oldest) { object.donations_release_oldest }
DiscourseEvent.trigger(:donations_ready)
end