Skip to content

Instantly share code, notes, and snippets.

@oivoodoo
Created August 26, 2011 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oivoodoo/1173227 to your computer and use it in GitHub Desktop.
Save oivoodoo/1173227 to your computer and use it in GitHub Desktop.
$(function() {
var BaseController = function(link) {
var context = this;
this.link = link;
this.syncLink = link + "/sync";
$(window).bind('online', function() {
context.sync();
});
};
BaseController.prototype.sync = function() {
var context = this;
$.getJSON(context.syncLink, function(ids) {
if (context.table.isNeedUpdate(ids)) {
$.getJSON(context.link, function(lines) {
context.table.save(lines);
});
}
});
};
var RiskProfile = {};
RiskProfile.Questionnaire = function(link) {
BaseController.apply(this, arguments);
this.table = Storage.define('Questionnaire');
};
inherit(RiskProfile.Questionnaire, BaseController)
RiskProfile.ControlAsnwer = function(link) {
BaseController.apply(this, arguments);
this.table = Storage.define('ControlAnswer');
};
inherit(RiskProfile.ControlAnswer, BaseController)
RiskProfile.SecurityAssessment = function(link) {
BaseController.apply(this, arguments);
this.table = Storage.define('SecurityAssessment');
};
inherit(RiskProfile.SecurityAssessment, BaseController)
window.RiskProfile = RiskProfile;
window.BaseController = BaseController;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment