Compare commits

..

19 Commits

Author SHA1 Message Date
basti 8ac6e3ad3c 1.15.0 2019-12-14 12:06:28 +01:00
basti 215ad1d640 Merge pull request #180 from 67P/feature/add_contribution_with_params
Add "give kredits" button to contributor profiles
2019-12-13 17:33:18 +01:00
basti 3f4cc39067 Refactor assignment
Co-authored-by: Garret Alfert <alfert@wevelop.de>
2019-12-13 17:04:52 +01:00
basti 0a6b6180b9 Add "give kredits" button to contributor profiles
closes #172
2019-12-12 17:33:08 +01:00
basti 536868002f Support query params for adding contribution
Just contributor ID, kind, and amount for now.
2019-12-10 18:16:54 +01:00
basti 04a7f9139d Allow partial override of contribution attributes 2019-12-10 13:40:08 +03:00
basti 863b542e3e Add failing test for partial attribute override
Currently the default attributes are only set correctly when either none
or all attributes are handed to the component
2019-12-10 13:18:21 +03:00
basti 23d86f1502 Add unit test for add-contribution component 2019-12-10 13:09:30 +03:00
basti 314cf58c29 1.14.0 2019-12-02 15:59:30 +01:00
basti 9c063b82f1 Merge pull request #169 from 67P/feature/163-small_screen_details_new
Show contributor/contribution details on mobile
2019-12-02 15:57:22 +01:00
basti b397e4faf6 Merge pull request #168 from 67P/bugfix/ios_button_styling
Reset iOS button styling
2019-11-29 21:07:35 +01:00
galfert 256197094e Don't show intro text on details page 2019-11-29 18:06:32 +01:00
galfert 9898d4bb1d Show contributor/contribution details on mobile
Refs #163

