Skip to content

Commit

Permalink
Merge branch 'master' into 2016-08-mn-report-comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Magdalena Noffke committed Aug 23, 2016
2 parents 621b5d4 + 5f196ea commit 5b3826d
Show file tree
Hide file tree
Showing 46 changed files with 562 additions and 70 deletions.
15 changes: 15 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Opin: A youth participation platform
Copyright (C) 2016 Liquid Democracy e.V.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

* nodejs (+ npm)
* python 3.x (+ virtualenv + pip)

* libmagic
* libjpeg
* libpq (only if postgres should be used)

## Setup and development

Expand Down
9 changes: 8 additions & 1 deletion euth/comments/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@


@receiver(post_delete, sender=Comment)
def delete_comments_for_Idea(sender, instance, **kwargs):
def delete_comments_for_Comment(sender, instance, **kwargs):
contenttype = ContentType.objects.get_for_model(instance)
pk = instance.pk
services.delete_comments(contenttype, pk)


@receiver(post_delete, sender=Comment)
def delete_rates_for_Comment(sender, instance, **kwargs):
contenttype = ContentType.objects.get_for_model(instance)
pk = instance.pk
services.delete_rates(contenttype, pk)
2 changes: 1 addition & 1 deletion euth/comments/static/comments/react_comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ var CommentEditForm = React.createClass({
}),
h('input.cancel-button', {
type: 'submit',
value: django.gettext('cancle'),
value: django.gettext('cancel'),
onClick: this.props.handleCancel
})
])
Expand Down
Empty file added euth/dashboard/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions euth/dashboard/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class DashboardConfig(AppConfig):
name = 'euth.dashboard'
label = 'euth_dashboard'
56 changes: 56 additions & 0 deletions euth/dashboard/templates/euth_dashboard/base_dashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{% extends "base.html" %}
{% load i18n dashboard_templatetags %}


{% block content %}
<div class="container-narrow">
<div class="dashboard row">
<div class="col-md-3">
<div class="dashboard-nav">
<div class="list-group">
{% url 'dashboard-overview' as dashboard_overview %}
<a href="{{ dashboard_overview }}" class="list-group-item">
<h4 class="list-group-item-heading {% selected request dashboard_overview %}">
<i class="fa fa-home" aria-hidden="true"></i> {% trans 'Overview' %}
</h4>
</a>
<!--<a href="#" class="list-group-item">
<h4 class="list-group-item-heading">
<i class="fa fa-rocket" aria-hidden="true"></i> Organisations
</h4>
</a>
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading">
<i class="fa fa-clone" aria-hidden="true"></i> Projects
</h4>
</a>
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading">
<i class="fa fa-check" aria-hidden="true"></i> Moderation
</h4>
</a>
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading">
<i class="fa fa-users" aria-hidden="true"></i> Users
</h4>
</a>-->
{% url 'dashboard-profile' as dashboard_profile %}
<a href="{{ dashboard_profile }}" class="list-group-item">
<h4 class="list-group-item-heading {% selected request dashboard_profile %}">
<i class="fa fa-user" aria-hidden="true"></i> {% trans 'Profile' %}
</h4>
</a>
</div>
</div>
</div>
<div class="col-md-9">
<div class="dashboard-content">
{% block dashboard_content %}
{% endblock %}
</div>
</div>
</div>
</div>


{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "euth_dashboard/base_dashboard.html" %}
{% load i18n %}

{% block dashboard_content %}
<h1>{% trans 'Overview' %}</h1>
{% endblock %}
28 changes: 28 additions & 0 deletions euth/dashboard/templates/euth_dashboard/profile_detail.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% extends "euth_dashboard/base_dashboard.html" %}
{% load widget_tweaks i18n %}

{% block dashboard_content %}
<h1>{% trans 'Profile' %}</h1>

<div class="general-form">
<form enctype="multipart/form-data" action="{{ request.path }}" method="post">
{% csrf_token %}
{{ form.media }}
{% for field in form %}
<div class="form-group {% if field.errors %}has-error {% endif %}">
<label>{{ field.label }}</label>
{% render_field field class="form-control" %}
{% if field.errors %}
<span class="help-block">{{ field.errors.0 }}</span>
{% endif %}
</div>
{% endfor %}
<button type="submit" class="submit-button">{% trans 'post'%}</button>
{% if mode == 'create' %}
<a href="{% url 'project-detail' project.slug %}" class="cancel-button">{% trans 'cancel'%}</a>
{% elif mode == 'update' %}
<a href="{% url 'idea-detail' idea.slug %}" class="cancel-button">{% trans 'cancel'%}</a>
{% endif %}
</form>
</div>
{% endblock %}
Empty file.
11 changes: 11 additions & 0 deletions euth/dashboard/templatetags/dashboard_templatetags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django import template

