Commit a565b977 authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

Merge branch 'testing' into 'master'

Testing

See merge request !11
parents 7ea0a9a1 fa162381
Pipeline #6561 failed with stage
prod:
stage: deploy
script:
- echo "pipeline started"
- cp -r ckanext-theme_hft/* /usr/lib/ckan/default/src/ckanext-theme_hft/
- source /usr/lib/ckan/default/bin/activate
- cd /usr/lib/ckan/default/src/ckanext-theme_hft
- python setup.py develop
- deactivate
- supervisorctl restart all
tags:
- production
only:
- master
devel:
stage: deploy
script:
- echo "pipeline started"
- cp -r ckanext-theme_hft/* /usr/lib/ckan/default/src/ckanext-theme_hft/
- . /usr/lib/ckan/default/bin/activate
- cd /usr/lib/ckan/default/src/ckanext-theme_hft
- python setup.py develop
- deactivate
- supervisorctl restart all
tags:
- testing
only:
- testing
# ckan theme
# Customized Theme of CKAN Data Catalog of HFT Stuttgart
The extension and files for the customization are structured as follows in the **`ckan`** source code's parent directory:
- ckanext-theme_hft
- ckanext
- theme_hft
- assets
- theme.css
- webassets.yml
- public
- (pictures).jpg/png
- templates
- *.html
- plugin.py
- setup.py
The theme for the Data Catalog of HFT Stuttgart
\ No newline at end of file
### Steps to implement the customized theme
1. Run the following command to create a new extension and place its directory in the **`ckan`** source code's parent directory:
> ckan generate extension
- New extension name: _`ckanext-theme_hft`_
1. Put the files in this repo to the their respective directories.
1. Go to **`ckanext-theme_hft`** directory and run the following command:
> python setup.py develop
1. Add the new plugin to the ckan.plugins setting in `/etc/ckan/default/ckan.ini` file:
> ckan.plugins = stats text_view recline_view theme_hft
1. Start CKAN
> ckan -c /etc/ckan/default/ckan.ini run
/* ========================================================================
The main masthead bar that contains the site logo, nav links, and search
======================================================================== */
.masthead {
background-color: #ffffff;
color: black;
}
.masthead .nav > li > a {
color: black;
text-shadow: none;
}
/* The "navigation pills" in the masthead (the links to Datasets,
Organizations, etc) when the user's pointer hovers over them. */
.masthead .navigation .nav-pills li a:hover {
background-color: #C14531;
color: black;
}
/* The "active" navigation pill (for example, when you're on the /dataset page
the "Datasets" link is active). */
.masthead .navigation .nav-pills li.active a {
background-color: #C14531;
}
/* The "box shadow" effect that appears around the search box when it
has the keyboard cursor's focus. */
.masthead input[type="text"]:focus {
-webkit-box-shadow: inset 0px 0px 2px 0px rgba(0, 0, 0, 0.7);
box-shadow: inset 0px 0px 2px 0px rgba(0, 0, 0, 0.7);
}
@media (min-width: 768px) {
.hero {
background: url("https://m4lab.hft-stuttgart.de/katalog/header.jpg");
}
}
/* ====================================
The footer at the bottom of the site
==================================== */
.site-footer,
body {
background-color: #ffffff;
}
/* The text in the footer. */
.site-footer,
.site-footer label,
.site-footer small {
color: rgba(128, 128, 128, 1);
}
/* The link texts in the footer. */
.site-footer a {
color: rgba(128, 128, 128, 1);
}
theme:
output: theme_hft/theme.css
contents: theme.css
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
class ThemeHftPlugin(plugins.SingletonPlugin):
plugins.implements(plugins.IConfigurer)
# IConfigurer
def update_config(self, config):
toolkit.add_template_directory(config, 'templates')
toolkit.add_public_directory(config, 'public')
toolkit.add_resource('assets', 'theme_hft')
{% ckan_extends %}
{# Add HFT assets (figures, footer, css, etc.) #}
{% block styles %}
{{ super() }}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
{% asset 'theme_hft/theme' %}
{% endblock %}
{% ckan_extends %}
{# Override footer.html to put M4_LAB footer #}
{% block footer_content %}
<div class="row">
<div class="col-md-4 attribution">
<img src="https://m4lab.hft-stuttgart.de/img/footer/Innovative_Hochschule_Initiative_BMBF_GWK_RGB.png" height='90'/>
</div>
<div class="col-md-2 attribution">
<img src="https://m4lab.hft-stuttgart.de/img/footer/M4_LAB_LOGO_Graustufen.png" height='80'/>
</div>
<div class="col-md-3 footer-links">
<a href="https://twitter.com/InnolabM4">
<i class="fa fa-twitter fa-3x"></i>
</a>
<a href="https://wwww.facebook.com/HfTStuttgart/">
<i class="fa fa-facebook-square fa-3x"></i>
</a>
<a href="https://www.instagram.com/m4_lab/">
<i class="fa fa-instagram fa-3x"></i>
</a>
<a href="https://de.linkedin.com/school/hochschule-f%C3%BCr-technik-stuttgart-%E2%80%93-university-of-applied-sciences/">
<i class="fa fa-linkedin fa-3x"></i>
</a>
<a href="https://www.youtube.com/channel/UCi0_JfF2qMZbOhOnNH5PyHA">
<i class="fa fa-youtube-play fa-3x"></i>
</a>
</div>
<div class="col-md-3 footer-links">
<div class="row">
<div class="col">Hochschule für Technik Stuttgart</div>
</div>
<div class="row">
<div class="col-md-6">
<a href="https://www.hft-stuttgart.de/impressum">Impressum</a>
</div>
<div class="col-md-6">
<a href="https://www.hft-stuttgart.de/datenschutz">Datenschutz</a>
</div>
</div>
</div>
</div>
{% endblock %}
{% ckan_extends %}
{# Remove Activity Stream #}
{% block content_primary_nav %}
{{ h.build_nav_icon(group_type + '.read', _('Datasets'), id=group_dict.name, icon='sitemap') }}
{{ h.build_nav_icon(group_type + '.about', _('About'), id=group_dict.name, icon='info-circle') }}
{% endblock %}
{% ckan_extends %}
{# Remove access to Profile Setting #}
{% block header_account_settings_link %}
{% endblock %}
{# Exclude About and Organizations #}
{% block header_site_navigation_tabs %}
{{ h.build_nav_main(
('dataset.search', _('Datasets')),
('group.index', _('Groups')) ) }}
{% endblock %}
{% ckan_extends %}
{% block featured_group %}
{% snippet 'snippets/most_popular_groups.html',
groups=h.hft_theme_most_popular_groups() %}
{% endblock %}
{% ckan_extends %}
{# remove promoted image #}
{% block home_image %}{% endblock %}
{% set placeholder = _('E.g. environment') %}
{# Remove tags #}
<div class="module module-search module-narrow module-shallow box">
<form class="module-content search-form" method="get" action="{% url_for 'dataset.search' %}">
<h3 class="heading">{{ _("Search data") }}</h3>
<div class="search-input form-group search-giant">
<input aria-label="{% block header_site_search_label %}{{ _('Search datasets') }}{% endblock %}" id="field-main-search" type="text" class="form-control" name="q" value="" autocomplete="off" placeholder="{% block search_placeholder %}{{ placeholder }}{% endblock %}" />
<button type="submit" aria-labelledby="search-label">
<i class="fa fa-search"></i>
<span class="sr-only" id="search-label">{{ _('Search') }}</span>
</button>
</div>
</form>
</div>
{% ckan_extends %}
{# Remove Organization #}
{% block stats_group %}
<li>
<a href="{{ h.url_for('dataset.search') }}">
<strong>{{ h.SI_number_span(stats.dataset_count) }}</strong>
{{ _('dataset') if stats.dataset_count == 1 else _('datasets') }}
</a>
</li>
<li>
<a href="{{ h.url_for(controller='group', action='index') }}">
<strong>{{ h.SI_number_span(stats.group_count) }}</strong>
{{ _('group') if stats.group_count == 1 else _('groups') }}
</a>
</li>
{% endblock %}
{% ckan_extends %}
{% block primary_content_inner %}
{{ super() }}
{% if (group_dropdown) and (c.userobj) %}
{% endif %}
{% endblock %}
{% ckan_extends %}
{# Remove Activity Stream #}
{% block content_primary_nav %}
{{ h.build_nav_icon(dataset_type ~ '.read', _('Dataset'), id=pkg.id if is_activity_archive else pkg.name, icon='sitemap') }}
{{ h.build_nav_icon(dataset_type ~ '.groups', _('Groups'), id=pkg.id if is_activity_archive else pkg.name, icon='users') }}
{% endblock %}
{% ckan_extends %}
{# Simplifies the form for adding datasets by removing Tags. Titel field is marked as *Pflichtfeld (mandatory) #}
{% block package_basic_fields_title %}
{{ form.input('title', id='field-title', label=_('Title'), placeholder=_('eg. A descriptive title'), value=data.title, error=errors.title, classes=['control-full', 'control-large'], attrs={'data-module': 'slug-preview-target', 'class': 'form-control'}, is_required=true) }}
{% endblock %}
{% block package_basic_fields_tags %}
{% endblock %}
{% ckan_extends %}
{# Remove Custom Fields and marks Autor, Verantwortlicher, and their emails fields as *Pflichtfeld (mandatory) #}
{% block package_metadata_author %}
{{ form.input('author', label=_('Author'), id='field-author', placeholder=_('Joe Bloggs'), value=data.author, error=errors.author, classes=['control-medium'], is_required=true) }}
{{ form.input('author_email', label=_('Author Email'), id='field-author-email', placeholder=_('joe@example.com'), value=data.author_email, error=errors.author_email, classes=['control-medium'], is_required=true) }}
{% endblock %}
{% block package_metadata_fields_maintainer %}
{{ form.input('maintainer', label=_('Maintainer'), id='field-maintainer', placeholder=_('Joe Bloggs'), value=data.maintainer, error=errors.maintainer, classes=['control-medium'], is_required=true) }}
{{ form.input('maintainer_email', label=_('Maintainer Email'), id='field-maintainer-email', placeholder=_('joe@example.com'), value=data.maintainer_email, error=errors.maintainer_email, classes=['control-medium'], is_required=true) }}
{% endblock %}
{% block package_metadata_fields_custom %}
{% endblock %}
{% ckan_extends %}
{# Add a label: maximum data size #}
{% block basic_fields_url %}
{% set is_upload = (data.url_type == 'upload') %}
{{ form.image_upload(data, errors, field_url='url', field_upload='upload', field_clear='clear_upload',
is_upload_enabled=h.uploads_enabled(), is_url=data.url and not is_upload, is_upload=is_upload,
upload_label=_('Data (max. 150MB)'), url_label=_('URL'), placeholder=_('http://example.com/external-data.csv'), field_name='name') }}
{% endblock %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment