Skip to content

Commit

Permalink
Merge pull request openhatch#42 from daveeloo/ui
Browse files Browse the repository at this point in the history
Commit to close issue openhatch#22 enhancements from user feedback
  • Loading branch information
paulproteus authored and daveeloo committed Sep 10, 2013
2 parents 3b732f5 + e0ac666 commit 6c90160
Show file tree
Hide file tree
Showing 67 changed files with 78 additions and 723 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'greenhouse.urls'
ROOT_URLCONF = 'greenhouse-project-settings.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'greenhouse.wsgi.application'
WSGI_APPLICATION = 'greenhouse-project-settings.wsgi.application'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""
import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "greenhouse.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "greenhouse-project.settings")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
Expand Down
2 changes: 1 addition & 1 deletion greenhouse/manage.py~ → greenhouse-project/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "greenhouse-config.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "greenhouse-project-settings.settings")

from django.core.management import execute_from_command_line

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>{% block title %}{% trans "Greenhouse Overview" %}{% endblock %}</title>
<title>{% block title %}{% trans "Greenhouse" %}{% endblock %}</title>

<link rel="shortcut icon" href="{% static 'img/favicon.ico' %}" type="image/x-icon" />

Expand All @@ -25,18 +25,10 @@
<div id="wrapper">

<div id="header">
<div id="extheader">
<ul>
<li><a href="http://www.debian.org">Debian.org</a></li>
<li><a href="http://wiki.debian.org/Community">Community</a></li>
<li><a href="http://www.debian.org/support">Support</a></li>
<li><a href="http://www.debian.org/partners/">Partners</a></li>
</ul>
</div>

<div id="mainheader">
<a id="sitetitle" href="{% url 'home' %}" class="quiet">
<span id="sitename">{% trans "Greenhouse Overview" %}</span>
<span id="sitename">{% trans "Greenhouse" %}</span>
</a>

<span id="userdata">
Expand Down Expand Up @@ -72,30 +64,18 @@
{% block content %}{% endblock %}
</div>

{% if in_allowed_group %}
{% include "sidebar.html" %}
{% endif %}

</div>

<div class="bottom"></div>

<div id="footer">
<div id="footnav">
<ul>
<li class="toplevel"><a href="{% url 'home' %}">{% trans "Greenhouse Overview" %}</a></li>
<li class="toplevel"><a href="{% url 'home' %}">{% trans "Greenhouse" %}</a></li>
<li><a href="https://github.com/openhatch/oh-greenhouse/issues?state=open" target="_blank">{% trans "Bugs" %}</a></li>
<li><a href="http://github.com/openhatch/oh-greenhouse" target="_blank">{% trans "Code" %}</a></li>
</ul>
</div>

<div id="copyright">
&copy; 2013 Debian Project

</div>
</div>

</div>
</body>

</html>

Original file line number Diff line number Diff line change
@@ -1,38 +1,49 @@
{% load custom_tags %}
{% block dashboard %}

<h2>Dashboard:</h2>
<p>The purpose of this app is to help Debian Developer Advisory Team get in touch with new Debian contributors.
People who should get pinged are active contributors who become inactive as well as experienced people who should
be applying for developer status.
</p>
<div id='content' class='row-fluid'>

<div class='dashboard-box span4'>

<h3>New comers not greeted yet:</h3>

{% for p in first_timers|dictsortreversed:"first_upload.timestamp" %}
<li><a href="contributors/{{ p.email }}">{{ p.name }}</a>, {{ p.first_upload.timestamp|date:"SHORT_DATE_FORMAT" }}</li>
{% endfor %}

</div>

<div class='dashboard-box span4'>

<h3>Have done 40 uploads but need to be contacted:</h3>

{% for p in experienced|dictsortreversed:"last_upload.timestamp" %}
<li><a href="contributors/{{ p.email }}">{{ p.name }}</a>, {{ p.total_uploads }} uploads</li>
{% endfor %}

