Пример #1
0
def layout():
    if is_logged_in():
        username = get_current_user().name
    else:
        return html.Div(
            [html.Br(), html.H1("You must be logged in to do this")])

    user = get_current_user()

    return html.Div(
        children=[
            html.H1("Hi {}! Want to update your details?".format(username)),
            html.Br(),
            create_equal_row([
                html.Label("Location:"),
                dcc.Input(
                    value="",
                    placeholder="Which office are you in?",
                    type="text",
                    id="location-{}".format(NAME),
                ),
            ]),
            html.Br(),
            create_equal_row([html.Label("Biography:")]),
            dcc.Textarea(
                placeholder="Enter a biography",
                value=user.bio,
                id=biography_id,
                style={"width": "100%"},
            ),
            html.Br(),
            html.Button(
                "Save",
                id=save_id,
                n_clicks=0,
                className="btn btn-lg btn-primary btn-block",
            ),
            html.Br(),
            html.Br(),
            dcc.Link(
                html.Button(
                    "Delete Account",
                    id=delete_id,
                    n_clicks=0,
                    className="btn btn-lg btn-warning btn-block",
                ),
                href="/",
            ),
            html.Div(id=_dummy1, hidden=True),
        ],
        className="container",
    )
Пример #2
0
def layout():
    return html.Div(
        [
            html.H1("Metaswitch Tinder", className="text-center"),
            html.Br(),
            html.P(
                "Username and email provided by google authentication.",
                className="lead",
            ),
            html.Br(),
            create_equal_row([
                html.Label("Location:"),
                dcc.Input(
                    value="",
                    placeholder="Which office are you in?",
                    type="text",
                    id="location-{}".format(NAME),
                ),
            ]),
            html.Br(),
            create_equal_row([html.Label("Biography:")]),
            dcc.Textarea(
                placeholder="Enter a biography",
                value="",
                id="biography-{}".format(NAME),
                style={"width": "100%"},
            ),
            html.Br(),
            create_equal_row([html.Label("Tell us what you know about:")]),
            *tags_dropdown_with_add_new_entry_box(
                "categories-{}".format(NAME)),
            html.Br(),
            create_equal_row(
                [html.Label("Additional details about your skills:")]),
            create_equal_row([
                dcc.Input(value="", type="text", id="details-{}".format(NAME))
            ]),
            html.Br(),
            html.A(
                html.Button(
                    "Submit!",
                    id="submit-{}".format(NAME),
                    n_clicks=0,
                    className="btn btn-lg btn-primary btn-block",
                ),
                href="/login",
            ),
        ],
        className="container",
        id="signup",
    )
Пример #3
0
def layout():
    """
    Layout for debug login.
    """
    return html.Div(
        [
            html.H1("Metaswitch Tinder", className="text-center"),
            html.Br(),
            create_equal_row([
                html.Label("Username:"******"text-center"),
                dcc.Input(value="", type="text",
                          id="username-{}".format(NAME)),
            ]),
            html.Br(),
            dcc.Link(
                html.Button(
                    "Submit!",
                    id="submit-{}".format(NAME),
                    n_clicks=0,
                    className="btn btn-lg btn-primary btn-block",
                ),
                href=href(__name__, debug_login_submit),
            ),
        ],
        className="container",
        id="signin",
    )
Пример #4
0
def layout():
    user = get_current_user()

    return html.Div(
        [
            create_equal_row([html.Label("Tell us what you know about:")]),
            *tags_dropdown_with_add_new_entry_box(categories_id,
                                                  init_selection=user.tags),
            html.Br(),
            create_equal_row(
                [html.Label("Additional details about your skills:")]),
            create_equal_row([
                dcc.Input(value="", type="text", id="details-{}".format(NAME))
            ]),
            html.Div(id="dummy-{}".format(NAME), hidden=True),
        ],
        className="container",
    )
