Friday, July 8, 2016

Customizing the subscription text in the WSO2 Enterprise Store 2.1.0

This short tutorial will focus on the process of customizing the subscription text which appears when a user subscribes to a given asset instance.

The complete set of resources utilized in this tutorial can be accessed here [1] .


Prerequisites

  • WSO2 Enterprise Store 2.1.0 (Pending a public release)


Our Goal

We will define a new Application Registry Extension file and change the text which appears when a user subscribes to an asset instance.


How can we achieve this goal?

The Enterprise Store Extension framework provides for individual sections of a page (referred to as partials) to be overridden by asset types.In this case the subscription text is controlled by the following partials:
  1. process-asset-text.hbs
  2. processed-asset-text.hbs


Step 1 : Defining  new partials


Alter the process-asset-text.hbs:



Alter the processed-asset-text.hbs:



What is the data-process tag?

The data-process defines text which will be displayed while the asset is been subscribed.

What is the data-success tag?

The data-success tag defines the text of the message which appears after successfully subscribing to an asset.

What is the data-error tag?

The data-error tag defines the text of the message which appears  if the subscription process fails.

What if I want more control over the client side behaviour?

The client side behaviour is controlled by the asset-core.js available here [3] .


Step 2 : Deploying the new partials

In order to deploy the above partials to the Store we will need to create an asset extension [2]. A completed asset extension  is available here [1].


Step 3 : Restart the server


Final Result

The final result of the above changes will be visible in the asset details page





References

[1] https://github.com/splinter/es-tutorial-3
[2] https://github.com/splinter/es-tutorial-3/tree/master/applications/themes/store/partials
[3] https://github.com/wso2/carbon-store/blob/master/apps/store/themes/store/js/asset-core.js

No comments:

Post a Comment