Add red banner on the Public Share page

Discussion in 'LiquidFiles General' started by Pascal de Vries, Nov 22, 2025.

  1. Pascal de Vries

    Pascal de Vries New Member

    Joined:
    Jan 16, 2024
    Messages:
    16
    Likes Received:
    0
    We are using Public Shares and we want to make it clear for internal users that upload documents to Public Shares that they are only allowed to upload unclassified documents. So we would like to have a banner in red on any Public Share page that says "Please do not upload any classified documents to this Share".

    On the Authenticated Shares page, we should not have that banner. Can this be done by using the custom Java Script option? And if so, what should the script look like?

    Many thanks.
     
  2. David

    David Administrator
    Staff Member

    Joined:
    Dec 1, 2015
    Messages:
    839
    Likes Received:
    34
    With custom javasript is not a problem to place a generic banner on the Share page.
    i.e. like this:
    Code:
    if (!$('.not_logged_in ').length) {
        $('#share_title').after('<div class="alert alert-danger" role="alert"><strong>Please do not upload any classified documents to public  Shares</strong></div>');
     }
    But currently only with javascript itself we can't detect if a particular Share is publicly available or not.
     
  3. Pascal de Vries

    Pascal de Vries New Member

    Joined:
    Jan 16, 2024
    Messages:
    16
    Likes Received:
    0
    Thanks a lot, David. That was what I am looking for. I tested it and it works.
     
  4. David

    David Administrator
    Staff Member

    Joined:
    Dec 1, 2015
    Messages:
    839
    Likes Received:
    34
    Since v4.2.4 has been added a public_share class in the body classes for the Share pages (lf.domain.com/shares/someshare) so now it's possible to identify the public shares and show the banner accordingly only there.

    Code:
    $(function() {
        if ($('body').hasClass('public_share') && !$('.not_logged_in').length) {
              $('#share_title').after('<div class="alert alert-danger" role="alert"><strong>Please do not upload any classified documents to public Shares</strong></div>');
        }
    });
    
     
    David M likes this.
  5. Pascal de Vries

    Pascal de Vries New Member

    Joined:
    Jan 16, 2024
    Messages:
    16
    Likes Received:
    0
    We just upgraded to version 4.2.4. I have tested this new JavaScript and it works perfectly. Many thanks.
     

Share This Page