Skip to content

Commit

Permalink
a bug fixed and a bug introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
bhanuc committed Sep 24, 2015
1 parent a9bbf18 commit bbbfa26
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ A cross Platform Desktop Client which lets Busy Professors create a course WebPa
Download the release from [here](https://github.com/navya/Kalam/releases).

##Dev Build Process
Just Read [DEV-README](https://github.com/navya/Kalam/blob/master/DEV-README.md)
Just Read [DEV-README](https://github.com/navya/Kalam/blob/master/DEV-README.md)


##Contributions :
Expand Down
22 changes: 19 additions & 3 deletions app/js/db_func.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ function showcourse() {
});
}

function update_single_field(type, value) {
var course = window.course;
db.get(course._id).then(function(doc) {
course._rev = doc._rev;
course._id = id;
course[type] = value
window.course = course
return db.put(course);
}).then(function(response) {
alertify.success('course updated.')
update_ui()
}).catch(function(err) {
console.log(JSON.stringify(err));
});
}

function updatecoursebyid(id, course) {
db.get(id).then(function(doc) {
course._rev = doc._rev;
Expand All @@ -45,14 +61,14 @@ function updatefilebyid(id, course, output, elemid) {
db.get(id).then(function(doc) {
course._rev = doc._rev;
course._id = id;
doc[elemid] = doc[elemid]|| []
course[elemid]= _.uniq(_.union(doc[elemid], output))
doc[elemid] = doc[elemid] || []
course[elemid] = _.uniq(_.union(doc[elemid], output))
localStorage.setItem('course', JSON.stringify(course));
window.course = course;
return db.put(course);
}).then(function(response) {
alertify.success('course updated.')
updateattachments(course[elemid], elemid)
update_ui()
}).catch(function(err) {
console.log(JSON.stringify(err));
});
Expand Down
7 changes: 4 additions & 3 deletions app/js/single.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

function updatefield(type) {
var id = getelem('formfield-' + type).dataset.value;
getelem(id).innerHTML = template[type](id, 'get')
var value = template[type](id, 'get')
update_single_field( id, value)
overlay(type)
}

Expand Down Expand Up @@ -61,7 +62,7 @@
return a
}

function updateattachments() {
function update_ui() {
//Updates the UI currently only refreshes :P
getcoursebyid(window.location.hash.slice(8))
//overlay('attachments')
Expand Down Expand Up @@ -97,7 +98,7 @@
}
tmp = ''
getelem("fields").innerHTML = str;
updateattachments(course.cour)
update_ui()
}

function getcoursebyid(id) {
Expand Down

0 comments on commit bbbfa26

Please sign in to comment.