diff --git a/ember/.bowerrc b/ember/.bowerrc index 6866ac2ca..959e1696e 100644 --- a/ember/.bowerrc +++ b/ember/.bowerrc @@ -1,3 +1,4 @@ { - "directory": "vendor" + "directory": "bower_components", + "analytics": false } diff --git a/ember/.editorconfig b/ember/.editorconfig new file mode 100644 index 000000000..5d5dea4cc --- /dev/null +++ b/ember/.editorconfig @@ -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 diff --git a/ember/.ember-cli b/ember/.ember-cli new file mode 100644 index 000000000..ee64cfed2 --- /dev/null +++ b/ember/.ember-cli @@ -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 +} diff --git a/ember/.gitignore b/ember/.gitignore index 38806e814..86fceae7a 100644 --- a/ember/.gitignore +++ b/ember/.gitignore @@ -6,8 +6,7 @@ # dependencies /node_modules -/vendor/* -!/vendor/json-api.js +/bower_components # misc /.sass-cache diff --git a/ember/.jshintrc b/ember/.jshintrc index 89765e858..08096effa 100644 --- a/ember/.jshintrc +++ b/ember/.jshintrc @@ -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, diff --git a/ember/.travis.yml b/ember/.travis.yml new file mode 100644 index 000000000..cf23938b7 --- /dev/null +++ b/ember/.travis.yml @@ -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 diff --git a/ember/Brocfile.js b/ember/Brocfile.js index 05add588c..9f03d0dd8 100644 --- a/ember/Brocfile.js +++ b/ember/Brocfile.js @@ -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(); diff --git a/ember/app/adapters/application.js b/ember/app/adapters/application.js index 66d8252dd..da2a2d7d4 100644 --- a/ember/app/adapters/application.js +++ b/ember/app/adapters/application.js @@ -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: [], - - ajax: function(url, type, hash) { - var adapter = this; - - return new Ember.RSVP.Promise(function(resolve, reject) { - hash = adapter.ajaxOptions(url, type, hash); - - 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); - }, + 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}); + }, }); + +// export default DS.JsonApiAdapter.extend({ +// host: '/api', + +// // xhr: [], + +// // ajax: function(url, type, hash) { +// // var adapter = this; + +// // return new Ember.RSVP.Promise(function(resolve, reject) { +// // hash = adapter.ajaxOptions(url, type, hash); + +// // 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); +// // }, +// }); diff --git a/ember/app/app.js b/ember/app/app.js index b58da3e50..601bc88f7 100644 --- a/ember/app/app.js +++ b/ember/app/app.js @@ -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 diff --git a/ember/app/helpers/abbreviate-number.js b/ember/app/helpers/abbreviate-number.js index 82e6c0d97..e48eaaaeb 100644 --- a/ember/app/helpers/abbreviate-number.js +++ b/ember/app/helpers/abbreviate-number.js @@ -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); }); diff --git a/ember/app/helpers/post-content.js b/ember/app/helpers/post-content.js deleted file mode 100644 index d9cabee8e..000000000 --- a/ember/app/helpers/post-content.js +++ /dev/null @@ -1,14 +0,0 @@ -import Ember from 'ember'; - -// This helper takes a post as its argument and renders a certain component -// corresponding to the post's type. The naming convention is 'post-type-[type]' -// (for example, post-type-comment for a comment.) Other arguments added to the -// helper are passed through to the component. - -export default Ember.Handlebars.makeBoundHelper(function(post, options) { - options.hash.post = post; - var component = 'post-type-'+post.get('type'); - var helper = Ember.Handlebars.resolveHelper(options.data.view.container, component); - - helper.call(this, options); -}); diff --git a/ember/app/index.html b/ember/app/index.html index af2b75a21..5bfcca9ec 100644 --- a/ember/app/index.html +++ b/ember/app/index.html @@ -7,20 +7,19 @@ - {{BASE_TAG}} + {{content-for 'head'}} + + {{content-for 'head-footer'}}
- + {{content-for 'body'}} + - + + {{content-for 'body-footer'}}