diff --git a/atst/routes/workspaces.py b/atst/routes/workspaces.py index ae0525a2..8f1055ba 100644 --- a/atst/routes/workspaces.py +++ b/atst/routes/workspaces.py @@ -30,12 +30,14 @@ bp = Blueprint("workspaces", __name__) @bp.context_processor def workspace(): + workspaces = Workspaces.for_user(g.current_user) workspace = None if "workspace_id" in http_request.view_args: try: workspace = Workspaces.get( g.current_user, http_request.view_args["workspace_id"] ) + workspaces = [ws for ws in workspaces if not ws.id == workspace.id] except UnauthorizedError: pass @@ -46,7 +48,12 @@ def workspace(): ) return False - return {"workspace": workspace, "permissions": Permissions, "user_can": user_can} + return { + "workspace": workspace, + "workspaces": workspaces, + "permissions": Permissions, + "user_can": user_can, + } @bp.route("/workspaces") diff --git a/styles/atat.scss b/styles/atat.scss index 13e47202..c128610e 100644 --- a/styles/atat.scss +++ b/styles/atat.scss @@ -20,6 +20,7 @@ @import 'elements/tooltip'; @import 'elements/kpi'; @import 'elements/graphs'; +@import 'elements/menu'; @import 'components/topbar'; @import 'components/global_layout'; diff --git a/styles/components/_topbar.scss b/styles/components/_topbar.scss index 92b3a2e5..4af39785 100644 --- a/styles/components/_topbar.scss +++ b/styles/components/_topbar.scss @@ -59,9 +59,38 @@ align-items: stretch; justify-content: flex-end; - .topbar__link--workspace { - &:first-child { - margin-right: auto; + .topbar__workspace-menu { + margin-right: auto; + position: relative; + + .topbar__workspace-menu__toggle { + margin: 0; + border-radius: 0; + + &--open { + background-color: $color-blue-darkest; + position: relative; + + &::before { + content: ''; + display: block; + position: absolute; + bottom: 0; + left: $gap * 2; + right: $gap * 2; + height: $gap / 2; + background-color: $color-primary; + } + } + + .icon { + @include icon-size(10); + margin-left: $gap * 2; + } + } + + .topbar__workspace-menu__panel { + position: absolute; } } diff --git a/styles/elements/_menu.scss b/styles/elements/_menu.scss new file mode 100644 index 00000000..7c18bc62 --- /dev/null +++ b/styles/elements/_menu.scss @@ -0,0 +1,56 @@ +.menu { + background-color: $color-blue-darkest; + color: $color-white; + position: absolute; + min-width: 30rem; + max-height: 80vh; + overflow-y: auto; + padding-bottom: $gap * 2; + box-shadow: 0 2px 4px rgba(0,0,0,0.25); + + .menu__heading { + @include h5; + margin: 0; + padding: ($gap * 3) ($gap * 2) $gap; + } + + .menu__list { + margin: 0; + padding: 0; + + > .menu__list__item { + margin: 0; + + > a { + @include h5; + font-weight: normal; + text-decoration: none; + display: block; + color: $color-white; + padding: ($gap * .75) ($gap * 2); + + .icon { + @include icon-color($color-white); + @include icon-size(10); + margin-left: $gap; + } + + &:hover { + background-color: $color-blue-darker; + } + } + } + } + + .menu__message { + @include h5; + font-weight: normal; + font-style: italic; + padding: 0 ($gap * 2); + } + + .menu__button { + margin: ($gap * 2) ($gap * 2) 0; + white-space: nowrap; + } +} diff --git a/templates/navigation/topbar.html b/templates/navigation/topbar.html index ceeefcfb..19464a6f 100644 --- a/templates/navigation/topbar.html +++ b/templates/navigation/topbar.html @@ -15,9 +15,44 @@
{% if workspace %} - - {{ ("Workspace " + workspace.name) }} - + +
+ +
+ {% endif %}