</div>

<div class='dashboard-box span4'>

<h3>Haven't done an upload since being contacted:</h3>

{% for p in inactive|dictsortreversed:"last_upload.timestamp" %}
<li><a href="contributors/{{ p.email }}">{{ p.name }}</a> <b>{% ubu_dev_img p.ubuntu_dev %}</b>, {{ p.last_upload.timestamp|date:"SHORT_DATE_FORMAT" }}</li>
<li><a href="contributors/{{ p.email }}">{{ p.name }}</a>, {{ p.last_upload.timestamp|date:"SHORT_DATE_FORMAT" }}</li>
{% endfor %}
</div>

<div class='dashboard-box span4'>
<h3>Was recently contacted:</h3>
{% for p in contacted %}
<li><a href="contributors/{{ p.email }}">{{ p.name }}</a>, {{ p.last_upload.timestamp|date:"SHORT_DATE_FORMAT" }}</li>
{% endfor %}
</div>

</div>

<div id='action_log'>
<h2>Your Most Recent Actions:</h2>
<ul>{% for action in actions|slice:":20" %}
<li>{{ action.action_time|date:"D d M Y" }}:
<a href="/contributors/{{ action.object_repr }}">
{{ action.change_message }}</a></li>
{% endfor %}
</ul>
</div>
{% endblock %}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
{% load custom_tags %}

{% block content %}

<h1>Welcome to Greenhouse</h1>
<h3>The purpose of this app is to help Debian Developers get in touch with new Debian contributors. People who should
get pinged are active contributors who become inactive as well as experienced people who should be applying for
developer status.
</h3>
<br/>

<div class='main'>

{% if not in_allowed_group %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ <h1>{{ person.name }} </h1><p>{{ suggestion|safe }}</p>
| <a id="unify" title="If this person already exists under another identity
click here to merge the identities"> [unify duplicate identity] </a>
</li>
<li><b>DDPO:</b><a href="http://qa.debian.org/developer.php?email={{person.email}}"> {{person.name}}</a></li>
<li><b>Debian Developer:</b> {{ person.ubuntu_dev|yesno:"Yes,No" }}</li>
<li><b>Last Seen:</b> {{ person.last_upload.timestamp }}</li>
<li><b>Last Contact:</b> {{ person|recent_contact }}</li>
Expand Down Expand Up @@ -82,6 +83,25 @@ <h1>{{ person.name }} </h1><p>{{ suggestion|safe }}</p>
</center>
</div>

<div id='recent_uploads'>
<h2>Most recent uploads:</h2>

<table>
<tr>
<th>Package</th>
<th>Version</th>
<th>Date</th>
</tr>
{% for ul in recent_uploads %}
<tr>
<td><a href="http://packages.qa.debian.org/{{ ul.package }}">{{ ul.package }}</a></td>
<td>{{ ul.version }}</td>
<td>{{ ul.timestamp }}</td>
</tr>
{% endfor %}
</table>
</div>


<div id='whiteboard'>
<h2>Whiteboard:</h2>
Expand Down Expand Up @@ -137,30 +157,13 @@ <h3>#{{ forloop.revcounter }}</h3>
<h2>Uploads per release:</h2>
<div id="uploads_per_release_chart"></div>
</div>

<div id='recent_ulpoads'>
<h2>Most recent uploads:</h2>

<table>
<tr>
<th>Package</th>
<th>Version</th>
<th>Date</th>
</tr>
{% for ul in recent_uploads %}
<tr>
<td><a href="https://launchpad.net/ubuntu/+source/{{ ul.package }}/{{ ul.version }}">{{ ul.package }}</a></td>
<td>{{ ul.version }}</d>
<td>{{ ul.timestamp }}</td>
</tr>
{% endfor %}
</table>
</div>
</div>

<script type="text/javascript">
var textarea = document.getElementById('id_comment');
textarea.setAttribute('placeholder', 'After you contact the person leave a comment here...');
textarea.setAttribute('placeholder', 'After you contact the person leave a comment here...' +
' ' +
'Example: Emailed this person and encouraged her to apply for Debian Developer status');

var textarea = document.getElementById('id_notes');
textarea.setAttribute('placeholder', 'Example: This person has skills in...');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ <h1>{{ profile.user.get_full_name}}</h1>
</li>
</ul>
</div>
<br>
<div id='action_log'>
<h2>Most Recent Actions:</h2>
<ul>{% for action in actions|slice:":20" %}
<li>{{ action.action_time|date:"D d M Y" }}:
<a href="/contributors/{{ action.object_repr }}">
{{ action.change_message }}</a></li>
{% endfor %}</ul>
</div>
</div>

{% endblock %}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
from django.contrib.auth.models import User
from django.contrib.admin.models import LogEntry, ADDITION
from django.contrib.contenttypes.models import ContentType
from django.contrib.comments import Comment
from django.contrib.comments.signals import comment_was_posted
from django.shortcuts import render, get_object_or_404, get_list_or_404
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.dispatch import receiver
from django.utils import timezone
from django.db.models import Q

from distro_info import UbuntuDistroInfo

Expand Down Expand Up @@ -176,7 +178,6 @@ def user_profile(request, user):
"object_repr", flat=True).distinct()
return render(request, 'user_profile.html',
{'profile': profile,
'actions': actions,
'edited_contribs': edited_contribs})


