diff --git a/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js.es6 b/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js.es6 index 8f0729360b4..862d71dd515 100644 --- a/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js.es6 +++ b/plugins/discourse-local-dates/assets/javascripts/discourse/components/discourse-local-dates-create-form.js.es6 @@ -18,6 +18,7 @@ export default Ember.Component.extend({ this.set("date", moment().format(this.dateFormat)); this.set("time", moment().format(this.timeFormat)); + this.set("currentMoment", moment()); this.set("format", `LLL`); this.set("timezones", (this.siteSettings.discourse_local_dates_default_timezones || "").split("|").filter(f => f)); this.set("formats", (this.siteSettings.discourse_local_dates_default_formats || "").split("|")); @@ -34,6 +35,16 @@ export default Ember.Component.extend({ return moment.tz.guess(); }, + @computed("formats") + previewedFormats(formats) { + return formats.map(format => { + return { + format: format, + preview: moment().format(format) + }; + }); + }, + @computed recurringOptions() { return [ @@ -88,6 +99,11 @@ export default Ember.Component.extend({ return dateTime.isValid(); }, + @computed("advancedMode") + toggleModeBtnLabel(advancedMode) { + return advancedMode ? "discourse_local_dates.create.form.simple_mode" : "discourse_local_dates.create.form.advanced_mode"; + }, + actions: { advancedMode() { this.toggleProperty("advancedMode"); diff --git a/plugins/discourse-local-dates/assets/javascripts/discourse/templates/components/discourse-local-dates-create-form.hbs b/plugins/discourse-local-dates/assets/javascripts/discourse/templates/components/discourse-local-dates-create-form.hbs index c416dc625c8..5b7ae5fa842 100644 --- a/plugins/discourse-local-dates/assets/javascripts/discourse/templates/components/discourse-local-dates-create-form.hbs +++ b/plugins/discourse-local-dates/assets/javascripts/discourse/templates/components/discourse-local-dates-create-form.hbs @@ -5,56 +5,78 @@ style="overflow: auto"}}
-
-
- {{date-picker-future class="date" value=date defaultDate="DD-MM-YYYY"}} - {{input type="time" value=time class="time"}} - {{currentUserTimezone}} +
+
+ +
+ {{date-picker-future class="date-input" value=date defaultDate="DD-MM-YYYY"}} +
+ +
+ +
+ {{input type="time" value=time class="time-input"}} +
+
+ + {{currentUserTimezone}}
-

{{i18n "discourse_local_dates.create.form.recurring_title"}}

-
+ {{#unless validDate}} + {{i18n "discourse_local_dates.create.form.invalid_date"}} + {{/unless}} + +
+ {{#if advancedMode}} - +

{{{i18n "discourse_local_dates.create.form.recurring_description"}}}

{{/if}}
- {{combo-box content=recurringOptions value=recurring none="discourse_local_dates.create.form.recurring_none"}} + {{combo-box content=recurringOptions class="recurrence-input" value=recurring none="discourse_local_dates.create.form.recurring_none"}}
- {{d-button - class="advanced-mode-btn" - action=(action "advancedMode") - icon="cog" - label="discourse_local_dates.create.form.advanced_mode"}} - {{#if advancedMode}}
-
-