diff --git a/src/digimarks/main.py b/src/digimarks/main.py index ab0d939..414156d 100644 --- a/src/digimarks/main.py +++ b/src/digimarks/main.py @@ -135,6 +135,14 @@ def clean_tags(tags_list: list) -> list: return tags_res +def list_tags_for_bookmarks(bookmarks: list) -> list: + """Generate a unique list of the tags from the list of bookmarks.""" + tags = [] + for bookmark in bookmarks: + tags += bookmark.tags_list + return clean_tags(tags) + + def file_type(filename: str) -> str: """Try to determine the file type for the file in `filename`. @@ -392,7 +400,7 @@ def list_bookmarks( offset: int = 0, limit: Annotated[int, Query(le=10000)] = 100, ) -> list[Bookmark]: - """List all bookmarks in the database. By default gives back 100 items.""" + """List all bookmarks in the database. By default 100 items are returned.""" bookmarks = session.exec( select(Bookmark) .where(Bookmark.userkey == user_key, Bookmark.status != Visibility.DELETED) @@ -567,10 +575,7 @@ def list_tags_for_user( ) -> list[str]: """List all tags in use by the user.""" bookmarks = session.exec(select(Bookmark).where(Bookmark.userkey == user_key)).all() - tags = [] - for bookmark in bookmarks: - tags += bookmark.tags_list - return clean_tags(tags) + return list_tags_for_bookmarks(bookmarks) @app.get('/{user_key}', response_class=HTMLResponse) @@ -579,6 +584,7 @@ def page_user_landing( request: Request, user_key: str, ): + """HTML page with the main view for the user.""" user = session.exec(select(User).where(User.key == user_key)).first() if not user: raise HTTPException(status_code=404, detail='User not found') @@ -588,3 +594,42 @@ def page_user_landing( name='user_index.html', context={'language': language, 'version': DIGIMARKS_VERSION, 'user_key': user_key}, ) + + +# def tags_page(userkey): +# """Overview of all tags used by user""" +# tags = get_cached_tags(userkey) +# alltags = [] +# for tag in tags: +# try: +# publictag = PublicTag.get(PublicTag.userkey == userkey, PublicTag.tag == tag) +# except PublicTag.DoesNotExist: +# publictag = None +# +# total = ( +# Bookmark.select() +# .where(Bookmark.userkey == userkey, Bookmark.tags.contains(tag), Bookmark.status == Bookmark.VISIBLE) +# .count() +# ) +# alltags.append({'tag': tag, 'publictag': publictag, 'total': total}) +# totaltags = len(alltags) +# totalbookmarks = Bookmark.select().where(Bookmark.userkey == userkey, Bookmark.status == Bookmark.VISIBLE).count() +# totalpublic = PublicTag.select().where(PublicTag.userkey == userkey).count() +# totalstarred = Bookmark.select().where(Bookmark.userkey == userkey, Bookmark.starred).count() +# totaldeleted = Bookmark.select().where(Bookmark.userkey == userkey, Bookmark.status == Bookmark.DELETED).count() +# totalnotes = Bookmark.select().where(Bookmark.userkey == userkey, Bookmark.note != '').count() +# totalhttperrorstatus = Bookmark.select().where(Bookmark.userkey == userkey, Bookmark.http_status != 200).count() +# theme = get_theme(userkey) +# return render_template( +# 'tags.html', +# tags=alltags, +# totaltags=totaltags, +# totalpublic=totalpublic, +# totalbookmarks=totalbookmarks, +# totaldeleted=totaldeleted, +# totalstarred=totalstarred, +# totalhttperrorstatus=totalhttperrorstatus, +# totalnotes=totalnotes, +# userkey=userkey, +# theme=theme, +# ) diff --git a/src/digimarks/static/css/digimarks.css b/src/digimarks/static/css/digimarks.css index f79a63e..c37ef00 100644 --- a/src/digimarks/static/css/digimarks.css +++ b/src/digimarks/static/css/digimarks.css @@ -1,7 +1,7 @@ /** * digimarks styling * - * Overrides on the digui styling + * Overrides on and additions to the digui styling */ /* Star, error, note etc */ @@ -12,4 +12,14 @@ .star { color: #ffeb3b; +} + +.thumbnail { + /*width: 80px;*/ + width: 66; +} + +.thumbnail img { + /*width: 72px;*/ + width: 60px; } \ No newline at end of file diff --git a/src/digimarks/static/css/digui.css b/src/digimarks/static/css/digui.css index 6246333..e896185 100644 --- a/src/digimarks/static/css/digui.css +++ b/src/digimarks/static/css/digui.css @@ -200,7 +200,7 @@ h1 { font-size: 2em; } -a, a:hover, a:visited, a:active { +a, a:hover, a:visited, a:active, a.button, a.button:hover, a.button:active, a.button:visited { text-decoration: none; } @@ -230,9 +230,7 @@ ol li::marker, ul li::marker { /* Buttons */ -button, input, select, textarea { - border: var(--border-width) solid var(--border-color); - border-radius: var(--border-radius); +button, .button, input, select, textarea { box-sizing: border-box; color: var(--text-color-secondary); background-color: var(--button-color); @@ -241,7 +239,6 @@ button, input, select, textarea { font-size: 13px; /*line-height: 29px;*/ /*padding: 0 10px 0 11px;*/ - padding: .5rem .5rem; position: relative; text-align: left; text-decoration: none; @@ -251,14 +248,20 @@ button, input, select, textarea { vertical-align: middle; } -button:hover { +button, .button, input, select, textarea, table { + border: var(--border-width) solid var(--border-color); + border-radius: var(--border-radius); + padding: .5rem .5rem; +} + +button:hover, .button:hover { /*background-color: #f7fafa;*/ /*background-color: #d57803;*/ background-color: var(--color-highlight); filter: brightness(80%); } -button:focus { +button:focus, .button:focus { /*border-color: #008296;*/ /*box-shadow: rgba(213, 217, 217, .5) 0 2px 5px 0;*/ outline: 0; @@ -292,6 +295,16 @@ button:focus { filter: brightness(80%); } +/* Table */ + +th { + text-align: left; +} + +th, td { + padding: 0 0.3rem; +} + /* Cards */ .cards { @@ -311,14 +324,18 @@ button:focus { [data-theme='nebula'] .card, [data-theme='nebula'] button, +[data-theme='nebula'] .button, [data-theme='nebula'] input, [data-theme='nebula'] select, [data-theme='nebula'] textarea, +[data-theme='nebula'] table, [data-theme='nebula-dark'] .card, [data-theme='nebula-dark'] button, +[data-theme='nebula-dark'] .button, [data-theme='nebula-dark'] input, [data-theme='nebula-dark'] select, -[data-theme='nebula-dark'] textarea { +[data-theme='nebula-dark'] textarea, +[data-theme='nebula-dark'] table { box-shadow: var(--shadow-color) 0 2px 5px 0; } diff --git a/src/digimarks/templates/404.html b/src/digimarks/templates/404.html index 8f21320..056a970 100644 --- a/src/digimarks/templates/404.html +++ b/src/digimarks/templates/404.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% block title %}404: Page not found{% endblock %} -{% block pageheader %}404: Page not found{% endblock %} -{% block pagecontent %} -The page you requested was not found. +{% block page_header %}404: Page not found{% endblock %} +{% block page_content %} + The page you requested was not found. {% endblock %} diff --git a/src/digimarks/templates/base.html b/src/digimarks/templates/base.html index 6f67350..496e151 100644 --- a/src/digimarks/templates/base.html +++ b/src/digimarks/templates/base.html @@ -18,7 +18,7 @@
-{% block pagecontent %} +{% block page_content %}