Fix styling issues on Bootstrap 3

This commit is contained in:
amercader 2018-10-25 12:19:43 +02:00
parent 7dd82a0e01
commit bdbf53caea
9 changed files with 42 additions and 24 deletions

View File

@ -11,6 +11,9 @@ header.with-filter h1 {
text-shadow: none;
font-weight: normal;
}
[data-diff="error"] {
background-color: #b55457;
}
[data-diff="added"] {
background-color: #9ee592;
}
@ -36,9 +39,8 @@ header.with-filter h1 {
.harvest-types label.radio input {
top: 3px;
}
#source-new .controls {
margin-left: 135px;
}
#source-new .control-label {
#source-new.bs2 .control-label {
width: 125px;
}
-}

View File

@ -110,3 +110,12 @@ def harvest_source_extra_fields():
fields[harvester.info()['name']] = harvester.extra_schema().keys()
return fields
def bootstrap_version():
if p.toolkit.check_ckan_version(max_version='2.7.99'):
return 'bs2'
else:
return (
'bs2' if
p.toolkit.config.get('ckan.base_public_folder') == 'public-bs2'
else 'bs3')

View File

@ -218,7 +218,7 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm, DefaultTranslation):
# Setup harvest model
model_setup()
# Configure database logger
_configure_db_logger(config)
@ -293,6 +293,7 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm, DefaultTranslation):
'harvest_frequencies': harvest_helpers.harvest_frequencies,
'link_for_harvest_object': harvest_helpers.link_for_harvest_object,
'harvest_source_extra_fields': harvest_helpers.harvest_source_extra_fields,
'bootstrap_version': harvest_helpers.bootstrap_version,
}
def dataset_facets(self, facets_dict, package_type):
@ -472,7 +473,7 @@ def _delete_harvest_source_object(context, data_dict):
def _configure_db_logger(config):
# Log scope
#
#
# -1 - do not log to the database
# 0 - log everything
# 1 - model, logic.action, logic.validators, harvesters
@ -486,16 +487,16 @@ def _configure_db_logger(config):
scope = p.toolkit.asint(config.get('ckan.harvest.log_scope', -1))
if scope == -1:
return
parent_logger = 'ckanext.harvest'
children = ['plugin', 'model', 'logic.action.create', 'logic.action.delete',
'logic.action.get', 'logic.action.patch', 'logic.action.update',
children = ['plugin', 'model', 'logic.action.create', 'logic.action.delete',
'logic.action.get', 'logic.action.patch', 'logic.action.update',
'logic.validators', 'harvesters.base', 'harvesters.ckanharvester']
children_ = {0: children, 1: children[1:], 2: children[1:-2],
3: children[1:-3], 4: children[2:-3], 5: children[1:2],
6: children[:1], 7: children[-2:]}
# Get log level from config param - default: DEBUG
from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL
level = config.get('ckan.harvest.log_level', 'debug').upper()
@ -513,7 +514,7 @@ def _configure_db_logger(config):
level = DEBUG
loggers = children_.get(scope)
# Get root logger and set db handler
logger = getLogger(parent_logger)
if scope < 1:

View File

@ -17,7 +17,7 @@ Example:
{% if job.status == 'Finished' %}
<p>
<span class="label label-important">
<span class="label label-important" data-diff="error">
{% if 'errored' in stats and stats['errored'] > 0 %}
{{ stats['errored'] }}
{% else %}

View File

@ -6,7 +6,7 @@
{% if source.status and source.status.last_job %}
{% snippet "snippets/job_details.html", job=source.status.last_job %}
<div class="form-actions">
<a href="{{ h.url_for(controller='ckanext.harvest.controllers.view:ViewController', action='show_last_job', source=source.name) }}" class="btn pull-right">
<a href="{{ h.url_for(controller='ckanext.harvest.controllers.view:ViewController', action='show_last_job', source=source.name) }}" class="btn pull-right btn-default">
<i class="fa fa-briefcase icon-briefcase"></i>
{{ _('View full job report') }}
</a>

View File

@ -14,7 +14,7 @@
{% else %}
{% set locale = h.dump_json({'content': _('This will re-run the harvesting for this source. Any updates at the source will overwrite the local datasets. Sources with a large number of datasets may take a significant amount of time to finish harvesting. Please confirm you would like us to start reharvesting.')}) %}
{{ '<li>' if show_li }}
<a href="{{ h.url_for('harvest_refresh', id=source.id) }}" class="btn" data-module="confirm-action" data-module-i18n="{{ locale }}"
<a href="{{ h.url_for('harvest_refresh', id=source.id) }}" class="btn btn-default" data-module="confirm-action" data-module-i18n="{{ locale }}"
title="{{ _('Start a new harvesting job for this harvest source now') }}">
<i class="fa fa-refresh icon-refresh"></i>
{{ _('Reharvest') }}
@ -23,7 +23,7 @@
{% endif %}
{% if source.status and source.status.last_job and (source.status.last_job.status == 'Running') %}
{{ '<li>' if show_li }}
<a href="{{ h.url_for('harvest_job_abort', source=source.name, id=source.status.last_job.id) }}" class="btn" title="Stop this Job">
<a href="{{ h.url_for('harvest_job_abort', source=source.name, id=source.status.last_job.id) }}" class="btn btn-default" title="Stop this Job">
<i class="fa fa-ban icon-ban-circle"></i>
{{ _('Stop') }}
</a>
@ -31,13 +31,19 @@
{% endif %}
{% set locale = h.dump_json({'content': _('Warning: This will remove all datasets for this source, as well as all previous job reports. Are you sure you want to continue?')}) %}
{{ '<li>' if show_li }}
<a href="{{ h.url_for('harvest_clear', id=source.id) }}" class="btn" data-module="confirm-action" data-module-i18n="{{ locale }}"
<a href="{{ h.url_for('harvest_clear', id=source.id) }}" class="btn btn-default" data-module="confirm-action" data-module-i18n="{{ locale }}"
title="{{ _('Delete all harvest jobs and existing datasets from this source') }}">
{{ _('Clear') }}
</a>
{{ '</li>' if show_li }}
{{ '<li>' if show_li }}{{ h.nav_link(_('View harvest source'), named_route='{0}_read'.format(c.dataset_type), id=source.name, class_='btn', icon='eye-open')}}{{ '</li>' if show_li }}
{{ '<li>' if show_li }}
<a href="{{ h.url_for('{0}_read'.format(c.dataset_type), id=source.id) }}" class="btn btn-default">
<i class="fa fa-eye eye-open"></i>
{{ _('View harvest source') }}
</a>
{{ '</li>' if show_li }}
{% endblock %}
{# CKAN 2.0 #}

View File

@ -40,7 +40,7 @@
<ul class="dataset-resources unstyled">
{% if 'errored' in job.stats and job.stats['errored'] > 0 %}
<li>
<span class="label label-important">
<span class="label label-important" data-diff="error">
{{ job.stats['errored'] }} {{ _('errors') }}
</span>
</li>

View File

@ -6,7 +6,7 @@
<div class="module-content">
<p class="pull-right">
{{ h.nav_link(_('Back to job list'), named_route='harvest_job_list', source=source.name, class_='btn', icon='arrow-left')}}
{{ h.nav_link(_('Back to job list'), named_route='harvest_job_list', source=source.name, class_='btn btn-default', icon='arrow-left')}}
</p>
<h1>{{ _('Job Report') }}</h1>

View File

@ -1,7 +1,7 @@
{% import 'macros/form.html' as form %}
{% resource 'harvest-extra-field/main' %}
<form id="source-new" class="form-horizontal" method="post" >
<form id="source-new" class="form-horizontal dataset-form {{ h.bootstrap_version() }}" method="post" >
{% block errors %}{{ form.errors(error_summary) }}{% endblock %}
@ -22,7 +22,7 @@
{{ form.markdown('notes', id='field-notes', label=_('Description'), value=data.notes, error=errors.notes) }}
<div class="harvest-types control-group">
<div class="harvest-types form-group control-group">
<label class="control-label">Source type</label>
<div class="controls">
{% for harvester in h.harvesters_info() %}
@ -59,7 +59,7 @@
{% if show_organizations_selector %}
{% set existing_org = data.owner_org %}
<div class="control-group">
<div class="control-group form-group">
<label for="field-organizations" class="control-label">{{ _('Organization') }}</label>
<div class="controls">
<select id="field-organizations" name="owner_org" data-module="autocomplete">