Пример #5
0
def layout():
    if session.is_logged_in():
        log.debug("%s: already logged in.", NAME)
        btn = (dcc.Link(
            html.Button(
                "Submit my request!",
                id=submit_button,
                className="btn btn-lg btn-success btn-block",
            ),
            href=href(__name__, submit_request),
        ), )
    else:
        log.debug("%s: not logged in.", NAME)
        btn = (html.A(
            html.Button(
                "Submit my request and sign up!",
                id=submit_button,
                className="btn btn-lg btn-success btn-block",
            ),
            href="/login",
        ), )

    return html.Div(
        [
            html.Label("What topics do you want to learn about?"),
            html.Br(),
            *tags_dropdown_with_add_new_entry_box(categories_id),
            html.Br(),
            html.Label(
                "Describe in more detail what you're looking for:",
                className="text-center text-dark",
            ),
            html.Br(),
            create_equal_row([
                dcc.Textarea(
                    value="",
                    id=details_id,
                    rows=6,
                    placeholder="Try starting with one of the following:\n"
                    "  I'd like a code review of...\n"
                    "  I'd like weekly mentoring sessions...\n"
                    "  I'm looking for a one off education session about...\n"
                    "  I want a running partner.\n"
                    "  I'm looking for someone to play chess with.",
                    maxLength=2000,
                )
            ]),
            html.Br(),
            html.Div(btn),
            html.Div(id="dummy-submit-{}".format(NAME)),
        ],
        className="container",
        id="mentee-request-div",
    )
Пример #6
0
def edit_request_layout(request: Request):
    """Layout to display when a request has been selected to be edited."""
    log.debug("Displaying request edit page for request: %s", request)
    return html.Div(
        [
            html.Label("What topics do you want to learn about?"),
            html.Br(),
            *tags_dropdown_with_add_new_entry_box(tags_id, init_selection=request.tags),
            html.Br(),
            html.Label(
                "Any additional details about this request that the mentor "
                "should know?",
                className="text-center",
            ),
            html.Br(),
            create_equal_row([dcc.Textarea(value=request.comment, id=details_id)]),
            html.Br(),
            dcc.Link(
                html.Button(
                    "Save",
                    id=save_id,
                    n_clicks=0,
                    className="btn btn-lg btn-primary btn-block",
                ),
                href=href(__name__, save_id),
            ),
            html.Br(),
            html.Br(),
            dcc.Link(
                html.Button(
                    "Delete Request",
                    id=delete_id,
                    n_clicks=0,
                    className="btn btn-lg btn-warning btn-block",
                ),
                href=href(__name__, delete_id),
            ),
            html.Div(request.id, id=current_request_id, hidden=True),
        ],
        className="container",
    )
Пример #7
0
def tags_dropdown_with_add_new_entry_box(_id: str,
                                         init_selection: List[str] = None
                                         ) -> List:

    tag_list = [{
        "label": tag.name,
        "value": tag.name
    } for tag in list_all_tags()]

    return [
        dcc.Dropdown(options=tag_list,
                     value=init_selection or [],
                     multi=True,
                     id=_id),
        html.Br(),
        create_equal_row([
            html.Label("Can't find the right tag? Create a new one:"),
            dcc.Input(value="", type="text", id=new_tag_id),
            html.Button("Ok", id=ok_id, className="btn btn-success btn-block"),
        ]),
    ]
Пример #8
0
def layout():
    return html.Div(
        [
            html.H1("Metaswitch Tinder", className="cover-heading"),
            create_equal_row([
                html.A(
                    "Sign in!",
                    href="/login",
                    id="signin-{}".format(NAME),
                    className="btn btn-lg btn-secondary",
                ),
                dcc.Link(
                    "Sign up!",
                    href=href(__name__, signup),
                    className="btn btn-lg btn-primary",
                ),
            ]),
        ],
        className="container text-center",
        id="signin-or-signup",
    )
Пример #9
0
def layout():
    return html.Div(
        [
            html.H1("Metaswitch Tinder", className="cover-heading"),
            html.P(
                "Metaswitch Tinder is a match-making service for informal mentoring "
                "and unofficial pastoral support "
                "at Metaswitch.",
                className="lead",
            ),
            create_equal_row([
                dcc.Link(
                    "Become a mentor!",
                    href=href(__name__, im_a_mentor),
                    className="btn btn-lg btn-info",
                ),
                dcc.Link(
                    "Become a mentee!",
                    href=href(__name__, im_a_mentee),
                    className="btn btn-lg btn-primary",
                ),
            ]),
            html.Br(),
            html.Br(),
            html.A(
                "I have an account - sign in.",
                href="/login",
                className="btn btn-primary",
                id=signin,
            ),
            html.Br(),
            html.Br(),
            about_div(),
            html.Div(id="dummy", hidden=True),
        ],
        className="container text-center",
    )