74 lines
2.3 KiB
HTML
74 lines
2.3 KiB
HTML
{#
|
|
Renders a complete block of rating snippets
|
|
|
|
package - The package for which the rating is displayed
|
|
|
|
{% snippet "rating/snippets/rating.html", package=pkg %}
|
|
|
|
#Updated by Francesco Mangiacrapa
|
|
#}
|
|
|
|
<script type="text/javascript" >
|
|
|
|
//Task #10389
|
|
window.addEventListener("message",
|
|
function (e) {
|
|
|
|
var curr_loc = window.location.toString()
|
|
var orgin = e.origin.toString()
|
|
if(curr_loc.startsWith(orgin)){
|
|
//alert("ignoring message from myself");
|
|
return;
|
|
}
|
|
//console.log("origin: "+e.data)
|
|
if(e.data == null)
|
|
return;
|
|
|
|
var pMess = JSON.parse(e.data)
|
|
//console.log(pMess.explore_vres_landing_page)
|
|
window.linktogateway = pMess.explore_vres_landing_page;
|
|
goToHomeLink("rating-private")
|
|
},false);
|
|
|
|
//Task #10389
|
|
goToHomeLink = function (divId) {
|
|
|
|
var myDiv = document.getElementById(divId);
|
|
var myHost = window.linktogateway.substring(0, window.linktogateway.lastIndexOf("/"));
|
|
//console.log("my host: "+myHost)
|
|
|
|
if(myDiv && myHost){
|
|
myDiv.innerHTML= myDiv.innerHTML + ". <a target=\"_blank\" href="+myHost+"/home"+">Go to Login...</a>";
|
|
}
|
|
|
|
}
|
|
</script>
|
|
|
|
{% resource "rating_css/rating.css" %}
|
|
{% if h.show_rating_in_type(package.type) %}
|
|
<div class="rating">
|
|
{% block general_rating %}
|
|
<h2 class="heading">{{ _('Rating') }}</h2>
|
|
<div class="rating-container">
|
|
{% snippet "rating/snippets/stars_inactive.html", package=package %}
|
|
</div>
|
|
{% endblock %}
|
|
{% block user_rating %}
|
|
{% if h.check_access('check_access_user') %}
|
|
<h2 class="heading">{{ _('Your rating') }}</h2>
|
|
<div class="rating-container">
|
|
{%- snippet "rating/snippets/stars.html", package=package -%}
|
|
{% block user_rating_br %}<br>{% endblock %}
|
|
<span class="rating-details">
|
|
{%- snippet "rating/snippets/rating_description.html", rating=h.get_user_rating(package.id) -%}
|
|
</span>
|
|
</div>
|
|
{% else %}
|
|
<div class="login-rating-details">
|
|
<!-- <a href="{{ h.url_for('login') }}">{{ _('Login') }}</a> {{ _('to leave a rating') }} -->
|
|
<div id="rating-private" class="required-access">To access the rating you must log in</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|
|
</div>
|
|
{% endif %} |