Exemplo n.º 1
0
    def postp(r, output):

        if not r.component and r.record and isinstance(output, dict):

            # Custom CRUD buttons
            if "buttons" not in output:
                buttons = output["buttons"] = {}
            else:
                buttons = output["buttons"]

            # Anonymize-button
            from s3 import S3AnonymizeWidget
            anonymize = S3AnonymizeWidget.widget(
                r, _class="action-btn anonymize-btn")

            # ID-Card button
            if id_card_export:
                card_button = A(
                    T("ID Card"),
                    data={
                        "url": URL(c="br", f="person",
                                   args=["%s.card" % r.id]),
                    },
                    _class="action-btn s3-download-button",
                    _script="alert('here')",
                )
            else:
                card_button = ""

            # Render in place of the delete-button
            buttons["delete_btn"] = TAG[""](
                card_button,
                anonymize,
            )
        return output
Exemplo n.º 2
0
Arquivo: br.py Projeto: nursix/eden
    def postp(r, output):

        if not r.component and r.record and isinstance(output, dict):

            # Custom CRUD buttons
            if "buttons" not in output:
                buttons = output["buttons"] = {}
            else:
                buttons = output["buttons"]

            # Anonymize-button
            from s3 import S3AnonymizeWidget
            anonymize = S3AnonymizeWidget.widget(r, _class="action-btn anonymize-btn")

            # ID-Card button
            if id_card_export:
                card_button = A(T("ID Card"),
                                data = {"url": URL(c="br", f="person",
                                                   args = ["%s.card" % r.id]
                                                   ),
                                        },
                                _class = "action-btn s3-download-button",
                                _script = "alert('here')",
                                )
            else:
                card_button = ""

            # Render in place of the delete-button
            buttons["delete_btn"] = TAG[""](card_button,
                                            anonymize,
                                            )
        return output