Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ac6e3ad3c | |||
| 215ad1d640 | |||
| 3f4cc39067 | |||
| 0a6b6180b9 | |||
| 536868002f | |||
| 04a7f9139d | |||
| 863b542e3e | |||
| 23d86f1502 | |||
| 314cf58c29 | |||
| 9c063b82f1 | |||
| b397e4faf6 | |||
| 256197094e | |||
| 9898d4bb1d | |||
| c321dc51b0 |
@@ -1,7 +1,7 @@
|
||||
import Component from '@ember/component';
|
||||
import { computed } from '@ember/object';
|
||||
import { and, notEmpty } from '@ember/object/computed';
|
||||
import { isEmpty } from '@ember/utils';
|
||||
import { assign } from '@ember/polyfills';
|
||||
import moment from 'moment';
|
||||
|
||||
export default Component.extend({
|
||||
@@ -24,19 +24,17 @@ export default Component.extend({
|
||||
init () {
|
||||
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', assign({}, this.defaultAttr, this.attributes));
|
||||
|
||||
this.reset();
|
||||
},
|
||||
|
||||
@@ -6,6 +6,8 @@ export default Controller.extend({
|
||||
|
||||
kredits: service(),
|
||||
|
||||
queryParams: ['contributorId', 'kind', 'amount'],
|
||||
|
||||
contributors: alias('kredits.contributors'),
|
||||
minedContributors: filterBy('contributors', 'id'),
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ Router.map(function() {
|
||||
this.route('new');
|
||||
});
|
||||
this.route('contributions', function() {
|
||||
this.route('new');
|
||||
this.route('new', { queryParams: ['contributorId', 'kind', 'amount'] });
|
||||
this.route('resubmit', { path: ':id/resubmit' });
|
||||
});
|
||||
this.route('contributors', function() {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default Route.extend({
|
||||
|
||||
model (params) {
|
||||
return { params };
|
||||
}
|
||||
|
||||
});
|
||||
@@ -10,6 +10,7 @@ button, input[type=submit], .button {
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
letter-spacing: 0.1em;
|
||||
-webkit-appearance: none;
|
||||
|
||||
&+button, &+input[type=submit], &+.button {
|
||||
margin-left: 0.5rem;
|
||||
|
||||
@@ -84,5 +84,17 @@ section#contribution-details {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// On small screens, hide intro text, contributor and contributions list when
|
||||
// showing details
|
||||
@include media-max(small) {
|
||||
#dashboard.with-details {
|
||||
#contributions, #stats {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
#intro.with-details {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,10 @@ section#contributor-profile {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.actions {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.actions {
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
</header>
|
||||
|
||||
<div class="content">
|
||||
{{add-contribution contributors=sortedContributors save=(action "save")}}
|
||||
{{add-contribution contributors=sortedContributors
|
||||
attributes=model.params
|
||||
save=(action "save")}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{#if showIntroText}}
|
||||
<div id="intro">
|
||||
<div id="intro" class={{if showDetailsPane "with-details"}}>
|
||||
<h2>
|
||||
Welcome to the contribution dashboard of the
|
||||
<a href="https://kosmos.org" target="_blank" rel="noopener">Kosmos</a> project!
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
kredits will be issued.
|
||||
</p>
|
||||
<p>
|
||||
{{link-to "Re-submit contribution …" "contributions.resubmit" model class="button small green"}}.
|
||||
{{link-to "Re-submit contribution …" "contributions.resubmit" model class="button small green"}}
|
||||
</p>
|
||||
</div>
|
||||
{{/if}}
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<div class="actions">
|
||||
<p>
|
||||
{{link-to "Copy & edit as new" "contributions.resubmit" model class="button small"}}.
|
||||
{{link-to "Copy & edit as new" "contributions.resubmit" model class="button small"}}
|
||||
{{#if model.ipfsHash}}
|
||||
<a href="{{ipfsGatewayUrl}}/{{model.ipfsHash}}"
|
||||
class="button small" target="_blank" rel="noopener">
|
||||
|
||||
@@ -22,6 +22,13 @@
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
<div class="actions">
|
||||
<p>
|
||||
{{link-to "♥ Give kredits" "contributions.new"
|
||||
(query-params contributorId=model.id)
|
||||
class="button green"}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kredits-web",
|
||||
"version": "1.13.0",
|
||||
"version": "1.15.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kredits-web",
|
||||
"version": "1.13.0",
|
||||
"version": "1.15.0",
|
||||
"private": true,
|
||||
"description": "Contribution dashboard of the Kosmos project",
|
||||
"repository": "https://github.com/67P/kredits-web",
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+14
-12
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3
-3
@@ -8,10 +8,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
|
||||
|
||||
<meta name="kredits-web/config/environment" content="%7B%22modulePrefix%22%3A%22kredits-web%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22auto%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_JQUERY_INTEGRATION%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22kredits-web%22%2C%22version%22%3A%221.13.0%2B15e5d3c2%22%7D%2C%22browserify%22%3A%7B%22tests%22%3Atrue%2C%22transform%22%3A%5B%5B%22babelify%22%2C%7B%22presets%22%3A%5B%22es2015%22%5D%2C%22global%22%3Atrue%7D%5D%5D%7D%2C%22web3ProviderUrl%22%3A%22https%3A%2F%2Frinkeby.infura.io%2Fv3%2Fd4f788b7a6584f7db2fc3c268d4d09e9%22%2C%22web3RequiredNetwork%22%3A%22rinkeby%22%2C%22githubConnectUrl%22%3A%22https%3A%2F%2Fhal8000.chat.kosmos.org%2Fkredits%2Fsignup%2Fconnect%2Fgithub%22%2C%22githubSignupUrl%22%3A%22https%3A%2F%2Fhal8000.chat.kosmos.org%2Fkredits%2Fsignup%2Fgithub%22%2C%22ipfs%22%3A%7B%22host%22%3A%22ipfs.kosmos.org%22%2C%22port%22%3A%225444%22%2C%22protocol%22%3A%22https%22%2C%22gatewayUrl%22%3A%22https%3A%2F%2Fipfs.kosmos.org%2Fipfs%22%7D%2C%22exportApplicationGlobal%22%3Afalse%7D" />
|
||||
<meta name="kredits-web/config/environment" content="%7B%22modulePrefix%22%3A%22kredits-web%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22auto%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_JQUERY_INTEGRATION%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22kredits-web%22%2C%22version%22%3A%221.15.0%2B215ad1d6%22%7D%2C%22browserify%22%3A%7B%22tests%22%3Atrue%2C%22transform%22%3A%5B%5B%22babelify%22%2C%7B%22presets%22%3A%5B%22es2015%22%5D%2C%22global%22%3Atrue%7D%5D%5D%7D%2C%22web3ProviderUrl%22%3A%22https%3A%2F%2Frinkeby.infura.io%2Fv3%2Fd4f788b7a6584f7db2fc3c268d4d09e9%22%2C%22web3RequiredNetwork%22%3A%22rinkeby%22%2C%22githubConnectUrl%22%3A%22https%3A%2F%2Fhal8000.chat.kosmos.org%2Fkredits%2Fsignup%2Fconnect%2Fgithub%22%2C%22githubSignupUrl%22%3A%22https%3A%2F%2Fhal8000.chat.kosmos.org%2Fkredits%2Fsignup%2Fgithub%22%2C%22ipfs%22%3A%7B%22host%22%3A%22ipfs.kosmos.org%22%2C%22port%22%3A%225444%22%2C%22protocol%22%3A%22https%22%2C%22gatewayUrl%22%3A%22https%3A%2F%2Fipfs.kosmos.org%2Fipfs%22%7D%2C%22exportApplicationGlobal%22%3Afalse%7D" />
|
||||
|
||||
<link integrity="" rel="stylesheet" href="/assets/vendor-179cf27a97ea5bbb0ce72403a401cc8c.css">
|
||||
<link integrity="" rel="stylesheet" href="/assets/kredits-web-7486572f1c1005f28df459da134a97f2.css">
|
||||
<link integrity="" rel="stylesheet" href="/assets/kredits-web-6b341df3a0facb8197a92e426fccd7ce.css">
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
|
||||
<script src="/assets/vendor-21c31ba5343c7b72f638899d335a0531.js" integrity="sha256-5QKR4/TvbS9UoThtAlcyvj54wU+Bcn0hnM0FzjUbvfA= sha512-tHxWM5t9FYFz6DBnXuzWiIMPPW/gNwPaFDOdUL32cWvWcMfjyrhIEPM5I1D6+HQE1kXCEd64a+7UiMdU2hH5JQ==" ></script>
|
||||
<script src="/assets/kredits-web-a6b23d76eb470475515cfa602440fbfb.js" integrity="sha256-0kjKqEi3xMDzRlsV7Z+2x9xXF5AAi0EFVSLPD16NdH8= sha512-9IuLwhzOfgxZKJZ2L2sy4zoibavROIwKU4TRoNYGdzkVqPUhNOhT5i3BLgbRrZ57oFm5WwfjVyB6RAoVjVz06w==" ></script>
|
||||
<script src="/assets/kredits-web-8e76b81273d6c0097f587de0a50886a5.js" integrity="sha256-XITXC2+4rHKAMRTko5/Lm3/QfPulcAhldCaNQC7xJu4= sha512-COQxwB23J3NmW5jAA2YIiLrsqmJRv3wAdTEv9aGjsqVEpGw3ve9dD2zeN+pz44NkbyrtJD52iJw8ai0Y1RubLg==" ></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import moment from 'moment';
|
||||
|
||||
module('Unit | Component | add-contribution', function(hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let component = this.owner.factoryFor('component:add-contribution').create();
|
||||
assert.ok(component);
|
||||
});
|
||||
|
||||
test('default attributes', function(assert) {
|
||||
let component = this.owner.factoryFor('component:add-contribution').create();
|
||||
|
||||
['contributorId', 'kind', 'amount', 'description', 'url', 'details'].forEach(a => {
|
||||
assert.equal(component.attributes[a], null, `sets the default ${a} attribute`);
|
||||
assert.equal(component.get(a), null, `sets the ${a} property`);
|
||||
});
|
||||
|
||||
assert.ok(moment.isDate(component.attributes.date), 'sets the default date attribute');
|
||||
assert.ok(moment.isDate(component.date), 'sets the default date');
|
||||
});
|
||||
|
||||
test('override default attributes', function(assert) {
|
||||
let component = this.owner.factoryFor('component:add-contribution').create({
|
||||
attributes: { contributorId: '1' }
|
||||
});
|
||||
|
||||
assert.equal(component.contributorId, '1', `overrides the default property`);
|
||||
|
||||
['kind', 'amount', 'description', 'url', 'details'].forEach(a => {
|
||||
assert.equal(component.attributes[a], null, `sets the default ${a} attribute`);
|
||||
assert.equal(component.get(a), null, `sets the ${a} property`);
|
||||
});
|
||||
|
||||
assert.ok(moment.isDate(component.attributes.date), 'sets the default date attribute');
|
||||
assert.ok(moment.isDate(component.date), 'sets the default date');
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user