From 1e319ff7a08977376ec1ebec5b021fc56423e73b Mon Sep 17 00:00:00 2001 From: pr0chin Date: Tue, 6 Jun 2017 14:42:09 +0545 Subject: [PATCH] [#840]:Setting new concept --- app/MyApp/app/Router.js | 4 ++- app/MyApp/app/views/AddCourseCareer.js | 30 +++++++++++++----- app/MyApp/app/views/ManageCourseCareer.js | 17 +++++++++++ app/MyApp/index.html | 37 +++++++++++++++-------- init_docs/Text.json | 2 ++ 5 files changed, 69 insertions(+), 21 deletions(-) create mode 100644 app/MyApp/app/views/ManageCourseCareer.js diff --git a/app/MyApp/app/Router.js b/app/MyApp/app/Router.js index b1820a35c..089aa4166 100644 --- a/app/MyApp/app/Router.js +++ b/app/MyApp/app/Router.js @@ -97,7 +97,8 @@ $(function() { 'passwordResetEmail': 'showPasswordResetEmail', 'password-reset': 'showPasswordReset', 'courseCareerPath':'CourseCareerPath', - 'courseCareerPath/add':'addCareerPath' + 'courseCareerPath/add':'addCareerPath', + 'courseCareerPath/manage/:careernmae':'ManageCourseCareer' }, addOrUpdateWelcomeVideoDoc: function() { // fetch existing welcome video doc if there is any @@ -6769,5 +6770,6 @@ $(function() { applyCorrectStylingSheet(directionOfLang) } + })) }) diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js index ae372a30e..528246729 100644 --- a/app/MyApp/app/views/AddCourseCareer.js +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -7,8 +7,7 @@ $(function() { "click #AddCareerPath": function() { this.saveCareerPath(); }, - "click #CancelCOursePath": function(e) { - this.saveCareerPath(); + "click #CancelCoursePath": function(e) { }, }, @@ -25,23 +24,38 @@ $(function() { 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('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") + success: function() { + var coursecareer = new App.Collections.CourseCareerPath() + coursecareer.memberId = $.cookie('Member._id'); + coursecareer.CoursePathName = courseCareerTitle + coursecareer.fetch({ + async:false + }); + console.log(coursecareer) + var manageCaoursecareer = new App.Views.ManageCourseCareer({ + collection:coursecareer + }); + manageCaoursecareer.render() + + $('#ManageCourseCareer').append(manageCaoursecareer.el) + Backbone.history.navigate('courseCareerPath/add', { + trigger: true + }) } + + }); - //location.reload(); + }, + render: function() { var arrcourses = [] var arrCourseIds = [] diff --git a/app/MyApp/app/views/ManageCourseCareer.js b/app/MyApp/app/views/ManageCourseCareer.js new file mode 100644 index 000000000..fc2b93c8f --- /dev/null +++ b/app/MyApp/app/views/ManageCourseCareer.js @@ -0,0 +1,17 @@ +$(function() { + + App.Views.ManageCourseCareer = Backbone.View.extend({ + template: $('#template-careerPathManage').html(), + vars: {}, + + initialize: function() { + + }, + + render: function() { + console.log(this.collection) + this.$el.html(_.template(this.template,this.vars)) + }, + }) + +}) diff --git a/app/MyApp/index.html b/app/MyApp/index.html index 1001e02bc..c535475cf 100644 --- a/app/MyApp/index.html +++ b/app/MyApp/index.html @@ -307,6 +307,7 @@ + @@ -1456,19 +1457,13 @@

+ - + + +