Skip to content

Commit

Permalink
chore: fix admin form overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Jul 29, 2023
1 parent 463c545 commit 1475b9c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 24 deletions.
4 changes: 4 additions & 0 deletions ckanext/editable_config/assets/css/editable_config.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.editable-option-help--key {
max-width: 100%;
overflow-wrap: break-word;
}
10 changes: 0 additions & 10 deletions ckanext/editable_config/assets/script.js

This file was deleted.

5 changes: 0 additions & 5 deletions ckanext/editable_config/assets/style.css

This file was deleted.

10 changes: 5 additions & 5 deletions ckanext/editable_config/assets/webassets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ editable_config-js:
preload:
- base/main

# editable_config-css:
# filter: cssrewrite
# output: ckanext-editable_config/%(version)s-editable_config.css
# contents:
# - css/editable_config.css
editable_config-css:
filter: cssrewrite
output: ckanext-editable_config/%(version)s-editable_config.css
contents:
- css/editable_config.css
3 changes: 3 additions & 0 deletions ckanext/editable_config/config_declaration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ groups:
type: int
default: 0
example: 10
editable: true
description: |
Minimal number of seconds between two consequent change detection
cycles. Basically, if you set 60 as a value, plugin will check config
Expand All @@ -60,12 +61,14 @@ groups:
- key: ckanext.editable_config.disable_admin_config_tab
type: bool
example: true
editable: true
description: |
Remove "Config" tab from CKAN's Admin UI.
- key: ckanext.editable_config.replace_admin_config_tab
type: bool
example: true
editable: true
description: |
Replace "Config" tab from CKAN's Admin UI with basic form for
editable config options.
Expand Down
11 changes: 10 additions & 1 deletion ckanext/editable_config/templates/editable_config/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
{% asset "editable_config/editable_config-js" %}
{% endblock scripts %}

{% block styles %}
{{ super() }}
{% asset "editable_config/editable_config-css" %}
{% endblock styles %}


{% block primary_content_inner %}
{% block form %}

Expand Down Expand Up @@ -64,7 +70,10 @@ <h2 class="module-heading">
{% block sidebar_content %}
{% for name in options %}
<p>
<label for="{{ "field-value-" ~ name.replace(".", "-") }}">
<label
class="editable-option-help--key"
title="{{ name }}"
for="{{ "field-value-" ~ name.replace(".", "-") }}">
{{ name }}
</label>
{{ h.render_markdown(h.editable_config_option_description(name), allow_html=true) }}
Expand Down
4 changes: 1 addition & 3 deletions ckanext/editable_config/tests/test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest

import ckan.plugins.toolkit as tk
from ckan.common import config_declaration as cd


@pytest.mark.usefixtures("with_plugins", "non_clean_db")
Expand All @@ -20,8 +19,7 @@ def test_key_and_value_required(self, option_factory):

def test_key_cannot_be_undeclared(self, option_factory, faker):
"""Undeclared options are not allowed."""
while (key := faker.word()) in cd:
continue
key = faker.word()

with pytest.raises(tk.ValidationError) as e:
option_factory(key=key, value=faker.word())
Expand Down

0 comments on commit 1475b9c

Please sign in to comment.