Exemplo n.º 1
0
def changelog():
    user = current_user
    resp = make_response(
        render_template("app/main.html",
                        section="changelog",
                        data=json.dumps({})))
    return refresh_token(user, resp)
Exemplo n.º 2
0
def bookmarks():
    user = current_user
    resp = make_response(
        render_template("app/main.html",
                        section="bookmarks",
                        data=json.dumps({})))
    return refresh_token(user, resp)
Exemplo n.º 3
0
def index(doc_id=None):
    user = current_user

    searched_term = request.args.get('search', '')
    if doc_id is not None and searched_term != '':
        return redirect(
            url_for("app_bp.index",
                    section="documents",
                    data=json.dumps({
                        'docId': None,
                        'searchedTerm': searched_term
                    })))

    if doc_id is not None and not Document.query.filter(
            Document.id == doc_id).first():
        abort(status=404)

    resp = make_response(
        render_template("app/main.html",
                        section="documents",
                        data=json.dumps({
                            'docId': doc_id,
                            'searchedTerm': searched_term
                        })))
    return refresh_token(user, resp)
Exemplo n.º 4
0
def login():
    user = current_user
    if user.is_authenticated:
        return redirect(url_for("app_bp.index"))
    login_template = current_app.user_manager.login_view()
    resp = make_response(
        render_template("app/main.html",
                        section="template",
                        data=json.dumps({'template': login_template})))
    return refresh_token(user, resp)
Exemplo n.º 5
0
def collections(collection_id=None):
    user = current_user

    if collection_id is not None and not Collection.query.filter(
            Collection.id == collection_id).first():
        abort(status=404)

    resp = make_response(
        render_template("app/main.html",
                        section="collections",
                        data=json.dumps({'collectionId': collection_id})))
    return refresh_token(user, resp)
Exemplo n.º 6
0
def user_action(action):
    user = current_user

    if action == "login":
        return redirect(url_for("app_bp.login"))
    elif action == "logout":
        return redirect(url_for("app_bp.logout"))

    try:
        action_stub = current_app.view_functions['user.%s' %
                                                 action.replace("-", '_')]
        action_template = action_stub()
    except Exception as e:
        pprint.pprint(current_app.view_functions)
        print(str(e))
        print("VIEW NOT FOUND:", action, 'user.%s' % action.replace("-", '_'))
        return redirect(url_for("app_bp.index"))

    resp = make_response(
        render_template("app/main.html",
                        section="template",
                        data=json.dumps({'template': action_template})))
    return refresh_token(user, resp)