From 72c77d21b5139e4429252d77069d34b374c4cbdd Mon Sep 17 00:00:00 2001 From: pr0chin Date: Thu, 1 Jun 2017 12:53:49 +0545 Subject: [PATCH 01/32] [#840]: Layout Created For CareerPath --- app/MyApp/app/Router.js | 24 ++++++++++- app/MyApp/app/models/CoursecarrerPath.js | 24 +++++++++++ app/MyApp/app/views/AddCourseCareer.js | 24 +++++++++++ app/MyApp/app/views/CourseCareerPath.js | 19 ++++++++ app/MyApp/index.html | 55 +++++++++++++++++++++++- databases/coursecareerpath.js | 24 +++++++++++ 6 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 app/MyApp/app/models/CoursecarrerPath.js create mode 100644 app/MyApp/app/views/AddCourseCareer.js create mode 100644 app/MyApp/app/views/CourseCareerPath.js create mode 100644 databases/coursecareerpath.js diff --git a/app/MyApp/app/Router.js b/app/MyApp/app/Router.js index bbcae5527..665bdded0 100644 --- a/app/MyApp/app/Router.js +++ b/app/MyApp/app/Router.js @@ -95,7 +95,9 @@ $(function() { 'checksum(/:nation/:url)': 'checkSum', 'listLearnersCredits/:cid': 'showLearnersListForCredits', 'passwordResetEmail': 'showPasswordResetEmail', - 'password-reset': 'showPasswordReset' + 'password-reset': 'showPasswordReset', + 'courseCareerPath':'CourseCareerPath', + 'courseCareerPath/add':'addCareerPath' }, addOrUpdateWelcomeVideoDoc: function() { // fetch existing welcome video doc if there is any @@ -2174,6 +2176,7 @@ $(function() { var button = '

' button += ''+App.languageDict.attributes.Add_Course+'' button += ''+App.languageDict.attributes.Request_Course+'' + button += ''+App.languageDict.attributes.Course_Career_Path+'' button += '' button += '' button += '

' @@ -6728,6 +6731,25 @@ $(function() { }); passwordResetView.render(); App.$el.children('.body').append(passwordResetView.el) + }, + CourseCareerPath:function(){ + var coursePath = new App.Views.CourseCareerPath(); + coursePath.render() + App.$el.children('.body').html('
'); + $('#CareerPath').append('

'+App.languageDict.attributes.Course_Career_Path+'

') + $('#CareerPath').append(coursePath.el); + var directionOfLang = App.languageDict.get('directionOfLang'); + applyCorrectStylingSheet(directionOfLang) + }, + addCareerPath:function(){ + var addCourseCareer = new App.Views.AddCourseCareer(); + addCourseCareer.render() + App.$el.children('.body').html('
'); + $('#ManageCourseCareer').append('

'+App.languageDict.attributes.Add_Multiple_Courses+'

') + $('#ManageCourseCareer').append(addCourseCareer.el); + var directionOfLang = App.languageDict.get('directionOfLang'); + applyCorrectStylingSheet(directionOfLang) + } })) }) diff --git a/app/MyApp/app/models/CoursecarrerPath.js b/app/MyApp/app/models/CoursecarrerPath.js new file mode 100644 index 000000000..91dc2923f --- /dev/null +++ b/app/MyApp/app/models/CoursecarrerPath.js @@ -0,0 +1,24 @@ +$(function() { + + App.Models.CourseCareerPath = Backbone.Model.extend({ + + idAttribute: "_id", + url: function() { + if (_.has(this, 'id')) { + var url = (_.has(this.toJSON(), '_rev')) ? App.Server + '/coursecareerpath/' + this.id + '?rev=' + this.get('_rev') // For UPDATE and DELETE + : App.Server + '/coursecareerpath/' + this.id // For READ + } else { + var url = App.Server + '/coursecareerpath' // for CREATE + } + return url + }, + defaults: { + 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 + CourseCareer: []//Array:Arranging the Courses + } + }) +}) \ No newline at end of file diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js new file mode 100644 index 000000000..fe7ddb181 --- /dev/null +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -0,0 +1,24 @@ +$(function() { + + App.Views.AddCourseCareer = Backbone.View.extend({ + template: $('#template-addCourseCareer').html(), + vars: {}, + events: { + }, + "click .back_button":function() + { + Backbone.history.navigate('courseCareerPath' + this.levelId + '/' + this.revId, { + trigger: true + }) + }, + initialize: function() { + + }, + render: function() { + this.$el.html(_.template(this.template,this.vars)) + } + + + }) + +}) diff --git a/app/MyApp/app/views/CourseCareerPath.js b/app/MyApp/app/views/CourseCareerPath.js new file mode 100644 index 000000000..d1e638828 --- /dev/null +++ b/app/MyApp/app/views/CourseCareerPath.js @@ -0,0 +1,19 @@ +$(function() { + + App.Views.CourseCareerPath = Backbone.View.extend({ + template: $('#template-courseCareerPath').html(), + vars: {}, + events: { + }, + + initialize: function() { + + }, + render: function() { + this.$el.html(_.template(this.template,this.vars)) + } + + + }) + +}) diff --git a/app/MyApp/index.html b/app/MyApp/index.html index f1a427d31..01f7edaad 100644 --- a/app/MyApp/index.html +++ b/app/MyApp/index.html @@ -256,7 +256,8 @@ - + + @@ -1438,6 +1439,58 @@

+ + + + @@ -1457,36 +1458,34 @@


<%= languageDict.attributes.New_Career_Path %>

- -
-
- - - - - - + + + + + + + + + - - + +
- - - - - - - -
Course CareerAction
+ Course Career + Courses List + Action +
diff --git a/init_docs/Text.json b/init_docs/Text.json index 57132b88c..49b83b697 100644 --- a/init_docs/Text.json +++ b/init_docs/Text.json @@ -74,6 +74,10 @@ "language": "Language", "subject": "Subject(s)", "level": "Level(s)", + "Level_Name":"Level Name", + "Course_Career_Path_Name":"Course Career Path Name", + "List_of_Courses":"List of Courses", + "Create_Course_Career":"Create Course Career", "publisher_attribution": "Publisher/Attribution", "link_to_license": "Link to License", "resource_for": "Resource For", From acce8e6381ef97aeb159be740a55a2ff219c2111 Mon Sep 17 00:00:00 2001 From: Rupesh Manandhar Date: Fri, 2 Jun 2017 15:46:52 +0545 Subject: [PATCH 03/32] [#840] added multiselect feature --- app/MyApp/app/Router.js | 1 + app/MyApp/index.html | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/MyApp/app/Router.js b/app/MyApp/app/Router.js index 4680e5cd7..5df7e8288 100644 --- a/app/MyApp/app/Router.js +++ b/app/MyApp/app/Router.js @@ -6754,6 +6754,7 @@ $(function() { App.$el.children('.body').html('
'); $('#ManageCourseCareer').append('

'+App.languageDict.attributes.Add_Multiple_Courses+'

') $('#ManageCourseCareer').append(addCourseCareer.el); + $('#LCourse').multiselect({columns: 1,placeholder: 'Select Course'}); var directionOfLang = App.languageDict.get('directionOfLang'); applyCorrectStylingSheet(directionOfLang) diff --git a/app/MyApp/index.html b/app/MyApp/index.html index 8ac3be520..5de20cdbf 100644 --- a/app/MyApp/index.html +++ b/app/MyApp/index.html @@ -1461,23 +1461,22 @@

<%= languageDict.attributes.New_Career_Path %>

- - + - <%for(var i =0; i <%}%> - - + +
From ec0d6a94b5bad29124a9c0efaa4a170d412e437d Mon Sep 17 00:00:00 2001 From: pr0chin Date: Fri, 2 Jun 2017 15:52:51 +0545 Subject: [PATCH 04/32] [#840] Some Changes --- ...oursecarrerPath.js => CoursecareerPath.js} | 11 ++++--- app/MyApp/app/views/AddCourseCareer.js | 33 +++++++++++++++---- app/MyApp/index.html | 7 ++-- 3 files changed, 36 insertions(+), 15 deletions(-) rename app/MyApp/app/models/{CoursecarrerPath.js => CoursecareerPath.js} (65%) diff --git a/app/MyApp/app/models/CoursecarrerPath.js b/app/MyApp/app/models/CoursecareerPath.js similarity index 65% rename from app/MyApp/app/models/CoursecarrerPath.js rename to app/MyApp/app/models/CoursecareerPath.js index 91dc2923f..3d529abc5 100644 --- a/app/MyApp/app/models/CoursecarrerPath.js +++ b/app/MyApp/app/models/CoursecareerPath.js @@ -1,6 +1,6 @@ $(function() { - App.Models.CourseCareerPath = Backbone.Model.extend({ + App.Models.CoursecareerPath = Backbone.Model.extend({ idAttribute: "_id", url: function() { @@ -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 - } + }, }) }) \ No newline at end of file diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js index 2aa78ddba..1cc4d9d94 100644 --- a/app/MyApp/app/views/AddCourseCareer.js +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -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 + @@ -1461,8 +1462,8 @@

<%= languageDict.attributes.New_Career_Path %>

- + @@ -1471,7 +1472,7 @@

<%= languageDict.attributes.New_Career_Path %>

<%for(var i =0; i - - <%}%> + + <%}%> From d79ab6cfe2407c26a43eb6832841bed0271af60b Mon Sep 17 00:00:00 2001 From: pr0chin Date: Mon, 5 Jun 2017 14:03:08 +0545 Subject: [PATCH 06/32] [#840]:Changes Made --- app/MyApp/app/collections/CourseCareerPath | 29 +++++++++++++++ app/MyApp/app/models/CoursecareerPath.js | 5 ++- app/MyApp/app/views/AddCourseCareer.js | 43 ++++++++++++++-------- app/MyApp/index.html | 1 + databases/coursecareerpath.js | 6 +-- 5 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 app/MyApp/app/collections/CourseCareerPath diff --git a/app/MyApp/app/collections/CourseCareerPath b/app/MyApp/app/collections/CourseCareerPath new file mode 100644 index 000000000..23ddf3394 --- /dev/null +++ b/app/MyApp/app/collections/CourseCareerPath @@ -0,0 +1,29 @@ +$(function() { + + App.Collections.CourseCareerPath = Backbone.Collection.extend({ + + url: function() { + if (this.CoursePathName != "" && this.MemberID != "") { + return App.Server + '/coursecareerpath/_design/bell/_view/GetCourseCareerByLevelNameMemberIds/?key=["' +this.CoursePathName + '","' +this.MemberID+ '"]&include_docs=true' + } else { + return App.Server + '/coursecareerpath/_all_docs?include_docs=true' + } + }, + + parse: function(response) { + var models = [] + _.each(response.rows, function(row) { + models.push(row.doc) + }); + return models + }, + + comparator: function(model) { + var type = model.get('Type') + if (type) return type.toLowerCase() + }, + + model: App.Models.CourseacreerPath + }) + +}) diff --git a/app/MyApp/app/models/CoursecareerPath.js b/app/MyApp/app/models/CoursecareerPath.js index 3d529abc5..f5c0dfebe 100644 --- a/app/MyApp/app/models/CoursecareerPath.js +++ b/app/MyApp/app/models/CoursecareerPath.js @@ -17,9 +17,10 @@ $(function() { }, schema: { Level_Name: 'Text', - Course_Title: 'Text', + CoursePathName:'Text', + Courselist: 'Text', CourseIds:[],//Array:Multiple Courses - CourseCareer: []//Array:Arranging the Courses + MemberID:'Text' }, }) }) \ No newline at end of file diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js index 1cc4d9d94..f8a35b508 100644 --- a/app/MyApp/app/views/AddCourseCareer.js +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -5,7 +5,7 @@ $(function() { vars: {}, events: { "click #AddCareerPath": function() { - this.saveCareerPath(); + this.saveCareerPath(); }, "click #CancelCOursePath": function(e) { this.saveCareerPath(); @@ -17,18 +17,30 @@ $(function() { }, saveCareerPath: function(){ - var levelname = $('#level').val() + var levelname = $('#levelSelect').val() + var coursecareerpath = $('#careerPath').val() + var res = $('input:checked[name="multiselect_LCourse"]').val() + /* if ($("input[name = 'LCourse[]']").val() != undefined) { + var res = []; + $("input[name = 'LCourse[]']:checked").each(function(index) { + if($(this).is(':checked')==true){ + res.push(decodeURI($(this).val())); + } + }); + } + console.log(res)*/ var coursetitle = $('#LCourse').val() var arrcourseId = [] - for(var i = 0; i '+App.languageDict.attributes.Finish+'
  '); this.vars.Courselist = arrcourses - this.vars.Course_Length = this.collection.models.length + this.vars.Course_Length = this.collection.models.length-1 this.$el.html(_.template(this.template,this.vars)) }, - - }) }) diff --git a/app/MyApp/index.html b/app/MyApp/index.html index f44158684..981f940fc 100644 --- a/app/MyApp/index.html +++ b/app/MyApp/index.html @@ -185,6 +185,7 @@ + diff --git a/databases/coursecareerpath.js b/databases/coursecareerpath.js index b82515352..5cdfdb154 100644 --- a/databases/coursecareerpath.js +++ b/databases/coursecareerpath.js @@ -13,10 +13,10 @@ ddoc.views = { } } }, - GetCourseCareerByMember: { + GetCourseCareerByLevelNameMemberIds: { map: function(doc) { - if (this.MemberID != "") { - emit([doc.MemberID], doc); + if (this.CoursePathName!= "" && this.MemberID != "" ) { + emit([doc.CoursePathName,doc.MemberID], doc); } } }, From 472c5738c0d410a390fededc50c57ccb59591d62 Mon Sep 17 00:00:00 2001 From: Rupesh Manandhar Date: Mon, 5 Jun 2017 15:57:35 +0545 Subject: [PATCH 07/32] [#840]:list of courseCareer --- .../{CourseCareerPath => CourseCareerPath.js} | 7 +++---- app/MyApp/app/views/AddCourseCareer.js | 9 +++++++++ app/MyApp/index.html | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) rename app/MyApp/app/collections/{CourseCareerPath => CourseCareerPath.js} (86%) diff --git a/app/MyApp/app/collections/CourseCareerPath b/app/MyApp/app/collections/CourseCareerPath.js similarity index 86% rename from app/MyApp/app/collections/CourseCareerPath rename to app/MyApp/app/collections/CourseCareerPath.js index 23ddf3394..25663ab60 100644 --- a/app/MyApp/app/collections/CourseCareerPath +++ b/app/MyApp/app/collections/CourseCareerPath.js @@ -3,7 +3,7 @@ $(function() { App.Collections.CourseCareerPath = Backbone.Collection.extend({ url: function() { - if (this.CoursePathName != "" && this.MemberID != "") { + if (this.CoursePathName!= undefined && this.MemberID!= undefined ) { return App.Server + '/coursecareerpath/_design/bell/_view/GetCourseCareerByLevelNameMemberIds/?key=["' +this.CoursePathName + '","' +this.MemberID+ '"]&include_docs=true' } else { return App.Server + '/coursecareerpath/_all_docs?include_docs=true' @@ -21,9 +21,8 @@ $(function() { comparator: function(model) { var type = model.get('Type') if (type) return type.toLowerCase() - }, - - model: App.Models.CourseacreerPath + } }) }) + diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js index 59a59019c..a60782017 100644 --- a/app/MyApp/app/views/AddCourseCareer.js +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -51,6 +51,15 @@ $(function() { arrcourses.push(courseslist) arrCourseIds.push(courseId) } + var courseCareers = new App.Collections.CourseCareerPath() + courseCareers.memberId = $.cookie('Member._id'); + courseCareers.fetch({ + async:false + }); + this.vars.careerList = []; + for(var i = 0; i < (courseCareers.length -1 ); i++) { + this.vars.careerList.push(courseCareers.models[i].attributes); + } this.vars.Courselist = arrcourses this.vars.Courseid = arrCourseIds this.vars.Course_Length = this.collection.models.length-1 diff --git a/app/MyApp/index.html b/app/MyApp/index.html index b68499b1e..542e5a52a 100644 --- a/app/MyApp/index.html +++ b/app/MyApp/index.html @@ -1486,6 +1486,13 @@

<%= languageDict.attributes.New_Career_Path %>

Course Career Courses List Action + <% for (var i=0; i < careerList.length; i++){%> + + <%= careerList[i].CoursePathName %>Courses + <%= careerList[i].Courses %> + + + <% } %>
From b6b76508974a3b9cfe9668091df03f9dd790f9cc Mon Sep 17 00:00:00 2001 From: pr0chin Date: Mon, 5 Jun 2017 15:58:49 +0545 Subject: [PATCH 08/32] [#840]:Upgrading --- .../{CourseCareerPath => CourseCareerPath.js} | 5 +---- app/MyApp/app/views/AddCourseCareer.js | 2 +- app/MyApp/index.html | 20 +++++++++---------- init_docs/Text.json | 5 +++++ 4 files changed, 17 insertions(+), 15 deletions(-) rename app/MyApp/app/collections/{CourseCareerPath => CourseCareerPath.js} (92%) diff --git a/app/MyApp/app/collections/CourseCareerPath b/app/MyApp/app/collections/CourseCareerPath.js similarity index 92% rename from app/MyApp/app/collections/CourseCareerPath rename to app/MyApp/app/collections/CourseCareerPath.js index 23ddf3394..fb0ee19a7 100644 --- a/app/MyApp/app/collections/CourseCareerPath +++ b/app/MyApp/app/collections/CourseCareerPath.js @@ -1,9 +1,8 @@ $(function() { App.Collections.CourseCareerPath = Backbone.Collection.extend({ - url: function() { - if (this.CoursePathName != "" && this.MemberID != "") { + if (this.CoursePathName != "" && this.MemberID != "" && this.CoursePathName!= undefined && this.MemberID!= undefined ) { return App.Server + '/coursecareerpath/_design/bell/_view/GetCourseCareerByLevelNameMemberIds/?key=["' +this.CoursePathName + '","' +this.MemberID+ '"]&include_docs=true' } else { return App.Server + '/coursecareerpath/_all_docs?include_docs=true' @@ -22,8 +21,6 @@ $(function() { var type = model.get('Type') if (type) return type.toLowerCase() }, - - model: App.Models.CourseacreerPath }) }) diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js index 59a59019c..16c6fb884 100644 --- a/app/MyApp/app/views/AddCourseCareer.js +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -54,7 +54,7 @@ $(function() { this.vars.Courselist = arrcourses this.vars.Courseid = arrCourseIds this.vars.Course_Length = this.collection.models.length-1 - this.$el.html(_.template(this.template,this.vars)) + $el.html(_.template(this.template,this.vars)) }, }) diff --git a/app/MyApp/index.html b/app/MyApp/index.html index b68499b1e..240d39287 100644 --- a/app/MyApp/index.html +++ b/app/MyApp/index.html @@ -1451,8 +1451,8 @@

- - +
Course CareerAction + Course Career Title <%= languageDict.attributes.Actions %>
@@ -1465,27 +1465,27 @@

<%= languageDict.attributes.New_Career_Path %>

- <%for(var i =0; i <%}%> - +
- - - + +
Course CareerCourses ListAction + <%= languageDict.attributes.Course_Career %><%= languageDict.attributes.Courses_List %><%= languageDict.attributes.Actions %>
diff --git a/init_docs/Text.json b/init_docs/Text.json index 49b83b697..d4b4c4afd 100644 --- a/init_docs/Text.json +++ b/init_docs/Text.json @@ -76,7 +76,12 @@ "level": "Level(s)", "Level_Name":"Level Name", "Course_Career_Path_Name":"Course Career Path Name", + "Course_Career":"Course Career", + "Courses_List":"Courses List", + "Course_Career_Title":"Course Career Title", "List_of_Courses":"List of Courses", + "Beginners":"Beginners", + "Intermediate":"Intermediate", "Create_Course_Career":"Create Course Career", "publisher_attribution": "Publisher/Attribution", "link_to_license": "Link to License", From 72f41a504d05aca7ec67dd0334793d5a11bb9dd7 Mon Sep 17 00:00:00 2001 From: pr0chin Date: Mon, 5 Jun 2017 16:45:41 +0545 Subject: [PATCH 09/32] [#840]:AddCourseCareer completed --- app/MyApp/app/collections/CourseCareerPath.js | 8 -------- app/MyApp/app/views/AddCourseCareer.js | 10 +++++++--- app/MyApp/index.html | 6 ++++-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/MyApp/app/collections/CourseCareerPath.js b/app/MyApp/app/collections/CourseCareerPath.js index 3125a8017..393e4f22a 100644 --- a/app/MyApp/app/collections/CourseCareerPath.js +++ b/app/MyApp/app/collections/CourseCareerPath.js @@ -2,11 +2,7 @@ $(function() { App.Collections.CourseCareerPath = Backbone.Collection.extend({ url: function() { -<<<<<<< HEAD:app/MyApp/app/collections/CourseCareerPath.js - if (this.CoursePathName != "" && this.MemberID != "" && this.CoursePathName!= undefined && this.MemberID!= undefined ) { -======= if (this.CoursePathName!= undefined && this.MemberID!= undefined ) { ->>>>>>> 472c5738c0d410a390fededc50c57ccb59591d62:app/MyApp/app/collections/CourseCareerPath.js return App.Server + '/coursecareerpath/_design/bell/_view/GetCourseCareerByLevelNameMemberIds/?key=["' +this.CoursePathName + '","' +this.MemberID+ '"]&include_docs=true' } else { return App.Server + '/coursecareerpath/_all_docs?include_docs=true' @@ -24,11 +20,7 @@ $(function() { comparator: function(model) { var type = model.get('Type') if (type) return type.toLowerCase() -<<<<<<< HEAD:app/MyApp/app/collections/CourseCareerPath.js - }, -======= } ->>>>>>> 472c5738c0d410a390fededc50c57ccb59591d62:app/MyApp/app/collections/CourseCareerPath.js }) }) diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js index d596e7928..ae372a30e 100644 --- a/app/MyApp/app/views/AddCourseCareer.js +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -56,14 +56,18 @@ $(function() { courseCareers.fetch({ async:false }); + console.log(courseCareers) this.vars.careerList = []; - for(var i = 0; i < (courseCareers.length -1 ); i++) { - this.vars.careerList.push(courseCareers.models[i].attributes); + for(var i = 0; i < (courseCareers.length); i++) { + if(courseCareers.models[i].attributes._id !== "_design/bell"){ + this.vars.careerList.push(courseCareers.models[i].attributes); + } } + console.log(this.vars.careerList) this.vars.Courselist = arrcourses this.vars.Courseid = arrCourseIds this.vars.Course_Length = this.collection.models.length-1 - $el.html(_.template(this.template,this.vars)) + this.$el.html(_.template(this.template,this.vars)) }, }) diff --git a/app/MyApp/index.html b/app/MyApp/index.html index 4844403c1..1001e02bc 100644 --- a/app/MyApp/index.html +++ b/app/MyApp/index.html @@ -1484,13 +1484,15 @@

<%= languageDict.attributes.New_Career_Path %>

+ - Courses + - + + <% } %>
<%= languageDict.attributes.Course_Career %><%= languageDict.attributes.Level_Name %> <%= languageDict.attributes.Courses_List %> <%= languageDict.attributes.Actions %> <% for (var i=0; i < careerList.length; i++){%>
<%= careerList[i].CoursePathName %><%= careerList[i].CoursePathName %> <%= careerList[i].Level_Name %> <%= careerList[i].Courses %>
From 1e319ff7a08977376ec1ebec5b021fc56423e73b Mon Sep 17 00:00:00 2001 From: pr0chin Date: Tue, 6 Jun 2017 14:42:09 +0545 Subject: [PATCH 10/32] [#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 @@

+ - + + + + @@ -1473,25 +1474,25 @@

<%= languageDict.attributes.New_Career_Path %>

<%}%> +
- +
diff --git a/databases/coursecareerpath.js b/databases/coursecareerpath.js index 5cdfdb154..a3088ff5b 100644 --- a/databases/coursecareerpath.js +++ b/databases/coursecareerpath.js @@ -20,5 +20,12 @@ ddoc.views = { } } }, + getCourseCareerByName: { + map: function(doc) { + if (this.CoursePathName!= "") { + emit([doc.CoursePathName], doc); + } + } + } } module.exports = ddoc; \ No newline at end of file From 59ac28474095c527a0acd000d5617f3539751249 Mon Sep 17 00:00:00 2001 From: pr0chin Date: Fri, 9 Jun 2017 15:31:45 +0545 Subject: [PATCH 16/32] [#840]:Latest push Course Career --- app/MyApp/app/Router.js | 12 +++++++++- app/MyApp/app/views/AddCourseCareer.js | 14 +++++++++++- app/MyApp/app/views/CourseCareerPath.js | 28 ++++++++++++++++++++--- app/MyApp/app/views/ManageCourseCareer.js | 1 + app/MyApp/index.html | 2 +- 5 files changed, 51 insertions(+), 6 deletions(-) diff --git a/app/MyApp/app/Router.js b/app/MyApp/app/Router.js index c3686a260..d18eeb742 100644 --- a/app/MyApp/app/Router.js +++ b/app/MyApp/app/Router.js @@ -6741,7 +6741,17 @@ $(function() { $('#CareerPath').append('

'+App.languageDict.attributes.Course_Career_Path+'

') $('#CareerPath').append(coursePath.el); var directionOfLang = App.languageDict.get('directionOfLang'); - applyCorrectStylingSheet(directionOfLang) + applyCorrectStylingSheet(directionOfLang); + $.ajax({ + url: '/coursecareerpath/_design/bell/_view/getCourseCareerByName', + type: 'GET', + dataType: "jsonp", + async: false, + success: function(json) { + console.log(json) + $(careerList).insertBefore('#searchText'); + } + }); }, addCareerPath:function(){ var courses = new App.Collections.Courses() diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js index a79d7834c..12bc6e100 100644 --- a/app/MyApp/app/views/AddCourseCareer.js +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -9,6 +9,18 @@ $(function() { }, "click #CancelCoursePath": function(e) { }, + "click #Delete": function(e) { + var a = $(e.target).attr('data-id') + var career = new App.Models.CoursecareerPath({ + _id: a + }) + career.fetch({ + async: false + }) + career.destroy() + alert(App.languageDict.attributes.Selected); + location.reload(); + }, "click #careerEdit": function(e) { var currentId = $(e.target).attr("data-id"); $('#AddCareerPath').hide(); @@ -24,7 +36,7 @@ $(function() { console.log($('#UpdateCareerPath').attr('data-id')) }, "click #UpdateCareerPath": function(e) { - this.saveCareerPath( $('#UpdateCareerPath').attr('data-id')); + this.saveCareerPath($('#UpdateCareerPath').attr('data-id')); }, }, diff --git a/app/MyApp/app/views/CourseCareerPath.js b/app/MyApp/app/views/CourseCareerPath.js index d1e638828..bcfc491c6 100644 --- a/app/MyApp/app/views/CourseCareerPath.js +++ b/app/MyApp/app/views/CourseCareerPath.js @@ -3,7 +3,12 @@ $(function() { App.Views.CourseCareerPath = Backbone.View.extend({ template: $('#template-courseCareerPath').html(), vars: {}, + searchText: "", + searchCoursePathName: "", events: { + "click .Search": function(e) { + this.renderTable($('#searchText').val().toLowerCase()) + }, }, initialize: function() { @@ -11,9 +16,26 @@ $(function() { }, render: function() { this.$el.html(_.template(this.template,this.vars)) + }, + 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.CourseCareerPath({ + collection: response + }) + careerTable.render(); + $(".btable").append(""+career.models[0].attributes.CoursePathName+"") + App.stopActivityIndicator() + }, + error: function() { + App.stopActivityIndicator() + } + }) } - - }) -}) +}) \ No newline at end of file diff --git a/app/MyApp/app/views/ManageCourseCareer.js b/app/MyApp/app/views/ManageCourseCareer.js index 238384595..11e500ddd 100644 --- a/app/MyApp/app/views/ManageCourseCareer.js +++ b/app/MyApp/app/views/ManageCourseCareer.js @@ -35,6 +35,7 @@ $(function() { console.log("Not Saved") } }); + location.reload() }, render: function() { var multiplecareer = new App.Collections.CourseCareerPath(); diff --git a/app/MyApp/index.html b/app/MyApp/index.html index dc1f86dda..69df9763e 100644 --- a/app/MyApp/index.html +++ b/app/MyApp/index.html @@ -1487,7 +1487,7 @@

<%= languageDict.attributes.New_Career_Path %>

<%= careerList[i].CoursePathName %>
  • <%= careerList[i].Courses %>
- + <% } %> From de5b79224dd45b1ba7f0bc2094cea425e32985f8 Mon Sep 17 00:00:00 2001 From: pr0chin Date: Wed, 14 Jun 2017 10:30:57 +0545 Subject: [PATCH 17/32] 840:Changed as per required --- app/MyApp/app/Router.js | 56 ++---------------------- app/MyApp/app/models/CoursecareerPath.js | 2 +- app/MyApp/app/views/AddCourseCareer.js | 11 ++--- app/MyApp/index.html | 21 ++++----- init_docs/Text.json | 9 +++- 5 files changed, 28 insertions(+), 71 deletions(-) diff --git a/app/MyApp/app/Router.js b/app/MyApp/app/Router.js index ec0422652..c34ddcf05 100644 --- a/app/MyApp/app/Router.js +++ b/app/MyApp/app/Router.js @@ -6735,56 +6735,6 @@ $(function() { App.$el.children('.body').append(passwordResetView.el) }, CourseCareerPath:function(){ - /*App.startActivityIndicator() - var careerPath = new App.Collections.CourseCareerPath() - careerPath.fetch({ - success: function() { - var languageDictValue; - var clanguage = getLanguage($.cookie('Member._id')); - languageDictValue = getSpecificLanguage(clanguage); - App.languageDict = languageDictValue; - var directionOfLang = App.languageDict.get('directionOfLang'); - careerTable = new App.Views.CareerPathTable({ - collection: careerPath - }) - careerTable.render(); - var parentDiv='
'; - var lib_page = $.url().data.attr.fragment; - if(lib_page=="careerPath"){ - $('.body').empty(); - $('#parentLibrary').css('visibility', 'visible'); - } - App.$el.children('.body').append(parentDiv); - $('#parentLibrary').append('

'+App.languageDict.attributes.Course_Career_Path+'

') - var button = '

' - button += ''+App.languageDict.attributes.Back_To_Course+'' - button += 'Add New Career' - //button += ''+App.languageDict.attributes.Request_Course+'' - button += '' - button += '' - button += '

' - $('#parentLibrary').append( button); - $('#parentLibrary').append(careerTable.el); - careerTable.changeDirection(); - if(directionOfLang.toLowerCase()==="right") - { - $("#requestCourseButton").addClass('addMarginsOnRequestCourse'); - $("#addCourseButton").addClass('addMarginsOnCourseUrdu'); - $('#searchText').attr('placeholder',App.languageDict.attributes.KeyWord_s); - $('#searchText').css('margin-left','1%'); - $('#headingOfCourses').css('margin-right','2%'); - } - else - { - $('#searchSpan').css('float','right'); - $('#requestCourseButton').css('margin-left','10px'); - $("#addCourseButton").addClass('addMarginsOnCourse'); - $('#searchText').attr('placeholder',App.languageDict.attributes.KeyWord_s); - } - } - }); - console.log(careerPath); - App.stopActivityIndicator() */ var coursePath = new App.Views.CourseCareerPath(); coursePath.render() App.$el.children('.body').html('
'); @@ -6814,7 +6764,7 @@ $(function() { }); addCourseCareer.render() App.$el.children('.body').html('
'); - $('#ManageCourseCareer').append('

'+App.languageDict.attributes.Course_Career_Path+'

') + $('#ManageCourseCareer').append('

'+App.languageDict.attributes.Career_Path+'

') $('#ManageCourseCareer').append(addCourseCareer.el); $("#EditCareerPath").hide(); $('#LCourse').multiselect().multiselectfilter(); @@ -6842,14 +6792,14 @@ $(function() { }); console.log(courseCareerPath) var manageCouseCareer = new App.Views.ManageCourseCareer({ - collection:courseCareerPath + model:courseCareerPath }); var directionOfLang = App.languageDict.get('directionOfLang'); applyCorrectStylingSheet(directionOfLang) model:courseCareerPath manageCouseCareer.render(); App.$el.children('.body').html('
'); - $('#CourseCareerManage').append('

'+App.languageDict.attributes.Add_Multiple_Courses+'

') + $('#CourseCareerManage').append('

'+App.languageDict.attributes.Add_Multiple_Careers+'

') $('#CourseCareerManage').append(manageCouseCareer.el); $('#careerPathList').hide() $('#LCourse').multiselect().multiselectfilter(); diff --git a/app/MyApp/app/models/CoursecareerPath.js b/app/MyApp/app/models/CoursecareerPath.js index f5c0dfebe..eecd68bc7 100644 --- a/app/MyApp/app/models/CoursecareerPath.js +++ b/app/MyApp/app/models/CoursecareerPath.js @@ -17,7 +17,7 @@ $(function() { }, schema: { Level_Name: 'Text', - CoursePathName:'Text', + CareerPathName:'Text', Courselist: 'Text', CourseIds:[],//Array:Multiple Courses MemberID:'Text' diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js index 1959822f2..534154972 100644 --- a/app/MyApp/app/views/AddCourseCareer.js +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -5,7 +5,7 @@ $(function() { vars: {}, events: { "click #AddCareerPath": function() { - this.saveCareerPath(); + this.saveCareerPath(); }, "click #CancelCoursePath": function(e) { }, @@ -61,7 +61,7 @@ $(function() { } }); var courseCareerTitle = $('#careerPath').val() - courseCareer.set('CoursePathName',courseCareerTitle); + courseCareer.set('CareerPathName',courseCareerTitle); courseCareer.set('Courses',selectedCourseName); courseCareer.set('CourseIds',selectedCourseId); courseCareer.set('MemberID',$.cookie('Member._id')); @@ -85,13 +85,14 @@ $(function() { savecoursecareer.set('CourseIds',selectedCourseId); savecoursecareer.set('MemberID',$.cookie('Member._id')); savecoursecareer.save(null, { - error: function(){ + error: function() { console.log("Not Saved") } - }); - } + }) + } }, + render: function() { var arrcourses = [] var arrCourseIds = [] diff --git a/app/MyApp/index.html b/app/MyApp/index.html index fa6d6dcea..a33a60d3c 100644 --- a/app/MyApp/index.html +++ b/app/MyApp/index.html @@ -1467,31 +1467,32 @@

<%= languageDict.attributes.New_Career_Path %>

- - + + - +
- + - - - + <% } %>
<%= languageDict.attributes.Course_Career %><%= languageDict.attributes.Career_Path %> <%= languageDict.attributes.Courses_List %> <%= languageDict.attributes.Actions %> <% for (var i=0; i < careerList.length; i++){%>
<%= careerList[i].CoursePathName %>
  • <%= careerList[i].Courses %>
class='course btn btn-success'><%=languageDict.attributes.EditLabel%> + <%=languageDict.attributes.DeleteLabel%> + <%=languageDict.attributes.View_Details%> +
@@ -1503,10 +1504,10 @@

<%= languageDict.attributes.New_Career_Path %>

- + @@ -1460,23 +1460,21 @@

- - - + @@ -1475,7 +1476,7 @@

<%for (var i=0; i < careerList.length; i++) {%> - <%= careerList[i].CoursePathName %> + <%= careerList[i].CoursePathName %>
  • <%= careerList[i].Courses %>
  • <%= careerList[i].requiredCareerPathIds%>
@@ -1512,6 +1513,38 @@

<%= languageDict.attributes.Course_Lists %>
+ + From 59256b60033bd62563b89beb26c39d87d5e8034c Mon Sep 17 00:00:00 2001 From: Raju Chaudhary Date: Mon, 15 Jan 2018 14:11:49 +0545 Subject: [PATCH 30/32] [#840] indentation fixed --- app/MyApp/app/Router.js | 9 --------- app/MyApp/app/views/AddCourseCareer.js | 4 +--- app/MyApp/app/views/CourseCareerPath.js | 10 ++++------ app/MyApp/app/views/CourseSearch.js | 1 - app/MyApp/index.html | 1 - 5 files changed, 5 insertions(+), 20 deletions(-) diff --git a/app/MyApp/app/Router.js b/app/MyApp/app/Router.js index 3a86e93ab..9dc0cf988 100644 --- a/app/MyApp/app/Router.js +++ b/app/MyApp/app/Router.js @@ -7342,15 +7342,6 @@ $(function() { CareerPath.fetch({ async:false }); - console.log(CareerPath) - // for (var i = 0; i < CareerPath.attributes.CourseIds.length; i++){ - // var course = new App.Models.Course({ - // _id: CareerPath.attributes.CourseIds[i] - // }) - // course.fetch({ - // async:false - // }) - // } var careerView = new App.Views.CareerDetailView({ model: CareerPath }) diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js index 3835b21a8..7bace5682 100644 --- a/app/MyApp/app/views/AddCourseCareer.js +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -98,7 +98,7 @@ $(function() { courseCareer.set('requiredCareerPathIds',selectedCareerIds); courseCareer.save(null, { success: function(response){ - location.reload(); + location.reload(); }, error: function() { console.log("Not Saved") @@ -136,7 +136,6 @@ $(function() { } }, - render: function() { var careerlength; var arrcourses = [] @@ -154,7 +153,6 @@ $(function() { courseCareers.fetch({ async:false }); - this.vars.careerList = []; for(var i = 0; i < (courseCareers.length); i++) { if(courseCareers.models[i].attributes._id !== "_design/bell"){ diff --git a/app/MyApp/app/views/CourseCareerPath.js b/app/MyApp/app/views/CourseCareerPath.js index 6641edb19..66302f0a2 100644 --- a/app/MyApp/app/views/CourseCareerPath.js +++ b/app/MyApp/app/views/CourseCareerPath.js @@ -7,14 +7,12 @@ $(function() { searchCoursePathName: "", events: { "click .Search": function(e) { - this.renderTable($('#searchText').val().toLowerCase()) - alert('Hi') + this.renderTable($('#searchText').val().toLowerCase()) }, }, - - initialize: function() { - - }, + + initialize: function() {}, + render: function() { this.$el.html(_.template(this.template,this.vars)) }, diff --git a/app/MyApp/app/views/CourseSearch.js b/app/MyApp/app/views/CourseSearch.js index f5151ed7b..cb2785ba9 100644 --- a/app/MyApp/app/views/CourseSearch.js +++ b/app/MyApp/app/views/CourseSearch.js @@ -12,7 +12,6 @@ $(function () { enablenext = 0 }, render: function () { - console.log(searchText) var obj = this if (searchText != "") { this.fetchRecords() diff --git a/app/MyApp/index.html b/app/MyApp/index.html index 5840947eb..29f51ee41 100644 --- a/app/MyApp/index.html +++ b/app/MyApp/index.html @@ -1543,7 +1543,6 @@

CareerDetailView

<%}%> - - - @@ -1483,15 +1481,12 @@

class='course btn btn-success'><%=languageDict.attributes.EditLabel%> <%=languageDict.attributes.DeleteLabel%> - <% } %> - -