register = template.Library()


@register.simple_tag
def selected(request, pattern):
path = request.path
if path == pattern:
return 'selected'
return ''
10 changes: 10 additions & 0 deletions euth/dashboard/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.conf.urls import url

from . import views

urlpatterns = [
url(r'profile/$',
views.DashboardProfileView.as_view(), name='dashboard-profile'),
url(r'',
views.DashboardOverviewView.as_view(), name='dashboard-overview'),
]
23 changes: 23 additions & 0 deletions euth/dashboard/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from braces.views import LoginRequiredMixin
from django.shortcuts import get_object_or_404
from django.views import generic

from euth.user_management import models as user_models


class DashboardProfileView(LoginRequiredMixin, generic.UpdateView):

model = user_models.User
template_name = "euth_dashboard/profile_detail.html"
fields = ['avatar', 'email']

def get_object(self):
return get_object_or_404(user_models.User, pk=self.request.user.id)

def get_success_url(self):
return self.request.path


class DashboardOverviewView(LoginRequiredMixin, generic.TemplateView):

template_name = "euth_dashboard/dashboard_overview.html"
9 changes: 4 additions & 5 deletions euth/ideas/templates/euth_ideas/idea_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ <h1>{{ idea.name }}</h1>
</div>

<div class="avatar-small">
{% if idea.creator.avatar %}
<img src="{{ idea.creator.avatar | thumbnail_url:'avatar_small' }}"></img>
{% else %}
<img src=""></img>
{% endif %}
<div class="name">{{ idea.creator.username }}</div>
</div>

Expand All @@ -51,11 +55,6 @@ <h1>{{ idea.name }}</h1>

{% react_rates idea %}

<!--<div class="idea-rate">
<a class="idea-rate-btn idea-rate-up is-selected" href="#" title="{% trans 'Vote Up' %}"><i class="fa fa-chevron-up"></i> 33</a>
<a class="idea-rate-btn idea-rate-down" href="#" title="{% trans 'Vote Down' %}"><i class="fa fa-chevron-down"></i> 33</a>
</div>-->


<div>
{% react_comments idea %}
Expand Down
11 changes: 7 additions & 4 deletions euth/ideas/templates/euth_ideas/idea_list.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{% extends 'euth_projects/project_detail.html' %}
{% load i18n %}

{% block phase_cta %}
<a href="{% url 'idea-create' slug=view.module.slug %}" class="button">{% trans 'Create Proposal' %}</a>
{% endblock %}

{% block phase_content %}
<div class="idea-list">
<h2>{{ view.phase.name }}</h2>
<p class="idea-list-description">{{ view.phase.description }}</p>

<button class="idea-list-button">
<a href="{% url 'idea-create' slug=view.module.slug %}">
<i class="fa fa-plus idea-list-button-icon" aria-hidden="true"></i>
{% trans 'Create Proposal' %}
</a>
</button>

{% for idea in idea_list %}
{% include "euth_ideas/includes/idea_list_tile.html" with idea=idea %}
{% endfor %}
Expand Down
21 changes: 12 additions & 9 deletions euth/ideas/templates/euth_ideas/includes/idea_list_tile.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
{% load i18n thumbnail static %}
<div class="idea-list-tile">
{% if idea.image %}
<a href="{% url 'idea-detail' idea.slug %}" class="idea-tile-image-link col-md-2 col-sm-2 col-xs-3" style="background-size: cover; background-image: url({{ idea.image.url }});">
<a href="{% url 'idea-detail' idea.slug %}" class="idea-tile-image-link" style="background-image: url({{ idea.image.url }});">
</a>
{% else %}
<a href="{% url 'idea-detail' idea.slug %}" class="idea-tile-image-link col-md-2 col-sm-2 col-xs-3">
<a href="{% url 'idea-detail' idea.slug %}" class="idea-tile-image-link">
</a>
{% endif %}
<div class="idea-tile-body col-md-10 col-md-offset-2 col-sm-10 col-sm-offset-2 col-xs-9 col-xs-offset-3">
<div class="idea-tile-body">
<div class="row">
<div class="col-lg-8">
<div class="col-xs-8">
<h3 class="idea-tile-title">
<a href="{% url 'idea-detail' idea.slug %}">
{{ idea.name }}
</a>
</h3>
</div>
<div class="col-lg-4 pull-right idea-meta">
<!-- FIXME: votes -->
<div class="col-xs-4 pull-right idea-meta">
<span class="idea-upvotes idea-meta-item">{{ idea.positive_rates }} <i class="fa fa-chevron-up" aria-hidden="true"></i></span>
<span class="idea-downvotes idea-meta-item">{{ idea.negative_rates }} <i class="fa fa-chevron-down" aria-hidden="true"></i></span>
<span class="idea-comments-count idea-meta-item"><i class="fa fa-comment-o" aria-hidden="true"></i> {{ idea.comments.count }}</span>
</div>
</div>
<div class="avatar-small">
<!-- FIXME: logo -->
<img src="/static/images/logo.svg" width="30" height="30" alt=""/><div class="name">{{ idea.creator.username }} <span class="idea-date"> {{ idea.created | date }}</span></div>
{% if idea.creator.avatar %}
<img src="{{ idea.creator.avatar | thumbnail_url:'avatar_small'}}" width="30" height="30" alt=""/>
{% else %}
<img src="/static/images/logo.svg" width="30" height="30" alt=""/>
{% endif %}
<div class="name">{{ idea.creator.username }} <span class="idea-date"> {{ idea.created | date }}</span>
</div>
</div>
</div>
</div>

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="col-sm-4">
<div class="org-tile">
{% if organisation.image %}
<a href="{% url 'organisation-detail' organisation.slug %}" class="org-tile-image-link" style="background-image:url({{organisation.image.url}}); background-size:cover;">
<a href="{% url 'organisation-detail' organisation.slug %}" class="org-tile-image-link" style="background-image:url({{organisation.image.url}});">
{% else %}
<a href="{% url 'organisation-detail' organisation.slug %}" class="org-tile-image-link">
{% endif %}
Expand All @@ -24,7 +24,7 @@ <h2 class="org-tile-title">
{{ organisation.name }}
</a>
</h2>
<p class="org-tile-teaser">{{ organisation.description | truncatechars:150 }}</p>
<p class="org-tile-teaser">{{ organisation.description | truncatechars:200 }}</p>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1 class="block-title">{% trans 'Organisations' %}</h1>
{% endfor %}
</div>
{% if is_paginated %}
<div class=row>
<div class="row">
<nav class="pull-right">
<ul class="pagination">
{% if page_obj.has_previous %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<h2 class="project-tile-title"><a href="{% url 'project-detail' project.slug %}">{{ project }}</a></h2>
<p class="project-tile-teaser">{{ project.description|truncatechars:200 }}</p>
<p class="project-tile-org">
<img src="{{ project.organisation.logo }}" class="project-tile-org-avatar" height="30" width="30" alt=""/>
<img src="{{ project.organisation.logo.url }}" class="project-tile-org-avatar" height="30" width="30" alt=""/>
{{ project.organisation.name }}
</p>
</div>
Expand Down
40 changes: 29 additions & 11 deletions euth/projects/templates/euth_projects/project_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
<div class="container">
<div class="container-narrow">
<div class="euth-hero-unit-header">
<div class="org-badge">
{% if view.project.organisation.logo %}
<img src="{{ view.project.organisation.logo|thumbnail_url:'avatar_medium'}}" class="org-badge-image" alt="" />
{% endif %}
{{ view.project.organisation }}
</div>
<h1>{{ view.project.name }}</h1>
<p>{{ view.project.description }}</p>
<p>{{ view.project.description | truncatechars:200 }}</p>
{% block phase_cta %}{% endblock %}
</div>
</div>
Expand All @@ -33,17 +39,29 @@ <h1>{{ view.project.name }}</h1>
</div>
</nav>
<div class="container">
<div class="container-narrow">
<article id="panel-info" class="tab-panel">
<h3>{% trans "info" %}</h3>
{{ view.project.description }}
</article>
<article id="panel-participation" class="tab-panel">
<article id="panel-info" class="tab-panel">
<h3 class="tab-panel-title">{% trans "info" %}</h3>
<div class="tab-panel-description">
{{ view.project.description }}
<!-- FIXME: Use Badge Group when badges are implemented -->
<!--<div class="badge-group">
<span class="badge">
<strong>Dummy Dummy</strong>
12 Sep 2016
</span>
<span class="badge">
<strong>Dummy Dummy</strong>
12 Sep 2016
</span>
</div>-->
</article>
<article id="panel-participation" class="tab-panel">
<div class="tab-panel-description">
{% block phase_content %}{% endblock %}
</article>
<article id="panel-offline" class="tab-panel">
</article>
</div>
</div>
</article>
<article id="panel-offline" class="tab-panel">
</article>
</div>
{% if view.project.other_projects %}
<div class="project-other-projects">
Expand Down
6 changes: 5 additions & 1 deletion euth/user_management/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@


class UsersConfig(AppConfig):
name = 'user_management'
name = 'euth.user_management'
label = 'user_management'

def ready(self):
import euth.user_management.signals # noqa:F401

0 comments on commit 5b3826d

Please sign in to comment.