File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import DS from 'ember-data' ;
2+ import WildemberAdapter from 'wild-ember/adapters/wildember' ;
3+
4+ export default WildemberAdapter . extend ( {
5+ wilddogConfig : {
6+ syncDomain : "ddlisting.wilddog.com" ,
7+ syncURL : "https://ddlisting.wilddogio.com" //输入节点 URL
8+ }
9+ } ) ;
Original file line number Diff line number Diff line change 1+ // app/models/note.js
2+ import DS from 'ember-data' ;
3+
4+ export default DS . Model . extend ( {
5+ title : DS . attr ( 'string' ) ,
6+ content : DS . attr ( 'string' ) ,
7+ createDate : DS . attr ( 'date' ) ,
8+ status : DS . attr ( 'number' ) , //1-正常;0-删除
9+ userId : DS . attr ( 'string' ) , //冗余一个字段,可能方便查询
10+ note : DS . belongsTo ( 'notebook' ) //笔记
11+ } ) ;
Original file line number Diff line number Diff line change 1+ import DS from 'ember-data' ;
2+
3+ export default DS . Model . extend ( {
4+ title : DS . attr ( 'string' ) ,
5+ createDate : DS . attr ( 'date' ) ,
6+ status : DS . attr ( 'number' ) , //1-正常;0-删除
7+ userId : DS . attr ( 'string' ) , //冗余一个字段,可能方便查询
8+ user : DS . belongsTo ( 'user' ) , //用户
9+ notes : DS . hasMany ( 'notebook' ) //笔记
10+ } ) ;
Original file line number Diff line number Diff line change 1+ // * 用户模型类 app/models/user.js
2+ import Model from 'ember-data/model' ;
3+ import DS from 'ember-data' ;
4+
5+ export default Model . extend ( {
6+ // userId: DS.attr('string'), //不需要,直接使用id即可
7+ nickname : DS . attr ( 'string' ) ,
8+ email : DS . attr ( 'string' ) ,
9+ password : DS . attr ( 'string' ) ,
10+ createDate : DS . attr ( 'number' ) ,
11+ status : DS . attr ( 'number' ) , //1-正常;0-删除
12+ userProfile : DS . attr ( 'string' ) , //用户头像
13+ notebooks : DS . hasMany ( 'notebook' ) //笔记本
14+ } ) ;
Original file line number Diff line number Diff line change 1+ import Ember from 'ember' ;
2+
3+ export default Ember . Route . extend ( {
4+ model ( ) {
5+ return this . get ( 'store' ) . findAll ( 'user' ) ;
6+ }
7+ } ) ;
Original file line number Diff line number Diff line change 1+
2+ <table >
3+ <thead >
4+ <tr >
5+ <td >
6+ 密码
7+ </td >
8+ </tr >
9+ </thead >
10+
11+ <tbody >
12+ {{ #each model as |u |}}
13+ <tr >
14+ <td >
15+ {{ u.password }}
16+ </td >
17+ </tr >
18+ {{ /each }}
19+ </tbody >
20+ </table >
21+
22+ {{ outlet }}
Original file line number Diff line number Diff line change 1+ /* jshint expr:true */
2+ import { expect } from 'chai' ;
3+ import {
4+ describeModule ,
5+ it
6+ } from 'ember-mocha' ;
7+
8+ describeModule (
9+ 'service:wildember' ,
10+ 'WildemberService' ,
11+ {
12+ // Specify the other units that are required for this test.
13+ // needs: ['service:foo']
14+ } ,
15+ function ( ) {
16+ // Replace this with your real tests.
17+ it ( 'exists' , function ( ) {
18+ let service = this . subject ( ) ;
19+ expect ( service ) . to . be . ok ;
20+ } ) ;
21+ }
22+ ) ;
You can’t perform that action at this time.
0 commit comments