Skip to content

Commit

Permalink
Merge 44ac467 into 2720b0e
Browse files Browse the repository at this point in the history
  • Loading branch information
philli-m committed Jan 14, 2021
2 parents 2720b0e + 44ac467 commit ca9be2a
Show file tree
Hide file tree
Showing 12 changed files with 188 additions and 33 deletions.
4 changes: 4 additions & 0 deletions adhocracy-plus/assets/scss/components/_tile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ $svg-colour: #2a3cd4;
min-height: 20rem;
}

.tile__image--sm {
min-height: 8rem;
}

.tile__image--contained {
min-height: 13rem;
}
Expand Down
10 changes: 6 additions & 4 deletions adhocracy-plus/assets/scss/components/_userdashboard.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
.userdashboard-profile__side {
padding: $padding;
min-height: 100%;
text-align: center;
}

.userdashboard-profile__user {
border: 1px solid #dadada;
text-align: center;
padding-bottom: 2*$padding;
}

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

~ h2 {
Expand All @@ -27,6 +30,5 @@

.userdashboard-profile__side {
display: block;
padding: 2*$padding;
}
}
4 changes: 4 additions & 0 deletions adhocracy-plus/assets/scss/icons/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@
.fa-eye {
font-size: 1.05rem;
}

.font--lg {
font-size: 2rem !important;
}
3 changes: 2 additions & 1 deletion adhocracy-plus/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@
'idea_thumbnail': {'size': (240, 240), 'crop': 'smart'},
'avatar': {'size': (200, 200), 'crop': 'smart'},
'item_image': {'size': (330, 0), 'crop': 'scale'},
'map_thumbnail': {'size': (200, 200), 'crop': 'smart'}
'map_thumbnail': {'size': (200, 200), 'crop': 'smart'},
'tiny_thumbnail': {'size': (50, 50), 'crop': 'smart'}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h3>
{% endif %}
</div>
<span class="list-item__author">
{{ object.creator.username }}
<a href="{% url 'profile' object.creator.username %}">{{ object.creator.username }}</a>
</span>
{% html_date object.created class='list-item__date' %}
</li>
3 changes: 2 additions & 1 deletion apps/contrib/templates/a4_candy_contrib/item_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ <h1 class="item-detail__title">{{ object.name }}</h1>

<div class="item-detail__meta lr-bar">
<div class="lr-bar__left">
<strong class="item-detail__creator">{{ object.creator.username }}</strong>
<strong class="item-detail__creator"><a href="{% url 'profile' object.creator.username %}">{{ object.creator.username }}</a>
</strong>
{% html_date object.created %}
</div>
<div class="lr-bar__right">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h3>
</div>

<span class="list-item__author">
{{ object.creator.username }}
<a href="{% url 'profile' object.creator.username %}">{{ object.creator.username }}</a>
</span>
{% html_date object.created class='list-item__date' %}
</li>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h3>
{% endif %}
</div>
<span class="list-item__author">
{{ object.creator.username }}
<a href="{% url 'profile' object.creator.username %}">{{ object.creator.username }}</a>
</span>
{% html_date object.created class='list-item__date' %}
</li>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{% load i18n project_tags a4_candy_project_tags contrib_tags thumbnail rules %}
{% project_tile_image project as project_image %}
{% project_tile_image_copyright project as project_image_copyright %}

<li class="tile organisation__tile">
<div class="tile__head">
<div class="tile__image tile__image--sm"
{% if project_image %}
style="background-image: url({{ project_image|thumbnail_url:'project_thumbnail' }})"
{% endif %}>
{% if project_image_copyright %}
<div class="tile__image__copyright copyright">© {{ project_image_copyright }}</div>
{% endif %}
{% if project.is_semipublic %}
<div class="tile__private-badge">
<div class="tile__private-badge--top"></div>
<i class="fas fa-eye" title="{% trans 'Project is semi-public.' %}" aria-label="{% trans 'Project is semi-public.' %}"></i>
<div class="tile__private-badge--left"></div>
</div>

{% endif %}
</div>
</div>
<div class="tile__body">
<span class="text-muted">{% trans 'By ' %}{{ project.organisation.name }}</span>
<h3 class="tile__title mb-4" id="project-title-{{ project.pk }}">
<a href="{{ project|project_url }}">{{ project.name }}</a>
</h3>

