Right now I'm very into Geneva version since we are going to update from Fuji in 2 weeks. So I guess the couple of next posts will be about Geneva "problems" or new features. So this time I'm going to show how easy you can hide the "three dotted menu" from end users. What I'm talking about is the menu that contains the template choice, tag etc.
So, the code itself is very small so I'm also going to show how you easy can find out the ID(name) of the menu so you can put it in the code. For most of the people reading, this is basic stuff, but for other people like me without a dev background from the start it might be something new. This opened up a new world for me when I learned it and hopefully it will do the same for someone else.
So, lets go to a page which has the menu that I want to hide. for example an incident form. Now what we are going to use is the developer tools that comes with the browser. In my case I'll show with Firefox, but it works as good with Chrome.
So what you do is you hold "ctrl" and right click on the menu like this and choose "Inspect Element":
Now in the log at the bottom you shows you the html-code for the menu and you can see as well how the menu is "glowing", showing graphically where the code is. Clicking around here can give you a lot of information and new ideas. You can also on the on the right-part of the menu below do a lot of CSS-stuff to check the effect live, but I feel that in that area I'm still a newbie and leave others to tell more about it, but try it =)
Now, the info we want is the ID and you can see it at the beginning. <button id="toggleMoreOptions" and this is what we need for our code.
Now lets hide it!
In this scenario we have different views beside "self service" so this ui policy will need to check if the user has any roles instead of just setting the UI policy to a specific view instead of having the check in the code.
So if you only have one view, you can specify that in the "when to apply" and skip row nr. 2 in the code.
I'm using the gel() which pretty much is a shortcut for "document.getElementById".
So, that's it 8)
//Göran
Inga kommentarer:
Skicka en kommentar