Пример #1
0
    def render(self, request, url):
        """
        :type url: werkzeug.routing.MapAdapter
        :type request: werkzeug.wrappers.Request
        """

        # ifLogged = lambda fun: fun if self.isLogged else ''
        isTrusted = IGBRequest(request).isTrusted

        layout = (
            T.html(lang='en')[
                T.head[
                    T.meta(charset='utf-8'),
                    T.meta(content='IE=Edge', **{'http-equiv': "X-UA-Compatible"}),
                    T.meta(name='viewport', content='width=device-width, initial-scale=1'),

                    T.title['PyEve IGB'],

                    T.link(href='/static/css/bootstrap-black.min.css', rel='stylesheet'),
                    T.link(href='/static/css/igb.css', rel='stylesheet'),

                    T.script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'),
                    T.script(src='/static/js/bootstrap.js'),
                    T.script(src='/static/js/igbCore.js'),

                    self.getAdditionalJs()
                ],

                T.body[
                    # 'HOWDY',
                    # request.headers.get('EVE_TRUSTED', 'alo'),
                    T.div(class_='container-fluid')[
                        C.switch(isTrusted)[
                            C.case(True)[self.content],
                            C.case(False)[self.renderRequestTrust()]
                        ],

                        T.div(class_='text-center')[
                            T.small[
                                'PyEVE. Created by ',
                                T.a(href="#", onclick="CCPEVE.showInfo(1377, 93747896); return false")[
                                    'Rudykocur Maxwell'
                                ]
                            ]
                        ]
                    ],
                ]
            ]
        )

        return Response(flatten(layout), mimetype='text/html')
Пример #2
0
    def getKnownSignaturesTable(self, signatures):

        result = [
            T.table(class_='table table-bordered')[
                T.thead[
                    T.tr[
                        T.th['Key'],
                        T.th['Group'],
                        T.th['Type'],
                        T.th['Name'],
                        T.th[''],
                    ]
                ],

                T.tbody[
                    forEach(signatures, lambda key, group, sigType, name: [
                        T.tr[
                            T.td[key],
                            T.td[group],
                            T.td[sigType],
                            T.td[name],
                            T.td[
                                C.when(sigType in ['Data Site', 'Relic Site'])[
                                    T.a(href='#', class_='lootModalToggle', **{'data-key': key})[
                                        'Loot'
                                    ]
                                ]
                            ]
                        ]
                    ])
                ]
            ]
        ]

        return result
Пример #3
0
def Panel(content, heading=None):
    return T.div(class_="panel panel-default")[
        C.when(heading is not None)[
            T.div(class_='panel-heading')[
                T.h3(class_='panel-title')[
                    heading
                ]
            ]
        ],
        T.div(class_="panel-body")[
            content
        ]
    ]
Пример #4
0
    def renderStandardField(self, field):
        additionalClasses = set()

        feedbackIcon = None

        if field.flags.required:
            feedbackIcon = 'glyphicon-asterisk'

        if field.errors:
            additionalClasses.add('has-error')
            feedbackIcon = 'glyphicon-remove'

        if feedbackIcon is not None:
            additionalClasses.add('has-feedback')

        classes = ' %s' % ' '.join(additionalClasses)

        return (
            T.div(class_="form-group%s" % classes)[
                T.label(class_="col-sm-3 control-label")[field.label],
                T.div(class_="col-sm-9")[
                    field(class_='form-control'),

                    C.when(feedbackIcon)[
                        T.span(class_='glyphicon form-control-feedback %s' % feedbackIcon),
                    ],

                    C.when(field.errors)[
                        T.span(class_='help-block')[
                            T.ul[
                                [T.li[err] for err in field.errors]
                            ]
                        ]
                    ]
                ],
            ],
        )
Пример #5
0
def Modal(id, content, heading=None, footer=None):
    result = []

    result.append(T.div(class_='modal fade', id=id, tabindex='-1', role='dialog')[
        T.div(class_='modal-dialog')[
            T.div(class_='modal-content')[
                T.div(class_='modal-header')[
                    T.button(type='button', class_='close', **{'data-dismiss': 'modal'})[
                        T.span[entities.times],
                        T.span(class_='sr-only')['Close']
                    ],
                    T.h4(class_='modal-title')[heading]
                ],
                T.div(class_='modal-body')[
                    content
                ],
                C.when(footer is not None)[
                    T.div(class_='modal-footer')[footer]
                ]
            ]
        ]
    ])

    return result