Skip to content

Instantly share code, notes, and snippets.

@rickcnagy
Created July 5, 2014 22:08
Show Gist options
  • Save rickcnagy/26f76beedfc0f778aa80 to your computer and use it in GitHub Desktop.
Save rickcnagy/26f76beedfc0f778aa80 to your computer and use it in GitHub Desktop.
Disable adding/removing siblings when parents login to the Parent Portal while still allowing them to add/edit parents.
<script type="text/javascript">
$(window).load(function() {
var extendTimer = setInterval(function() {
if (typeof S_ParentTab !== "undefined") {
clearInterval(extendTimer);
disableSiblingsBoxForParents();
}
}, 50);
});
function disableSiblingsBoxForParents() {
S_ParentTab.prototype._renderSiblings = extend(
Rest.get("/sms/v1/self", {}, this, function(returnData) {
if (returnData.personType === "Parent") {
S_ParentTab.prototype._renderSiblings = extend(
S_ParentTab.prototype._renderSiblings, function() {
$(".qpwRow:contains(Siblings) .inputBox")
.unbind("click")
.addClass("readOnly");
});
}
});
}
function extend(oldFunc, newFunc, newFuncIsAfter) {
newFuncIsAfter = newFuncIsAfter || true;
return function() {
if (newFuncIsAfter) {
var ret = oldFunc.apply(this, arguments);
newFunc.apply(this, arguments);
return ret;
} else {
newFunc.apply(this, arguments);
return oldFunc.apply(this, arguments);
}
};
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment