Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #11 from SlateFoundation/develop
Browse files Browse the repository at this point in the history
Release: slate-core-data v1.1.6
  • Loading branch information
themightychris authored Apr 3, 2019
2 parents 71bd1ae + 3316f29 commit 0f18c0b
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
78 changes: 78 additions & 0 deletions src/model/person/GlobalRecipient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
Ext.define('Slate.model.person.GlobalRecipient', {
extend: 'Ext.data.Model',
requires: [
'Slate.proxy.people.GlobalRecipients',
'Emergence.ext.proxy.Records',
'Ext.data.identifier.Negative',
'Ext.data.validator.Presence',
'Ext.data.validator.Bound'
],


// model config
idProperty: 'ID',
identifier: 'negative',

fields: [

// ActiveRecord fields
{
name: 'ID',
type: 'int',
allowNull: true
},
{
name: 'Class',
type: 'string',
defaultValue: 'Emergence\\CRM\\GlobalRecipient'
},
{
name: 'Created',
type: 'date',
dateFormat: 'timestamp',
allowNull: true,
persist: false
},
{
name: 'CreatorID',
type: 'int',
allowNull: true,
persist: false
},

// GlobalRecipient fields
{
name: 'PersonID',
type: 'int'
},
{
name: 'Title',
type: 'string'
},

// dynamic fields
{
name: 'Person',
persist: false,
sortType: function(v) {
return v ? v.LastName+v.FirstName : '_';
}
}
],

proxy: 'slate-globalrecipients',

validators: [
{
field: 'Title',
type: 'presence',
message: 'Title is required'
},
{
field: 'PersonID',
type: 'bound',
min: 1,
message: 'PersonID is required'
}
]
});
10 changes: 10 additions & 0 deletions src/proxy/people/GlobalRecipients.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Ext.define('Slate.proxy.people.GlobalRecipients', {
extend: 'Slate.proxy.Records',
alias: 'proxy.slate-globalrecipients',


config: {
url: '/global-recipients',
include: ['Person']
}
});
9 changes: 9 additions & 0 deletions src/store/people/GlobalRecipients.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Ext.define('Slate.store.people.GlobalRecipients', {
extend: 'Ext.data.Store',


model: 'Slate.model.person.GlobalRecipient',
config: {
pageSize: 0
}
});

0 comments on commit 0f18c0b

Please sign in to comment.