AnsweredAssumed Answered

Hide some buttons using JS

Question asked by Joni Miller Expert on Mar 23, 2016
Latest reply on Mar 24, 2016 by shane.ohara@unh.edu

Hi, I'm moving this over as a continuation from the Canvas Beta Release Notes (2016-03-21)  comments.

Thanks Shane O'Hara for the help on hiding the delete, reset, and conclude buttons!

 

I would also like to hide the

+people button on the people page for instructors

+discussion button on the discussions page for students

 

The code that I have right now isn't working very well.  I don't think it's right.

+people button:  hides it from admins but then if we refresh the screen it shows up sometimes after refreshing 1-10 times, depending on the browser, AND it will show up for teachers if they do the same

+discussions:  hides it from admins and teachers but then if we refresh the screen it shows up sometimes after refreshing 1-10 times, depending on the browser, AND it will show up for teachers if they do the same

 

As you can imagine, this is annoying!  Can anyone help???  Thank you!!!

 

This is the code I have for each of these now that is not working properly:

/*remove the +people button for teachers*/

  for(x=0;x<ENV.current_user_roles.length;x++){

    if(ENV.current_user_roles[x]=='teacher'){

        $('#addUsers').remove();

        }

    }

 

 

/*remove the +discussion button for students*/ 

    if(ENV.current_user_roles.indexOf("student") > -1) {

        $('#new-discussion-btn').remove();

    }

Outcomes