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

Commit

Permalink
[#840] Some Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pr0chin committed Jun 2, 2017
1 parent 1c0bfd5 commit ec0d6a9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$(function() {

App.Models.CourseCareerPath = Backbone.Model.extend({
App.Models.CoursecareerPath = Backbone.Model.extend({

idAttribute: "_id",
url: function() {
Expand All @@ -13,12 +13,13 @@ $(function() {
return url
},
defaults: {
kind: 'coursecareerpath'//Saves kind of document according to corresponding db's.Mostly used in couch db views.
kind: 'coursecareerpath',//Saves kind of document according to corresponding db's.Mostly used in couch db views.
},
schema: {
Level_Name: 'Text', .
Courses: [], //Array:Multiple Courses
Level_Name: 'Text',
Course_Title: 'Text',
CourseIds:[],//Array:Multiple Courses
CourseCareer: []//Array:Arranging the Courses
}
},
})
})
33 changes: 26 additions & 7 deletions app/MyApp/app/views/AddCourseCareer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,39 @@ $(function() {
template: $('#template-addCourseCareer').html(),
vars: {},
events: {
"click #AddCareerPath": function() {
this.saveCareerPath();
},
"click #CancelCOursePath": function(e) {
this.saveCareerPath();
},
},

"click #AddCareerPath": function(e) {
this.saveCareerPath();
},
"click #CancelCOursePath": function(e) {
this.saveCareerPath();
},
initialize: function() {

},

saveCareerPath: function(){
alert("What's up");
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 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();
},

render: function() {
Expand Down
7 changes: 4 additions & 3 deletions app/MyApp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
<script src="app/models/AdminMember.js"></script> <!-- app/models.js -->
<script src="app/models/CourseQuestion.js"></script> <!-- app/models.js -->
<script src="app/models/CourseAnswer.js"></script> <!-- app/models.js -->
<script src="app/models/CoursecareerPath.js"></script> <!-- app/models.js -->

<!-- App Collection -->
<script src="app/collections/listRCollection.js"></script> <!-- app/collections.js -->
Expand Down Expand Up @@ -1461,8 +1462,8 @@ <h4 id="new-quiz"><%= languageDict.attributes.New_Career_Path %></h4>
<div class ="multipleCourse">
<form>
<label for="lName"><%= languageDict.attributes.Level_Name %></label>
<select id="LCourse" style="font-size: 15px;font-weight: 500;">
<option selected><%= languageDict.attributes.Select_An_option %></option>
<select id="level" style="font-size: 15px;font-weight: 500;">
<option><%= languageDict.attributes.Select_An_option %></option>
<option value='Begineers'>Begineers</option>
<option value='Intermediate'>Intermediate</option>
<option value='Professional'>Professional</option>
Expand All @@ -1471,7 +1472,7 @@ <h4 id="new-quiz"><%= languageDict.attributes.New_Career_Path %></h4>
<input type="text" id="careerPath" placeholder="Course Career Path Name" style = "padding-top: 12px; padding-bottom: 11px;">
<label for="LCourse"><%= languageDict.attributes.List_of_Courses %></label>
<select id="LCourse" style="font-size: 15px;font-weight: 500;">
<option selected><%= languageDict.attributes.Select_An_option %></option>
<option><%= languageDict.attributes.Select_An_option %></option>
<%for(var i =0; i<Course_Length;i++){%>
<option value='<%=Courselist[i]%>'><%=Courselist[i]%></option>
<%}%>
Expand Down

0 comments on commit ec0d6a9

Please sign in to comment.