-
Notifications
You must be signed in to change notification settings - Fork 2
Front End Global
Iain J McCallum edited this page Mar 13, 2016
·
9 revisions
We are using $rootScope to hold information about the current state. This is what it looks like:
$rootScope {
user : {
meta : {
gravatar: 'string', //url
unPublished : [],
published : [],
trashed : []
}
},
currentDraft: { //this is also what a draft claim object looks like
description: 'string',
axiom: boolean, //yep - the hard bit
status: boolean, //the status of this current draft
meta: {
author: {user object},
created: date
},
supporting: [{ //an array of the supporting argument groups
status: boolean, //the status of this argument group
reasons: [{
reasonMeta: {
draft: boolean,
state: string //used to check over reasons before saving, so we know what needs to be done
'Default': there is nothing there - TODO, change to 'Empty'
'New': this reason needs to be saved as a new draft
'Claim': it's a link to a published claim, but the link isn't saved
'Draft': it's a link to an existing draft, but the link isn't saved
'Saved': All good! You may proceed with the BIG SAVE :D
'Deleted' : Need to implement this
},
claimObjectRefrence: {claim object}
}]
}],
opposing: //same as supporting
},
search: {
term: 'search term',
results: [],
draftResults: [],
order: 'the order',
selectedResult: {}
},
inFocus: { //the claim that's currently in focus
// claim object with populated reasons
},
theFocusLocation: { //don't use here - move this into currentDraft and/or inFocus
type : "side|group|reason|word",
side: "supporting|opposing",
group: "Index",
reason: "Index",
wordIndex: "Index",
word: "string"
},
alerts {
settings: {
enabled: true,
level: 'high',
duration: 5
},
list: []
}
}
$rootScope.user holds the user object...
$rootScope.focus holds whatever claim / draftClaim the user is looking at in detail or editing.
Claim Objects
draftClaimSchema: {
}
Controllers and services... (single flow?).
The bulk of the work happens in the services. The controllers mainly bind buttons to the correct function within the relevant service.