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 StyleFormTwo in styleguide #3181

Merged
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
39 changes: 26 additions & 13 deletions python/nav/web/styleguide.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@

from django.shortcuts import render
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms_foundation.layout import Layout, Column, Row, Fieldset

from nav.web.crispyforms import (
FlatFieldset,
FormColumn,
FormRow,
set_flat_form_attributes,
)


class StyleFormOne(forms.Form):
Expand All @@ -36,17 +41,25 @@ class StyleFormTwo(forms.Form):

def __init__(self, *args, **kwargs):
super(StyleFormTwo, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_action = ''
self.helper.form_method = 'POST'
self.helper.layout = Layout(
Fieldset(
'Address form',
Row(
Column('name', css_class='small-6'),
Column('address', css_class='small-6'),
),
)

self.attrs = set_flat_form_attributes(
form_fields=[
FlatFieldset(
legend="Address form",
fields=[
FormRow(
fields=[
FormColumn(
fields=[self["name"]], css_classes="small-6"
),
FormColumn(
fields=[self["address"]], css_classes="small-6"
),
]
)
],
)
]
)


Expand Down
5 changes: 2 additions & 3 deletions python/nav/web/templates/styleguide.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends 'base.html' %}
{% load crispy_forms_tags %}

{% block base_header_additional_head %}
<style>
Expand Down Expand Up @@ -416,8 +415,8 @@ <h3 class="underline">Forms</h3>
need to create forms - ask on mail/jabber/irc.
</p>

{% crispy form1 %}
{% crispy form2 %}
{% include 'custom_crispy_templates/flat_form.html' with form=form1 %}
{% include 'custom_crispy_templates/flat_form.html' with form=form2 %}

</div>

Expand Down
Loading