Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Follow the instructions below to change the default subscription button from "Bookmark" to "Subscribe" for and "Bookmarked" to "Subscribed" for the asset type named gadget:

Excerpt IncludeCreating the Shell of an Asset ExtensionCreating the Shell of an Asset Extensionnopaneltrue 

  1. Define the new partials.

    1. Navigate to the <ES_HOME>/repository/deployment/server/jaggeryapps/store/themes/store/partials directory. 

    2. 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 is Bookmark.
      • 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 is Bookmarked.
    3. Update the process-asset-text.hbs file as follows and save the file:

      Code Block
      <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.
    4. Update the processed-asset-text.hbs file as follows and save the file.

      Code Block
      <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.

        Tip

        If you need to have more control over the client-side behavior, work with the asset-core.js file.


  2. Deploy the new partials.
    1. 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.
    2. Create the  the /themes/store/partials directory within the latter mentioned /gadget directory.
      This folder structure forms the shell for the asset extension
    3. Move the updated partial files into the <ES_HOME>/repository/deployment/server/jaggeryapps/store/extensions/assets/gadget/themes/store/partials directory.
  3. Verify whether you were able to change the subscription process successfully.
    Follow the instructions below to verify the success of the subscription process customization: 

    1. Sign into the Store.
    2. Click Gadgets in the left navigator menu.
    3. Click on an asset. The asset details page appears.
    4. Click on the Subscribe button. The caption of the Subscribe button changes to Subscribed.

What's Next?

Excerpt Include
Creating the Shell of an Asset Extension
Creating the Shell of an Asset Extension
nopaneltrue