ember.js

Ember Simple Auth: Session lost on refresh

可紊 提交于 2019-12-18 15:31:03
问题 I'm using Ember Simple Auth Devise v 0.6.4 in an Ember-cli app. I can log in fine but when I refresh the page the session is lost. (Tested in Firefox and Chrome.) Right after logging in, inspecting the localStorage shows the session and after refreshing localStorage is empty. Here's what's in the local storage when I sign in: 回答1: The problem is that you have neither user_token nor user_email in the session which are required for the session to be authenticated. So as soon as you reload the

Ember.js: How to refresh parent route templates in a nested route scenario?

有些话、适合烂在心里 提交于 2019-12-18 14:55:48
问题 My page layout (application template) looks like this (simplified): I use it for different routes (offer list + offer detail, customer list + customer detail). Lists are shown in the sub-navigation outlet. My router's code: App.Router.map(function () { //... this.resource('offers', function () { this.resource('offer', { path: '/:offer_id' }); }); } My Routes: App.OffersRoute = Ember.Route.extend({ model: function () { return App.Offer.find(); }, renderTemplate: function (controller, model) {

ember-cli meta config/environment file

亡梦爱人 提交于 2019-12-18 14:52:08
问题 I'm using ember-cli to structure my app. It compiles all the files to the dist/ directory. However as I inspected the compiled index.html I noticed it was creating this meta tag. <meta name="user/config/environment" content="%7B%22modulePrefix%22%3A%22user%22%2C%22environment%22%3A%22development%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22%3A%22auto%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%20localhost%22%2C%22script-src%22%3A%22%27self%27%20%27unsafe-inline

How to cache query result in ember data

﹥>﹥吖頭↗ 提交于 2019-12-18 13:53:08
问题 I want to cache the result of a query in ember-data. ( findQuery ) To make it clear: I don't want to cache the entire models; just what models are the result of the query. Where is the right place for this? I was thinking about implementing this in the adapter and cache the result of the AJAX call, but I don't think this is a good solution since I don't wanna override the loaded and maybe newer and/or modified model data. I don't thinks its possible to just return a list of ID's, and to

Filter child-records (hasMany association) with Ember.js

别等时光非礼了梦想. 提交于 2019-12-18 13:49:08
问题 Is there any possibility to filter the hasMany records from a model record? I want to get the active projects, grouped by the customer. Customer model Docket.Customer = DS.Model.extend({ name: DS.attr('string'), initial: DS.attr('string'), description: DS.attr('string'), number: DS.attr('string'), archived: DS.attr('boolean'), projects: DS.hasMany('project',{ async: true }) }); Project model Docket.Project = DS.Model.extend({ name: DS.attr('string'), description: DS.attr('string'), number: DS

Filter child-records (hasMany association) with Ember.js

你离开我真会死。 提交于 2019-12-18 13:49:00
问题 Is there any possibility to filter the hasMany records from a model record? I want to get the active projects, grouped by the customer. Customer model Docket.Customer = DS.Model.extend({ name: DS.attr('string'), initial: DS.attr('string'), description: DS.attr('string'), number: DS.attr('string'), archived: DS.attr('boolean'), projects: DS.hasMany('project',{ async: true }) }); Project model Docket.Project = DS.Model.extend({ name: DS.attr('string'), description: DS.attr('string'), number: DS

Create Ember View from a jQuery object

∥☆過路亽.° 提交于 2019-12-18 13:37:57
问题 I'm looking into integrating Ember with an existing Rails application, to take advantage of Ember's bindings, events (didInsertElement, etc.) ... Now I don't want to transfer my erb views to handlebars, but instead I want to create Ember View objects and attach them to various elements already in the DOM. For example, I might have <html> <body> <div class="header"> </div> <div class="content"> </div> <div class="footer"> </div> </body> </html> and (on DOM ready) create a View for each element

Image address in ember templates grunt build

元气小坏坏 提交于 2019-12-18 13:35:55
问题 I used Yeoman to create a web app in EmberJS. Everything works ok, but after using the grunt build command, if I view the built app in the browser (from dist directory), I can see that some images are missing because the src path is wrong. Grunt is changing the names of all images in the "image" folder, but not updating the paths in my HTML. It updates the path only in css files; the images in the .hbs template files still have the old path (with the old image name)... Anyone know how to fix

Ember CLI: where to reopen framework classes

扶醉桌前 提交于 2019-12-18 12:48:03
问题 I'd like to reopen Ember or Ember Data framework classes. Using Ember CLI, where is the right place to put these so that they get initialized property? Here's an example of something I'd like to do: import DS from 'ember-data'; DS.Model.reopen({ rollback: function() { this._super(); // do some additional stuff } }); 回答1: I think the best way to execute modules that have side effects would be to create an initializer. Something like this: // app/initializers/modify-model.js import DS from

Ember.js Router Action to Controller

安稳与你 提交于 2019-12-18 12:37:41
问题 When I use the Ember Router, how can I define actions in the template who are connected to the controller? An Example is here: http://jsfiddle.net/KvJ38/3/ Unter My Profile are two actions: One is defined on the State, and is working Two is defined on the Controller. How can i make this working or should I use another approach? App.Router = Em.Router.extend({ enableLogging: true, location: 'hash', root: Em.State.extend({ // EVENTS goHome: Ember.State.transitionTo('home'), viewProfile: Ember