Five star Rating creation in telligent

Hi Team,

I am applying five-star rating with the help of the following tool from below tool,

<span id="ratingControl"></span>

var ratingControl = $('#ratingControl');
ratingControl.evolutionStarRating({
    value: 4,  //  initial value of rating
    isReadOnly: false,
    onRate: function(value) {
        alert(value + ' selected!');

        // Temporarily disable editing of rating during saving
        ratingControl.evolutionStarRating('readOnly', true);

        // ...perform AJAX-based saving of rating here...

        // After a successful save, turn off the read-only state of the control
        ratingControl.evolutionStarRating('readOnly', false);
    }
});

And I am getting the design as like below but how can I save these ratings information & get ratings' baack again. Can you help me please??

 
  • Can Anyone suggest to me like we have any script API's to save data & get the star rating data from telligent?

  •  rate UI Component Is the component that uses evolutionStarRating and should provide a fully functional implementation.  This is the same functionality you get when using the core_v2_ui.Rate method.  Is there an issue with using core_v2_ui.Rate to render the star rating?

  • Yes   I have an issue while saving the data and PFA for error.

     I passing the code like below format and I am the getting values for contentId & contentTypeId  but I am facing the above issue.

    #set($content = $core_v2_content.Current)
    #set ( $contentId = $content.ContentId)
    #set ( $contentTypeId = $content.ContentTypeId )

    <span class="ui-rate"></span>
    <script type="text/javascript" charset="utf-8">

    jQuery.telligent.evolution.ui.components.rate = {
    setup: function() {

    },
    add: function(elm, options) {
    var settings = jQuery.extend({}, {
    isReadOnly: (options.readonly === 'true'),
    value: parseFloat(options.initialvalue),
    ratingCount: parseFloat(options.initialcount)
    });

    settings.value = settings.value * jQuery.fn.evolutionStarRating.defaults.maxRating;
    settings.onRate = function(value) {
    debugger;
    if (!options.contentid || !options.contenttypeid) {
    return;
    }

    value = value / jQuery.fn.evolutionStarRating.defaults.maxRating;
    var data = {
    ContentId: "$contentId",
    ContentTypeId: "$contentTypeId",
    Value: value
    };
    if (options.ratingtypeid) {
    data.TypeId = options.ratingtypeid;
    }

    jQuery.telligent.evolution.post({
    url: jQuery.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/ratings.json',
    data: data,
    success: function(response) {
    var data = {
    ContentId: options.contentid
    };
    if (options.ratingtypeid) {
    data.TypeId = options.ratingtypeid;
    }

    jQuery.telligent.evolution.get({
    url: jQuery.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/rateditem.json',
    data: data,
    success: function(response) {
    if (response && response.RatedItem && response.RatedItem.AverageValue) {
    jQuery(elm).evolutionStarRating('option', {
    value: response.RatedItem.AverageValue * jQuery.fn.evolutionStarRating.defaults.maxRating,
    ratingCount: response.RatedItem.Count
    });
    } else {
    jQuery(elm).evolutionStarRating('option', {
    value: 0,
    ratingCount: 0
    });
    }
    }
    });
    }
    });
    };

    if (settings.ratingCount == 0 && settings.isReadOnly) {
    return;
    }

    jQuery(elm).evolutionStarRating(settings);
    }
    };


    </script>

    Kindly help me to resolve this issue, please. Thanks!

  • ContentPages do not implement IRateableContentType, so they can not be rated.