Skip to content

Commit

Permalink
[RazortoothRTC#39] Better list for 'use prepared questions' step
Browse files Browse the repository at this point in the history
  • Loading branch information
chrqls committed Apr 21, 2014
1 parent 60ff228 commit 314ebec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
24 changes: 13 additions & 11 deletions static/js/smileteacher.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ var SMILEROUTES = {
"createsession": "/smile/createsession"
};

var IQSet = function(title,teacherName,groupName,date) {
var self = this;
self.sessionName = title;
self.teacherName = teacherName;
self.groupName = groupName;
self.date = date;
var IQSet = function(id,title,teacherName,groupName,date) {
//var self = this;
this.id = id;
this.sessionName = title;
this.teacherName = teacherName;
this.groupName = groupName;
this.date = date;
}

//
Expand Down Expand Up @@ -83,11 +84,11 @@ var GlobalViewModel = {

GlobalViewModel.createSession = function() {

var self = this;
//var self = this;

if (!self.teacher_name() || self.teacher_name() === "") { self.teacher_name('Default Teacher'); }
if (!self.session_name() || self.session_name() === "") { self.session_name('Default Session'); }
if (!self.group_name() || self.group_name() === "") { self.group_name('Default Group'); }
if (!this.teacher_name() || this.teacher_name() === "") { this.teacher_name('Default Teacher'); }
if (!this.session_name() || this.session_name() === "") { this.session_name('Default Session'); }
if (!this.group_name() || this.group_name() === "") { this.group_name('Default Group'); }

$.ajax({
cache: false,
Expand All @@ -100,7 +101,7 @@ GlobalViewModel.createSession = function() {
smileAlert('#globalstatus', 'Unable to post session values. Reason: ' + xhr.status + ':' + xhr.responseText + '. Please verify your connection or server status.', 'trace');
},
success: function(data) {
smileAlert('#globalstatus', 'Success ('+self.teacher_name()+','+self.session_name()+','+self.group_name()+')', 'green', 5000);
smileAlert('#globalstatus', 'Success ('+GlobalViewModel.teacher_name()+','+GlobalViewModel.session_name()+','+GlobalViewModel.group_name()+')', 'green', 5000);
switchSection('div[data-slug=choose-activity-flow]');
}
});
Expand Down Expand Up @@ -146,6 +147,7 @@ GlobalViewModel.usePreparedQuestions = function() {

GlobalViewModel.iqsets.push(
new IQSet(
i,
iqsets[i].value[0],
iqsets[i].value[1],
iqsets[i].value[2],
Expand Down
5 changes: 4 additions & 1 deletion static/smile-teacher.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,11 @@ <h3>

<div data-bind="foreach: iqsets" >
<div>
<input type="radio" name="optionsGroup" data-bind="attr: {value: sessionName}, checked: $root.iqsetToLoad" />
<input type="radio" name="optionsGroup" data-bind="attr: {value: id}, checked: $root.iqsetToLoad" />
<span data-bind="text: sessionName"></span>
(<span data-bind="text: teacherName"></span>,
<span data-bind="text: groupName"></span>,
<span data-bind="text: date"></span>)
</div>
</div>

Expand Down

0 comments on commit 314ebec

Please sign in to comment.