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

Dev

parent 0787bd66
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
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
- home
- index.html
- snippets
- promoted.html
- base.html
- header.html
- footer.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`_
- theme name: _`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("/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:
filters: cssrewrite
output: assets/%(version)s_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 %}
{% 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 #}
{% block footer_content %}
<div class="row">
<div class="col-md-4 attribution">
<img src="/Innovative_Hochschule_Initiative_BMBF_GWK_RGB.png" height='90'/>
</div>
<div class="col-md-2 attribution">
<img src="/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 %}
{# exclude About #}
{% block header_site_navigation_tabs %}
{{ h.build_nav_main(
('dataset.search', _('Datasets')),
('organization.index', _('Organizations')),
('group.index', _('Groups')) ) }}
{% endblock %}
{# process the default index.html first #}
{% ckan_extends %}
{% ckan_extends %}
{# remove promoted image #}
{% block home_image %}{% endblock %}
# -*- coding: utf-8 -*-
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='''ckanext-theme_hft''',
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# http://packaging.python.org/en/latest/tutorial.html#version
version='0.0.1',
description=''' Customized UI of CKAN of HFT Stuttgart''',
long_description=long_description,
long_description_content_type="text/markdown",
# Choose your license
license='AGPL',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2.7',
],
# What does your project relate to?
keywords='''data catalog''',
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
namespace_packages=['ckanext'],
install_requires=[
# CKAN extensions should not list dependencies here, but in a separate
# ``requirements.txt`` file.
#
# http://docs.ckan.org/en/latest/extensions/best-practices.html
# add-third-party-libraries-to-requirements-txt
],
# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well.
include_package_data=True,
package_data={
},
# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages.
# see http://docs.python.org/3.4/distutils/setupscript.html
# installing-additional-files
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
data_files=[],
# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow
# pip to create the appropriate form of executable for the target platform.
entry_points='''
[ckan.plugins]
theme_hft=ckanext.theme_hft.plugin:ThemeHftPlugin
[babel.extractors]
ckan = ckan.lib.extract:extract_ckan
''',
# If you are changing from the default layout of your extension, you may
# have to change the message extractors, you can read more about babel
# message extraction at
# http://babel.pocoo.org/docs/messages/#extraction-method-mapping-and-configuration
message_extractors={
'ckanext': [
('**.py', 'python', None),
('**.js', 'javascript', None),
('**/templates/**.html', 'ckan', None),
],
}
)
Markdown is supported
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