Skip to content

Commit

Permalink
Merge 85fd74a into 17e114e
Browse files Browse the repository at this point in the history
  • Loading branch information
Rineee committed Jan 11, 2021
2 parents 17e114e + 85fd74a commit 0ec18ff
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 43 deletions.
4 changes: 4 additions & 0 deletions adhocracy-plus/assets/scss/components/_tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
float: right;
}

.tablist--left {
text-align: left;
}

.tablist__left {
float: left;
}
Expand Down
32 changes: 32 additions & 0 deletions adhocracy-plus/assets/scss/components/_userdashboard.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.userdashboard-profile__side {
padding: $padding;
min-height: 100%;
text-align: center;
border: 1px solid #dadada;
}

.userdashboard-profile__avatar {
border-radius: 50%;
shape-outside: circle();
box-shadow: 0 0 2em rgba(0, 0, 0, 0.1);
position: relative;

~ h2 {
clear: both;
}
}

.userdashboard-profile__main {
padding: 0 $padding;
}

@media (min-width: $breakpoint) {
/* Ensure that info sidebar is always visible in sm
and above and only a tab in sm
*/

.userdashboard-profile__side {
display: block;
padding: 2*$padding;
}
}
1 change: 1 addition & 0 deletions adhocracy-plus/assets/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
@import 'components/upload';

@import 'components/user_profile';
@import 'components/userdashboard';
@import 'components/userindicator';

@import 'utility';
Expand Down
1 change: 1 addition & 0 deletions adhocracy-plus/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
'apps.exports',
'apps.offlineevents',
'apps.projects',
'apps.userdashboard',

# Apps defining phases
'apps.activities',
Expand Down
1 change: 1 addition & 0 deletions adhocracy-plus/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
re_path(r'^account/', include('apps.account.urls')),
re_path(r'^embed/', include('apps.embed.urls')),
re_path(r'^profile/', include('apps.users.urls')),
re_path(r'^userdashboard/', include('apps.userdashboard.urls')),
re_path(r'^i18n/', include(i18n)),

# API urls
Expand Down
80 changes: 39 additions & 41 deletions adhocracy-plus/templates/a4dashboard/base_dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,48 @@
{% block dashboard_nav %}
<div class="tablist tablist--right tablist--background">
<div class="container">
<div class="tablist__left d-flex">
{% if ORGANISATION.logo %}
{% url 'organisation' organisation_slug=ORGANISATION.slug as organisation_url %}
<a href="{% url 'organisation' organisation_slug=ORGANISATION.slug %}" rel="home">
<img src="{% thumbnail ORGANISATION.logo '0x160' %}" height="80" alt="{{ ORGANISATION.name }}" class="dashboard-nav__logo" />
</a>
{% else %}
<div class="dashboard-nav__logo-link">
<a class="font-weight-bold" href="{% url 'organisation' organisation_slug=ORGANISATION.slug %}">
<i class="fas fa-home pt-2" aria-label="{{ ORGANISATION.name }} {% trans 'Home' %}"></i>
</a>
</div>
{% endif %}
<div class="dropdown">
{% if view.other_organisations_of_user %}
<button
title="{% trans 'Organisations' %}"
type="button"
class="dropdown-toggle btn btn--none btn--small"
data-toggle="dropdown"
data-flip="false"
aria-haspopup="true"
aria-expanded="false"
id="organisation-selection"
>
{{ view.organisation.name }}
<i class="fa fa-caret-down" aria-hidden="true"></i>
</button>
<div class="dropdown-menu" aria-labelledby="organisation-selection">
{% for organisation in view.other_organisations_of_user %}
<a
class="dropdown-item"
href="{% url 'a4dashboard:project-list' organisation_slug=organisation.slug %}">
{{ organisation.name }}
</a>
{% endfor %}
</div>
<div class="tablist__left d-flex">
{% if ORGANISATION.logo %}
{% url 'organisation' organisation_slug=ORGANISATION.slug as organisation_url %}
<a href="{% url 'organisation' organisation_slug=ORGANISATION.slug %}" rel="home">
<img src="{% thumbnail ORGANISATION.logo '0x160' %}" height="80" alt="{{ ORGANISATION.name }}" class="dashboard-nav__logo" />
</a>
{% else %}
<span class="btn btn--none btn--small">{{ view.organisation.name }}</span>
<div class="dashboard-nav__logo-link">
<a class="font-weight-bold" href="{% url 'organisation' organisation_slug=ORGANISATION.slug %}">
<i class="fas fa-home pt-2" aria-label="{{ ORGANISATION.name }} {% trans 'Home' %}"></i>
</a>
</div>
{% endif %}
<div class="dropdown">
{% if view.other_organisations_of_user %}
<button
title="{% trans 'Organisations' %}"
type="button"
class="dropdown-toggle btn btn--none btn--small"
data-toggle="dropdown"
data-flip="false"
aria-haspopup="true"
aria-expanded="false"
id="organisation-selection"
>
{{ view.organisation.name }}
<i class="fa fa-caret-down" aria-hidden="true"></i>
</button>
<div class="dropdown-menu" aria-labelledby="organisation-selection">
{% for organisation in view.other_organisations_of_user %}
<a
class="dropdown-item"
href="{% url 'a4dashboard:project-list' organisation_slug=organisation.slug %}">
{{ organisation.name }}
</a>
{% endfor %}
</div>
{% else %}
<span class="btn btn--none btn--small">{{ view.organisation.name }}</span>
{% endif %}
</div>
</div>
</div>

<nav class="d-none d-sm-inline-block" aria-label="{% trans 'Dashboard' %}">
<a href="{% url 'a4dashboard:project-list' organisation_slug=view.organisation.slug %}"
Expand Down Expand Up @@ -109,8 +109,6 @@
</div>
</li>
</ul>


</div>
</div>
{% endblock %}
Expand Down
Empty file added apps/userdashboard/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions apps/userdashboard/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class Config(AppConfig):
name = 'apps.userdashboard'
label = 'a4_candy_userdashboard'
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{% extends "base.html" %}
{% load i18n thumbnail %}

{% block content %}
{% block dashboard_nav %}
<div class="tablist tablist--left tablist--background">
<div class="container">
<nav class="d-none d-sm-inline-block" aria-label="{% trans 'Dashboard' %}">
<a href="{% url 'userdashboard-overview' %}"
class="tab {% ifequal view.menu_item 'overview' %}active{% endifequal %}">
{% trans 'Overview' %}
</a>
<a href="{% url 'userdashboard-moderation' %}"
class="tab {% ifequal view.menu_item 'moderation' %}active{% endifequal %}">
{% trans 'Moderation' %}
</a>
</nav>
</div>
</div>

<div class="row pt-4 bg-white">

<div class="col-md-2 offset-2">
<div
class="tabpanel userdashboard-profile userdashboard-profile__side"
id="userdashboard-user-{{ user.pk }}-tile"
role="tabpanel"
aria-labelledby="userdashboard-{{ user.pk }}-tile"
aria-expanded="false">
<a href="{% url 'profile' user.username %}">
{% if user.avatar %}
<img class="userdashboard-profile__avatar mb-2" src="{% thumbnail user.avatar '170x170' crop %}" alt="" />
{% else %}
<img class="userdashboard-profile__avatar mb-2" src="{{ user.avatar_fallback }}" width="170" height="170" alt="" />
{% endif %}
</a>

<h1 class="mt-0 u-word-break-all">
{{ user.username }}
</h1>
</div>
</div>
{% endblock %}

<div class="col-md-6">
{% block dashboard_content %}
{% endblock %}
</div>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% extends "a4_candy_userdashboard/base_userdashboard.html" %}

{% block dashboard_content %}{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% extends "a4_candy_userdashboard/base_userdashboard.html" %}

{% block dashboard_content %}{% endblock %}
12 changes: 12 additions & 0 deletions apps/userdashboard/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.conf.urls import url

from . import views

urlpatterns = [
url(r'^overview/$',
views.UserDashboardOverviewView.as_view(),
name='userdashboard-overview'),
url(r'^moderation/$',
views.UserDashboardModerationView.as_view(),
name='userdashboard-moderation'),
]
30 changes: 30 additions & 0 deletions apps/userdashboard/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from django.views import generic

from apps.users.models import User


class UserDashboardOverviewView(generic.base.ContextMixin,
generic.base.TemplateResponseMixin,
generic.base.View,
):

model = User
template_name = 'a4_candy_userdashboard/userdashboard_overview.html'
menu_item = 'overview'

def get(self, request):
response = self.render_to_response(self.get_context_data())
return response


class UserDashboardModerationView(generic.base.ContextMixin,
generic.base.TemplateResponseMixin,
generic.base.View):

model = User
template_name = 'a4_candy_userdashboard/userdashboard_moderation.html'
menu_item = 'moderation'

def get(self, request):
response = self.render_to_response(self.get_context_data())
return response
4 changes: 2 additions & 2 deletions apps/users/templates/a4_candy_users/indicator.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
{% if request.user.is_superuser %}
<a class="dropdown-item" href="{% url 'admin:index' %}">{% trans "Admin" %}</a>
{% endif %}
<a class="dropdown-item" href="{% url 'account' %}">{% trans "Account Settings" %}</a>
<a class="dropdown-item" href="{% url 'userdashboard-overview' %}">{% trans 'User dashboard' %}</a>

<a class="dropdown-item" href="{% url 'profile' request.user.username %}">{% trans 'View your profile' %}</a>
<a class="dropdown-item" href="{% url 'account' %}">{% trans "Account Settings" %}</a>

{% for organisation in request.user.organisations %}
<a class="dropdown-item" href="{% url 'a4dashboard:project-list' organisation_slug=organisation.slug %}">
Expand Down

0 comments on commit 0ec18ff

Please sign in to comment.