Add "give kredits" button to contributor profiles #180

Merged
raucao merged 6 commits from feature/add_contribution_with_params into master 2019-12-13 16:33:20 +00:00
Showing only changes of commit 04a7f9139d - Show all commits
+16 -9
View File
@@ -24,18 +24,25 @@ export default Component.extend({
init () {
galfert commented 2019-12-13 15:39:27 +00:00 (Migrated from github.com)
Review

Instead of merging attributes manually, you can use Ember's assign method to replace the whole if-else block.

import { assign } from '@ember/polyfills';
...
this.set('attributes', assign({}, this.defaultAttr, this.attributes));
Instead of merging attributes manually, you can use Ember's `assign` method to replace the whole `if-else` block. ```js import { assign } from '@ember/polyfills'; ... this.set('attributes', assign({}, this.defaultAttr, this.attributes)); ```
this._super(...arguments);
this.set('defaultDate', moment().startOf('hour').toDate());
this.set('defaultAttr', {
contributorId: null,
kind: null,
date: this.defaultDate,
amount: null,
description: null,
url: null,
details: null
});
// Default attributes used by reset
if (isEmpty(this.attributes)) {
this.set('attributes', {
contributorId: null,
kind: null,
date: this.defaultDate,
amount: null,
description: null,
url: null,
details: null
});
this.set('attributes', this.defaultAttr);
} else {
Object.keys(this.defaultAttr).forEach(a => {
if (typeof this.attributes[a] === 'undefined') {
this.attributes[a] = this.defaultAttr[a];
}
})
}
this.reset();