ember.js

Input type=“file” in Ember.js

守給你的承諾、 提交于 2019-12-22 17:51:06
问题 I wrote an Ember component that represents a styled input field that can handle file uploads. In order to achieve this I used a <div> and an <input> . The <input> has visibility: hidden and once the click event on the <div> is fired I fire the click event on the invisible <input> in the action handling of the Ember component. My problem is that after choosing files the action never reaches my Ember component. add-document-input.hbs <div {{action "add"}} class="floating-button"> <span>+</span>

Input type=“file” in Ember.js

久未见 提交于 2019-12-22 17:50:19
问题 I wrote an Ember component that represents a styled input field that can handle file uploads. In order to achieve this I used a <div> and an <input> . The <input> has visibility: hidden and once the click event on the <div> is fired I fire the click event on the invisible <input> in the action handling of the Ember component. My problem is that after choosing files the action never reaches my Ember component. add-document-input.hbs <div {{action "add"}} class="floating-button"> <span>+</span>

Action Cables, nested JSON attributes and JSONAPI

喜夏-厌秋 提交于 2019-12-22 15:54:31
问题 I have a fairly specific problem that I was hoping one of you really intelligent folk might know a solution for (or even a workaround at this stage) Specifically, I'm dealing with action cables, nested JSON, and the JSONAPI . I have an asset model, which has some attributes like name , desc etc. but it also has an attribute called state which is a complex nested JSON object. // app/models/asset.js export default DS.Model.extend({ // Attributes name: DS.attr('string'), desc: DS.attr('string'),

How to implement multiple filters with checkboxes in emberjs?

拜拜、爱过 提交于 2019-12-22 15:37:21
问题 How do I implement multiple filters with checkboxes in emberjs? I would like to filter a grid table with the items that have certain properties that are checked in the template checkboxes... For example, if I have this fixture: export default employees[ { name: 'Ricky', department: 'Finance', departmentIsChecked: false }, { name:'George', department:'Marketing' departmentIsChecked:false }, { name:'Jonah', department: 'Finance', departmentIsChecked:false } ]; how would I only display the

Ember store.push with hasMany doesn't update template?

佐手、 提交于 2019-12-22 14:18:56
问题 Assuming the following models : App.User = DS.Model.extend( email: DS.attr('string') session_users: DS.hasMany('sessionUser') ) App.SessionUser = DS.Model.extend( user: DS.belongsTo('user') state: DS.attr('string') session: DS.belongsTo('session') ) App.Session = DS.Model.extend( title: DS.attr('string') session_users: DS.hasMany('sessionUser') ) The route session_route.js.coffee : App.SessionRoute = Ember.Route.extend( model: (params) -> this.store.find('session', params.id) ) And the

Ember store.push with hasMany doesn't update template?

拥有回忆 提交于 2019-12-22 14:17:07
问题 Assuming the following models : App.User = DS.Model.extend( email: DS.attr('string') session_users: DS.hasMany('sessionUser') ) App.SessionUser = DS.Model.extend( user: DS.belongsTo('user') state: DS.attr('string') session: DS.belongsTo('session') ) App.Session = DS.Model.extend( title: DS.attr('string') session_users: DS.hasMany('sessionUser') ) The route session_route.js.coffee : App.SessionRoute = Ember.Route.extend( model: (params) -> this.store.find('session', params.id) ) And the

Ember Data: Why hasMany and belongsTo

柔情痞子 提交于 2019-12-22 13:53:18
问题 I'm wondering why I have to define hasMany and belongsTo in two related data sets? It seems redundant as all necessary information is in one of the arrays already and it is difficult to keep both synchronized. It also doesn't reflect the tables in an sql database where there is only one foreign key in one table in an one-to-many relationship. 回答1: Because relationships can go one or two ways. In your SQL example, a foreign key in one table only places a restraint on that table, NOT the table

Rendering ember component outside parent template

匆匆过客 提交于 2019-12-22 13:30:16
问题 Imagine the following situation. I have a sidebar positioned absolutely and then some more stuff positioned absolutely within that sidebar. In that sidebar I have a button, which shows a menu, the template looks like this: <button>Click me</button> {{#if shouldDisplayMenu}} {{view App.MyMenu}} {{/if}} What I like about this solution and want to keep is that the menu in the template is defined right next to the button, making for nice maintainability. The problem is that I want the menu to be

Binding child views and collections within an outlet in emberjs

和自甴很熟 提交于 2019-12-22 12:43:06
问题 I'm trying to render a view Team inside of an {{outlet}} . This Team view is comprised of a simple Person view (the team leader), and a collection of Person views (team members). The outlet is set up by calling connectOutlet() on the ApplicationController. Although the Person child views are rendered in the markup as expected, all the values of name are missing. It sure seems like my bindings and/or controller are not set up properly. What am I missing? Code and demo: http://jsfiddle.net

Files created inside docker are write protected on host

纵饮孤独 提交于 2019-12-22 12:39:15
问题 I am using docker container for rails and ember.I am mounting the source from my local to the container. All the changes I make here on local are reflected in the container. Now I want to use generators to create files. The files are created, but they are write protected on my machine. When I try to do docker-compose run frontend bash , I get a root@061e4159d4ef:/frontend# superuser prompt access inside of the container. I can create files when I am in this mode. These files are write