Skip to content

Commit

Permalink
Upgrade ember-cli to 0.1.4 and fix related breakage. closes #18
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyzerner committed Dec 23, 2014
1 parent 9365205 commit 238bb40
Show file tree
Hide file tree
Showing 28 changed files with 221 additions and 505 deletions.
3 changes: 2 additions & 1 deletion ember/.bowerrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"directory": "vendor"
"directory": "bower_components",
"analytics": false
}
33 changes: 33 additions & 0 deletions ember/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.hbs]
indent_style = space
indent_size = 2

[*.css]
indent_style = space
indent_size = 2

[*.html]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions ember/.ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}
3 changes: 1 addition & 2 deletions ember/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

# dependencies
/node_modules
/vendor/*
!/vendor/json-api.js
/bower_components

# misc
/.sass-cache
Expand Down
14 changes: 7 additions & 7 deletions ember/.jshintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"predef": {
"document": true,
"window": true,
"FlarumENV": true
},
"browser" : true,
"boss" : true,
"predef": [
"document",
"window",
"-Promise"
],
"browser": true,
"boss": true,
"curly": true,
"debug": false,
"devel": true,
Expand Down
20 changes: 20 additions & 0 deletions ember/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
language: node_js

sudo: false

cache:
directories:
- node_modules

before_install:
- "npm config set spin false"
- "npm install -g npm@^2"

install:
- npm install -g bower
- npm install
- bower install

script:
- npm test
19 changes: 9 additions & 10 deletions ember/Brocfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ var EmberApp = require('ember-cli/lib/broccoli/ember-app');

var app = new EmberApp();

app.import('vendor/bootstrap/dist/js/bootstrap.js');
app.import('vendor/spin.js/spin.js');
app.import('vendor/spin.js/jquery.spin.js');
app.import('vendor/moment/moment.js');
app.import('vendor/json-api.js');
app.import('bower_components/bootstrap/dist/js/bootstrap.js');
app.import('bower_components/spin.js/spin.js');
app.import('bower_components/spin.js/jquery.spin.js');
app.import('bower_components/moment/moment.js');

app.import('vendor/font-awesome/fonts/fontawesome-webfont.eot');
app.import('vendor/font-awesome/fonts/fontawesome-webfont.svg');
app.import('vendor/font-awesome/fonts/fontawesome-webfont.ttf');
app.import('vendor/font-awesome/fonts/fontawesome-webfont.woff');
app.import('vendor/font-awesome/fonts/FontAwesome.otf');
app.import('bower_components/font-awesome/fonts/fontawesome-webfont.eot');
app.import('bower_components/font-awesome/fonts/fontawesome-webfont.svg');
app.import('bower_components/font-awesome/fonts/fontawesome-webfont.ttf');
app.import('bower_components/font-awesome/fonts/fontawesome-webfont.woff');
app.import('bower_components/font-awesome/fonts/FontAwesome.otf');

module.exports = app.toTree();
49 changes: 30 additions & 19 deletions ember/app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
import Ember from 'ember';
import DS from 'ember-data';

export default DS.JsonApiAdapter.extend({
import JsonApiAdapter from 'ember-json-api/json-api-adapter';
export default JsonApiAdapter.extend({
host: '/api',

xhr: [],
findQuery: function(store, type, query) {
var ids = null;
if (query.ids) {
ids = query.ids.join(',');
delete query.ids;
}
return this.ajax(this.buildURL(type.typeKey, ids), 'GET', {data: query});
},
});

ajax: function(url, type, hash) {
var adapter = this;
// export default DS.JsonApiAdapter.extend({
// host: '/api',

return new Ember.RSVP.Promise(function(resolve, reject) {
hash = adapter.ajaxOptions(url, type, hash);
// // xhr: [],

hash.success = function(json) {
Ember.run(null, resolve, json);
};
// // ajax: function(url, type, hash) {
// // var adapter = this;

hash.error = function(jqXHR, textStatus, errorThrown) {
Ember.run(null, reject, adapter.ajaxError(jqXHR));
};
// // return new Ember.RSVP.Promise(function(resolve, reject) {
// // hash = adapter.ajaxOptions(url, type, hash);

adapter.xhr.push(Ember.$.ajax(hash));
}, "DS: RestAdapter#ajax " + type + " to " + url);
},
});
// // hash.success = function(json) {
// // Ember.run(null, resolve, json);
// // };

// // hash.error = function(jqXHR, textStatus, errorThrown) {
// // Ember.run(null, reject, adapter.ajaxError(jqXHR));
// // };

// // adapter.xhr.push(Ember.$.ajax(hash));
// // }, "DS: RestAdapter#ajax " + type + " to " + url);
// // },
// });
14 changes: 5 additions & 9 deletions ember/app/app.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';

Ember.MODEL_FACTORY_INJECTIONS = true;

var App = Ember.Application.extend({
modulePrefix: 'flarum', // TODO: loaded via config
Resolver: Resolver,

registerPlugin: function(plugin) {
console.log('Plugin loaded: '+plugin.name);
plugin.boot();
}
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver: Resolver
});

loadInitializers(App, 'flarum');

loadInitializers(App, config.modulePrefix);

//-----------------------------------------
// TODO: Move all this to an initializer
Expand Down
2 changes: 1 addition & 1 deletion ember/app/helpers/abbreviate-number.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from 'ember';

export default Ember.Handlebars.makeBoundHelper(function(number, options) {
return new Handlebars.SafeString(number);
return new Ember.Handlebars.SafeString(''+number);
});

14 changes: 0 additions & 14 deletions ember/app/helpers/post-content.js

This file was deleted.

15 changes: 7 additions & 8 deletions ember/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{BASE_TAG}}
{{content-for 'head'}}

<link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/flarum.css">

{{content-for 'head-footer'}}
</head>
<body>
<script>
window.FlarumENV = {{ENV}};
window.EmberENV = window.FlarumENV.EmberENV;
</script>
{{content-for 'body'}}

<script src="assets/vendor.js"></script>
<script src="assets/flarum.js"></script>
<script>
window.Flarum = require('flarum/app')['default'].create(FlarumENV.APP);
</script>

{{content-for 'body-footer'}}
</body>
</html>
8 changes: 4 additions & 4 deletions ember/app/router.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Ember from 'ember';
import config from './config/environment';

console.log(config.locationType);
var Router = Ember.Router.extend({
location: FlarumENV.locationType
location: config.locationType
});

Router.map(function() {

this.resource('categories', { path: '/categories' });
this.resource('categories', { path: '/categories' });

this.resource('discussions', { path: '/' }, function() {
this.resource('discussion', { path: '/:id/:slug' });
Expand All @@ -18,7 +19,6 @@ Router.map(function() {
this.route('discussions');
this.route('preferences');
});

});

export default Router;
22 changes: 10 additions & 12 deletions ember/app/serializers/application.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import Ember from 'ember';
import DS from 'ember-data';
import JsonApiSerializer from 'ember-json-api/json-api-serializer';
export default JsonApiSerializer.extend({
normalize: function(type, hash, property) {
var json = {};

export default DS.JsonApiSerializer.extend({
normalize: function(type, hash, property) {
var json = {};
for (var prop in hash) {
json[prop.camelize()] = hash[prop];
}

for (var prop in hash) {
json[prop.camelize()] = hash[prop];
}

return this._super(type, json, property);
}
});
return this._super(type, json, property);
}
});
2 changes: 1 addition & 1 deletion ember/app/templates/discussion-post.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
{{!-- #{{view.post.number}} (ID: {{view.post.id}}) --}}
{{/link-to}}

{{post-content view.post}}
{{dynamic-component type=view.contentComponent post=view.post}}
6 changes: 3 additions & 3 deletions ember/app/templates/discussions-result.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="controls btn-group">
{{!-- <div class="controls btn-group">
<button data-toggle="dropdown" class="dropdown-toggle btn btn-default btn-xs btn-icon">{{fa-icon "caret-down"}}</button>
{{menu-list items=view.controls class="dropdown-menu pull-right"}}
</div>
</div> --}}

<div class="discussion">

Expand Down Expand Up @@ -40,7 +40,7 @@
{{#link-to "user" discussion.lastUser}}{{user-avatar discussion.lastUser class="avatar-thumb"}}{{/link-to}}
{{#link-to "discussion" discussion.content (query-params start="last")}}{{abbreviate-time discussion.lastTime}}{{/link-to}}
{{/if}}
</span>
</span>

<span class="replies">{{abbreviate-number discussion.repliesCount}}</span>

Expand Down
4 changes: 4 additions & 0 deletions ember/app/views/discussion-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export default Ember.View.extend({

controls: null,

contentComponent: function() {
return 'post-type-'+this.get('post.type');
}.property('post.type'),

classNames: ['post'],
classNameBindings: ['post.deleted', 'post.edited'],

Expand Down
19 changes: 10 additions & 9 deletions ember/bower.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "flarum",
"dependencies": {
"handlebars": "~1.3.0",
"handlebars": "2.0.0",
"jquery": "^1.11.1",
"qunit": "~1.12.0",
"ember-qunit": "~0.1.8",
"ember": "~1.7.0",
"ember-resolver": "~0.1.5",
"loader": "stefanpenner/loader.js#1.0.0",
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.2",
"ember": "1.9.0",
"ember-data": "1.0.0-beta.12",
"ember-resolver": "~0.1.10",
"loader.js": "stefanpenner/loader.js#1.0.1",
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4",
"ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2",
"ember-qunit-notifications": "^0.0.3",
"ember-cli-test-loader": "rjackson/ember-cli-test-loader#0.0.2",
"ember-qunit": "0.1.8",
"ember-qunit-notifications": "0.0.4",
"qunit": "~1.15.0",
"bootstrap": "~3.2.0",
"font-awesome": "~4",
"spin.js": "~1.3.3",
Expand Down
Loading

0 comments on commit 238bb40

Please sign in to comment.