Edit only module

I want to have the option to create a button on UI that redirects content writers in my company to our ticket management system. Regardless to say, this must be available in editor mode only and not accessible to the users. How would one go about acheiving this?

You can’t modify the Hubspot visual composer so the only way I can imagine is displaying a button inside the page itself (in the iframe of the preview) but not really sure if you can actually find a way to display a link only in the previewer.

Good luck!

Hmm.

If all those content writers in your company are known by hubspot (ie: if there is a cookie installed in their browser, because they filled in a form or because they clicked in a link from an email). You could use conditional statements (or smartcontent) to show to button on the page.. depending if they have a certain property with a certain value..
That way only the content-writers would see it?

OR if the people are inside your company and all within the same network, you could use the hubl code to also show the button conditinally by checking the IP address ( {{ request.remote_ip }} )

Another option is, you tell the content writers to add a certain paramter in the url and again use conditional statements to show the button for example:

www.mywebsite.com?user=contentwriter
then use {{ request.query_dict }} - to check the value of user and show the button.

I have a workaround that may work for you but it would require the following:

  • The user wouldn’t be able to “click to follow the button” but instead would have to middle mouse click to open.
  • I can look into javascript to fix it but this is just something I just threw together
  • New code below should work

You can use the following HubL statement in either a HubL module or if using the new design manager, a new custom module.

{% if request.domain == "preview.hs-sites.com" %}<a href="https://google.com" style="z-index:2147483599;position:absolute;padding:25px;left:0;top:50%;background:red;color:#fff;" onclick="window.open('https://www.google.com','_blank')">Support Button</a>{% endif %}

Essentially this checks for the domain being requested and if it equals “preview.hs-sites.com” (which is the domain used for the editor iframe) it will show the content otherwise, it will not show it. Below is a screenshot of both sides so you can see.


As I mentioned, this is a small hack way to go about doing it which def needs to be explored more to make it a working link. I would suggest adding this to the idea forum about being able to create content fields or “Author/Editor” only notices that can be added to the page editors.

-AJ

(edited to include working code with onclick JS)