Expand All @@ -194,45 +195,58 @@ def access_denied(request, redirect):


def index(request):
return render(request, 'index.html', dashboard())
return render(request, 'index.html', dashboard(request))


def dashboard():
def dashboard(request):
MAX_PPL_IN_VIEW = 5
first_timers = []
experienced = []
inactive = []
contacted_filter = set()

first_timers_qs = group('first_timers').select_related(
'contacts').order_by('last_upload__timestamp').reverse()
experienced_qs = group('experienced').select_related(
'contacts').order_by('last_upload__timestamp').reverse()
inactive_qs = group('inactive').select_related(
'contacts').order_by('last_upload__timestamp').reverse()
actions = LogEntry.objects.filter(user_id=request.user.id)
contacted_qs = Comment.objects.for_model(People).order_by('submit_date')

for p in first_timers_qs:
if (len(first_timers) < 20 and not p.contacts.all()):
if len(first_timers) < MAX_PPL_IN_VIEW and not p.contacts.all():
first_timers.append(p)
for p in experienced_qs:
if p.contacts.all():
recent_c = p.contacts.all().reverse()[0].submit_date
else:
recent_c = None
if (len(experienced) < 20 and (recent_c is None or
if (len(experienced) < MAX_PPL_IN_VIEW and (recent_c is None or
recent_c < Uploads.objects.filter(
email_changer=p.email).order_by("timestamp")[39].timestamp)):
experienced.append(p)

for p in inactive_qs:
if p.contacts.all():
recent_c = p.contacts.all().reverse()[0].submit_date
else:
recent_c = None
if len(inactive) < 20 and (recent_c is None or
if len(inactive) < MAX_PPL_IN_VIEW and (recent_c is None or
recent_c < p.last_upload.timestamp):
inactive.append(p)
for c in contacted_qs:
if len(contacted_filter) < MAX_PPL_IN_VIEW:
contacted_filter.add(c.object_pk)
query = Q()
for object_pk in contacted_filter:
query |= Q(id=object_pk)
contacted = People.objects.filter(query) if query else []
return {'first_timers': first_timers,
'experienced': experienced,
'inactive': inactive}
'inactive': inactive,
'contacted': contacted,
'actions': actions,
}


@receiver(comment_was_posted)
Expand Down
10 changes: 0 additions & 10 deletions greenhouse/file.py~

This file was deleted.

Loading

0 comments on commit 6c90160

Please sign in to comment.