On small screens, when selecting a contribution or contributor, the
lists are hidden and only the details are shown.
2019-11-29 18:05:52 +01:00
galfert c321dc51b0 Reset iOS button styling
Removes the pill shaped, shaded button styling on iOS.
2019-11-29 17:44:22 +01:00
basti 8c759601ca 1.13.0 2019-11-27 15:22:02 +01:00
galfert 15e5d3c2fb Merge pull request #166 from 67P/feature/welcome_text
Add intro, fix topbar on mobile, fix filter button
2019-11-27 13:50:31 +01:00
basti 47b7a6501b Add intro text for new users
closes #164
2019-11-27 12:39:49 +01:00
basti 42304a8e27 Fix account panel breaking out of topbar on mobile
refs #163
2019-11-27 11:55:08 +01:00
basti 9a4db6daf6 Do not require account for filtering contributions 2019-11-27 11:00:10 +01:00
25 changed files with 183 additions and 50 deletions
+4 -6
View File
@@ -1,7 +1,7 @@
import Component from '@ember/component'; import Component from '@ember/component';
import { computed } from '@ember/object'; import { computed } from '@ember/object';
import { and, notEmpty } from '@ember/object/computed'; import { and, notEmpty } from '@ember/object/computed';
import { isEmpty } from '@ember/utils'; import { assign } from '@ember/polyfills';
import moment from 'moment'; import moment from 'moment';
export default Component.extend({ export default Component.extend({
@@ -24,10 +24,7 @@ export default Component.extend({
init () { init () {
this._super(...arguments); this._super(...arguments);
this.set('defaultDate', moment().startOf('hour').toDate()); this.set('defaultDate', moment().startOf('hour').toDate());
this.set('defaultAttr', {
// Default attributes used by reset
if (isEmpty(this.attributes)) {
this.set('attributes', {
contributorId: null, contributorId: null,
kind: null, kind: null,
date: this.defaultDate, date: this.defaultDate,
@@ -36,7 +33,8 @@ export default Component.extend({
url: null, url: null,
details: null details: null
}); });
}
this.set('attributes', assign({}, this.defaultAttr, this.attributes));
this.reset(); this.reset();
}, },
@@ -8,7 +8,7 @@
<span class="core-flag">(core)</span> <span class="core-flag">(core)</span>
{{/if}} {{/if}}
{{else}} {{else}}
Anonymous <span class="anonymous">Anonymous</span>
<button {{action "signup"}} class="small">Sign up</button> <button {{action "signup"}} class="small">Sign up</button>
{{#if showConnectButton}} {{#if showConnectButton}}
<button {{action "connectAccount"}} class="small green">Connect account</button> <button {{action "connectAccount"}} class="small green">Connect account</button>
+2
View File
@@ -6,6 +6,8 @@ export default Controller.extend({
kredits: service(), kredits: service(),
queryParams: ['contributorId', 'kind', 'amount'],
contributors: alias('kredits.contributors'), contributors: alias('kredits.contributors'),
minedContributors: filterBy('contributors', 'id'), minedContributors: filterBy('contributors', 'id'),
+4
View File
@@ -33,6 +33,10 @@ export default Controller.extend({
showQuickFilterUnconfirmed: false, showQuickFilterUnconfirmed: false,
showQuickFilterConfirmed: false, showQuickFilterConfirmed: false,
showIntroText: computed('kredits.{hasAccounts,currentUser}', function(){
return (!this.kredits.hasAccounts || !this.kredits.currentUser);
}),
actions: { actions: {
vetoContribution (contributionId) { vetoContribution (contributionId) {
+1 -1
View File
@@ -20,7 +20,7 @@ Router.map(function() {
this.route('new'); this.route('new');
}); });
this.route('contributions', function() { this.route('contributions', function() {
this.route('new'); this.route('new', { queryParams: ['contributorId', 'kind', 'amount'] });
this.route('resubmit', { path: ':id/resubmit' }); this.route('resubmit', { path: ':id/resubmit' });
}); });
this.route('contributors', function() { this.route('contributors', function() {
+9
View File
@@ -0,0 +1,9 @@
import Route from '@ember/routing/route';
export default Route.extend({
model (params) {
return { params };
}
});
+1
View File
@@ -10,6 +10,7 @@ button, input[type=submit], .button {
text-transform: uppercase; text-transform: uppercase;
cursor: pointer; cursor: pointer;
letter-spacing: 0.1em; letter-spacing: 0.1em;
-webkit-appearance: none;
&+button, &+input[type=submit], &+.button { &+button, &+input[type=submit], &+.button {
margin-left: 0.5rem; margin-left: 0.5rem;
-5
View File
@@ -8,8 +8,3 @@ $red: #fb6868;
$primary-color: $blue; $primary-color: $blue;
$body-text-color: #fff; $body-text-color: #fff;
#topbar {
background-color: rgba(255, 0, 255, .2);
}
+34
View File
@@ -61,6 +61,40 @@ main {
} }
} }
#intro {
padding: 2rem;
background-color: rgba(0,0,0,.2);
font-size: 1.6rem;
@include media-max(small) {
padding: 2rem 1rem;
font-size: 1.4rem;
}
h2 {
font-size: inherit;
margin-bottom: 1em;
}
p {
margin-bottom: 1em;
line-height: 1.5em;
font-size: 1.2rem;
&:last-child {
margin-bottom: 0;
}
}
a {
text-decoration: none;
&:hover, &:active {
text-decoration: underline;
}
}
}
@media (min-width: 550px) { @media (min-width: 550px) {
main { main {
&#dashboard { &#dashboard {
@@ -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 { .actions {
@@ -8,4 +8,10 @@ header#topbar section#user-account {
margin-left: 0.6rem; margin-left: 0.6rem;
} }
@include media-max(small) {
.anonymous {
display: none;
}
}
} }
+3 -1
View File
@@ -6,7 +6,9 @@
</header> </header>
<div class="content"> <div class="content">
{{add-contribution contributors=sortedContributors save=(action "save")}} {{add-contribution contributors=sortedContributors
attributes=model.params
save=(action "save")}}
</div> </div>
</section> </section>
+18 -2
View File
@@ -1,3 +1,19 @@
{{#if showIntroText}}
<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!
</h2>
<p>
If you want to learn more about what the numbers mean and how this works,
check out the
<a href="https://wiki.kosmos.org/Kredits" target="_blank" rel="noopener">Kredits documentation</a>.
If you want to start earning kredits for your contributions,
{{link-to "create a contributor profile" "signup"}}.
</p>
</div>
{{/if}}
<main id="dashboard" class={{if showDetailsPane "with-details"}}> <main id="dashboard" class={{if showDetailsPane "with-details"}}>
<div id="stats"> <div id="stats">
@@ -41,12 +57,12 @@
<section id="contributions-unconfirmed"> <section id="contributions-unconfirmed">
<header class="with-nav"> <header class="with-nav">
<h2>Latest Contributions</h2> <h2>Latest Contributions</h2>
{{#if kredits.hasAccounts}}
<nav> <nav>
<button {{action "toggleQuickFilterUnconfirmed"}} class="small {{if showQuickFilterUnconfirmed "active"}}">filter</button> <button {{action "toggleQuickFilterUnconfirmed"}} class="small {{if showQuickFilterUnconfirmed "active"}}">filter</button>
{{#if kredits.hasAccounts}}
{{link-to "add" "contributions.new" title="Submit a contribution" class="button small green"}} {{link-to "add" "contributions.new" title="Submit a contribution" class="button small green"}}
</nav>
{{/if}} {{/if}}
</nav>
</header> </header>
<div class="content"> <div class="content">
{{!-- TODO: We need a better naming for kredits.hasAccounts --}} {{!-- TODO: We need a better naming for kredits.hasAccounts --}}
@@ -42,7 +42,7 @@
kredits will be issued. kredits will be issued.
</p> </p>
<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> </p>
</div> </div>
{{/if}} {{/if}}
@@ -50,7 +50,7 @@
<div class="actions"> <div class="actions">
<p> <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}} {{#if model.ipfsHash}}
<a href="{{ipfsGatewayUrl}}/{{model.ipfsHash}}" <a href="{{ipfsGatewayUrl}}/{{model.ipfsHash}}"
class="button small" target="_blank" rel="noopener"> class="button small" target="_blank" rel="noopener">
@@ -22,6 +22,13 @@
</li> </li>
{{/if}} {{/if}}
</ul> </ul>
<div class="actions">
<p>
{{link-to "♥ Give kredits" "contributions.new"
(query-params contributorId=model.id)
class="button green"}}
</p>
</div>
</div> </div>
<div class="actions"> <div class="actions">
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "kredits-web", "name": "kredits-web",
"version": "1.12.0", "version": "1.15.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "kredits-web", "name": "kredits-web",
"version": "1.12.0", "version": "1.15.0",
"private": true, "private": true,
"description": "Contribution dashboard of the Kosmos project", "description": "Contribution dashboard of the Kosmos project",
"repository": "https://github.com/67P/kredits-web", "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
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -8,10 +8,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <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.12.0%2B5a618f7e%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/vendor-179cf27a97ea5bbb0ce72403a401cc8c.css">
<link integrity="" rel="stylesheet" href="/assets/kredits-web-a1a46af359f6abc5253690f6a7b29c6b.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/vendor-21c31ba5343c7b72f638899d335a0531.js" integrity="sha256-5QKR4/TvbS9UoThtAlcyvj54wU+Bcn0hnM0FzjUbvfA= sha512-tHxWM5t9FYFz6DBnXuzWiIMPPW/gNwPaFDOdUL32cWvWcMfjyrhIEPM5I1D6+HQE1kXCEd64a+7UiMdU2hH5JQ==" ></script>
<script src="/assets/kredits-web-afbc29b08c72e5915f60326c02c8aaf0.js" integrity="sha256-7NimDs4gj3uLie/5x8Y5dQZDjLbYaxqwWOn8eCQMZ84= sha512-L4P1fbUTM9zXge/og2OyK7pKHEG81XUFSWJMeBfMEvamlttklZqZCLXHHfrKyEip8RKPX1/ud7BUGvw01weptQ==" ></script> <script src="/assets/kredits-web-8e76b81273d6c0097f587de0a50886a5.js" integrity="sha256-XITXC2+4rHKAMRTko5/Lm3/QfPulcAhldCaNQC7xJu4= sha512-COQxwB23J3NmW5jAA2YIiLrsqmJRv3wAdTEv9aGjsqVEpGw3ve9dD2zeN+pz44NkbyrtJD52iJw8ai0Y1RubLg==" ></script>
</body> </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');
});
});