Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncrispify all of seedDB #3128

Merged
merged 4 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/nav/web/seeddb/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def cut_branch(field, klass, pk):
return [c for c in field.choices if c[0] not in descendant_ids]


# non-crispy helpers
# helpers


def get_single_layout(heading, row):
Expand Down
7 changes: 0 additions & 7 deletions python/nav/web/seeddb/page/service/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

from nav.models.service import Service, ServiceProperty
from nav.models.manage import Netbox
from nav.web.crispyforms import set_flat_form_attributes
from nav.web.servicecheckers import get_description, load_checker_classes
from nav.web.message import new_message, Messages
from nav.web.seeddb.page.service import ServiceInfo
Expand All @@ -45,8 +44,6 @@ def __init__(self, *args, **kwargs):
widget=forms.Select(attrs={'class': 'select2'}),
)

self.attrs = set_flat_form_attributes()

@staticmethod
def _build_checker_choices():
checkers = load_checker_classes()
Expand Down Expand Up @@ -75,8 +72,6 @@ class ServiceForm(forms.Form):
handler = forms.CharField(widget=forms.HiddenInput)
netbox = forms.IntegerField(widget=forms.HiddenInput)

attrs = set_flat_form_attributes()


class ServicePropertyForm(forms.Form):
"""Form for editing service properties"""
Expand All @@ -94,8 +89,6 @@ def __init__(self, *args, **kwargs):
for arg, descr in opt_args:
self.fields[arg] = forms.CharField(required=False, help_text=descr)

self.attrs = set_flat_form_attributes()


def service_edit(request, service_id=None):
"""Controller for editing services"""
Expand Down
12 changes: 3 additions & 9 deletions python/nav/web/templates/seeddb/edit.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{% extends "seeddb/base.html" %}
{% load crispy_forms_tags %}


{% block base_header_additional_head %}
{{ block.super }}
Expand Down Expand Up @@ -41,13 +39,9 @@ <h4>{{ title }}
<form class="seeddb-edit" action="" method="post">
<fieldset>
<legend>Attributes</legend>
{% if form.attrs %}
{% include 'custom_crispy_templates/_form_content.html' %}
{% else %}
{% block crispyfields %}
{{ form|crispy }}
{% endblock %}
{% endif %}
{% block formfields %}
{% include 'custom_crispy_templates/_form_content.html' %}
{% endblock %}
</fieldset>
<input type="submit" name="submit" value="Save {{ verbose_name }}" class="submit button small left" id="submit-id-submit">
</form>
Expand Down
2 changes: 1 addition & 1 deletion python/nav/web/templates/seeddb/edit_prefix.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "seeddb/edit.html" %}
{% block crispyfields %}
{% block formfields %}
{{ block.super }}
{% include 'custom_crispy_templates/_form_content.html' with form=vlan_form %}
{% endblock %}
2 changes: 1 addition & 1 deletion python/nav/web/templates/seeddb/edit_vlan.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "seeddb/edit.html" %}
{% block crispyfields %}
{% block formfields %}
<div>
<p>Net type<br/>
{{ object.net_type }}</p>
Expand Down
11 changes: 1 addition & 10 deletions python/nav/web/templates/seeddb/list.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
{% extends "seeddb/base.html" %}
{% load crispy_forms_tags %}

{% block content %}

{% if filter_form %}
{% if filter_form.base_fields|length >= 3 %}
{% if filter_form.attrs %}
{% include 'custom_crispy_templates/flat_form.html' with form=filter_form %}
{% else %}
{{ filter_form }}
{% endif %}
{% include 'custom_crispy_templates/flat_form.html' with form=filter_form %}
{% else %}
<div class="row">
<div class="medium-6 column">
{% if filter_form.attrs %}
{% include 'custom_crispy_templates/flat_form.html' with form=filter_form %}
{% else %}
{% crispy filter_form %}
{% endif %}
</div>
</div>
{% endif %}
Expand Down
6 changes: 1 addition & 5 deletions python/nav/web/templates/seeddb/service_netbox_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ <h4>
<form id="service_checker_add_form" action="" method="post">
<fieldset>
<legend>Add new service checker</legend>
{% if choice_form.attrs %}
{% include 'custom_crispy_templates/_form_content.html' with form=choice_form %}
{% else %}
{{ choice_form }}
{% endif %}
{% include 'custom_crispy_templates/_form_content.html' with form=choice_form %}
<input type="submit" value="Continue" class="button small"/>
</fieldset>
</form>
Expand Down
12 changes: 2 additions & 10 deletions python/nav/web/templates/seeddb/service_property_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,9 @@ <h4>
<form action="" method="post">
<fieldset>
<legend>Attributes</legend>
{% if service_form.attrs %}
{% include 'custom_crispy_templates/_form_content.html' with form=service_form %}
{% else %}
{{ service_form }}
{% endif %}
{% include 'custom_crispy_templates/_form_content.html' with form=service_form %}
{% if property_form.fields %}
{% if property_form.attrs %}
{% include 'custom_crispy_templates/_form_content.html' with form=property_form %}
{% else %}
{{ property_form }}
{% endif %}
{% include 'custom_crispy_templates/_form_content.html' with form=property_form %}
{% else %}
<div class="alert-box">
There are no attributes for this service.
Expand Down
Loading