diff --git a/app/components/add-contribution/component.js b/app/components/add-contribution/component.js index 4b16e65..0c25c85 100644 --- a/app/components/add-contribution/component.js +++ b/app/components/add-contribution/component.js @@ -1,6 +1,7 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import { and, notEmpty } from '@ember/object/computed'; +import moment from 'moment'; export default Component.extend({ @@ -21,13 +22,13 @@ export default Component.extend({ init () { this._super(...arguments); - this.set('defaultDate', new Date()); + this.set('defaultDate', moment().startOf('hour').toDate()); // Default attributes used by reset this.set('attributes', { contributorId: null, kind: null, - date: [new Date()], + date: this.defaultDate, amount: null, description: null, url: null, @@ -49,8 +50,12 @@ export default Component.extend({ } const attributes = this.getProperties(Object.keys(this.attributes)); - const [ date/* , time */ ] = attributes.date[0].toISOString().split('T'); - attributes.date = date; + + let dateInput = (attributes.date instanceof Array) ? + attributes.date[0] : attributes.date; + + const [ date, time ] = dateInput.toISOString().split('T'); + [ attributes.date, attributes.time ] = [ date, time ]; this.set('inProgress', true); diff --git a/app/components/add-contribution/template.hbs b/app/components/add-contribution/template.hbs index 8126463..2d2751f 100644 --- a/app/components/add-contribution/template.hbs +++ b/app/components/add-contribution/template.hbs @@ -1,54 +1,68 @@
-

- -

-

- -

-

- {{ember-flatpickr - allowInput=false - altFormat="F j, Y" - altInput=true - altInputClass="date-alt" - date=date - dateFormat="Y-m-d" - defaultDate=defaultDate - maxDate=defaultDate - onChange=(action (mut date)) - }} -

-

- {{input type="text" - placeholder="500" - value=amount - class=(if isValidAmount "valid" "")}} -

-

- {{input type="text" - placeholder="Description" - value=description - class=(if isValidDescription "valid" "")}} -

-

- {{input type="text" - placeholder="URL (optional)" - value=url - class=(if isValidUrl "valid" "")}} -

+ + + + + + +

{{input type="submit" disabled=inProgress diff --git a/app/styles/_forms.scss b/app/styles/_forms.scss index f9e3dd9..75f3067 100644 --- a/app/styles/_forms.scss +++ b/app/styles/_forms.scss @@ -7,6 +7,10 @@ section#add-proposal { p { margin-bottom: 1.5rem; + &.label { + margin-bottom: .5rem; + } + &.actions { padding-top: 1.5rem; text-align: center;