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

class viewflow.forms.Tag not implemented #217

Open
Tooblippe opened this issue Feb 6, 2025 · 1 comment
Open

class viewflow.forms.Tag not implemented #217

Tooblippe opened this issue Feb 6, 2025 · 1 comment

Comments

@Tooblippe
Copy link

HI,

I cannot seem to find the implementtion of the class viewflow.forms.Tag

From where to I import this?

regards

@Tooblippe
Copy link
Author

Tooblippe commented Feb 6, 2025

i made a very crude implementation.

class Tag(LayoutNode):
    def __init__(self, text, tag_type, attribs: dict, **kwargs):
        self.text = text
        self.tag_type = tag_type
        self.attribs = attribs
        super().__init__(*kwargs)

    def append(self, layout: FormLayout, form: forms.Form, root: ElementTree.Element):
        ElementTree.SubElement(
            root,
            self.tag_type,
            self.attribs,
        )

and i am using it with alpine.js and it works


Tag(
                "Add company",
                "button",
                {
                    "x-data": "{x:'+ New Company'}",
                    "x-text": "x",
                    "@click.prevent": "window.location ='/company_view/'",
                    "class": "bg-crm-primary text-white px-4 py-2 rounded-lg hover:bg-gray-500",
                },
            ),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant