最近搜索


没有最近搜索

Hide Component Based on Role



已于 2024年4月02日 发布

Hello! I am looking to hide recent_activity on the homepage based on the user role.  I do not want end-users to see this section, but leave it in place for Agents and Admins.  Any ideas on how to accomplish this?


1

1

1 条评论

image avatar

Pulkit Pandey

Zendesk LuminaryCommunity Moderator

Hi Alek

 

Please go through the following steps to hide the recent_activity on the homepage for end users and available for the Agents and Admins.

1. Go to the home_page.hbs file and search for the following “{{recent_activity}}” and then add the “hide” class on its wrapper.

 

 

 

2. Then go to the script.js file and add the below code at the bottom 

if (HelpCenter.user.role=="agent"){
    document.querySelector(".home-section.activity").classList.remove("hide");
 }
 if (HelpCenter.user.role=="manager"){
     document.querySelector(".home-section.activity").classList.remove("hide");
 }

 

3. Add the below CSS at the bottom of your style.css file 

 

.hide {
  display: none;
}

 

 

Let me know if it solves your issue 

 

 

Thank You 

 

Pulkit

 

Team Diziana

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0


请先登录再写评论。

找不到所需的内容?

新建帖子