Updating rating.html to add:

This commit is contained in:
Francesco Mangiacrapa 2019-10-02 17:16:23 +02:00
parent 4733b00256
commit 63e95546cf
5 changed files with 66 additions and 2 deletions

17
.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ckanext-rating</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

7
.settings/.jsdtscope Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="src" path=""/>
<classpathentry kind="output" path=""/>
</classpath>

View File

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.JRE_CONTAINER

View File

@ -0,0 +1 @@
Global

View File

@ -6,6 +6,43 @@ package - The package for which the rating is displayed
{% snippet "rating/snippets/rating.html", package=pkg %}
#}
<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">
@ -27,9 +64,10 @@ package - The package for which the rating is displayed
</div>
{% else %}
<div class="login-rating-details">
<a href="{{ h.url_for('login') }}">{{ _('Login') }}</a> {{ _('to leave a rating') }}
<!-- <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 %}
{% endif %}