cleanup, refactoring some view and model names, some minor fixes

This commit is contained in:
Jason White
2015-08-20 20:41:21 -04:00
parent 6307f102f0
commit 0e474d9de8
22 changed files with 37 additions and 21908 deletions

View File

@ -1,12 +1,12 @@
define(['jquery',
'underscore',
'libs/backbone',
'goatApp/model/LessonContentData',
'goatApp/model/LessonContentModel',
'goatApp/view/LessonContentView',
'goatApp/view/PlanView',
'goatApp/view/SourceView',
'goatApp/view/SolutionView',
'goatApp/view/LessonHintView',
'goatApp/view/HintView',
'goatApp/view/HelpControlsView',
'goatApp/view/CookieView',
'goatApp/view/ParamView',
@ -16,12 +16,12 @@ define(['jquery',
function($,
_,
Backbone,
LessonContentData,
LessonContentModel,
LessonContentView,
PlanView,
SourceView,
SolutionView,
LessonHintView,
HintView,
HelpControlsView,
CookieView,
ParamView,
@ -32,17 +32,12 @@ define(['jquery',
var Controller = function(options) {
this.lessonContent = new LessonContentData();
this.lessonContent = new LessonContentModel();
this.lessonView = options.lessonView;
/*this.planView = new PlanView();
this.solutionView = new SolutionView();
this.sourceView = new SourceView();
*/
_.extend(Controller.prototype,Backbone.Events);
this.start = function() {
this.listenToOnce(this.lessonContent,'contentLoaded',this.onContentLoaded);
this.listenTo(this.lessonContent,'contentLoaded',this.onContentLoaded);
};
//load View, which can pull data
@ -77,7 +72,7 @@ define(['jquery',
this.sourceView = new SourceView();
this.listenToOnce(this.sourceView,'source:loaded',this.areHelpsReady);
//load help controls view (contextul to what helps are available)
this.lessonHintView = new LessonHintView();
this.lessonHintView = new HintView();
this.listenToOnce(this.lessonHintView,'hints:loaded',this.areHelpsReady);
//
this.cookieView = new CookieView();
@ -86,7 +81,7 @@ define(['jquery',
var paramModel = new ParamModel({
});
paramModel.set('screenParam',this.lessonContent.get('screenParam'));
paramModel.set('menuParam',this.lessonContent.get('screenParam'));
paramModel.set('menuParam',this.lessonContent.get('menuParam'));
this.paramView = new ParamView({model:paramModel});
this.hideShowHelps(null);
};

View File

@ -1,13 +1,13 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/model/LessonCookieModel'],
'goatApp/model/CookieModel'],
function($,
_,
Backbone,
LessonCookieModel) {
CookieModel) {
return Backbone.Collection.extend({
url:'service/cookie.mvc',
model:LessonCookieModel
model:CookieModel
});
});

View File

@ -1,14 +1,14 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/model/LessonHintModel'],
'goatApp/model/HintModel'],
function($,
_,
Backbone,
LessonHintModel) {
HintModel) {
return Backbone.Collection.extend({
model: LessonHintModel,
model: HintModel,
url:'service/hint.mvc',
initialize: function () {
var self = this;

View File

@ -16,7 +16,7 @@ define(['jquery',
initialize: function (options) {
this.screenParam = null;
this.menuParam = null;
this.baseUrlRoot = 'attack?Screen=';//
this.baseUrlRoot = 'attack?Screen=';
},
loadData: function(options) {
this.urlRoot = this.baseUrlRoot +options.screen + '&menu=' + options.menu;

View File

@ -1,15 +1,15 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/model/LessonSourceModel'],
'goatApp/model/SourceModel'],
function($,
_,
Backbone,
LessonSourceModel) {
SourceModel) {
return Backbone.View.extend({
el:'#lessonHelpWrapper .lessonHelp.lessonPlan', //Check this
initialize: function() {
this.model = new LessonSourceModel();
this.model = new SourceModel();
this.listenTo(this.model,'loaded',this.onModelLoaded);
this.model.loadData();
},

View File

@ -1,11 +1,11 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/model/LessonHintCollection'],
'goatApp/model/HintCollection'],
function($,
_,
Backbone,
LessonHintCollection) {
HintCollection) {
return Backbone.View.extend({
el:'#lesson-hint-container',
events: {
@ -14,7 +14,7 @@ function($,
},
initialize: function() {
this.curHint=0;
this.collection = new LessonHintCollection();
this.collection = new HintCollection();
this.listenTo(this.collection,'loaded',this.onModelLoaded);
},

View File

@ -3,8 +3,13 @@ define(['jquery',
'underscore',
'backbone',
'libs/jquery.form',
'goatApp/model/LessonContentData'],
function($,_,Backbone,JQueryForm,LessonData) {
'goatApp/model/LessonContent'],
function(
$,
_,
Backbone,
JQueryForm,
LessonContent) {
return Backbone.View.extend({
el:'#lesson-content-wrapper', //TODO << get this fixed up in DOM
initialize: function(options) {

View File

@ -62,6 +62,7 @@ define(['jquery',
for (k=0; k < stages.length; k++) {
var stageName = stages[k].name;
var stageLink = $('<a>',{href:stages[k].link,text:stageName,id:GoatUtils.makeId(stageName)});
var stageSpan = $('<span>');
stageSpan.append(stageLink);
categoryLessonList.append(stageSpan);
if (stages[j].complete) {

View File

@ -1,11 +1,11 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/model/ParamsModel'],
'goatApp/model/ParamModel'],
function($,
_,
Backbone,
LessonCookieCollection) {
ParamModel) {
return Backbone.View.extend({
el:'#params-view',

View File

@ -1,13 +1,13 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/model/LessonSolutionModel'],
'goatApp/model/SolutionModel'],
//TODO: create a base 'HelpView class'
function($,_,Backbone,LessonSolutionModel) {
function($,_,Backbone,SolutionModel) {
return Backbone.View.extend({
el:'#lessonHelpWrapper .lessonHelp.lessonSolution', //Check this
initialize: function() {
this.model = new LessonSolutionModel();
this.model = new SolutionModel();
this.listenTo(this.model,'loaded',this.onModelLoaded);
this.model.loadData();
//TODO: handle error cases

View File

@ -1,19 +1,19 @@
define(['jquery',
'underscore',
'backbone',
'goatApp/model/LessonSourceModel',
'goatApp/model/SourceModel',
'goatApp/view/HelpView'],
function($,
_,
Backbone,
LessonSourceModel,
SourceModel,
HelpView) {
return HelpView.extend({
helpElement:{'helpElement':'source','value':true},
loadedMessage:'source:loaded',
el:'#lessonHelpWrapper .lessonHelp.lessonPlan', //Check this
initialize: function() {
this.model = new LessonSourceModel();
this.model = new SourceModel();
this.listenTo(this.model,'loaded',this.onModelLoaded);
this.model.loadData();
}