Exemplo n.º 1
0
def archive():
    options = {
        "time": datetime.now(),
        "title": "Archive - Linkbucket",
        "viewmode_visible": False,
        "active_page": 2,
        "counts": database.get_counts(),
    }
    links = database.get_matching_links(archived=True)

    stats = database.get_stats()
    stats.move_history_if_necessary()
    stats.increment_views()

    return render_template("link_view.html", options=options, links=links)
Exemplo n.º 2
0
def search():
    query = request.args.get("q", "")
    options = {
        "time": datetime.now(),
        "title": 'Search results for "{0}" - Linkbucket'.format(query),
        "viewmode_visible": False,
        "active_page": -1,
        "query": query,
        "counts": database.get_counts(),
    }
    links = database.search_for_links(query)

    stats = database.get_stats()
    stats.move_history_if_necessary()
    stats.increment_views()

    return render_template("search.html", options=options, links=links)
Exemplo n.º 3
0
def starred():
    options = {
        "time": datetime.now(),
        "title": "Starred - Linkbucket",
        "viewmode_visible": False,
        "active_page": 1,
        "counts": database.get_counts(),
    }
    links = database.get_matching_links(starred=True)
    links.extend(database.get_matching_links(starred=True, unread=True))
    links = sorted(links, key=lambda link: link.date, reverse=True)

    stats = database.get_stats()
    stats.move_history_if_necessary()
    stats.increment_views()

    return render_template("link_view.html", options=options, links=links)
Exemplo n.º 4
0
def stats():
    options = {
        "time": datetime.now(),
        "title": "Stats - Linkbucket",
        "viewmode_visible": False,
        "active_page": 3,
        "releases": github.get_latest_releases("jobbogamer", "linkbucket", 3),
        "counts": database.get_counts(),
    }

    stats = database.get_stats()
    stats.move_history_if_necessary()
    stats.increment_views()

    histories = {"add": stats.get_add_history(), "click": stats.get_click_history(), "view": stats.get_view_history()}

    return render_template("stats.html", options=options, stats=stats, histories=histories)