-
Notifications
You must be signed in to change notification settings - Fork 39
840 course career path(connects #840) #882
base: dev
Are you sure you want to change the base?
Changes from 28 commits
72c77d2
1c0bfd5
acce8e6
ec0d6a9
6bf8c55
0db709e
d79ab6c
3e23999
472c573
b6b7650
aa9400f
72f41a5
1e319ff
efee3b0
2d1ab43
8d181f6
b79af87
ed5410b
59ac284
9d8958c
6a26b1e
de5b792
4c288a7
e65d1a9
a4fba58
dd4f37e
44cf88f
0ff745c
979fa97
422c207
1134278
e396ec4
a6395f6
c9a06d2
c454d57
e94449c
59256b6
731c52e
b14251a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ $(function() { | |
'resource/search': 'bellResourceSearch', | ||
'search-bell/:levelId/:rId': 'SearchBell', | ||
'assign-to-level': 'AssignResourcetoLevel', | ||
'courses': 'Courses', | ||
'courses(/courseCareerPath)': 'Courses', | ||
'course/manage/:courseId': 'ManageCourse', | ||
'course/details/:courseId/:courseName': 'courseDetails', | ||
'usercourse/details/:courseId/:courseName': 'UserCourseDetails', | ||
|
@@ -95,7 +95,10 @@ $(function() { | |
'checksum(/:nation/:url)': 'checkSum', | ||
'listLearnersCredits/:cid': 'showLearnersListForCredits', | ||
'passwordResetEmail': 'showPasswordResetEmail', | ||
'password-reset': 'showPasswordReset' | ||
'password-reset': 'showPasswordReset', | ||
//'courseCareerPath':'CourseCareerPath', | ||
'courseCareerPath':'addCareerPath', | ||
'courseCareerPath/manage/:careername/:careerId':'manageCourseCareer' | ||
}, | ||
addOrUpdateWelcomeVideoDoc: function() { | ||
// fetch existing welcome video doc if there is any | ||
|
@@ -1803,6 +1806,7 @@ $(function() { | |
} | ||
$('.form .field-Tag select').attr("multiple", true); | ||
$('.form .field-Tag select').click(function() { | ||
console.log(this.value) | ||
context.AddNewSelect(this.value) | ||
}); | ||
$('.form .field-Tag select').dblclick(function() { | ||
|
@@ -2174,11 +2178,16 @@ $(function() { | |
var button = '<p id="library-top-buttons">' | ||
button += '<a id="addCourseButton" class="btn btn-success" href="#course/add">'+App.languageDict.attributes.Add_Course+'</a>' | ||
button += '<a id="requestCourseButton" class="btn btn-success" onclick=showRequestForm("Course")>'+App.languageDict.attributes.Request_Course+'</a>' | ||
//button += '<a id="courseCareerPath" style = "margin-left: 15px;" href="#courseCareerPath/add">'+App.languageDict.attributes.Course_Career_Path+'</a>' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this code |
||
button += '<span id="searchSpan"><input id="searchText" value="" size="30" style="height:24px;margin-top:1%;" type="text"><span style="margin-left:10px">' | ||
button += '<button class="btn btn-info" onclick="CourseSearch()">'+App.languageDict.attributes.Search+'</button></span>' | ||
button += '</p>' | ||
$('#parentLibrary').append( button); | ||
$('#parentLibrary').append('<h3 id="headingOfCourses">'+App.languageDict.attributes.Courses+'</h3>') | ||
if($.url().attr('fragment') == "courses") { | ||
$('#parentLibrary').append('<p id="labelOnResource" style="font-size:30px;color:#808080;"><a href="#courses"style="font-size:30px;text-decoration: underline;;">'+languageDict.attributes.Courses+'</a>  |  <a href="#courseCareerPath" style="font-size:30px;" >'+languageDict.attributes.Career_Path+'</a></p>') | ||
}else{ | ||
$('#parentLibrary').append('<p id="labelOnResource" style="font-size:30px;color:#808080;"><a href="#courses"style="font-size:30px;">'+languageDict.attributes.Courses+'</a>  |  <a href="#courseCareerPath" style="font-size:30px;text-decoration: underline;">'+languageDict.attributes.Career_Path+'</a></p>') | ||
} | ||
$('#parentLibrary').append(coursesTable.el); | ||
coursesTable.changeDirection(); | ||
if(directionOfLang.toLowerCase()==="right") | ||
|
@@ -6728,6 +6737,102 @@ $(function() { | |
}); | ||
passwordResetView.render(); | ||
App.$el.children('.body').append(passwordResetView.el) | ||
}, | ||
CourseCareerPath:function(){ | ||
var coursePath = new App.Views.CourseCareerPath(); | ||
coursePath.render() | ||
App.$el.children('.body').html('<div id="CareerPath"></div>'); | ||
$('#CareerPath').append('<div><h2>'+App.languageDict.attributes.Course_Career_Path+'</h2></div>') | ||
$('#CareerPath').append(coursePath.el); | ||
var directionOfLang = App.languageDict.get('directionOfLang'); | ||
applyCorrectStylingSheet(directionOfLang); | ||
$.ajax({ | ||
url: '/coursecareerpath/_design/bell/_view/getCourseCareerByName', | ||
type: 'GET', | ||
dataType: "jsonp", | ||
async: false, | ||
success: function(json) { | ||
console.log(json) | ||
$(careerList).insertBefore('#searchText'); | ||
} | ||
}); | ||
}, | ||
addCareerPath:function(){ | ||
var courses = new App.Collections.Courses() | ||
courses.memberId = $.cookie('Member._id'); | ||
courses.fetch({ | ||
async:false | ||
}); | ||
$.ajax({ | ||
url: '/coursecareerpath/_design/bell/_view/getCourseCareerByName', | ||
type: 'GET', | ||
dataType: "jsonp", | ||
async: false, | ||
success: function(json) { | ||
console.log(json) | ||
$(careerList).insertBefore('#searchText'); | ||
} | ||
}); | ||
var addCourseCareer = new App.Views.AddCourseCareer({ | ||
collection:courses | ||
}); | ||
addCourseCareer.render() | ||
App.$el.children('.body').html('<div id="ManageCourseCareer"></div>'); | ||
$('#ManageCourseCareer').append('<a id="addCourseButton" class="btn btn-success" href="#course/add">'+App.languageDict.attributes.Add_Course+'</a>') | ||
$('#ManageCourseCareer').append('<a id="requestCourseButton" class="btn btn-success" style="margin: 13px;margin-left: 9px;" onclick=showRequestForm("Course")>'+App.languageDict.attributes.Request_Course+'</a>') | ||
if($.url().attr('fragment') == "courses") { | ||
$('#ManageCourseCareer').append('<p id="labelOnResource" style="font-size:30px; margin-bottom: -23px;color:#808080"><a href="#courses"style="font-size:30px;text-decoration: underline;">'+languageDict.attributes.Courses+'</a>  |  <a href="#courseCareerPath" style="font-size:30px;text-decoration: underline;"checked data-toggle="toggle">'+languageDict.attributes.Career_Path+'</a></p>') | ||
}else{ | ||
$('#ManageCourseCareer').append('<p id="labelOnResource" style="font-size:30px; margin-bottom: -23px;color:#808080"><a href="#courses"style="font-size:30px;">'+languageDict.attributes.Courses+'</a>  |  <a href="#courseCareerPath" style="font-size:30px;text-decoration: underline;"checked data-toggle="toggle">'+languageDict.attributes.Career_Path+'</a></p>') | ||
} | ||
$('#ManageCourseCareer').append(addCourseCareer.el); | ||
$("#EditCareerPath").hide(); | ||
$('#LCourse').multiselect().multiselectfilter(); | ||
$('#LCourse').multiselect({ | ||
checkAllText: App.languageDict.attributes.checkAll, | ||
uncheckAllText: App.languageDict.attributes.unCheckAll, | ||
selectedText: '# '+App.languageDict.attributes.Selected | ||
}); | ||
$('#LCourse').multiselect().multiselectfilter("widget")[0].children[0].firstChild.data=App.languageDict.attributes.Filter; | ||
$('.ui-multiselect-filter').find('input').attr('placeholder',App.languageDict.attributes.KeyWord_s); | ||
$('#LCourse').attr("multiple", true); | ||
$('#LCourse').multiselect("uncheckAll"); | ||
var directionOfLang = App.languageDict.get('directionOfLang'); | ||
applyCorrectStylingSheet(directionOfLang) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove extra line |
||
}, | ||
manageCourseCareer: function(cname,cId){ | ||
var courseCareerPath = new App.Models.CoursecareerPath({ | ||
_id : cId | ||
}); | ||
courseCareerPath.fetch({ | ||
async:false | ||
}); | ||
console.log(courseCareerPath) | ||
var manageCouseCareer = new App.Views.ManageCourseCareer({ | ||
model:courseCareerPath | ||
}); | ||
var directionOfLang = App.languageDict.get('directionOfLang'); | ||
applyCorrectStylingSheet(directionOfLang) | ||
model:courseCareerPath | ||
manageCouseCareer.render(); | ||
App.$el.children('.body').html('<div id="CourseCareerManage"></div>'); | ||
$('#CourseCareerManage').append('<div><h2>'+App.languageDict.attributes.Add_Multiple_Careers+'</h2></div>') | ||
$('#CourseCareerManage').append(manageCouseCareer.el); | ||
$('#careerPathList').hide() | ||
$('#LCourse').multiselect().multiselectfilter(); | ||
$('#LCourse').multiselect({ | ||
checkAllText: App.languageDict.attributes.checkAll, | ||
uncheckAllText: App.languageDict.attributes.unCheckAll, | ||
selectedText: '# '+App.languageDict.attributes.Selected | ||
}); | ||
$('#LCourse').multiselect().multiselectfilter("widget")[0].children[0].firstChild.data=App.languageDict.attributes.Filter; | ||
$('.ui-multiselect-filter').find('input').attr('placeholder',App.languageDict.attributes.KeyWord_s); | ||
$('#LCourse').attr("multiple", true); | ||
$('#LCourse').multiselect("uncheckAll"); | ||
var directionOfLang = App.languageDict.get('directionOfLang'); | ||
applyCorrectStylingSheet(directionOfLang) | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove extra line |
||
})) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
$(function() { | ||
|
||
App.Collections.CourseCareerPath = Backbone.Collection.extend({ | ||
url: function() { | ||
if (this.CoursePathName!= undefined && this.MemberID!= undefined ) { | ||
return App.Server + '/coursecareerpath/_design/bell/_view/GetCourseCareerByLevelNameMemberIds?key=["' +this.CoursePathName + '","' +this.MemberID+ '"]&include_docs=true' | ||
} else if (this.CoursePathName!= undefined && this.MemberID == undefined ) { | ||
return App.Server + '/coursecareerpath/_design/bell/_view/getCourseCareerByName?key=["' +this.CoursePathName + '"]&include_docs=true' | ||
} else { | ||
return App.Server + '/coursecareerpath/_all_docs?include_docs=true' | ||
} | ||
}, | ||
|
||
parse: function(response) { | ||
var models = [] | ||
_.each(response.rows, function(row) { | ||
models.push(row.doc) | ||
}); | ||
return models | ||
}, | ||
initialize: function() { | ||
this.sort_key = 'CoursePathName'; | ||
}, | ||
comparator: function(a, b) { | ||
// Assuming that the sort_key values can be compared with '>' and '<', | ||
// modifying this to account for extra processing on the sort_key model | ||
// attributes is fairly straight forward. | ||
a = a.get(this.sort_key); | ||
b = b.get(this.sort_key); | ||
if (a > b) | ||
console.log("before") | ||
return a > b ? 1 : a < b ? -1 : 0; | ||
}, | ||
/*comparator: function(model) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this code if not used |
||
var type = model.get('Type') | ||
if (type) return type.toLowerCase() | ||
} */ | ||
}) | ||
|
||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
$(function() { | ||
|
||
App.Models.CoursecareerPath = Backbone.Model.extend({ | ||
|
||
idAttribute: "_id", | ||
url: function() { | ||
if (_.has(this, 'id')) { | ||
var url = (_.has(this.toJSON(), '_rev')) ? App.Server + '/coursecareerpath/' + this.id + '?rev=' + this.get('_rev') // For UPDATE and DELETE | ||
: App.Server + '/coursecareerpath/' + this.id // For READ | ||
} else { | ||
var url = App.Server + '/coursecareerpath' // for CREATE | ||
} | ||
return url | ||
}, | ||
defaults: { | ||
kind: 'coursecareerpath',//Saves kind of document according to corresponding db's.Mostly used in couch db views. | ||
}, | ||
schema: { | ||
Level_Name: 'Text', | ||
CareerPathName:'Text', | ||
Courselist: 'Text', | ||
CourseIds:[],//Array:Multiple Courses | ||
MemberID:'Text' | ||
}, | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
$(function() { | ||
|
||
App.Views.AddCourseCareer = Backbone.View.extend({ | ||
template: $('#template-addCourseCareer').html(), | ||
vars: {}, | ||
searchText: "", | ||
events: { | ||
"click .Search": function(e) { | ||
this.renderTable($('#searchText').val().toLowerCase()) | ||
}, | ||
"click #buttonCareer": function(){ | ||
alert('Hello') | ||
}, | ||
"click #AddCareerPath": function() { | ||
this.saveCareerPath(); | ||
}, | ||
"click #CancelCoursePath": function(e) { | ||
}, | ||
"click #Delete": function(e) { | ||
var a = $(e.target).attr('data-id') | ||
var career = new App.Models.CoursecareerPath({ | ||
_id: a | ||
}) | ||
career.fetch({ | ||
async: false | ||
}) | ||
career.destroy() | ||
alert(App.languageDict.attributes.Selected); | ||
location.reload(); | ||
}, | ||
"click #careerEdit": function(e) { | ||
var currentId = $(e.target).attr("data-id"); | ||
$('#AddCareerPath').hide(); | ||
var courseCareer = new App.Models.CoursecareerPath({ | ||
_id : currentId | ||
}) | ||
courseCareer.fetch({ | ||
async: false | ||
}); | ||
$('#careerPath').val(courseCareer.attributes.CoursePathName); | ||
$('#UpdateCareerPath').css('display',''); | ||
$('#UpdateCareerPath').attr('data-id',currentId); | ||
console.log($('#UpdateCareerPath').attr('data-id')) | ||
}, | ||
"click #UpdateCareerPath": function(e) { | ||
this.saveCareerPath($('#UpdateCareerPath').attr('data-id')); | ||
}, | ||
}, | ||
|
||
initialize: function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this function if nothing is in it. |
||
|
||
}, | ||
renderTable: function(searchText) { | ||
App.startActivityIndicator() | ||
var that = this | ||
var career = new App.Collections.CourseCareerPath() | ||
career.CoursePathName = searchText | ||
career.fetch({ | ||
success: function(response){ | ||
var careerTable = new App.Views.AddCourseCareer({ | ||
collection: response | ||
}) | ||
$(".btable").append("<tr><td>"+career.models[0].attributes.CoursePathName+"</td><td><ul><li>"+career.models[0].attributes.Courses+"</ul></li></td><td></td></tr>") | ||
App.stopActivityIndicator() | ||
}, | ||
|
||
error: function() { | ||
App.stopActivityIndicator() | ||
} | ||
}) | ||
console.log(career) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove extra line |
||
}, | ||
saveCareerPath: function(previousId){ | ||
var selectedCourseId = [] | ||
var selectedCourseName = [] | ||
if(previousId){ | ||
var courseCareer = new App.Models.CoursecareerPath({ | ||
_id : previousId | ||
}) | ||
courseCareer.fetch({ | ||
async: false | ||
}); | ||
$('#LCourse option:selected').each(function(){ | ||
if ($(this).length) { | ||
selectedCourseId.push($(this).val()); | ||
selectedCourseName.push($(this).text()); | ||
} | ||
}); | ||
var courseCareerTitle = $('#careerPath').val() | ||
courseCareer.set('CareerPathName',courseCareerTitle); | ||
courseCareer.set('Courses',selectedCourseName); | ||
courseCareer.set('CourseIds',selectedCourseId); | ||
courseCareer.set('MemberID',$.cookie('Member._id')); | ||
courseCareer.save(null, { | ||
error: function() { | ||
console.log("Not Saved") | ||
} | ||
}) | ||
location.reload(); | ||
} else { | ||
$('#LCourse option:selected').each(function(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation problem |
||
if ($(this).length) { | ||
selectedCourseId.push($(this).val()); | ||
selectedCourseName.push($(this).text()); | ||
} | ||
}); | ||
var courseCareerTitle = $('#careerPath').val() | ||
var savecoursecareer = new App.Models.CoursecareerPath() | ||
savecoursecareer.set('CoursePathName',courseCareerTitle); | ||
savecoursecareer.set('Courses',selectedCourseName); | ||
savecoursecareer.set('CourseIds',selectedCourseId); | ||
savecoursecareer.set('MemberID',$.cookie('Member._id')); | ||
savecoursecareer.save(null, { | ||
error: function() { | ||
console.log("Not Saved") | ||
} | ||
}) | ||
} | ||
}, | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra line should be remove. |
||
render: function() { | ||
var arrcourses = [] | ||
var arrCourseIds = [] | ||
for(var i = 0; i <this.collection.models.length-1; i++){ | ||
var courseslist = this.collection.models[i].attributes.CourseTitle | ||
var courseId = this.collection.models[i].attributes._id | ||
arrcourses.push(courseslist) | ||
arrCourseIds.push(courseId) | ||
} | ||
var courseCareers = new App.Collections.CourseCareerPath() | ||
courseCareers.memberId = $.cookie('Member._id'); | ||
courseCareers.fetch({ | ||
async:false | ||
}); | ||
this.vars.careerList = []; | ||
for(var i = 0; i < (courseCareers.length); i++) { | ||
if(courseCareers.models[i].attributes._id !== "_design/bell"){ | ||
this.vars.careerList.push(courseCareers.models[i].attributes); | ||
} | ||
} | ||
this.vars.Courselist = arrcourses | ||
this.vars.Courseid = arrCourseIds | ||
this.vars.Course_Length = this.collection.models.length-1 | ||
this.$el.html(_.template(this.template,this.vars)) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove extra line |
||
}, | ||
}) | ||
|
||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this code not just comment out