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

Commit

Permalink
[#840] select value and save career
Browse files Browse the repository at this point in the history
  • Loading branch information
Rupesh87 committed Jun 5, 2017
1 parent 6bf8c55 commit 0db709e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 23 deletions.
12 changes: 11 additions & 1 deletion app/MyApp/app/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,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 @@ -6754,7 +6755,16 @@ $(function() {
App.$el.children('.body').html('<div id="ManageCourseCareer"></div>');
$('#ManageCourseCareer').append('<div><h2>'+App.languageDict.attributes.Add_Multiple_Courses+'</h2></div>')
$('#ManageCourseCareer').append(addCourseCareer.el);
$('#LCourse').multiselect({columns: 1,placeholder: 'Select Course'});
$('#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)

Expand Down
45 changes: 25 additions & 20 deletions app/MyApp/app/views/AddCourseCareer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,43 @@ $(function() {
},

saveCareerPath: function(){
var levelname = $('#level').val()
var coursetitle = $('#LCourse').val()
var arrcourseId = []
for(var i = 0; i <this.collection.models.length; i++){
if(coursetitle === this.collection.models[i].attributes.CourseTitle){
var courseid = this.collection.models[i].attributes._id
arrcourseId.push(courseid)
var selectedCourseId = []
var selectedCourseName = []
$('#LCourse option:selected').each(function(){
if ($(this).length) {
selectedCourseId.push($(this).val());
selectedCourseName.push($(this).text());
}
}
});
console.log(selectedCourseId, selectedCourseName)
var levelname = $('#levelSelect').val()
var courseCareerTitle = $('#careerPath').val()
var savecoursecareer = new App.Models.CoursecareerPath()
savecoursecareer.set('Level_Name',levelname);
savecoursecareer.set('Courses',coursetitle);
savecoursecareer.set('CourseIds',arrcourseId);
savecoursecareer.set('MemberID',$.cookie('Member._id'));
savecoursecareer.save(null, {
error: function() {
console.log("Not Saved")
}
});
location.reload();
savecoursecareer.set('Level_Name',levelname);
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")
}
});
//location.reload();
},

render: function() {
console.log(this.collection.models)
var arrcourses = []
var arrCourseIds = []
for(var i = 0; i <this.collection.models.length; i++){
var courseslist = this.collection.models[i].attributes.CourseTitle
console.log(courseslist)
var courseId = this.collection.models[i].attributes._id
arrcourses.push(courseslist)
arrCourseIds.push(courseId)
}
this.$el.find('.multipleCourse').append('<div class="btn btn-info" id="finishPressed">'+App.languageDict.attributes.Finish+'</div>&nbsp&nbsp');
this.vars.Courselist = arrcourses
this.vars.Courseid = arrCourseIds
this.vars.Course_Length = this.collection.models.length
this.$el.html(_.template(this.template,this.vars))
},
Expand Down
4 changes: 2 additions & 2 deletions app/MyApp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1473,8 +1473,8 @@ <h4 id="new-quiz"><%= languageDict.attributes.New_Career_Path %></h4>
<label for="LCourse"><%= languageDict.attributes.List_of_Courses %></label>
<select id="LCourse" name = "LCourse[]">
<%for(var i =0; i<Course_Length;i++){%>
<option value='<%=Courselist[i]%>'><%=Courselist[i]%></option>
<%}%>
<option value='<%=Courseid[i]%>'><%=Courselist[i]%></option>
<%}%>
</select>
<button id="AddCareerPath" class="course btn btn-success" style="margin-left: 23px; margin-top: -1px;"><%= languageDict.attributes.Create_Course_Career %></button>
<button id ="CancelCOursePath" class="btn resignBtn btn-danger" style="margin-left: 23px;margin-top: -1px;" ><%= languageDict.attributes.Cancel %></button>
Expand Down

0 comments on commit 0db709e

Please sign in to comment.