{% if project.running_modules %}
<div class="status__active">
<span class="status-bar__status"><i class="fas fa-clock" aria-hidden="true"></i>
{% if project.module_running_days_left < 365 %}
{% blocktrans with time_left=project.module_running_time_left %} {{ time_left }} remaining {% endblocktrans %}
{% else %}
<span>{% trans 'more than 1 year remaining' %}</span>
{% endif %}
</span>
</div>
{% elif project.future_modules %}
<div class="status__future">
<span class="status-bar__status"><i class="fas fa-clock" aria-hidden="true"></i>{% blocktrans with date=project.future_modules.first.module_start.date|date:"d.m.Y" %} Participation: from {{ date }}{% endblocktrans %}</span>
</div>
{% elif project.past_modules %}
<div class="status-bar__past">
{% blocktrans %}Participation ended. Read result.{% endblocktrans %}
</div>
{% endif %}
</div>
<a class="tile__link" aria-labelledby="project-title-{{ project.pk }}" href="{{ project|project_url }}">
</a>
</li>
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,90 @@
</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="" />
<div class="container">
<div class="row pt-4">

<div class="col-md-3">
<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">

<div class="userdashboard-profile__user">
<div class="dropdown text-right">
<button
title="{% trans 'Settings' %}"
type="button"
class="dropdown-toggle btn btn--none btn--small"
data-toggle="dropdown"
data-flip="false"
aria-haspopup="true"
aria-expanded="false"
id="account-settings"
>
<i class="fa fa-ellipsis-v" aria-label="{% trans 'Settings' %}"></i>
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="account-settings">
<a class="dropdown-item" href="{% url 'account' %}">{% trans 'Account Settings' %}</a>
</div>
</div>

<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 %}
<h3 class="mt-0 u-word-break-all">
{{ user.username }}
</h3>
</a>
<div>
{% trans 'Since' %} {{ request.user.date_joined|date:"d M Y" }}
</div>
</div>

{% if request.user.organisations %}
<div>
<h3>{% trans 'Initiator Organisations' %}</h3>
{% for organisation in request.user.organisations %}
<div>
<a class="btn btn--link text-decoration-none text-muted" href="{% url 'a4dashboard:project-list' organisation_slug=organisation.slug %}">
{% if organisation.logo %}
<img src="{% thumbnail organisation.logo '0x40' %}" alt="{{ orgnaisation.name }}" />
{% else %}
<i class="fas fa-edit font--lg pt-1" aria-label="{{ orgnaisation.name }} {% trans 'Home' %}"></i>
{% endif %}
&nbsp{{ organisation.name }}
</a>
</div>
{% endfor %}
</div>
{% endif %}
</a>

<h1 class="mt-0 u-word-break-all">
{{ user.username }}
</h1>
<div>
<h3>{% trans 'Organisations' %}</h3>
{% for organisation in view.organisations %}
<a class="btn btn--link text-decoration-none text-muted" href="{% url 'organisation' organisation_slug=organisation.slug %}">
{% if organisation.logo %}
<img src="{% thumbnail organisation.logo '0x40' %}" alt="{{ orgnaisation.name }}" />
{% else %}
<i class="fas fa-home fa--lg pt-1" aria-label="{{ orgnaisation.name }} {% trans 'Home' %}"></i>
{% endif %}
&nbsp {{ organisation.name }}
</a>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock %}

<div class="col-md-6">
{% block dashboard_content %}
{% endblock %}

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

{% block dashboard_content %}{% endblock %}
{% block dashboard_content %}

<h3 class="mt-0">{% trans 'Following' %}</h3>
<div class="row">
{% for project in view.projects %}
<div class="col-sm-6 col-lg-4">
{% include 'a4_candy_projects/includes/project_tile_userprofile.html' with project=project orientation='vertical' %}
</div>
{% empty %}
{% trans 'This user is not active in any projects yet.' %}
{% endfor %}
</div>
{% endblock %}
21 changes: 21 additions & 0 deletions apps/userdashboard/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views import generic

from adhocracy4.projects.models import Project
from adhocracy4.rules import mixins as rules_mixins
from apps.organisations.models import Organisation
from apps.users.models import User


Expand All @@ -19,6 +21,18 @@ def get(self, request):
response = self.render_to_response(self.get_context_data())
return response

@property
def organisations(self):
return Organisation.objects.filter(
project__follow__creator=self.request.user,
project__follow__enabled=True
).distinct()

@property
def projects(self):
return Project.objects.filter(follow__creator=self.request.user,
follow__enabled=True)


class UserDashboardModerationView(LoginRequiredMixin,
rules_mixins.PermissionRequiredMixin,
Expand All @@ -34,3 +48,10 @@ class UserDashboardModerationView(LoginRequiredMixin,
def get(self, request):
response = self.render_to_response(self.get_context_data())
return response

@property
def organisations(self):
return Organisation.objects.filter(
project__follow__creator=self.request.user,
project__follow__enabled=True
).distinct()

0 comments on commit ca9be2a

Please sign in to comment.