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

Commit

Permalink
[#840]:features added
Browse files Browse the repository at this point in the history
  • Loading branch information
razu9861 committed Jun 14, 2017
1 parent 9d8958c commit 4c288a7
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 9 deletions.
14 changes: 11 additions & 3 deletions app/MyApp/app/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -6809,6 +6809,16 @@ $(function() {
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
});
Expand All @@ -6832,8 +6842,6 @@ $(function() {

},
manageCourseCareer: function(cname,cId){
console.log("CN--"+cname);
console.log("ID--"+cId)
var courseCareerPath = new App.Models.CoursecareerPath({
_id : cId
});
Expand All @@ -6842,7 +6850,7 @@ $(function() {
});
console.log(courseCareerPath)
var manageCouseCareer = new App.Views.ManageCourseCareer({
collection:courseCareerPath
model:courseCareerPath
});
var directionOfLang = App.languageDict.get('directionOfLang');
applyCorrectStylingSheet(directionOfLang)
Expand Down
22 changes: 17 additions & 5 deletions app/MyApp/app/collections/CourseCareerPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ $(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'
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'
return App.Server + '/coursecareerpath/_design/bell/_view/getCourseCareerByName?key=["' +this.CoursePathName + '"]&include_docs=true'
} else {
return App.Server + '/coursecareerpath/_all_docs?include_docs=true'
}
Expand All @@ -18,11 +18,23 @@ $(function() {
});
return models
},

comparator: function(model) {
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) {
var type = model.get('Type')
if (type) return type.toLowerCase()
}
} */
})

})
28 changes: 28 additions & 0 deletions app/MyApp/app/views/AddCourseCareer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ $(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();
},
Expand Down Expand Up @@ -43,7 +50,27 @@ $(function() {
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("<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)

},
saveCareerPath: function(previousId){
var selectedCourseId = []
var selectedCourseName = []
Expand Down Expand Up @@ -116,6 +143,7 @@ $(function() {
this.vars.Courseid = arrCourseIds
this.vars.Course_Length = this.collection.models.length-1
this.$el.html(_.template(this.template,this.vars))

},
})

Expand Down
1 change: 1 addition & 0 deletions app/MyApp/app/views/CourseCareerPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $(function() {
events: {
"click .Search": function(e) {
this.renderTable($('#searchText').val().toLowerCase())
alert('Hi')
},
},

Expand Down
4 changes: 3 additions & 1 deletion app/MyApp/app/views/ManageCourseCareer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $(function() {
},
"click #AddMultipleCareerPath":function(){
this.saveMultipelCareer()
alert('saved')
},
},

Expand All @@ -35,6 +36,7 @@ $(function() {
console.log("Not Saved")
}
});
location.reload()
},
render: function() {
var multiplecareer = new App.Collections.CourseCareerPath();
Expand All @@ -45,7 +47,7 @@ $(function() {
this.vars.careerList = [];
this.vars.careerListIds = [];
for(var i = 1; i< multiplecareer.length; i++){
if(multiplecareer.models[i].attributes._id != this.models.get('_id') ){
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);
}
Expand Down

0 comments on commit 4c288a7

Please sign in to comment.