[ARCHIVED] Java Script no longer working after unknown code changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did anyone have their custom Java Script break? We were hiding several buttons from faculty and suddenly they have reappered. No matter what I change my Java Script to I cannot hide the buttons from faculty. I was tolde to replace my first line with if ($.inArray("admin", ENV.current_user_roles) == -1) which doesn't work.
Does anyone know what in God's name they changed?
Thanks
Melissa
Here is the original code:
// Checks that current user role is is a teacher, Admins can see the buttons. Also allows Admins who are also Teachers
// to see the buttons. You many need to adjust the current user role name and ID to match the exceptions for your institution.
// You also may need to comment out buttons that you want to allow your teachers to see.
$(document).ready(function(){
if($.inArray('teacher',ENV['current_user_roles']) === 2 && $.inArray('admin',ENV['current_user_roles']) === 3 )
{
$('a.btn.button-sidebar-wide.reset_course_content_button').show();
$("a:contains('Conclude this Course')").show();
$('a.btn.button-sidebar-wide.delete_course_link').show();
}
else if
($.inArray('admin',ENV['current_user_roles']) === 2 || $.inArray('admin',ENV['current_user_roles']) === 3 ) {
$('a.btn.button-sidebar-wide.reset_course_content_button').show();
$("a:contains('Conclude this Course')").show();
$('a.btn.button-sidebar-wide.delete_course_link').show();
$("a:contains('Add Section')").hide();
}
else {
($.inArray('teacher',ENV['current_user_roles']) === 3 )
$('a.btn.button-sidebar-wide.reset_course_content_button').hide();
$("a:contains('Conclude this Course')").hide();
$('a.btn.button-sidebar-wide.delete_course_link').hide();
$('a.btn.button-sidebar-wide.crosslist_link').hide();
$("input#course_section_name").hide();
$("input#course_section_name").parent().hide();
}
});
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.