Skip to content
Snippets Groups Projects
Commit b0f6c8c8 authored by anonymous's avatar anonymous
Browse files

ODPSH-200: add popovers

parent a348d87a
Branches
Tags
No related merge requests found
......@@ -2,6 +2,8 @@ $(document).ready(function() {
$('.mylabel').click(function() {
window.location = $(this).siblings('a').attr('href');
});
// $('#tooltip').tooltip(show)
});
// Enable JavaScript's strict mode. Strict mode catches some common
// programming errors and throws exceptions, prevents some unsafe actions from
// being taken, and disables some confusing and bad JavaScript features.
"use strict";
ckan.module('odsh_popover', function ($)
{
return {
initialize: function ()
{
this.el.popover({
content: this.options.text,
placement: 'right',html:true});
}
};
});
\ No newline at end of file
......@@ -33,6 +33,8 @@ def odsh_openness_score_dataset_html(dataset):
qa = ast.literal_eval(r_qa)
else:
qa = r_qa
print('QA')
print(qa)
resource_score = qa.get('openness_score')
if resource_score > score:
score = resource_score
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 6.3499998 6.3500001"
version="1.1"
id="svg908"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="opendata-5.svg">
<defs
id="defs902" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16.417062"
inkscape:cx="8.4522277"
inkscape:cy="2.5068858"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1031"
inkscape:window-x="1920"
inkscape:window-y="25"
inkscape:window-maximized="1" />
<metadata
id="metadata905">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(171.50595,-209.66786)">
<circle
style="opacity:1;vector-effect:none;fill:none;stroke:#003064;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path10"
cx="-168.33095"
cy="212.84286"
r="1.4" />
</g>
</svg>
......@@ -448,10 +448,48 @@ ul.dataset-resources {
margin-bottom: 10px;
}
.odsh-star img {
.popover-content{
}
.popover{
width: unset;
display:inline-table!important;
}
a.odsh-star {
cursor: pointer;
display: inline-block;
}
a.odsh-star:focus,
a.odsh-star:hover {
text-decoration: none;
outline: none;
}
.odsh-star-wrap {
display: inline;
padding-right: 5px;
}
.odsh-star img:focus {
outline: none;
}
.odsh-star-info {
width: 15px;
height: 15px;
border-radius: 50%;
font-size: 15px;
color: #DBDBDB;
line-height: 15px;
text-align: center;
border: 1px solid;
display: inline-block;
vertical-align: middle;
}
.dataformat-label:hover {
background-color: #d4004b!important;
}
......@@ -1461,3 +1499,96 @@ font-weight: 100;
font-size: 12px;
margin-bottom: 5px;
}
a.tooltips_cls {
position: relative;
display: inline;
color: #000000;
text-decoration: none;
}
a.tooltips_cls span {
position: absolute;
width: 140px;
color: #FFFFFF;
background: #000000;
height: 30px;
line-height: 30px;
text-align: center;
visibility: hidden;
border-radius: 6px;
border: 1px solid 000000;
text-shadow: 0px 0px 0px #000000;
color: #FFFFFF
}
a.tooltips_cls span:after {
content: '';
position: absolute;
top: 50%;
right: 100%;
margin-top: -8px; width: 0; height: 0;
border-right: 8px solid #000000;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
}
a:hover.tooltips_cls span {
visibility: visible;
opacity: 0.8;
left: 100%;
top: 50%;
margin-top: -16px;
margin-left: 15px;
z-index: 999;
}
.tooltip {
display:inline-block;
position:relative;
border-bottom:1px dotted #666;
text-align:left;
}
.tooltip .right {
min-width:200px;
top:50%;
left:100%;
margin-left:20px;
transform:translate(0, -50%);
padding:10px 20px;
color:#999999;
background-color:#EEEEEE;
font-weight:normal;
font-size:13px;
border-radius:8px;
position:absolute;
z-index:99999999;
box-sizing:border-box;
border:1px solid #777777;box-shadow:0 1px 8px transparent;
display:none;
}
.tooltip:hover .right {
display:block;
}
.tooltip .right i {
position:absolute;
top:50%;
right:100%;
margin-top:-12px;
width:12px;
height:24px;
overflow:hidden;
}
.tooltip .right i::after {
content:'';
position:absolute;
width:12px;
height:12px;
left:0;
top:50%;
transform:translate(50%,-50%) rotate(-45deg);
background-color:#EEEEEE;
border:1px solid #777777;box-shadow:0 1px 8px transparent;
}
\ No newline at end of file
{% ckan_extends %}
{% block toolbar %}
{{ super() }}
<form id='dataset-search-box-form' class="section site-search simple-input" action="{% url_for controller='package', action='search' %}"
......
......@@ -8,7 +8,10 @@ reason - A reason why the dataset doesn't have a rating.
{% snippet "qa/stars.html", stars=4 %}
#}
{% set short_texts=['', ': OL', ': RE', ': OF', ': URI', ': LD'] %}
{% set texts=['OL = offene Lizenz', 'RE = maschinen-lesbar', 'OF = offenes Format', 'URI = verwendet URIs', 'LD = Linked Data'] %}
<span class="star-rating{% if stars == 0 %} no-stars{% endif %}">
{% resource 'odsh/odsh_popover.js' %}
{%- if stars == None -%}
{{ reason }}
{%- else -%}
......@@ -19,9 +22,11 @@ reason - A reason why the dataset doesn't have a rating.
</span>
{%- endfor -%}
{%- for index in range(5-stars) -%}
<span class="odsh-star">
<img src='/base/images/opendata-empty.svg'/>
</span>
<div class='odsh-star-wrap'>
<a tabindex="0" data-module="odsh_popover" data-module-text='{{texts[index]}}' role="button" data-toggle="popover" data-trigger="focus" class="odsh-star">
<img src='/base/images/opendata-{{index+1}}.svg'/>
</a>
</div>
{%- endfor -%}
{%- if stars == 0 -%}
{# 0 stars looks awfully like 5 stars, so be explicit #}
......@@ -29,4 +34,9 @@ reason - A reason why the dataset doesn't have a rating.
{%- endif -%}
</span>
{%- endif -%}
<div class='odsh-star-wrap'>
<a tabindex="0" data-module="odsh_popover" data-module-text="{{stars}} Stars{{short_texts[index]}}<br><a target='_blank' href='https://5stardata.info/de/'>5 Star Open Data Modell</a>" role="button" data-toggle="popover" data-trigger="focus" class="odsh-star">
<i class="fa fa-info odsh-star-info"></i>
</a>
</div>
</span>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment