Search code examples
orchardcmsorchardcms-1.8orchard-modules

Orchard CMS Contrib.Review module


I am beginner in Orchard CMS and i need add voting functionality to content. I have installed Contib.Vote and Contrib.Review modules. After that i have added Review part to page content type. Also, i have executed recipe. At the first look everything is fine, but link for review refer to the same page with # symbol and nothing is happenning by clicking on it. It seems like module does not work or work incorrectly. Please help with my problem.

UPD. Hi devqon and thanx for your help. Your answer was really useful for me. According to your advice i was looking around javascript inside Review Part view file (Parts_Reviews.cshtml). Just for a test i changed its source code a little bit.

@using (Script.Foot())
{
    <script type="text/javascript">
    //<![CDATA[
    (function () {
        var numberOfReviewsToShowByDefault = 5;
        var $showAllReviewsLink = $('#showAllReviewsLink');
        var $deleteReviewConfirmationDialogDiv = $('#deleteReviewConfirmationDialogDiv');


            $deleteReviewConfirmationDialogDiv.dialog({ autoOpen: false, modal: true, resizable: false });
            $('#deleteReviewLink').click(function () {
                $('#reviewId').val($(this).attr("data-review-id"));
                ShowDeleteReviewDialog();
                return false;
            });
            $('#showReviewFormLink').click(function () {
                $('#createReviewLinkDiv').slideToggle('fast', function () { $('#reviewFormDiv').slideToggle('fast'); });
                return false;
            });
            $('#cancelCreateReviewLink').click(function () {
                $('#reviewFormDiv').slideToggle('fast', function() { $('#createReviewLinkDiv').slideToggle('fast'); });
                return false;
            });
            $('#deleteReviewForm').submit(function () {
                $('input[type=submit]', this).attr('disabled', 'disabled');
            });
            $('#cancelDeleteReviewButton').click(function () {
                CloseConfirmationDialogDiv();
                return false;
            });
            var rowCount = $('#reviewsList li').length;
            if (rowCount > numberOfReviewsToShowByDefault) {
                SetupToggle();
            }

            if (document.location.hash === '#Reviews') {
                var topPx = $('#reviews-heading').position().top;
                $('body,html').animate({ scrollTop: topPx }, 'slow');
            }

            if ($("#comment").length) {
                var characterCountUpdater = new CharacterCountUpdater($("#comment"), $("#commentCharactersLeft"));
                setInterval(function() { characterCountUpdater.UpdateCharacterCount(); }, 100);
                $("#comment").keypress(function() { characterCountUpdater.UpdateCharacterCount(); });

                if ($("#comment").val().length) {
                    $("#showReviewFormLink").trigger("click");
                }
            }
        
        function CharacterCountUpdater(commentBox, charactersLeftBox)
        {
            this.commentBox = commentBox;
            this.charactersLeftBox = charactersLeftBox;
            this.maxLength = commentBox.attr("maxlength");
            commentBox.removeAttr("maxlength");
            return this;
        }

Now form for review is displayed. The form looks good, submit button works, character counter works too. But i still can't apply my rating. Stars not react on clicking. That is why submit operation ends with error 'In order to submit a review, you must also submit a rating.'. Look like something inside Parts.Stars.NoAverage.cshtml does not work. Please, help me.


Solution

  • Console of Firefox tells: $(...).live is not a function. It refers to Contrib.Stars.js source code file. This function is not supported in jquery now and i replaced it by .on() function in all places api.jquery.com/on. Now module works fine.