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

Commit

Permalink
[#840]:Upgraded some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pr0chin committed Jun 9, 2017
1 parent efee3b0 commit 2d1ab43
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 10 deletions.
24 changes: 18 additions & 6 deletions app/MyApp/app/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ $(function() {
'password-reset': 'showPasswordReset',
'courseCareerPath':'CourseCareerPath',
'courseCareerPath/add':'addCareerPath',
'courseCareerPath/manage/:careernmae':'manageCourseCareer'
'courseCareerPath/manage/:careername/:careerId':'manageCourseCareer'
},
addOrUpdateWelcomeVideoDoc: function() {
// fetch existing welcome video doc if there is any
Expand Down Expand Up @@ -6770,21 +6770,33 @@ $(function() {
applyCorrectStylingSheet(directionOfLang)

},
manageCourseCareer: function(cname){
var courseCareerPath = new App.Collections.CourseCareerPath()
courseCareerPath.memberId = $.cookie('Member._id');
courseCareerPath.CoursePathName =cname;
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({
collection:courseCareerPath
model:courseCareerPath
});
manageCouseCareer.render();

App.$el.children('.body').html('<div id="CourseCareerManage"></div>');
$('#CourseCareerManage').append('<div><h2>'+App.languageDict.attributes.Add_Multiple_Courses+'</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)

Expand Down
1 change: 1 addition & 0 deletions app/MyApp/app/views/AddCourseCareer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $(function() {
},
"click #CancelCoursePath": function(e) {
},

},

initialize: function() {
Expand Down
50 changes: 47 additions & 3 deletions app/MyApp/app/views/ManageCourseCareer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,59 @@ $(function() {
App.Views.ManageCourseCareer = Backbone.View.extend({
template: $('#template-careerPathManage').html(),
vars: {},
events: {},
events: {
"click #requiredCareer":function(){
$('#careerPathList').show()
},
"click #AddMultipleCareerPath":function(){
this.saveMultipelCareer()
},
},

initialize: function() {

},

saveMultipelCareer:function(){
var selectedCourseName = []
$('#LCourse option:selected').each(function(){
if ($(this).length) {
selectedCourseName.push($(this).val());
}
});
var multiplecareer = new App.Collections.CourseCareerPath();
multiplecareer.fetch({
async: false
});
console.log(selectedCourseName)
console.log(multiplecareer)
var arrcoursename = []
/* for(var i =0; i <multiplecareer.length; i++ ){
for (var j =0; j<selectedCourseName.length; i++){
var coursesname = multiplecareer.models[i].attributes._id
arrcoursename.push(coursesname)
}
}*/
console.log(arrcoursename)
},
render: function() {
console.log(this.collection)

console.log(this.model.get('_id'))
var multiplecareer = new App.Collections.CourseCareerPath();
multiplecareer.fetch({
async: false
});
this.vars.careerList = [];
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);
}
}
$('#careerPathList').hide()
this.vars.careerlength = multiplecareer.length-2
this.vars.CourseCareerName = this.model.get('CoursePathName');
this.vars.CouseLists = this.model.get('Courses');
console.log(this.model.get('CoursePathName'))
this.$el.html(_.template(this.template,this.vars))
},
})
Expand Down
16 changes: 15 additions & 1 deletion app/MyApp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ <h4 id="new-quiz"><%= languageDict.attributes.New_Career_Path %></h4>
<td><ul><li><%= careerList[i].Courses %></li></ul></td>
<td><button class='course btn btn-success'><%=languageDict.attributes.EditLabel%></button></td>
<td><button class='destroy btn btn-danger' style="margin-right: 420px;"><%=languageDict.attributes.DeleteLabel%></button></td>
<td><button class='btn btn-info' id="ManageCareer" onclick = "document.location.href='#courseCareerPath/manage/<%= careerList[i].CoursePathName %>'" style="margin-left: -550px;"><%=languageDict.attributes.View_Details%></button></td>
<td><button class='btn btn-info' id="ManageCareer" onclick = "document.location.href='#courseCareerPath/manage/<%= careerList[i].CoursePathName %>/<%= careerList[i]._id %>'" style="margin-left: -550px;"><%=languageDict.attributes.View_Details%></button></td>
</tr>
<% } %>
</table>
Expand All @@ -1499,7 +1499,21 @@ <h4 id="new-quiz"><%= languageDict.attributes.New_Career_Path %></h4>
<script type="text/template" id="template-careerPathManage">
<hr/>
<div id ="Manage">
<h4>Course Career | <%=CourseCareerName%></h4>
<h6>Course Lists</h6>
<textarea id="CareerDescription" rows="5" cols="100" style="width:98%;"><%=CouseLists%></textarea>
<button id="requiredCareer" class="course btn btn-success"><%= languageDict.attributes.Create_Course_Career %></button>
</div>
<div id = "careerPathList">
<label for="LCourse"><b><%= languageDict.attributes.Required_Course_Career_Path %></b></label>
<select id="LCourse" name = "LCourse">
<%for(var i =0; i< careerlength; i++){%>
<option value='<%=careerList[i]%>'><%=careerList[i]%></option>
<%}%>
</select>
<button id="AddMultipleCareerPath" class="course btn btn-success" style="margin-left: 23px; margin-top: -1px;"><%= languageDict.attributes.Save %></button>
<button id ="CancelCOursePath" class="btn resignBtn btn-danger" style="margin-left: 23px;margin-top: -1px;" ><%= languageDict.attributes.Cancel %></button>
</div>
</script>

<script type="text/html" id="template-courseLevelsTable">
Expand Down
1 change: 1 addition & 0 deletions init_docs/Text.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"subject": "Subject(s)",
"level": "Level(s)",
"Level_Name":"Level Name",
"Required_Course_Career_Path":"Required Course Career Path",
"Course_Career_Path_Name":"Course Career Path Name",
"Add_Course_Career_Level":"Add Course Career Level",
"Course_Career":"Course Career",
Expand Down

0 comments on commit 2d1ab43

Please sign in to comment.