Customizing the Subscription Process
Follow the instructions below to change the default subscription button from "Bookmark" to "Subscribe" and "Bookmarked" to "Subscribed" for the asset type named gadget:
Define the new partials.
Navigate to the
<ES_HOME>/repository/deployment/server/jaggeryapps/store/themes/store/partials
directory.Make a copy of the following default partials, which WSO2 ES uses to control the subscription text.
process-asset-text.hbs
- This defines the caption of the subscription process button before a user subscribes to it on the details asset page. The default value for this isBookmark
.processed-asset-text.hbs
- This defines the caption of the subscription process button after a user has subscribed to it on the details asset page. The default value for this isBookmarked
.
Update the
process-asset-text.hbs
file as follows and save the file:<i class="fw fw-bookmark"></i> <span class="main-bookmark" data-processing=" Adding..." data-success="Successfully bookmarked the asset" data-error="Failed to bookmark this asset!"> {{t "Subscribe"}} <span class="sub-bookmark"></span> </span>
The tags mentioned in the above code block are explained as follows:
data-processing
- This defines text that is displayed while subscribing to an asset.data-success
- This defines text that is displayed when successfully subscribing to an asset.data-error
- This defines text that is displayed when subscribing to an asset fails.
Update the
processed-asset-text.hbs
file as follows and save the file.<i class="fa fa-star"></i> <span class="main-bookmark" data-processing=" Removing..." data-success="Successfully removed the bookmark from asset" data-error="Failed to un-bookmark this asset!"> {{t "Subscribed"}} <span class="sub-bookmark"></span> </span>
The tags mentioned in the above code block are explained as follows:
data-processing
- This defines text that is displayed while unsubscribing from an asset.data-success
- This defines text that is displayed when successfully unsubscribing from an asset.data-error
- This defines text that is displayed when unsubscribing to an asset fails.If you need to have more control over the client-side behavior, work with the
asset-core.js
file.
- Deploy the new partials.
- Navigate to the
<ES_HOME>/repository/deployment/server/jaggeryapps
/store/extensions/assets/gadget
directory to apply the customization of the subscription process to the gadget asset type. - Create the
/themes/store/partials
directory within the latter mentioned/gadget
directory.
This folder structure forms the shell for the asset extension. - Move the updated partial files into the
<ES_HOME>/repository/deployment/server/jaggeryapps/store/extensions/assets/gadget/themes/store/partials
directory.
- Navigate to the
Verify whether you were able to change the subscription process successfully.
Follow the instructions below to verify the success of the subscription process customization:
- Sign into the Store.
- Click Gadgets in the left navigator menu.
- Click on an asset. The asset details page appears.
- Click on the Subscribe button. The caption of the Subscribe button changes to Subscribed.
What's Next?
For more information on asset extensions, see Introduction to Asset Extensions.