Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        headings = ["Case manager", "Cases opened", "Cases closed"]
        past_day = [
            ["David Francis", "3", "0"],
            ["Paul Farmer", "1", "0"],
            ["Rita Patel", "2", "0"],
        ]
        past_week = [
            ["David Francis", "24", "18"],
            ["Paul Farmer", "16", "20"],
            ["Rita Patel", "24", "27"],
        ]
        past_month = [
            ["David Francis", "98", "95"],
            ["Paul Farmer", "122", "131"],
            ["Rita Patel", "126", "142"],
        ]
        past_year = [
            ["David Francis", "1380", "1472"],
            ["Paul Farmer", "1129", "1083"],
            ["Rita Patel", "1539", "1265"],
        ]

        self.helper = FormHelper()
        self.helper.layout = Layout(
            Tabs(
                TabPanel(
                    "Past day",
                    HTML.h1("Past day"),
                    HTML.table(headings, past_day),
                ),
                TabPanel(
                    "Past week",
                    HTML.h1("Past week"),
                    HTML.table(headings, past_week),
                ),
                TabPanel(
                    "Past month",
                    HTML.h1("Past month"),
                    HTML.table(headings, past_month),
                ),
                TabPanel(
                    "Past year",
                    HTML.h1("Past year"),
                    HTML.table(headings, past_year),
                ),
            ))
Exemplo n.º 2
0
def test_parameters(headers, rows, caption, header_css, row_css):
    field = HTML.table(headers,
                       rows,
                       caption=caption,
                       header_css=header_css,
                       row_css=row_css)
    assert isinstance(field, HTML)
Exemplo n.º 3
0
 def valid_layout(self):
     self.fields["method"].widget = MultipleHiddenInput()
     self.helper.layout = Layout(
         "method",
         HTML.h2("You answered..."),
         HTML.table(None, [("Methods selected:", self.get_method())]),
         Button("continue", "Continue"),
     )
Exemplo n.º 4
0
 def valid_layout(self):
     value = self.cleaned_data["sort_by"]
     self.helper.layout = Layout(
         Hidden("sort_by", value),
         HTML.h2("You answered..."),
         HTML.table(None, [("Sort by:", self.get_choice("sort_by"))]),
         Button("continue", "Continue"),
     )
Exemplo n.º 5
0
 def valid_layout(self):
     value = self.cleaned_data["date"]
     self.helper.layout = Layout(
         Hidden("date_0", value.day),
         Hidden("date_1", value.month),
         Hidden("date_2", value.year),
         HTML.h2("You answered..."),
         HTML.table(None, [("Date:", value.strftime("%e %B %Y"))]),
         Button("continue", "Continue"),
     )
Exemplo n.º 6
0
 def valid_layout(self):
     name = self.cleaned_data["name"]
     email = self.cleaned_data["email"]
     phone = self.cleaned_data["phone"]
     self.helper.layout = Layout(
         Hidden("name", name),
         Hidden("email", email),
         Hidden("phone", phone),
         HTML.h2("You answered..."),
         HTML.table(None, [("Name:", name), ("Email:", email),
                           ("Phone:", phone)]),
         Button("continue", "Continue"),
     )
Exemplo n.º 7
0
 def valid_layout(self):
     name = self.cleaned_data["name"]
     method = self.cleaned_data["method"]
     self.helper.layout = Layout(
         Hidden("name", name),
         Hidden("method", method),
         HTML.h2("You answered..."),
         HTML.table(
             None,
             [
                 ("Name changed:", self.get_choice("name")),
                 ("Contact method:", self.get_choice("method")),
             ],
         ),
         Button("continue", "Continue"),
     )
Exemplo n.º 8
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        header = ["Case worker", "Number of cases closed"]
        rows = [["David Francis", 3], ["Paul Farmer", 1]]
        header_css = [
            "govuk-!-width-one-half",
            "govuk-!-width-one-half govuk-table__header--numeric",
        ]
        row_css = ["", "govuk-table__cell--numeric"]

        self.helper = FormHelper()
        self.helper.layout = Layout(
            HTML.table(
                header, rows, caption="Caption", header_css=header_css, row_css=row_css
            )
        )
Exemplo n.º 9
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        headings = ["Name of user", "status"]
        statuses = [
            [
                "Rachel Silver",
                mark_safe(HTML.tag("Pending", Colour.BLUE).html)
            ],
            [
                "Jesse Smith",
                mark_safe(HTML.tag("Inactive", Colour.PURPLE).html)
            ],
            [
                "Joshua Wessel ",
                mark_safe(HTML.tag("Active", Colour.GREEN).html)
            ],
            ["Tim Harvey",
             mark_safe(HTML.tag("Blocked", Colour.RED).html)],
            [
                "Rachael Pepper",
                mark_safe(HTML.tag("Disabled", Colour.GREY).html)
            ],
            [
                "Stuart Say",
                mark_safe(HTML.tag("Declined", Colour.ORANGE).html)
            ],
            ["Laura Frith",
             mark_safe(HTML.tag("Waiting", Colour.PINK).html)],
            [
                "Emma Tennant",
                mark_safe(HTML.tag("New", Colour.TURQUOISE).html)
            ],
            [
                "Nigel Starmer",
                mark_safe(HTML.tag("Delayed", Colour.YELLOW).html)
            ],
        ]

        self.helper = FormHelper()
        self.helper.layout = Layout(HTML.table(headings, statuses))