Hide some content of a page in editing view ?

Paul LALANNE August 3, 2014

Hi (an sorry for my english),

Would there be a way to hide some content of a page, but only in edit view? So that defined users could be able to see the entire content of the page in normal view, but not be able to edit the concerned parts?

I've tried the visibility plugin but with no result (i'm able to hide some content in normal view, but not in edit...). I'm not even sure that there's a way to achieve this.

I'm trying to make the edit view the most "simple" as possible, because the page layout (ex: sections and colums macros, etc) could confuse some of my users. I think i can't do this with template variables, due to the amount of text the users should be able to add.

Any help would be apprecated...

Thanx in advance.

5 answers

0 votes
Fabian Hußl June 27, 2019

Hi, 

I liked the idea of @Stephen Deutsch2  and wrote a User Macro.

## Macro title: Hidden Metadata 
## Macro has a body: Y
## Body processing: Rendered
##
## Developed by: Fabian Hußl
## Date created: 27/06/2019
## Installed by: My Name

## @noparams

<div>$body</div> 

 

The actual magic happens in Custom HTML via Javascript at At end of the BODY.

<script type="text/javascript"> 
  AJS.toInit(function ($) {
    setTimeout(function () {
      if ( !AJS.Meta.get('is-space-admin') || jQuery('#space-admin-link').length == 0 ) {
        jQuery("#wysiwygTextarea_ifr").contents().find("table.wysiwyg-macro[data-macro-name='hidden-metadata']>tbody>tr>td.wysiwyg-macro-body").attr("style", "display:none;");
      } else {
        jQuery("#wysiwygTextarea_ifr").contents().find("table.wysiwyg-macro[data-macro-name='hidden-metadata']>tbody>tr>td.wysiwyg-macro-body").attr("style", "display:table-cell;");
      }
    }, 2000);
  });
</script>

 

The user macro should make it possible to hide content in the edit mode of a page for non-administrators.

Administrators see all content as usual.

Regards
Fabian

0 votes
Paul LALANNE August 3, 2014

I tried this this morning, with the include page macro. It worked, but not rendered properly some parts of the layout. I'll give a try to the excerpt one. Hoped a "hide" macro would have done the job better.

Thanx a lot anyway.

Regards.

0 votes
Guilherme Nedel [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 3, 2014

Hello Paul, there is one way to enclose content in a separate macro which can keep customers away from editing such, the only risk would be to have the macro itself removed from the page:

There is a Macro called Excerpt Include which can pull content from another page into the target one, and one can assign edit permissions to the originating page.

Hope this can be a solution.

0 votes
Paul LALANNE August 3, 2014

Hi Stephen.

Thanks a lot for your answer and the tip. I'll give it a try.

Thanx again.

0 votes
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2014

Hi Paul,

There's not really such a good way to do so, but you might consider copying and pasting the content (using the source editor plugin) into a user macro (and setting it to visible only for administrators). That's the only way I know of that you could do what you asked. Just be aware that if you have to do this for a lot of pages you will have a ton of user macros... Not exactly ideal, but there you have it.

Best regards

Stephen

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events