Example #1
0
    def __init__(self,
                 title,
                 contents,
                 link=None,
                 cls=None,
                 delete=None,
                 reply=None,
                 rejudge=None,
                 edit=None):
        if cls == None:
            cls = "card"
        else:
            cls += " card"
        deleteLink = ""
        if delete:
            deleteLink = div(h.i("clear", cls="material-icons"),
                             cls="delete-link",
                             onclick=delete)
        elif reply:
            deleteLink = div(h.button("Reply",
                                      cls="btn btn-primary",
                                      onclick=reply),
                             cls="delete-link")
        if rejudge:
            deleteLink = div(h.button("Rejudge All",
                                      cls="btn btn-primary",
                                      onclick=rejudge),
                             cls="delete-link")

            # Add a pencil to the card if one is desired
        editLink = ""
        if edit:
            editLink = div(h.i("edit", cls="material-icons", onclick=edit),
                           cls="delete-link")

        self.html = h.div(cls=cls,
                          contents=[
                              div(cls="card-header",
                                  contents=[
                                      h2(contents=[title], cls="card-title"),
                                      deleteLink, editLink
                                  ]),
                              div(cls="card-contents", contents=contents)
                          ])
        if link != None:
            self.html = div(a(href=link, cls="card-link"),
                            self.html,
                            cls="card-link-box")
 def __init__(self, sub):
     result = sub.getContestantResult()
     self.html = h.tr(h.td(sub.problem.title),
                      h.td(cls='time-format', contents=sub.timestamp),
                      h.td(sub.language),
                      h.td(h.i(" ", cls=f"fa fa-{icons[result]}"),
                           h.span(verdict_name[result])),
                      onclick=f"submissionPopupContestant('{sub.id}')")
Example #3
0
 def __init__(self, user: User):
     cls = "blue" if user.isAdmin() else ""
     self.html = div(cls="col-3",
                     contents=[
                         Card(div(
                             h.strong(h.i("Username:"******"username-hidden"),
                             h.br(cls="username-hidden"),
                             h.p(""", cls="username-hidden"),
                             h2(user.username, cls="card-title"),
                             h.p(""", cls="username-hidden")),
                              div(h.strong(h.i("Fullname:")), h.br(),
                                  f""{user.fullname}"", h.br(),
                                  h.strong(h.i("Password:"******""{user.password}""),
                              delete=f"deleteUser('{user.username}')",
                              cls=cls)
                     ])
Example #4
0
 def __init__(self, x, sub):
     num, result = x
     test_label = "Sample" if num < sub.problem.samples else "Judge"
     self.html = h.li(
         h.a(href=f"#tabs-{sub.id}-{num}",
             contents=[
                 h.i(cls=f"fa fa-{icons[result]}",
                     title=f"{verdict_name[result]}"),
                 f"{test_label} #{num}"
             ]))
Example #5
0
 def __init__(self, sub):
     checkoutUser = User.get(sub.checkout)
     self.html = h.tr(
         h.td(sub.user.username),
         h.td(sub.problem.title),
         h.td(sub.id),  # cls='time-format', contents=sub.timestamp
         h.td(sub.language),
         h.td(h.i("&nbsp;", cls=f"fa fa-{icons.get(sub.result)}"),
              h.span(verdict_name.get(sub.result))),
         h.td(contents=[
             sub.status,
             h.p(sub.version, id=f"{sub.id}-version", hidden=True)
         ]),
         h.td(
             checkoutUser.username if checkoutUser is not None else "None"),
         id=sub.id,
         cls="submit-row",
     )