Bind buttons to callbacks.

def bind_download_buttons(cls):
        """
        Bind buttons to callbacks.
        """
        def on_click(ev):
            button_el = ev.target
            form_el = button_el.parent.parent.parent

            # this allows to use disabled <textearea>, which is normally not
            # sent
            content = form_el.get(selector="textarea")[0].text

            # change filename according to output
            suffix = form_el.name
            download_path = "as_file/%s.%s" % (cls.filename, suffix)
            form_el.action = join(settings.API_PATH, download_path)

            input_el = form_el.get(selector="input")[0]
            input_el.value = content

        for el in document.get(selector="button.output_download_button"):
            el.bind("click", on_click)