Editing Page Loading Widget

I have recently downloaded the ‘Page Loading’ widget.
We have implemented a webpage that links through to another webpage which takes a while to load, I would like the page loading widget to show whilst it is loading.
The widget seems to only work in an interface setting. I would like to set the Destination to ‘authenticated webpage’ possibly by changing the base format: “page-path” in Code Studio?
Any help appreciated.

Thanks

Hi Lisa,
I have the same as you, with the following in Code Studio, and it doesn’t let me select an Authenticated web page either.

base_format: "page_path"

So to save time I would create a new Page Path Reference to the Authenticated Webpage you want to use (in the following example I chose “PP__AW__MyAuthWebpage”); then just amend line 8 onwards in main.js to:

		if (tmp_destination !== "_self") {
			/*
			tmp_destination = tmp_destination.split("|");
			let tmp_uri = cs.context().url_path.split("p");
			formatted_destination = '/' + tmp_uri[0] + tmp_destination[0] + ((widget.get_setting('context')) ? '?context_record_id=' + widget.get_base_record_id() : "");
			*/
			formatted_destination = cs.link(cs.ref("PP__AW__MyAuthWebpage"));
		} else {
            ...

Regards,

Neil.

Hi Neil,

Thanks for this, I’m working with Lisa to implement this. Here’s what we have so far:

formatted_destination = cs.link(cs.ref('page_shortbreaks_view_opportunities')) + '?context_record_id=' + record_id;

This hard codes the destination page, however we need to retain the context record. We’ve been successful in appending the context record to the URL, but we’re missing the webpage hash and without this we’re not able to view the page.

Is there a way we can generate a webpage hash and append this to the URL?

Many thanks,
Oliver

Hi Oliver,

Firstly, a little time saver, adding the context to your link can also be done by doing the following:

formatted_destination = cs.link(cs.ref('page_shortbreaks_view_opportunities'), record_id);

As cs.link includes this parameter option and passing a numerical value alone will automatically add it as a context_record_id.

Using a Page Path reference to an Authenticated Webpage in cs.link should generate a link with a hash automatically generated for you.
Therefore I will assume that you’re creating this new link while working through a series of Authenticated Webpages and not a one off; as you want to preserve the previously generated hash.

Therefore in that case we need to get the existing URL parameters in use and append them to the above link by using cs.url_param([name],[default]). Assuming the URL has a parameter of “hash”, that I want to preserve, I would do something similar to the following:

let newParams = {};
newParams.context_record_id = record_id;
newParams.hash = cs.url_param("hash");

formatted_destination = cs.link(cs.ref('page_shortbreaks_view_opportunities'), newParams);

Hopefully this should help :slight_smile:

Regards,

Neil.

Hi Neil,

Very helpful, we’ve got it working!

We are working within a flow of authenticated pages. Passing the record id into to cs.link function worked a charm and created a valid link for the widget to redirect to

let record_id =  widget.get_base_record_id();
formatted_destination = cs.link(page_reference, record_id);

Many thanks,
Oliver

Yes many thanks for your help Neil and Oliver of course, it’s working a dream now!

Lisa