FIX: Add 'none' option to region selector (#94)

This commit is contained in:
Dan Ungureanu 2021-01-19 11:35:14 +02:00 committed by GitHub
parent db6cab9cf1
commit 08ddbcc769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -18,11 +18,13 @@ export default ComboBoxComponent.extend({
localeNames[locale.value] = locale.name;
});
return HOLIDAY_REGIONS.map((region) => {
return {
let values = [{ name: I18n.t("discourse_calendar.region.none"), id: null }];
values = values.concat(
HOLIDAY_REGIONS.map((region) => ({
name: I18n.t(`discourse_calendar.region.names.${region}`),
id: region,
};
}).sort((a, b) => a.name.localeCompare(b.name));
})).sort((a, b) => a.name.localeCompare(b.name))
);
return values;
}),
});

View File

@ -13,7 +13,7 @@ en:
add_to_calendar: "Add to Google Calendar"
region:
title: "Region"
none: "Select a region..."
none: "None"
use_current_region: "Use Current Region"
names:
ar: "Argentina"

View File

@ -15,7 +15,7 @@ module Jobs
UserCustomField
.where(name: ::DiscourseCalendar::REGION_CUSTOM_FIELD)
.pluck(:user_id, :value)
.each { |user_id, region| regions_and_user_ids[region] << user_id }
.each { |user_id, region| regions_and_user_ids[region] << user_id if region.present? }
usernames = User
.real