cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
matt5834
Community Participant

How to Display Content on Course Pages for Teacher Role?

Jump to solution

Hi-

We want to include content (likely just links) directly within certain course pages that will only display for the teacher role. These links will go to teacher resources for the course as a way to provide a teaching guide.

Can anyone suggest a way I might do this? I have Kynnethware  installed already .... maybe some javascript to go along with that?

Thank you!
Matt

1 Solution

Accepted Solutions
dgrobani
Community Champion

Sorry, Matt, I misunderstood, but I think we're close.

What if you edited the HTML of the pages to embed id attributes, then use code incorporating the condition I provided to target those id's and insert hyperlinks to the teacher-only materials?

View solution in original post

5 Replies
awilliams
Instructure
Instructure

Hey matt5834​, hopefully someone will come along and answer your specific question, but I know of at least one other way to accomplish this. You could start all your new course shells out with an unpublished module that contains links for the faculty.

dgrobani
Community Champion

Here's how I added a left navigation tab visible only to teachers:

if (document.URL.indexOf('courses') > -1 && ENV.current_user_roles.indexOf('teacher') > -1) {

    $('div#left-side nav ul#section-tabs').append('<li class="section"><a class="collaborations" href="https://www.samuelmerritt.edu/online_faculty_resources">Faculty Resources</a></li>');

}

At the moment I don't remember why the 'class="collaborations"' bit.

matt5834
Community Participant

Thanks for this! 

However, I'm really looking to add unique items directly on individual Course pages (mostly Content and Assignment pages) only Teachers will see when they view the course. The course is quite long and involved and I'd like for teachers to be able to link directly from a particular course page to the exact  teacher resource that will help them. It will also link to a specific teacher discussion on a separate forum community.

Is what I'm asking even possible?

Thanks!

-Matt

dgrobani
Community Champion

Sorry, Matt, I misunderstood, but I think we're close.

What if you edited the HTML of the pages to embed id attributes, then use code incorporating the condition I provided to target those id's and insert hyperlinks to the teacher-only materials?

View solution in original post

matt5834
Community Participant

That did it!

I actually got it to work by hiding the elements for 'student'.

Here is my code inside of the condition you provided above. :

if (document.URL.indexOf('courses') > -1 && ENV.current_user_roles.indexOf('student') > -1) {

    $('div#left-side nav ul#section-tabs').append('<li class="section"><a class="collaborations" href="https://www.samuelmerritt.edu/online_faculty_resources">Faculty Resources</a></li>');

hide(document.querySelectorAll('.target1'));

function hide (elements) {

  elements = elements.length ? elements : [elements];

  for (var index = 0; index < elements.length; index++) {

    elements[index].style.display = 'none';

  }

}

}

Any div with the class 'target1' will be hidden for students.