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 #5 from SlateFoundation/develop
Browse files Browse the repository at this point in the history
Release: slate-core-data v1.1.0
  • Loading branch information
themightychris authored Dec 19, 2017
2 parents c420fa8 + d76b52f commit a3472e9
Show file tree
Hide file tree
Showing 16 changed files with 344 additions and 52 deletions.
7 changes: 2 additions & 5 deletions src/model/Term.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Ext.define('Slate.model.Term', {
extend: 'Ext.data.Model',
requires: [
'Slate.proxy.Records',
'Slate.proxy.Terms',
'Ext.data.identifier.Negative'
],

Expand Down Expand Up @@ -76,8 +76,5 @@ Ext.define('Slate.model.Term', {
}
],

proxy: {
type: 'slate-records',
url: '/terms'
}
proxy: 'slate-terms'
});
13 changes: 6 additions & 7 deletions src/model/CourseSection.js → src/model/course/Section.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Ext.define('Slate.model.CourseSection', {
Ext.define('Slate.model.course.Section', {
extend: 'Ext.data.Model',
alternateClassName: [
'Slate.model.CourseSection'
],
requires: [
'Slate.proxy.Records',
'Slate.proxy.courses.Sections',
'Ext.data.identifier.Negative'
],

Expand Down Expand Up @@ -76,9 +79,5 @@ Ext.define('Slate.model.CourseSection', {
}
],

proxy: {
type: 'slate-records',
url: '/sections',
include: ['Term']
}
proxy: 'slate-courses-sections'
});
80 changes: 80 additions & 0 deletions src/model/course/SectionParticipant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Ext.define('Slate.model.course.SectionParticipant', {
extend: 'Ext.data.Model',
requires: [
'Slate.proxy.courses.SectionParticipants',
'Ext.data.identifier.Negative'
],


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

fields: [
{
name: 'ID',
type: 'int',
allowNull: true
},
{
name: 'Class',
type: 'string',
defaultValue: 'Slate\\Courses\\SectionParticipant'
},
{
name: 'Created',
type: 'date',
dateFormat: 'timestamp',
allowNull: true
},
{
name: 'CreatorID',
type: 'int',
allowNull: true
},
{
name: 'CourseSectionID',
type: 'int'
},
{
name: 'PersonID',
type: 'int'
},
{
name: 'Person'
},
{
name: 'Role',
type: 'string'
},
{
name: 'StartDate',
type: 'date',
dateFormat: 'timestamp',
allowNull: true
},
{
name: 'EndDate',
type: 'date',
dateFormat: 'timestamp',
allowNull: true
},
{
name: 'Cohort',
type: 'string',
allowNull: true
},

// virtual fields
{
name: 'PersonFirstName',
mapping: 'Person.FirstName'
},
{
name: 'PersonLastName',
mapping: 'Person.LastName'
}
],

proxy: 'slate-courses-participants'
});
11 changes: 3 additions & 8 deletions src/model/person/Person.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Ext.define('Slate.model.person.Person', {
extend: 'Ext.data.Model',
requires: [
'Slate.proxy.Records',
'Slate.proxy.people.People',
'Ext.data.identifier.Negative',
'Ext.data.validator.Presence'
],
Expand Down Expand Up @@ -216,13 +216,7 @@ Ext.define('Slate.model.person.Person', {
LastName: 'presence'
},

proxy: {
type: 'slaterecords',
url: '/people',
startParam: false,
limitParam: false,
include: ['groupIDs', 'Advisor', 'PrimaryEmail']
},
proxy: 'slate-people',


// model methods
Expand Down Expand Up @@ -256,6 +250,7 @@ Ext.define('Slate.model.person.Person', {
return url ? '<a href="#'+url+'">'+displayName+'</a>' : displayName;
},

// TODO: move this to a SlateAdmin override
toUrl: function() {
var me = this;

Expand Down
9 changes: 2 additions & 7 deletions src/model/progress/SectionInterimReport.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Ext.define('Slate.model.progress.SectionInterimReport', {
extend: 'Ext.data.Model',
requires: [
'Slate.proxy.Records',
'Slate.proxy.progress.SectionInterimReports',
'Ext.data.identifier.Negative'
],

Expand Down Expand Up @@ -104,10 +104,5 @@ Ext.define('Slate.model.progress.SectionInterimReport', {
}
],

proxy: {
type: 'slate-records',
url: '/progress/section-interim-reports',
limitParam: null,
startParam: null
}
proxy: 'slate-progress-reports-section-interim'
});
9 changes: 2 additions & 7 deletions src/model/progress/SectionTermReport.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Ext.define('Slate.model.progress.SectionTermReport', {
extend: 'Ext.data.Model',
requires: [
'Slate.proxy.Records',
'Slate.proxy.progress.SectionTermReports',
'Ext.data.identifier.Negative'
],

Expand Down Expand Up @@ -104,10 +104,5 @@ Ext.define('Slate.model.progress.SectionTermReport', {
}
],

proxy: {
type: 'slate-records',
url: '/progress/section-term-reports',
limitParam: null,
startParam: null
}
proxy: 'slate-progress-reports-section-term'
});
9 changes: 9 additions & 0 deletions src/proxy/Terms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Ext.define('Slate.proxy.Terms', {
extend: 'Slate.proxy.Records',
alias: 'proxy.slate-terms',


config: {
url: '/terms'
}
});
10 changes: 10 additions & 0 deletions src/proxy/courses/SectionParticipants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Ext.define('Slate.proxy.courses.SectionParticipants', {
extend: 'Slate.proxy.Records',
alias: 'proxy.slate-courses-participants',


config: {
url: '/section-participants',
include: ['Person']
}
});
10 changes: 10 additions & 0 deletions src/proxy/courses/Sections.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Ext.define('Slate.proxy.courses.Sections', {
extend: 'Slate.proxy.Records',
alias: 'proxy.slate-courses-sections',


config: {
url: '/sections',
include: ['Term']
}
});
10 changes: 10 additions & 0 deletions src/proxy/people/People.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Ext.define('Slate.proxy.people.People', {
extend: 'Slate.proxy.Records',
alias: 'proxy.slate-people',


config: {
url: '/people',
include: ['groupIDs', 'Advisor', 'PrimaryEmail']
}
});
9 changes: 9 additions & 0 deletions src/proxy/progress/SectionInterimReports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Ext.define('Slate.proxy.progress.SectionInterimReports', {
extend: 'Slate.proxy.Records',
alias: 'proxy.slate-progress-reports-section-interim',


config: {
url: '/progress/section-interim-reports'
}
});
9 changes: 9 additions & 0 deletions src/proxy/progress/SectionTermReports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Ext.define('Slate.proxy.progress.SectionTermReports', {
extend: 'Slate.proxy.Records',
alias: 'proxy.slate-progress-reports-section-term',


config: {
url: '/progress/section-term-reports'
}
});
18 changes: 0 additions & 18 deletions src/store/CourseSections.js

This file was deleted.

62 changes: 62 additions & 0 deletions src/store/courses/SectionCohorts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Ext.define('Slate.store.courses.SectionCohorts', {
extend: 'Ext.data.Store',
requires: [
'Slate.proxy.Records'
],


config: {
section: null,

pageSize: 0,
remoteSort: false,

fields: [
'Cohort'
],

sorters: [
{
property: 'Cohort',
direction: 'ASC'
}
],

proxy: {
type: 'slate-records',
reader: {
type: 'json',
transform: function(response) {
return Ext.Array.map(response.data, function(cohort) {
return {
'Cohort': cohort
}
});
}
}
}
},


// config handlers
updateSection: function(sectionCode) {
this.getProxy().setUrl('/sections/'+sectionCode+'/cohorts');
this.dirty = true;
},


// member methods
loadIfDirty: function() {
if (!this.dirty || this.getSection() === null) {
return;
}

this.dirty = false;
this.load();
},

unload: function() {
this.loadCount = 0;
this.removeAll();
}
});
Loading

0 comments on commit a3472e9

Please sign in to comment.