Created
July 5, 2014 22:08
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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