diff --git a/app/MyApp/app/Router.js b/app/MyApp/app/Router.js
index 8908ac82d..9dc0cf988 100644
--- a/app/MyApp/app/Router.js
+++ b/app/MyApp/app/Router.js
@@ -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':'addCareerPath',
+ 'courseCareerPath/manage/:careername/:careerId':'manageCourseCareer',
+ 'courseCareerPath/details/:carrerId': 'CareerDetails'
},
addOrUpdateWelcomeVideoDoc: function() {
// fetch existing welcome video doc if there is any
@@ -1926,6 +1929,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() {
@@ -2303,7 +2307,11 @@ $(function() {
button += ''
button += '
'
$('#parentLibrary').append( button);
- $('#parentLibrary').append(''+App.languageDict.attributes.Courses+'
')
+ if($.url().attr('fragment') == "courses") {
+ $('#parentLibrary').append(''+languageDict.attributes.Courses+'  |  '+languageDict.attributes.Career_Path+'
')
+ }else{
+ $('#parentLibrary').append(''+languageDict.attributes.Courses+'  |  '+languageDict.attributes.Career_Path+'
')
+ }
$('#parentLibrary').append(coursesTable.el);
coursesTable.changeDirection();
if(directionOfLang.toLowerCase()==="right")
@@ -7234,6 +7242,112 @@ $(function() {
});
passwordResetView.render();
App.$el.children('.body').append(passwordResetView.el)
+ },
+
+ addCareerPath:function(cId){
+ 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('');
+ $('#ManageCourseCareer').append(''+App.languageDict.attributes.Add_Course+'')
+ $('#ManageCourseCareer').append(''+App.languageDict.attributes.Request_Course+'')
+ if($.url().attr('fragment') == "courses") {
+ $('#ManageCourseCareer').append(''+languageDict.attributes.Courses+'  |  '+languageDict.attributes.Career_Path+'
')
+ }else{
+ $('#ManageCourseCareer').append(''+languageDict.attributes.Courses+'  |  '+languageDict.attributes.Career_Path+'
')
+ }
+ $('#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");
+ ///--CarrerList
+ var courseCareerPath = new App.Collections.CourseCareerPath()
+ courseCareerPath.fetch({
+ async:false
+ });
+ $('#LCareer').multiselect().multiselectfilter();
+ $('#LCareer').multiselect({
+ checkAllText: App.languageDict.attributes.checkAll,
+ uncheckAllText: App.languageDict.attributes.unCheckAll,
+ selectedText: '# '+App.languageDict.attributes.Selected
+ });
+ $('#LCareer').multiselect().multiselectfilter("widget")[0].children[0].firstChild.data=App.languageDict.attributes.Filter;
+ $('.ui-multiselect-filter').find('input').attr('placeholder',App.languageDict.attributes.KeyWord_s);
+ $('#LCareer').attr("multiple", true);
+ $('#LCareer').multiselect("uncheckAll");
+ var directionOfLang = App.languageDict.get('directionOfLang');
+ applyCorrectStylingSheet(directionOfLang)
+ },
+
+ manageCourseCareer: function(cname,cId){
+ var courseCareerPath = new App.Models.CoursecareerPath({
+ _id : cId
+ });
+ courseCareerPath.fetch({
+ async:false
+ });
+ 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('');
+ $('#CourseCareerManage').append(''+App.languageDict.attributes.Add_Multiple_Careers+'
')
+ $('#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)
+ },
+
+ CareerDetails: function(careerId) {
+ var CareerPath = new App.Models.CoursecareerPath({
+ _id : careerId
+ });
+ CareerPath.fetch({
+ async:false
+ });
+ var careerView = new App.Views.CareerDetailView({
+ model: CareerPath
+ })
+ careerView.render()
+ App.$el.children('.body').html(careerView.el);
+ applyCorrectStylingSheet(App.languageDict.get('directionOfLang'))
}
}))
})
diff --git a/app/MyApp/app/collections/CourseCareerPath.js b/app/MyApp/app/collections/CourseCareerPath.js
new file mode 100644
index 000000000..105277a85
--- /dev/null
+++ b/app/MyApp/app/collections/CourseCareerPath.js
@@ -0,0 +1,26 @@
+$(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 ) {
+ 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';
+ }
+ })
+
+})
diff --git a/app/MyApp/app/models/CoursecareerPath.js b/app/MyApp/app/models/CoursecareerPath.js
new file mode 100644
index 000000000..eecd68bc7
--- /dev/null
+++ b/app/MyApp/app/models/CoursecareerPath.js
@@ -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'
+ },
+ })
+})
\ No newline at end of file
diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js
new file mode 100644
index 000000000..5550e977d
--- /dev/null
+++ b/app/MyApp/app/views/AddCourseCareer.js
@@ -0,0 +1,182 @@
+$(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(){
+ },
+ "click #AddCareerPath": function() {
+ var a1 = $("#careerPath").val()
+ if(a1 != "")
+ 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);
+ },
+ "click #UpdateCareerPath": function(e) {
+ this.saveCareerPath($('#UpdateCareerPath').attr('data-id'));
+ },
+ },
+
+ initialize: function() {},
+
+ 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(""+career.models[0].attributes.CoursePathName+" | - "+career.models[0].attributes.Courses+"
| |
")
+ App.stopActivityIndicator()
+ },
+ error: function() {
+ App.stopActivityIndicator()
+ }
+ })
+ },
+
+ saveCareerPath: function(previousId){
+ var selectedCourseId = []
+ var selectedCourseName = []
+ var selectedCareerIds = []
+ 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());
+ }
+ });
+ $('#LCareer option:selected').each(function(){
+ if ($(this).length) {
+ selectedCareerIds.push($(this).val());
+ }
+ });
+ var courseCareerTitle = $('#careerPath').val()
+ courseCareer.set('CareerPathName',courseCareerTitle);
+ courseCareer.set('Courses',selectedCourseName);
+ courseCareer.set('CourseIds',selectedCourseId);
+ courseCareer.set('MemberID',$.cookie('Member._id'));
+ courseCareer.set('requiredCareerPathIds',selectedCareerIds);
+ courseCareer.save(null, {
+ success: function(response){
+ location.reload();
+ },
+ error: function() {
+ console.log("Not Saved")
+ }
+ })
+ location.reload();
+ } else {
+ $('#LCourse option:selected').each(function(){
+ if ($(this).length) {
+ selectedCourseId.push($(this).val());
+ selectedCourseName.push($(this).text());
+ }
+ });
+ $('#LCareer option:selected').each(function(){
+ if ($(this).length) {
+ selectedCareerIds.push($(this).val());
+ }
+ });
+ 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.set('requiredCareerPathIds',selectedCareerIds);
+ savecoursecareer.save(null, {
+ success: function(response){
+ location.reload();
+ },
+ error: function(status) {
+ console.log(status)
+ console.log("Not Saved")
+ }
+ })
+ }
+ },
+
+ render: function() {
+ var careerlength;
+ var arrcourses = []
+ var arrCourseIds = []
+ for(var i = 0; i "+career.models[0].attributes.CoursePathName+" | | ")
+ App.stopActivityIndicator()
+ },
+ error: function() {
+ App.stopActivityIndicator()
+ }
+ })
+ }
+ })
+
+})
\ No newline at end of file
diff --git a/app/MyApp/app/views/ManageCourseCareer.js b/app/MyApp/app/views/ManageCourseCareer.js
new file mode 100644
index 000000000..865f48e58
--- /dev/null
+++ b/app/MyApp/app/views/ManageCourseCareer.js
@@ -0,0 +1,59 @@
+$(function() {
+
+ App.Views.ManageCourseCareer = Backbone.View.extend({
+ template: $('#template-careerPathManage').html(),
+ vars: {},
+ events: {
+ "click #requiredCareer":function(){
+ $('#careerPathList').show()
+ },
+ "click #AddMultipleCareerPath":function(){
+ this.saveMultipelCareer()
+ alert('saved')
+ },
+ },
+
+ initialize: function() {},
+ saveMultipelCareer:function(){
+ var selectedCareerIds = []
+ $('#LCourse option:selected').each(function(){
+ if ($(this).length) {
+ selectedCareerIds.push($(this).val());
+ }
+ });
+ var courseCareer = new App.Models.CoursecareerPath({
+ _id : this.model.attributes._id
+ })
+ courseCareer.fetch({
+ async: false
+ });
+ courseCareer.set('requiredCareerPathIds',selectedCareerIds);
+ courseCareer.save(null, {
+ error: function() {
+ console.log("Not Saved")
+ }
+ });
+ location.reload()
+ },
+ render: function() {
+ var multiplecareer = new App.Collections.CourseCareerPath();
+ multiplecareer.fetch({
+ async: false
+ });
+ this.vars.careerList = [];
+ this.vars.careerListIds = [];
+ for(var i = 1; i< multiplecareer.length; i++){
+ if(multiplecareer.models[i].attributes._id != this.model.get('_id') ){
+ this.vars.careerList.push(multiplecareer.models[i].attributes.CoursePathName);
+ this.vars.careerListIds.push(multiplecareer.models[i].attributes._id);
+ }
+ }
+ $('#careerPathList').hide()
+ this.vars.careerlength = multiplecareer.length-2
+ this.vars.CourseCareerName = this.model.get('CorsePathName');
+ this.vars.CouseLists = this.model.get('Courses');
+ this.$el.html(_.template(this.template,this.vars))
+ },
+ })
+
+})
diff --git a/app/MyApp/app/views/MembersTable.js b/app/MyApp/app/views/MembersTable.js
index dfd03ad7c..997f6b7c7 100644
--- a/app/MyApp/app/views/MembersTable.js
+++ b/app/MyApp/app/views/MembersTable.js
@@ -4,6 +4,27 @@ $(function() {
App.Views.MembersTable = Backbone.View.extend({
+ addOne: function(model) {
+ console.log(model)
+ var memberRow = new App.Views.MemberRow({
+ model: model
+ })
+ memberRow.isadmin = this.isadmin
+ memberRow.community_code = this.community_code;
+ memberRow.render()
+ this.$el.append(memberRow.el)
+ },
+ events: {
+ "click .pageNumber": function(e) {
+ this.collection.startkey = ""
+ this.collection.skip = e.currentTarget.attributes[0].value
+ this.collection.fetch({
+ async: false
+ })
+ if (this.collection.length > 0) {
+ this.render()
+ }
+ },
tagName: "table",
className: "btable btable-striped",
diff --git a/app/MyApp/index.html b/app/MyApp/index.html
index 9f5b6ead8..be2a442d4 100644
--- a/app/MyApp/index.html
+++ b/app/MyApp/index.html
@@ -138,6 +138,7 @@
+
@@ -188,6 +189,7 @@
+
@@ -260,7 +262,8 @@
-
+
+
@@ -305,10 +308,11 @@
-
-
+
+
+
@@ -1439,6 +1443,103 @@
+
+
+
+
+
+