Skip to content

Commit 7374243

Browse files
committed
Merge pull request #208 from Turbo87/ember-update
Update Ember.js
2 parents 01ada53 + 7cbe2cf commit 7374243

File tree

103 files changed

+824
-835
lines changed

Some content is hidden

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

103 files changed

+824
-835
lines changed

.editorconfig

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,24 @@ charset = utf-8
1111
trim_trailing_whitespace = true
1212
insert_final_newline = true
1313
indent_style = space
14-
indent_size = 2
14+
indent_size = 4
1515

1616
[*.js]
1717
indent_style = space
18-
indent_size = 2
18+
indent_size = 4
1919

2020
[*.hbs]
21+
insert_final_newline = false
2122
indent_style = space
22-
indent_size = 2
23+
indent_size = 4
2324

2425
[*.css]
2526
indent_style = space
26-
indent_size = 2
27+
indent_size = 4
2728

2829
[*.html]
2930
indent_style = space
30-
indent_size = 2
31+
indent_size = 4
3132

32-
[*.md]
33+
[*.{diff,md}]
3334
trim_trailing_whitespace = false

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# dependencies
99
/node_modules
10-
/bower_components/*
10+
/bower_components
1111

1212
# misc
1313
/.sass-cache

.jshintrc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
{
2-
"predef": {
3-
"document": true,
4-
"window": true,
5-
"-Promise": true,
6-
"moment": true,
7-
"google": true
8-
},
9-
"browser" : true,
10-
"boss" : true,
2+
"predef": [
3+
"document",
4+
"window",
5+
"-Promise"
6+
],
7+
"browser": true,
8+
"boss": true,
119
"curly": true,
1210
"debug": false,
1311
"devel": true,

.travis.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,29 @@ language: rust
22
rust: nightly
33
sudo: false
44

5-
before_script:
5+
cache:
6+
directories:
7+
- node_modules
8+
9+
before_install:
10+
- nvm install 0.12
11+
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
12+
- "npm config set spin false"
13+
- "npm install -g npm@^2"
14+
15+
install:
616
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
7-
- psql -c 'create database cargo_registry_test;' -U postgres
8-
- npm install -g phantomjs ember-cli
17+
- npm install -g bower
918
- npm install
19+
- bower install
20+
21+
before_script:
22+
- psql -c 'create database cargo_registry_test;' -U postgres
1023

1124
script:
1225
- cargo build
1326
- cargo test
14-
- ember test
27+
- npm test
1528

1629
after_success:
1730
- travis-cargo coveralls --no-sudo

.watchmanconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignore_dirs": ["tmp"]
3+
}

Brocfile.js

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ which enables tweaking the UI of the site without actually having the server
1717
running locally. To get up and running with just the UI, run:
1818

1919
```
20-
npm run startui
20+
npm run start:ui
2121
```
2222

2323
This will give you a local server to browse while using the staging backend

app/adapters/dependency.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import ApplicationAdapter from './application';
22

33
export default ApplicationAdapter.extend({
4-
findQuery: function(store, type, query) {
4+
query(store, type, query) {
55
if (!query.reverse) {
6-
return this._super(store, type, query);
6+
return this._super(...arguments);
77
}
88
delete query.reverse;
99
var crate = query.crate;

app/app.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ import Resolver from 'ember/resolver';
33
import loadInitializers from 'ember/load-initializers';
44
import config from './config/environment';
55

6+
var App;
7+
68
Ember.MODEL_FACTORY_INJECTIONS = true;
79

8-
var App = Ember.Application.extend({
10+
App = Ember.Application.extend({
911
modulePrefix: config.modulePrefix,
1012
podModulePrefix: config.podModulePrefix,
1113
Resolver: Resolver
1214
});
1315

1416
loadInitializers(App, config.modulePrefix);
15-
Ember.$.ajaxSetup({cache: false});
17+
Ember.$.ajaxSetup({
18+
cache: false
19+
});
1620

1721
export default App;

app/components/crate-row.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Ember from 'ember';
2+
3+
export default Ember.Component.extend({
4+
classNames: ['crate', 'row']
5+
});

app/components/user-avatar.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import Ember from 'ember';
22

3+
const { computed } = Ember;
4+
35
export default Ember.Component.extend({
46
size: 'small',
57
user: null,
68
attributeBindings: ['src', 'width', 'height'],
79
tagName: 'img',
810

9-
width: function() {
11+
width: computed('size', function() {
1012
if (this.get('size') === 'small') {
1113
return 22;
1214
} else if (this.get('size') === 'medium-small') {
1315
return 32;
1416
} else {
1517
return 85; // medium
1618
}
17-
}.property('size'),
19+
}),
1820

19-
height: function() {
20-
return this.get('width');
21-
}.property('width'),
21+
height: computed.readOnly('width'),
2222

23-
src: function() {
23+
src: computed('size', 'user', function() {
2424
return this.get('user.avatar') + '&s=' + this.get('width');
25-
}.property('size', 'user'),
25+
})
2626
});

app/components/user-link.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import Ember from 'ember';
22

3+
const { computed } = Ember;
4+
35
export default Ember.Component.extend({
46
user: null,
57
attributeBindings: ['title', 'href'],
68
tagName: 'a',
79

8-
title: function() {
9-
return this.get('user.login');
10-
}.property('user'),
11-
12-
'href': function() {
10+
title: computed.readOnly('user.login'),
11+
href: computed('user', function() {
1312
// TODO replace this with a link to a native crates.io profile
1413
// page when they exist.
1514
return this.get('user.url');
16-
}.property('user'),
15+
})
1716
});

app/controllers/application.js

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,60 @@
11
import Ember from 'ember';
22

3+
const { observer } = Ember;
4+
35
export default Ember.Controller.extend({
4-
needs: ['search'],
6+
searchController: Ember.inject.controller('search'),
57

68
flashError: null,
79
nextFlashError: null,
810
showUserOptions: false,
9-
search: Ember.computed.oneWay('controllers.search.q'),
11+
search: Ember.computed.oneWay('searchController.q'),
1012

11-
stepFlash: function() {
13+
stepFlash() {
1214
this.set('flashError', this.get('nextFlashError'));
1315
this.set('nextFlashError', null);
1416
},
1517

16-
aboutToTransition: function() {
18+
aboutToTransition() {
1719
Ember.$(document).trigger('mousedown');
1820
},
1921

20-
resetDropdownOption: function(controller, option) {
22+
// don't use this from other controllers..
23+
resetDropdownOption(controller, option) {
2124
controller.set(option, !controller.get(option));
2225
if (controller.get(option)) {
23-
Ember.$(document).on('mousedown.useroptions', function(e) {
26+
Ember.$(document).on('mousedown.useroptions', (e) => {
2427
if (Ember.$(e.target).prop('tagName') === 'INPUT') {
2528
return;
2629
}
27-
Ember.run.later(function() {
30+
Ember.run.later(() => {
2831
controller.set(option, false);
2932
}, 150);
3033
Ember.$(document).off('mousedown.useroptions');
3134
});
3235
}
3336
},
3437

35-
currentPathChanged: function () {
38+
_scrollToTop() {
3639
window.scrollTo(0, 0);
37-
}.observes('currentPath'),
40+
},
41+
42+
// TODO: remove observer & DOM mutation in controller..
43+
currentPathChanged: observer('currentPath', function () {
44+
Ember.run.scheduleOnce('afterRender', this, this._scrollToTop);
45+
}),
3846

3947
actions: {
40-
search: function(query) {
48+
search(q) {
4149
this.transitionToRoute('search', {
42-
queryParams: {q: query, page: 1}
50+
queryParams: {
51+
q,
52+
page: 1
53+
}
4354
});
4455
},
4556

46-
toggleUserOptions: function() {
57+
toggleUserOptions() {
4758
this.resetDropdownOption(this, 'showUserOptions');
4859
},
4960
},

app/controllers/catch-all.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Ember from 'ember';
22

33
export default Ember.Controller.extend({
44
actions: {
5-
search: function(query) {
5+
search(query) {
66
return this.transitionToRoute('search', {queryParams: {q: query}});
77
},
88
},

0 commit comments

Comments
 (0)