Skip to content

Commit e07408a

Browse files
committed
Merge remote-tracking branch 'upstream/master' into sg-port-categories-sync
2 parents ee052e2 + 172729a commit e07408a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1865
-275
lines changed

.buildpacks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
https://github.com/rcaught/heroku-buildpack-cmake#e4e2c9e
22
https://github.com/emk/heroku-buildpack-rust#578d630
33
https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/emberjs.tgz
4-
https://github.com/ryandotsmith/nginx-buildpack.git#af813ba
4+
https://github.com/travis-ci/nginx-buildpack.git#2fbde35
55
https://github.com/sgrif/heroku-buildpack-diesel#f605edd

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ language: rust
22
sudo: false
33
dist: trusty
44

5+
branches:
6+
except:
7+
- staging.tmp
8+
59
cache:
610
cargo: true
711

Cargo.lock

Lines changed: 98 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ hex = "0.2"
4040
license-exprs = "^1.3"
4141
dotenv = "0.10.0"
4242
toml = "0.4"
43-
diesel = { version = "0.14.0", features = ["postgres", "serde_json", "deprecated-time", "chrono"] }
44-
diesel_codegen = "0.14.0"
45-
r2d2-diesel = "0.14.0"
46-
diesel_full_text_search = "0.14.0"
43+
diesel = { version = "0.15.0", features = ["postgres", "serde_json", "deprecated-time", "chrono"] }
44+
diesel_codegen = "0.15.0"
45+
r2d2-diesel = "0.15.0"
46+
diesel_full_text_search = "0.15.0"
4747
serde_json = "1.0.0"
4848
serde_derive = "1.0.0"
4949
serde = "1.0.0"
@@ -53,6 +53,7 @@ chrono = "0.4.0"
5353
conduit = "0.8"
5454
conduit-conditional-get = "0.8"
5555
conduit-cookie = "0.8"
56+
cookie = "0.9"
5657
conduit-json-parser = "0.8"
5758
conduit-log-requests = "0.8"
5859
conduit-middleware = "0.8"
@@ -67,7 +68,7 @@ bufstream = "0.1"
6768

6869
[build-dependencies]
6970
dotenv = "0.10"
70-
diesel = { version = "0.14", features = ["postgres"] }
71+
diesel = { version = "0.15.0", features = ["postgres"] }
7172

7273
[features]
7374
unstable = []

app.json

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,7 @@
5656
],
5757
"buildpacks": [
5858
{
59-
"url": "https://github.com/rcaught/heroku-buildpack-cmake.git#e4e2c9e"
59+
"url": "https://github.com/heroku/heroku-buildpack-multi"
6060
},
61-
{
62-
"url": "https://github.com/emk/heroku-buildpack-rust.git#578d630"
63-
},
64-
{
65-
"url": "https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/emberjs.tgz"
66-
},
67-
{
68-
"url": "https://github.com/ryandotsmith/nginx-buildpack.git#af813ba"
69-
},
70-
{
71-
"url": "https://github.com/sgrif/heroku-buildpack-diesel.git#f605edd"
72-
}
7361
]
7462
}

app/adapters/version.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

app/components/email-input.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import Component from '@ember/component';
2+
import { empty } from '@ember/object/computed';
3+
4+
export default Component.extend({
5+
type: '',
6+
value: '',
7+
isEditing: false,
8+
user: null,
9+
disableSave: empty('user.email'),
10+
notValidEmail: false,
11+
prevEmail: '',
12+
emailIsNull: true,
13+
14+
actions: {
15+
editEmail() {
16+
let email = this.get('value');
17+
let isEmailNull = function(email) {
18+
return (email == null);
19+
};
20+
21+
this.set('emailIsNull', isEmailNull(email));
22+
this.set('isEditing', true);
23+
this.set('prevEmail', this.get('value'));
24+
},
25+
26+
saveEmail() {
27+
let userEmail = this.get('value');
28+
let user = this.get('user');
29+
30+
let emailIsProperFormat = function(userEmail) {
31+
let regExp = /^\S+@\S+\.\S+$/;
32+
return regExp.test(userEmail);
33+
};
34+
35+
if (!emailIsProperFormat(userEmail)) {
36+
this.set('notValidEmail', true);
37+
return;
38+
}
39+
40+
user.set('email', userEmail);
41+
user.save()
42+
.then(() => this.set('serverError', null))
43+
.catch(err => {
44+
let msg;
45+
if (err.errors && err.errors[0] && err.errors[0].detail) {
46+
msg = `An error occurred while saving this email, ${err.errors[0].detail}`;
47+
} else {
48+
msg = 'An unknown error occurred while saving this email.';
49+
}
50+
this.set('serverError', msg);
51+
});
52+
53+
this.set('isEditing', false);
54+
this.set('notValidEmail', false);
55+
},
56+
57+
cancelEdit() {
58+
this.set('isEditing', false);
59+
this.set('value', this.get('prevEmail'));
60+
}
61+
}
62+
});

app/components/validated-input.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import Ember from 'ember';
2+
3+
const {
4+
computed,
5+
defineProperty
6+
} = Ember;
7+
8+
export default Ember.Component.extend({
9+
classNames: ['validated-input'],
10+
classNameBindings: ['showErrorClass:has-error', 'isValid:has-success'],
11+
model: null,
12+
value: null,
13+
type: 'text',
14+
valuePath: '',
15+
placeholder: '',
16+
validation: null,
17+
showValidations: false,
18+
didValidate: false,
19+
20+
notValidating: computed.not('validation.isValidating').readOnly(),
21+
hasContent: computed.notEmpty('value').readOnly(),
22+
hasWarnings: computed.notEmpty('validation.warnings').readOnly(),
23+
isValid: computed.and('hasContent', 'validation.isTruelyValid').readOnly(),
24+
shouldDisplayValidations: computed.or('showValidations', 'didValidate', 'hasContent').readOnly(),
25+
26+
showErrorClass: computed.and('notValidating', 'showErrorMessage', 'hasContent', 'validation').readOnly(),
27+
showErrorMessage: computed.and('shouldDisplayValidations', 'validation.isInvalid').readOnly(),
28+
29+
init() {
30+
this._super(...arguments);
31+
let valuePath = this.get('valuePath');
32+
33+
defineProperty(this, 'validation', computed.readOnly(`model.validations.attrs.${valuePath}`));
34+
defineProperty(this, 'value', computed.alias(`model.${valuePath}`));
35+
},
36+
37+
focusOut() {
38+
this._super(...arguments);
39+
this.set('showValidations', true);
40+
}
41+
});

app/controllers/category/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ export default Controller.extend(PaginationMixin, {
77
queryParams: ['page', 'per_page', 'sort'],
88
page: '1',
99
per_page: 10,
10-
sort: 'downloads',
10+
sort: 'recent-downloads',
1111

1212
totalItems: computed.readOnly('model.meta.total'),
1313

1414
categoryController: controller('category'),
1515
category: computed.alias('categoryController.model'),
1616

1717
currentSortBy: computed('sort', function() {
18-
return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical';
18+
if (this.get('sort') === 'downloads') {
19+
return 'All-Time Downloads';
20+
} else if (this.get('sort') === 'alpha') {
21+
return 'Alphabetical';
22+
} else {
23+
return 'Recent Downloads';
24+
}
1925
}),
2026
});

app/controllers/crate/version.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
33
import ArrayProxy from '@ember/array/proxy';
44
import { computed } from '@ember/object';
55
import { later } from '@ember/runloop';
6-
import $ from 'jquery';
76
import moment from 'moment';
87

98
const NUM_VERSIONS = 5;
@@ -163,16 +162,6 @@ export default Controller.extend({
163162
this.toggleClipboardProps(false);
164163
},
165164

166-
download(version) {
167-
this.set('isDownloading', true);
168-
169-
version.getDownloadUrl().then(url => {
170-
this.incrementProperty('crate.downloads');
171-
this.incrementProperty('currentVersion.downloads');
172-
$('#download-frame').attr('src', url);
173-
}).finally(() => this.set('isDownloading', false));
174-
},
175-
176165
toggleFollow() {
177166
this.set('fetchingFollowing', true);
178167

app/controllers/crates.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ export default Controller.extend(PaginationMixin, {
1414
totalItems: computed.readOnly('model.meta.total'),
1515

1616
currentSortBy: computed('sort', function() {
17-
return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical';
17+
if (this.get('sort') === 'downloads') {
18+
return 'All-Time Downloads';
19+
} else if (this.get('sort') === 'recent-downloads') {
20+
return 'Recent Downloads';
21+
} else {
22+
return 'Alphabetical';
23+
}
1824
}),
1925
});

app/controllers/keyword/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@ export default Controller.extend(PaginationMixin, {
77
queryParams: ['page', 'per_page', 'sort'],
88
page: '1',
99
per_page: 10,
10-
sort: 'alpha',
10+
sort: 'recent-downloads',
1111

1212
totalItems: computed.readOnly('model.meta.total'),
1313

1414
currentSortBy: computed('sort', function() {
15-
return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical';
15+
if (this.get('sort') === 'downloads') {
16+
return 'All-Time Downloads';
17+
} else if (this.get('sort') === 'alpha') {
18+
return 'Alphabetical';
19+
} else {
20+
return 'Recent Downloads';
21+
}
1622
}),
1723
});

app/controllers/search.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ export default Controller.extend(PaginationMixin, {
1313
totalItems: computed.readOnly('model.meta.total'),
1414

1515
currentSortBy: computed('sort', function() {
16-
return (this.get('sort') === 'downloads') ? 'Downloads' : 'Relevance';
16+
if (this.get('sort') === 'downloads') {
17+
return 'All-Time Downloads';
18+
} else if (this.get('sort') === 'recent-downloads') {
19+
return 'Recent Downloads';
20+
} else {
21+
return 'Relevance';
22+
}
1723
}),
1824

1925
hasItems: computed.bool('totalItems'),

app/controllers/team.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export default Controller.extend(PaginationMixin, {
1212
totalItems: computed.readOnly('model.crates.meta.total'),
1313

1414
currentSortBy: computed('sort', function() {
15-
return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical';
15+
if (this.get('sort') === 'downloads') {
16+
return 'All-Time Downloads';
17+
} else if (this.get('sort') === 'recent-downloads') {
18+
return 'Recent Downloads';
19+
} else {
20+
return 'Alphabetical';
21+
}
1622
}),
1723
});

app/controllers/user.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ export default Controller.extend(PaginationMixin, {
1313
totalItems: computed.readOnly('model.crates.meta.total'),
1414

1515
currentSortBy: computed('sort', function() {
16-
return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical';
16+
if (this.get('sort') === 'downloads') {
17+
return 'All-Time Downloads';
18+
} else if (this.get('sort') === 'recent-downloads') {
19+
return 'Recent Downloads';
20+
} else {
21+
return 'Alphabetical';
22+
}
1723
}),
1824
});

app/models/crate.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import DS from 'ember-data';
44
export default DS.Model.extend({
55
name: DS.attr('string'),
66
downloads: DS.attr('number'),
7+
recent_downloads: DS.attr('number'),
78
created_at: DS.attr('date'),
89
updated_at: DS.attr('date'),
910
max_version: DS.attr('string'),

app/models/version.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,4 @@ export default DS.Model.extend({
2020
crateName: computed('crate', function() {
2121
return this.belongsTo('crate').id();
2222
}),
23-
24-
getDownloadUrl() {
25-
return this.store.adapterFor('version').getDownloadUrl(this.get('dl_path'));
26-
},
2723
});

app/routes/team.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import RSVP from 'rsvp';
2-
import { inject as service } from '@ember/service';
31
import Route from '@ember/routing/route';
2+
import { inject as service } from '@ember/service';
3+
import RSVP from 'rsvp';
44

55
export default Route.extend({
66
flashMessages: service(),
77

88
queryParams: {
9-
page: { refreshedModel: true },
10-
sort: { refreshedModel: true },
9+
page: { refreshModel: true },
10+
sort: { refreshModel: true },
1111
},
1212
data: {},
1313

app/styles/crate.scss

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
padding-top: 5px;
120120
@include display-flex;
121121
@include flex-direction(column);
122-
width: 85%;
122+
width: 75%;
123123
}
124124

125125
.info a {
@@ -133,10 +133,18 @@
133133
}
134134

135135
.stats {
136-
width: 15%;
136+
width: 25%;
137137
color: $main-color-light;
138138
}
139-
.downloads { @include display-flex; @include align-items(center); }
139+
.downloads {
140+
@include display-flex;
141+
@include align-items(center);
142+
padding-bottom: 5px;
143+
}
144+
.recent-downloads {
145+
@include display-flex;
146+
@include align-items(center);
147+
}
140148

141149
.rev-dep-downloads {padding-left: 7px}
142150
}

0 commit comments

Comments
 (0)