Skip to content
This repository has been archived by the owner on Aug 21, 2018. It is now read-only.

840 course career path(connects #840) #882

Open
wants to merge 39 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
72c77d2
[#840]: Layout Created For CareerPath
Pr0chin Jun 1, 2017
1c0bfd5
[#840]: Career Path
Pr0chin Jun 2, 2017
acce8e6
[#840] added multiselect feature
Rupesh87 Jun 2, 2017
ec0d6a9
[#840] Some Changes
Pr0chin Jun 2, 2017
6bf8c55
[#840]:CLean Conflict
Pr0chin Jun 2, 2017
0db709e
[#840] select value and save career
Rupesh87 Jun 5, 2017
d79ab6c
[#840]:Changes Made
Pr0chin Jun 5, 2017
3e23999
[#840]: Removed Conflit
Pr0chin Jun 5, 2017
472c573
[#840]:list of courseCareer
Rupesh87 Jun 5, 2017
b6b7650
[#840]:Upgrading
Pr0chin Jun 5, 2017
aa9400f
[#840]:Removed conflicts
Pr0chin Jun 5, 2017
72f41a5
[#840]:AddCourseCareer completed
Pr0chin Jun 5, 2017
1e319ff
[#840]:Setting new concept
Pr0chin Jun 6, 2017
efee3b0
[#840]:Some changes made
Pr0chin Jun 8, 2017
2d1ab43
[#840]:Upgraded some changes
Pr0chin Jun 9, 2017
8d181f6
[#840]save required career
Rupesh87 Jun 9, 2017
b79af87
[#840]-edit careerpath
Rupesh87 Jun 9, 2017
ed5410b
[#840]Delete and search
razu9861 Jun 9, 2017
59ac284
[#840]:Latest push Course Career
Pr0chin Jun 9, 2017
9d8958c
[#840]-changes on carrerpath
razu9861 Jun 12, 2017
6a26b1e
840-Remover Merge Conflict
Pr0chin Jun 13, 2017
de5b792
840:Changed as per required
Pr0chin Jun 14, 2017
4c288a7
[#840]:features added
razu9861 Jun 14, 2017
e65d1a9
[#840] Tab Function
Pr0chin Jun 16, 2017
a4fba58
[#840] Tab Functionality
Pr0chin Jun 19, 2017
dd4f37e
[#840] Upgraded changes
Pr0chin Jun 19, 2017
44cf88f
[#840] Made some changes
Pr0chin Jun 20, 2017
0ff745c
Merge branch '840-Course-Career-Path' of https://github.com/open-lear…
Pr0chin Jun 20, 2017
979fa97
[#840]-Career path
razu9861 Jun 21, 2017
422c207
[#840]:list career added
razu9861 Jun 26, 2017
1134278
[#840] Career Path
razu9861 Oct 9, 2017
e396ec4
[#840] careerpath
razu9861 Oct 11, 2017
a6395f6
[#840] unwanted files removed
razu9861 Oct 11, 2017
c9a06d2
careerppath
razu9861 Oct 27, 2017
c454d57
[#840] Career detail view
razu9861 Nov 2, 2017
e94449c
Merge branch 'dev' into 840-Course-Career-Path
razu9861 Jan 15, 2018
59256b6
[#840] indentation fixed
razu9861 Jan 15, 2018
731c52e
Update Text.json
razu9861 Jan 15, 2018
b14251a
[#840] indentation fixed
razu9861 Jan 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 108 additions & 3 deletions app/MyApp/app/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -95,7 +95,10 @@ $(function() {
'checksum(/:nation/:url)': 'checkSum',
'listLearnersCredits/:cid': 'showLearnersListForCredits',
'passwordResetEmail': 'showPasswordResetEmail',
'password-reset': 'showPasswordReset'
'password-reset': 'showPasswordReset',
//'courseCareerPath':'CourseCareerPath',
Copy link
Member

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

'courseCareerPath':'addCareerPath',
'courseCareerPath/manage/:careername/:careerId':'manageCourseCareer'
},
addOrUpdateWelcomeVideoDoc: function() {
// fetch existing welcome video doc if there is any
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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>'
Copy link
Member

Choose a reason for hiding this comment

The 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>&nbsp&nbsp|&nbsp&nbsp<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>&nbsp&nbsp|&nbsp&nbsp<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")
Expand Down Expand Up @@ -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>&nbsp&nbsp|&nbsp&nbsp<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>&nbsp&nbsp|&nbsp&nbsp<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)

Copy link
Member

Choose a reason for hiding this comment

The 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)
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra line

}))
})
40 changes: 40 additions & 0 deletions app/MyApp/app/collections/CourseCareerPath.js
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) {
Copy link
Member

Choose a reason for hiding this comment

The 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()
} */
})

})
26 changes: 26 additions & 0 deletions app/MyApp/app/models/CoursecareerPath.js
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'
},
})
})
151 changes: 151 additions & 0 deletions app/MyApp/app/views/AddCourseCareer.js
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() {
Copy link
Member

Choose a reason for hiding this comment

The 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)

Copy link
Member

Choose a reason for hiding this comment

The 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(){
Copy link
Contributor

Choose a reason for hiding this comment

The 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")
}
})
}
},


Copy link
Contributor

Choose a reason for hiding this comment

The 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))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra line

},
})

})
Loading