From e93535e239f0d6ab6d71a5764a8d1c3f8fa710b8 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Fri, 19 May 2017 14:09:32 +0800 Subject: [PATCH] Add "Next month" to topic timer selection options. --- .../components/auto-update-input-selector.js.es6 | 14 ++++++++++++++ config/locales/client.en.yml | 1 + 2 files changed, 15 insertions(+) diff --git a/app/assets/javascripts/discourse/components/auto-update-input-selector.js.es6 b/app/assets/javascripts/discourse/components/auto-update-input-selector.js.es6 index 6df72a587a6..56faeb5b054 100644 --- a/app/assets/javascripts/discourse/components/auto-update-input-selector.js.es6 +++ b/app/assets/javascripts/discourse/components/auto-update-input-selector.js.es6 @@ -7,6 +7,7 @@ const TOMORROW = 'tomorrow'; const LATER_THIS_WEEK = 'later_this_week'; const THIS_WEEKEND = 'this_weekend'; const NEXT_WEEK = 'next_week'; +const NEXT_MONTH = 'next_month'; export const PICK_DATE_AND_TIME = 'pick_date_and_time'; export const SET_BASED_ON_LAST_POST = 'set_based_on_last_post'; @@ -57,6 +58,13 @@ export default Combobox.extend({ }); } + if (moment().endOf('month').date() !== now.date()) { + selections.push({ + id: NEXT_MONTH, + name: I18n.t('topic.auto_update_input.next_month') + }); + } + selections.push({ id: PICK_DATE_AND_TIME, name: I18n.t('topic.auto_update_input.pick_date_and_time') @@ -111,6 +119,8 @@ export default Combobox.extend({ if (time) { if (state.id === LATER_TODAY) { time = time.format('h a'); + } else if (state.id === NEXT_MONTH) { + time = time.format('MMM D, h a'); } else { time = time.format('ddd, h a'); } @@ -157,6 +167,10 @@ export default Combobox.extend({ time = time.add(1, 'week').day(1).hour(timeOfDay).minute(0); icon = 'briefcase'; break; + case NEXT_MONTH: + time = time.add(1, 'month').startOf('month').hour(timeOfDay).minute(0); + icon = 'briefcase'; + break; case PICK_DATE_AND_TIME: time = null; icon = 'calendar-plus-o'; diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 15abfec97da..75e5e8e2422 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1511,6 +1511,7 @@ en: later_this_week: "Later this week" this_weekend: "This weekend" next_week: "Next week" + next_month: "Next month" pick_date_and_time: "Pick date and time" set_based_on_last_post: "Close based on last post" publish_to_category: