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

Merge remote-tracking branch 'origin/ODSH-45_continued_work'

parents 9ce14b2f 7f2cfe8c
Branches
No related tags found
No related merge requests found
Showing
with 698 additions and 147 deletions
$(document).ready(function() {
$('.mylabel').click(function() {
console.log($(this).siblings());
window.location = $(this).siblings('a').attr('href');
});
});
No preview for this file type
......@@ -39,3 +39,13 @@ msgstr "Namensnennung"
msgid "Spatial extension"
msgstr "räumliche Ausdehnung"
msgid "{number} dataset found"
msgid_plural "{number} datasets found"
msgstr[0] "{number} Datensatz gefunden X"
msgstr[1] "{number} Datensätze gefunden X"
msgid "{number} dataset found for \"{query}\""
msgid_plural "{number} datasets found for \"{query}\""
msgstr[0] "{number} Ergebnis für \"{query}\""
msgstr[1] "{number} Ergebnisse für \"{query}\""
......@@ -6,8 +6,22 @@ from ckan.lib.plugins import DefaultDatasetForm
from ckan.common import OrderedDict
import ckan.lib.helpers as helpers
import logging
log = logging.getLogger(__name__)
_ = toolkit._
def odsh_get_facet_items_dict(name, limit=None):
'''
Gets all facets like 'get_facet_items_dict' but sorted alphabetically
instead by count.
'''
facets = helpers.get_facet_items_dict(name, limit)
facets.sort(key=lambda it: (it['display_name'].lower(), -it['count']))
log.info(facets)
return facets
def odsh_main_groups():
'''Return a list of the groups to be shown on the start page.'''
......@@ -67,14 +81,18 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
# other extensions.
return {'odsh_main_groups': odsh_main_groups,
'odsh_now': odsh_now,
'odsh_group_id_selected':odsh_group_id_selected}
'odsh_group_id_selected': odsh_group_id_selected,
'odsh_get_facet_items_dict': odsh_get_facet_items_dict,
}
def before_map(self, map):
map.connect('info_page', '/info_page', controller='ckanext.odsh.controller:OdshRouteController', action='info_page')
return map
def dataset_facets(self, facets_dict, package_type):
return OrderedDict({'groups': _('Groups')})
# TODO: Frage von Pascal 12.10.2018: warum ist die Ordnung hier genau umgekehrt (von hinten nach vorne?)
return OrderedDict({'res_format': _('Dateiformat'),
'groups': _('Kategorie')})
def organization_facets(self, facets_dict, organization_type, package_type):
return facets_dict
......
File added
File added
File added
File added
ckanext/odsh/public/base/images/checked.png

472 B

ckanext/odsh/public/base/images/ckan-logo.png

13.3 KiB

ckanext/odsh/public/base/images/search_submit.png

480 B

ckanext/odsh/public/base/images/sprite.png

78.7 KiB

/* FONTS */
@font-face{
font-family:"MuseoSans";
src:url("/base/fonts/Fonts/905300/fd479df2-01b0-4e3a-a411-915c477f1352.eot?#iefix");
src:url("/base/fonts/Fonts/905300/fd479df2-01b0-4e3a-a411-915c477f1352.eot?#iefix") format("eot"),url("/base/fonts/Fonts/905300/1d3191cd-ae8c-45e2-bb04-11e96d8fa974.woff2") format("woff2"),url("/base/fonts/Fonts/905300/b252d464-65cb-4950-88f7-ac0a1bf79b75.woff") format("woff"),url("/base/fonts/Fonts/905300/b3d18117-6517-4d3f-afc1-774086ff5fc1.ttf") format("truetype");
}
/* css allgemein (body, etc.) */
body {
font-family: "MuseoSans", Euphemia, Segoe UI, Arial, Helvetica, sans-serif, "Droid Sans";
font-weight: 300;
font-style: normal;
line-height: 1.2;
font-size: 16px;
}
/* FROM: https://stackoverflow.com/questions/2610497/change-an-html5-inputs-placeholder-color-with-css */
/* do not group these rules */
*::-webkit-input-placeholder {
color: black !important;
}
*:-moz-placeholder {
/* FF 4-18 */
color: black !important;
opacity: 1 !important;
}
*::-moz-placeholder {
/* FF 19+ */
color: black !important;
opacity: 1 !important;
}
*:-ms-input-placeholder {
/* IE 10+ */
color: black !important;
}
*::-ms-input-placeholder {
/* Microsoft Edge */
color: black !important;
}
*::placeholder {
/* modern browser */
color: black !important;
}
input, button, select, textarea {
font-family: 'MuseoSans','Helvetica Neue',Helvetica,Arial,sans-serif;
}
/* css for searchresults */
/* same width as schleswig-holstein.de */
.container {
width: 1000px;
}
.search-form {
border-bottom: 4px solid #dbdbdb;
padding-bottom: 5px;
}
.search-form .control-order-by select {
width: 225px;
margin: 0;
border: 1px;
background-color: #f2f2f2;
color: black;
}
.search-form h2 {
margin-top: 0px;
font-size: 25px;
color: #003064;
font-weight: 300;
}
.module-content:first-child {
padding-top: 0px;
}
.module-content {
padding: 0;
}
input[type=radio], input[type=checkbox] {
top: 0px;
}
.nav-simple>li {
border-bottom: 0px;
padding: 15px 0px 15px 8px;
}
@media (min-width: 768px){
[role=main], .main {
background: white;
}
.wrapper {
background-image: none;
background-repeat: no-repeat;
}
}
.secondary {
background-color: #f2f2f2;
}
.secondary.span3 {
width: 210px;
padding: 20px 16px 0px;
}
.primary {
padding-left: 10px;
}
.primary.span9 {
width: 780px;
}
.wrapper {
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
border: none;
}
.karte_inner {
background-color: lightgrey;
height: 220px;
margin-bottom: 20px;
}
.filter-reset {
padding: 0px 0px 10px 0px;
}
.filter-reset-label {
float: left;
}
.filter-reset-box {
float: right;
background-color: white;
padding: 0px 10px 0px 10px;
}
.filter-reset-box a {
color: black;
font-size: 12px;
}
.filters section nav {
border-top: 2px solid #DBDBDB;
}
.filters section nav .nav-title {
padding: 15px 0px 0px 8px;
font-size: 12px;
color: black;
}
.nav-item .facet_label {
display: block;
float: left;
}
.nav-item .facet_label a{
color: black;
}
.nav-item .facet_count {
display: block;
float: right;
background-color: white;
padding: 0px 2px 0px 2px;
}
.filter-checkbox {
}
/* checkbox customize trick, see: https://stackoverflow.com/questions/24322599/css-why-cannot-change-checkbox-color-whatever-i-do */
input[type=checkbox] {
display:none;
}
input[type=checkbox] + label.mylabel {
background: #fff;
border: 1px solid white;
height: 8px;
width: 8px;
display: inline-block;
padding: 0 0 0 0px;
}
input[type=checkbox]:checked + label.mylabel {
background: url(/base/images/checked.png);
background-color: #fff;
background-size: 8px 8px;
border: 1px solid black;
height: 8px;
width: 8px;
display:inline-block;
padding: 0 0px 0 0px;
}
label.mylabel {
margin-right: 3px;
margin-bottom: 0px;
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
label.mylabel::after {
content: "";
}
/* following makes the secondary span (left side, facets etc.) the same height as the primary span */
/* see: https://scotch.io/bar-talk/different-tricks-on-how-to-make-bootstrap-columns-all-the-same-height */
.is-table-row {
display: table;
}
.is-table-row [class*="span"] {
float: none;
display: table-cell;
vertical-align: top;
}
.pill {
background-color: #F6F7F9;
border-radius: 0px;
color:black;
font-size: 12px;
margin-right: 2px;
}
.pill a.remove {
color: black;
font-size: 10px;
position: relative;
top: -8px;
right: -8px;
}
.container-fluid.odsh-dataset-item {
padding: 20px 0px 20px 0px;
border-bottom: 2px solid #DBDBDB;
}
.dataset-content {
float:left;
width: 70%;
}
.dataset-heading {
margin-right: 30px;
}
.dataset-empty {
margin-right: 30px;
color: darkgrey;
}
.dataset-meta {
float:right;
width: 30%;
}
ul.dataset-resources {
margin: 0px 0px 10px 0px;
}
.dataformat-label {
background-color: #1c355e !important;
padding: 3px 3px 1px 3px;
font-size: 14px;
margin-right: 4px;
}
.dataset-stars {
margin-bottom: 10px;
}
.odsh-star {
margin-right: 5px;
font-size: 20px;
color: #1c355e;
}
.dataformat-label:hover {
background-color: #d7004d !important;
}
.dataset-info p {
font-size: 12px;
margin-bottom: 1px;
color: black;
}
.breadcrumb>li a {
font-weight: normal !important;
font-size: 15px;
color: #003064 !important;
}
/* css for header */
/* same width as schleswig-holstein.de */
.navbar-static-top .container {
width: 1000px;
}
[class*="span"] {
margin-left: 0px;
}
.row {
margin-left: 0px;
}
.span3.span-navigation {
width: auto;
}
.span9.span-navigation {
width: auto;
margin-right: 15px;
}
.header-image {
padding-right: 0;
position: relative;
top: 0;
padding: 1em 0;
}
.language-switch {
float: right;
background-color: #f2f2f2;
padding: 6px 10px;
margin-left: 20px;
height: 44px; /* dirty fix to make it the same height as schleswig-holstein.de */
}
.language-switch ul {
margin: 0;
padding-left: 0;
list-style-type: none;
}
.language-switch li {
display: block;
padding: 7px;
float: left;
line-height: 1.5;
}
.language-switch li a {
color: #003064;
padding: 5px;
display: block;
}
.language-switch li a:hover {
color: white;
background: #011e5a;
}
.language-switch .navLeichteSprache {
background: url(/base/images/sprite.png) no-repeat 6px -5557px;
font: 0/0 serif;
display: block;
height: 20px;
width: 20px;
overflow: hidden;
}
.language-switch .navLeichteSprache:hover {
background: #011e5a url(/base/images/sprite.png) no-repeat 6px -5334px;
}
.masthead .top-search-form {
float:right;
background: #f2f2f2;
width: 15em;
height: 56px; /* dirty fix to make it the same height as schleswig-holstein.de */
}
.masthead .top-search-form .site-search {
margin: 0;
padding: 14px 15px 10px;
}
.masthead .site-search input {
padding: 5px 8px 0;
}
.masthead {
background: white;
}
#field-sitewide-search {
font-size: 87%;
font-weight: 300;
padding-left: .5em;
width: 167px;
line-height: 1.1;
border-bottom: 2px solid #c2cbd6 !important;
background: #f2f2f2;
border: 1px solid #f2f2f2;
box-shadow: none !important;
height: 20px;
}
#field-sitewide-search:focus {
outline: 1px solid rgba(82,168,236,0.8);
border-color: rgba(82,168,236,0.8);
}
.simple-input .field .btn-search {
height: 32px;
width: 32px;
background: url(/base/images/search_submit.png);
right: -47px;
top: 36%;
}
.navigation-container {
background: #f2f2f2;
width: 100% !important;
border-bottom: 15px solid #1c355e;
}
.navigation-row {
width: 1000px;
padding-left: 33px;
margin-left: auto;
margin-right: auto;
}
.masthead .nav-collapse {
float: left;
padding-top: 0px;
}
.nav-pills li a:hover, .nav-pills li:hover {
border-radius: 0px;
-webkit-border-radius: 0px;
background-color: #011e4a !important;
}
.masthead .navigation .nav-pills li:not(:first-child) {
margin-left: 22px;
}
/* Default border to align font vertically to active navigation tab */
.masthead .navigation .nav-pills li {
border-top: 2px solid #f2f2f2;
}
/* Change default border color on hover to background color (align font vertically to active navigation tab) */
.masthead .navigation .nav-pills li:hover {
border-top: 2px solid #011e4a;
}
/* The active navigation tab gets a differently coloured top-border */
.masthead .navigation .nav-pills li.active {
border-top: 2px solid #003064;
}
/* Remove borders and get background color from parent (.navigation-container) */
.masthead .navigation .nav-pills li.active a {
background-color: inherit;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
text-decoration: none;
}
/* Font color of navigation links (default) */
.masthead .nav>li>a, .masthead .nav>.active>a {
padding: 16px 10px 19px;
color: #003064;
font-size: 1.125rem;
}
/* Font color of navigation links (hover) */
.masthead .nav>li:hover a {
color: #ffffff;
text-decoration: underline;
}
......@@ -2,6 +2,8 @@
{% block styles %}
{{ super() }}
<script type="text/javascript" src="bootstrap-multiselect.js"></script>
<link rel="stylesheet" href="/odsh.css" />
{% resource 'odsh/odsh.js' %}
<link rel="stylesheet" href="/odsh.css?refresh={{ range(1,10000) | random }}" />
<link rel="stylesheet" href="/odsh_header.css?refresh={{ range(1,10000) | random }}" />
<link rel="stylesheet" href="/bootstrap-multiselect.css" />
{% endblock %}
{% block header_wrapper %}
{% block header_account %}
<header class="account-masthead">
<div class="container">
{% block header_account_container_content %}
{% if c.userobj %}
<div class="account avatar authed" data-module="me" data-me="{{ c.userobj.id }}">
<ul class="unstyled">
{% block header_account_logged %}
{% if c.userobj.sysadmin %}
<li>
<a href="{{ h.url_for(controller='admin', action='index') }}" title="{{ _('Sysadmin settings') }}">
<i class="fa fa-gavel" aria-hidden="true"></i>
<span class="text">{{ _('Admin') }}</span>
</a>
</li>
{% endif %}
<li>
<a href="{{ h.url_for(controller='user', action='read', id=c.userobj.name) }}" class="image" title="{{ _('View profile') }}">
{{ h.gravatar((c.userobj.email_hash if c and c.userobj else ''), size=22) }}
<span class="username">{{ c.userobj.display_name }}</span>
</a>
</li>
{% set new_activities = h.new_activities() %}
<li class="notifications {% if new_activities > 0 %}notifications-important{% endif %}">
{% set notifications_tooltip = ngettext('Dashboard (%(num)d new item)', 'Dashboard (%(num)d new
items)', new_activities) %}
<a href="{{ h.url_for(controller='user', action='dashboard') }}" title="{{ notifications_tooltip }}">
<i class="fa fa-tachometer" aria-hidden="true"></i>
<span class="text">{{ _('Dashboard') }}</span>
<span class="badge">{{ new_activities }}</span>
</a>
</li>
{% block header_account_settings_link %}
<li>
<a href="{{ h.url_for(controller='user', action='edit', id=c.userobj.name) }}" title="{{ _('Edit settings') }}">
<i class="fa fa-cog" aria-hidden="true"></i>
<span class="text">{{ _('Settings') }}</span>
</a>
</li>
{% endblock %}
{% block header_account_log_out_link %}
<li>
<a href="{{ h.url_for('/user/_logout') }}" title="{{ _('Log out') }}">
<i class="fa fa-sign-out" aria-hidden="true"></i>
<span class="text">{{ _('Log out') }}</span>
</a>
</li>
{% endblock %}
{% endblock %}
</ul>
</div>
{% else %}
<nav class="account not-authed">
<ul class="unstyled">
{% block header_account_notlogged %}
<li>{% link_for _('Log in'), controller='user', action='login' %}</li>
{% if h.check_access('user_create') %}
<li>{% link_for _('Register'), controller='user', action='register', class_='sub' %}</li>
{% endif %}
{% endblock %}
</ul>
</nav>
{% endif %}
{% endblock %}
</div>
</header>
<header class="navbar navbar-static-top masthead">
{% block header_debug %}
{% if g.debug and not g.debug_supress_header %}
......@@ -78,7 +13,7 @@
{# The .header-image class hides the main text and uses image replacement for the title #}
<div class='row'>
<div class='span4'>
<div class='span3 span-navigation'>
<hgroup class="{{ g.header_class }} pull-left">
{% block header_logo %}
......@@ -95,45 +30,43 @@
</hgroup>
</div>
<div class='span9 span-navigation pull-right'>
{% snippet "snippets/language_selector.html" %}
{% block header_site_search %}
<div class="span4">
<div class='top-search-form'>
<form class="section site-search simple-input" action="{% url_for controller='package', action='search' %}"
method="get">
<div class="field">
<label for="field-sitewide-search">{% block header_site_search_label %}{{ _('Search Datasets')
}}{%
endblock %}</label>
<input id="field-sitewide-search" type="text" name="q" placeholder="{{ _('Search') }}" />
<button class="btn-search" type="submit"><i class="fa fa-search"></i></button>
<input id="field-sitewide-search" type="text" name="q" placeholder="{{ _('Suchbegriff') }}" />
<button class="btn-search" type="submit">
</div>
</form>
</div>
{% endblock %}
<div class='span4'>
{% snippet "snippets/language_selector.html" %}
</div>
</div>
</div>
<div class="container navigation-container">
<div class='row navigation-row'>
<div class="nav-collapse collapse">
<nav class="section navigation">
<ul class="nav nav-pills">
{% block header_site_navigation_tabs %}
{{ h.build_nav_main(
('home', _('Start')),
('search', _('Datasets')),
('organizations_index', _('Organizations')),
('info_page', _('Info'))
('home', _('Startseite')),
('search', _('Daten')),
('organizations_index', _('Herausgeber')),
('info_page', _('Infos'))
) }}
{% endblock %}
</ul>
</nav>
{% endblock %}
</div>
</div>
</div>
</div>
</header>
......
......@@ -11,7 +11,18 @@
##
## tools on left side, ie filter
{% block secondary_content %}
<div class="karte_outer">
<p>Karte:</p>
<div class="karte_inner">
</div>
</div>
<div class="filters">
<div class="container-fluid filter-reset">
<div class="filter-reset-label"><span>Filter:</span></div>
<div class="filter-reset-box"><a href="#">zurücksetzen</a></button></div>
</div>
<div>
{% for facet in c.facet_titles %}
{{ h.snippet('snippets/facet_list.html', title=c.facet_titles[facet], name=facet) }}
......
{% ckan_extends %}
{%- block content %}
{% block maintag %}<div role="main">{% endblock %}
<div id="content" class="container">
{% block main_content %}
{% block flash %}
{{ super() }}
{% endblock %}
{% block toolbar %}
{{ super() }}
{% endblock %}
<div class="row wrapper{% block wrapper_class %}{% endblock %}{% if self.secondary()|trim == '' %} no-nav{% endif %} is-table-row">
{#
The pre_primary block can be used to add content to before the
rendering of the main content columns of the page.
#}
{% block pre_primary %}
{% endblock %}
{% block secondary %}
<aside class="secondary span3">
{% block secondary_content %}
{{ super() }}
{% endblock %}
</aside>
{% endblock %}
{% block primary %}
<div class="primary span9">
{% block primary_content %}
{{ super() }}
{% endblock %}
</div>
{% endblock %}
</div>
{% endblock %}
</div>
</div>
{% endblock -%}
{% ckan_extends %}
{% block facet_list_heading %}
{# {% set title = title or h.get_facet_title(name) %}
{{ title }} #}
{% endblock %}
{% block facet_list_items %}
{% with items = items or h.get_facet_items_dict(name) %}
{# {% with items = items or h.get_facet_items_dict(name,20) %} #}
{% with items = items or h.odsh_get_facet_items_dict(name,20) %}
{% if items %}
<nav>
{% set title = title or h.get_facet_title(name) %}
<div class="nav-title">{{ title }}</div>
<ul class="{{ nav_class or 'unstyled nav nav-simple nav-facet' }}">
{% for item in items %}
{% set href = h.remove_url_param(name, item.name, extras=extras, alternative_url=alternative_url) if
item.active else h.add_url_param(new_params={name: item.name}, extras=extras, alternative_url=alternative_url)
%}
{% set label = label_function(item) if label_function else item.display_name %}
{% set label_truncated = h.truncate(label, 22) if not label_function else label %}
<li class="{{ nav_item_class or 'nav-item' }}{% if item.active %} active{% endif %}">
{% set count = count_label(item['count']) if count_label else ('%d' % item['count']) %}
{% set label_truncated = h.truncate(label, 26) if not label_function else label %}
<li class="{{ nav_item_class or 'nav-item' }}">
<div class="facet_label">
{# TODO: checkbox-id vereinheitlichen (code-duplikation) und sicher gegen Titel mit Leerzeichen machen! #}
<input type="checkbox" {% if item.active %} checked {% endif %} class="filter-checkbox" id="check-{{ title.lower() }}-{{ loop.index }}"/>
<label class="mylabel" for="check-{{ title.lower() }}-{{ loop.index }}"></label>
<a href="{{ href }}" title="{{ label if label != label_truncated else '' }}">
<span>{{ label_truncated }}</span>
</a>
</div>
<div class="facet_count">
<span class="facet_count">{{ count }}</span>
</div>
</li>
{% endfor %}
</ul>
</nav>
<p class="module-footer">
{# TODO: when there are more than N facets ('with items...' above), how many should be
displayed and how should these links look? Pascal R. 12.10.2018 #}
{#<p class="module-footer">
{% if h.get_param_int('_%s_limit' % name) %}
{% if h.has_more_facets(name) %}
<a href="{{ h.remove_url_param('_%s_limit' % name, replace=0, extras=extras, alternative_url=alternative_url) }}"
......@@ -29,7 +49,8 @@
<a href="{{ h.remove_url_param('_%s_limit' % name, extras=extras, alternative_url=alternative_url) }}" class="read-more">{{
_('Show Only Popular {facet_type}').format(facet_type=title) }}</a>
{% endif %}
</p>
</p>#}
{% else %}
<p class="module-content empty">{{ _('There are no {facet_type} that match this search').format(facet_type=title) }}</p>
{% endif %}
......
{% set current_lang = request.environ.CKAN_LANG %}
<form class="form-inline form-select lang-select" action="{% url_for controller='util', action='redirect' %}"
data-module="select-switch" method="POST">
<select id="field-lang-select" name="url" data-module="autocomplete" data-module-dropdown-class="lang-dropdown"
data-module-container-class="lang-container">
<div class="language-switch">
<ul>
<li>
<a href="#" title="Leichte Sprache" class="navLeichteSprache">Leich­te Spra­che</a>
</li>
<li>
{% for locale in h.get_available_locales() %}
<option value="{% url_for h.current_url(), locale=locale.short_name %}" {% if locale.identifier==current_lang
%}selected="selected" {% endif %}>
{{ locale.short_name }}
</option>
{% if (locale.identifier!=current_lang) and ((locale.short_name=='de') or (locale.short_name=='en')) %}
<a title="Switch to ... website" href="{% url_for h.current_url(), locale=locale.short_name %}"
xml:lang="{{ locale.short_name }}" hreflang="{{ locale.short_name }}" lang="{{ locale.short_name }}">{{ locale.short_name.upper() }}</a>
{% endif %}
{% endfor %}
</select>
<button class="btn js-hide" type="submit">{{ _('Go') }}</button>
</form>
\ No newline at end of file
</li>
</ul>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment