MG 2.2 Edit template so media rating stars link to rating popup

oldford

Active member
I'm trying to make the rating stars link to the rating window. Basically so you can click on the stars or the "Leave a rating" button and get the same result. (see screenshot below)

I believe the template to edit is xfmg_media_view_macros around line 233:

Original code here:
HTML:
<dd>
                <xf:macro template="rating_macros" name="stars_text"
                    arg-rating="{$mediaItem.rating_avg}"
                    arg-count="{$mediaItem.rating_count}"
                    arg-rowClass="ratingStarsRow--textBlock" />
            </dd>

I tried this code with no success:
HTML:
<dd>
<a href="{{ link('media/media-ratings/', $media) }}">          
                <xf:macro template="rating_macros" name="stars_text"
                    arg-rating="{$mediaItem.rating_avg}"
                    arg-count="{$mediaItem.rating_count}"
                    arg-rowClass="ratingStarsRow--textBlock" />
</a>
            </dd>


1636234761623.png
 
Solution
Try:

HTML:
<dd>
    <a href="{{ link('media/media-ratings/rate', $mediaItem) }}">
        <xf:macro template="rating_macros" name="stars_text"
        arg-rating="{$mediaItem.rating_avg}"
        arg-count="{$mediaItem.rating_count}"
        arg-rowClass="ratingStarsRow--textBlock" />
    </a>
</dd>
This code call another template which is rating_macros
HTML:
<dd>
    <xf:macro template="rating_macros" name="stars_text"
    arg-rating="{$mediaItem.rating_avg}"
    arg-count="{$mediaItem.rating_count}"
    arg-rowClass="ratingStarsRow--textBlock" />
</dd>
 
Try:

HTML:
<dd>
    <a href="{{ link('media/media-ratings/rate', $mediaItem) }}">
        <xf:macro template="rating_macros" name="stars_text"
        arg-rating="{$mediaItem.rating_avg}"
        arg-count="{$mediaItem.rating_count}"
        arg-rowClass="ratingStarsRow--textBlock" />
    </a>
</dd>
 
Solution
Thanks Brogan. That worked great.

I also added the data-xf-click="overlay" so it would pop up a window rather than go to a new page.

HTML:
<dd>
    <a href="{{ link('media/media-ratings/rate', $mediaItem) }}" data-xf-click="overlay">
        <xf:macro template="rating_macros" name="stars_text"
        arg-rating="{$mediaItem.rating_avg}"
arg-count="{$mediaItem.rating_count}"
arg-rowClass="ratingStarsRow--textBlock" />
    </a>
</dd>
 
Thanks Paul:

Failed to load resource: the server responded with a status of 403 ()
core-compiled.js?_v=7f607430:43 PHP: <!DOCTYPE html>
<html style="height:100%">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title> 403 Forbidden
</title></head>
<body style="color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;">
<div style="height:auto; min-height:100%; "> <div style="text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;">
<h1 style="margin:0; font-size:150px; line-height:150px; font-weight:bold;">403</h1>
<h2 style="margin-top:20px;font-size: 30px;">Forbidden
</h2>
<p>Access to this resource on the server is denied!</p>
</div></div><div style="color:#f0f0f0; font-size:12px;margin:auto;padding:0px 30px 0px 30px;position:relative;clear:both;height:100px;margin-top:-101px;background-color:#474747;border-top: 1px solid rgba(0,0,0,0.15);box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset;">
<br>Proudly powered by <a style="color:#fff;" href="http://www.litespeedtech.com/error-page">LiteSpeed Web Server</a><p>Please be advised that LiteSpeed Technologies Inc. is not a web hosting company and, as such, has no control over content found on this site.</p></div></body></html>
 
Top Bottom