Skip to content

Commit

Permalink
apps/userdashboard: add following page view, url, template and link f…
Browse files Browse the repository at this point in the history
…rom overview
  • Loading branch information
philli-m committed Mar 25, 2021
1 parent 9a9221f commit e09b285
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends "a4_candy_userdashboard/base_userdashboard.html" %}
{% load i18n %}

{% block dashboard_content %}
<a class="btn btn--none pl-0 pt-0" href="{% url 'userdashboard-overview' %}">
<i class="fa fa-chevron-left" aria-hidden="true"></i>
<span>{% trans 'Back' %}</span>
</a>
<h3 class="mt-2">{% 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>
{% endfor %}
</div>

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ <h3 class="mt-0">{% trans 'Following' %}</h3>
{% empty %}
{% trans 'This user is not active in any projects yet.' %}
{% endfor %}
{% if view.projects.count > 9 %}
<a class="btn btn--light" href="{% url 'userdashboard-following' %}">{% trans 'View more' %}</a>
{% endif %}
</div>

{% for action in view.actions|slice:":5" %}
Expand All @@ -20,6 +23,6 @@ <h3 class="mt-0">{% trans 'Following' %}</h3>
{% trans 'No activity yet. '%}
{% endfor %}
{% if view.actions.count > 5 %}
<a href="{% url 'userdashboard-activities' %}">{% trans 'View more' %}</a>
<a class="btn btn--light" href="{% url 'userdashboard-activities' %}">{% trans 'View more' %}</a>
{% endif %}
{% endblock %}
3 changes: 3 additions & 0 deletions apps/userdashboard/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
url(r'^overview/activities/$',
views.UserDashboardActivitiesView.as_view(),
name='userdashboard-activities'),
url(r'^overview/following/$',
views.UserDashboardFollowingView.as_view(),
name='userdashboard-following'),
]
19 changes: 19 additions & 0 deletions apps/userdashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,22 @@ def actions(self):
return Action.objects.filter(
actor=self.request.user,
).exclude_updates()


class UserDashboardFollowingView(LoginRequiredMixin,
generic.base.ContextMixin,
generic.base.TemplateResponseMixin,
generic.base.View,
):

model = User
template_name = 'a4_candy_userdashboard/userdashboard_following.html'

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

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

0 comments on commit e09b285

Please sign in to comment.