Forum Discussion

saarah's avatar
saarah
Adept
8 years ago

Board subscription option

We want people to really easily see the Subscribe option. Is there any way to take out the subscribe button outside the dropdown.

  • saarah

    Ohh you are using it in js. It would not be possible to use restadmin in js.  In this scenario, you have to make a call to the endpoint. Where you can use the restadmin call like this

    <#assign subscribe = restadmin("/boards/id/${board_id}/subscriptions/users/self/add?subscription.type=email") />

     

10 Replies

  • saarah

    Yes, you can do it. 

    There are some ways you can use to get it done
    a) Use lithium OOTB component. Here is the component

    <@component id="subscriptions.action.add-message-user-email"/>

    b) Create it custom using lithium subscription APIs

  • saarah's avatar
    saarah
    Adept
    8 years ago

    VikasB My bad! It returns

    RenderQueueException:Render queue error in SetupRender[subscriptions/contributions/MessageActions:addmessageuseremailsubscription]: Failure reading parameter 'isVisible' of component subscriptions/contributions/MessageActions:addmessageuseremailsubscription$isvisible: No object of type lithium.web2.data.entity.PrimaryRenderContextEntity is available from the Environment. 

  • saarah's avatar
    saarah
    Adept
    8 years ago

    Also, we tested it with community APIs but running into permission issue. Do we need to set any permissions at back end. 

  • VikasB's avatar
    VikasB
    Boss
    8 years ago

    saarah

    I do not think so we need to set any permissions at the back end. And please share the  API you are using.  Also, give it a shot with restadmin if you are using rest call. 

  • saarah's avatar
    saarah
    Adept
    8 years ago

    Here it is. Do I need to replace the text restapi with restadminapi?

    $.post('/restapi/vc/boards/id/Careers/subscriptions/users/self/add?subscription.type=email,{},function(response,status) {})

  • VikasB's avatar
    VikasB
    Boss
    8 years ago

    saarah

    Ohh you are using it in js. It would not be possible to use restadmin in js.  In this scenario, you have to make a call to the endpoint. Where you can use the restadmin call like this

    <#assign subscribe = restadmin("/boards/id/${board_id}/subscriptions/users/self/add?subscription.type=email") />

     

  • luk's avatar
    luk
    Boss
    8 years ago

    If you're already touching Javascript you can also just create a custom button that you inject in some place where  it's useful/visible and then trigger a click on the link in the dropdown menu once the button is clicked...

     

    jQuery('<button class="button-subscribe-blog"><span>Subscribe</span></button>').prependTo('.lia-quilt-column-main-content');
    
    if ( jQuery('.lia-component-subscriptions-action-remove-board-user-email').length ) {
    	jQuery('.button-subscribe-blog span').text('Unsubscribe').parent().show();
    	jQuery('.button-subscribe-blog').on("click", function() {
    		jQuery('.lia-component-subscriptions-action-remove-board-user-email').trigger('click');
    	});
    } else {
    	jQuery('.button-subscribe-blog').show();
    	jQuery('.button-subscribe-blog').on("click", function() {
    		jQuery('.lia-component-subscriptions-action-add-board-user-email').trigger('click');
    	});
    }