コード例 #1
0
ファイル: forms.py プロジェクト: TomasNeumajer/appshell
    def render_fields(self, fields, form_info=None):
        tb = ClientSideTabbar()
        f = fields
        for i in self.parts:
            of, f = i.filter_own_fields(f)

            t = i.title

            if any((i.errors for i in of)):
                t = Markup('<span class="text-danger"><span class="glyphicon glyphicon-warning-sign"> {}</span>').format(t) 
            
            tb.add_tab(t,
                       element("div",
                               i.view.form_attrs,
                               i.view.render_fields(of, form_info=form_info)),
                       name=i.name)
        rest = ""
        if f:
            if not self.rest_view:
                raise ValueError("Not all fields assigned to parts")
            
            rest = element("div",
                           self.rest_view.form_attrs,
                           self.rest_view.render_fields(f,
                                                        form_info=form_info))

        return Markup("{}{}").format(rest, tb)
コード例 #2
0
    def render_fields(self, fields, form_info=None):
        tb = ClientSideTabbar()
        f = fields
        for i in self.parts:
            of, f = i.filter_own_fields(f)

            t = i.title

            if any((i.errors for i in of)):
                t = Markup(
                    '<span class="text-danger"><span class="glyphicon glyphicon-warning-sign"> {}</span>'
                ).format(t)

            tb.add_tab(t,
                       element("div", i.view.form_attrs,
                               i.view.render_fields(of, form_info=form_info)),
                       name=i.name)
        rest = ""
        if f:
            if not self.rest_view:
                raise ValueError("Not all fields assigned to parts")

            rest = element(
                "div", self.rest_view.form_attrs,
                self.rest_view.render_fields(f, form_info=form_info))

        return Markup("{}{}").format(rest, tb)
コード例 #3
0
ファイル: demo.py プロジェクト: TomasNeumajer/appshell
def tabs():
    tb = ClientSideTabbar()
    tb.add_tab("Foo", "foo content")
    tb.add_tab("Bar", "bar content")
    tb.add_tab("Quux", "quux content")

    return single_view(tb)