From 72c77d21b5139e4429252d77069d34b374c4cbdd Mon Sep 17 00:00:00 2001 From: pr0chin Date: Thu, 1 Jun 2017 12:53:49 +0545 Subject: [PATCH] [#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 @@

+ + + +