Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
Merge branch 'feature/non-image-logo' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe committed Aug 16, 2012
2 parents a8e6e1b + e7514de commit ad9c99d
Show file tree
Hide file tree
Showing 21 changed files with 84 additions and 79 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ pto/settings/local*
TODO TODO
cover/ cover/
sample_data.py sample_data.py
build/ /build/
collected/ puppet/manifests/build/
static/ /collected/
/static/
.vagrant .vagrant
2 changes: 1 addition & 1 deletion pto/apps/dates/static/dates/css/hours.css
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
#date_discriminator { #date_discriminator {
/*width: 900px;*/ /*width: 900px;*/
margin: 0 0 0 180px; margin: 20px 0 0 180px;
} }
#date_discriminator_panel { #date_discriminator_panel {
float: left; float: left;
Expand Down
2 changes: 1 addition & 1 deletion pto/apps/dates/templates/dates/following.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h2>People you're following (or not)</h2>
<h3>Add more people to follow:</h3> <h3>Add more people to follow:</h3>
<input name="search" id="id_search" size="50" placeholder="Start typing name or email of a person you want to follow"> <input name="search" id="id_search" size="50" placeholder="Start typing name or email of a person you want to follow">
<p class="tip-note"><strong>Note!</strong> If you can't find the person you're looking for, <p class="tip-note"><strong>Note!</strong> If you can't find the person you're looking for,
maybe that person hasn't used the PTO app before and can therefore not be found.</p> maybe that person hasn't used the Vacation tool before, and can therefore not be found.</p>
</form> </form>


<div id="observed"> <div id="observed">
Expand Down
4 changes: 2 additions & 2 deletions pto/apps/dates/templates/dates/home.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</div> </div>


<div id="pto_taken" class="extra-info"> <div id="pto_taken" class="extra-info">
<h2>How much PTO have I taken?</h2> <h2>How much vacation have I taken?</h2>


<p>You have taken <p>You have taken
<strong>{{ taken }}</strong> <strong>{{ taken }}</strong>
Expand Down Expand Up @@ -115,7 +115,7 @@ <h2>How much PTO have I taken?</h2>
WHILST WE DECIDE TO KEEP IT AT ALL WHILST WE DECIDE TO KEEP IT AT ALL


<div id="rightnow" class="extra-info"> <div id="rightnow" class="extra-info">
<h2>Who's on PTO right now?</h2> <h2>Who's on Vacation right now?</h2>


<dl> <dl>
{% for user in right_now_users %} {% for user in right_now_users %}
Expand Down
2 changes: 1 addition & 1 deletion pto/apps/dates/templates/dates/hours.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


<form action="." method="post">{{ csrf() }} <form action="." method="post">{{ csrf() }}
<div id="date_discriminator_panel"> <div id="date_discriminator_panel">
<p>Days of PTO:</p> <p>Days of Vacation:</p>
<h5 id="date_discriminator_hours">{{ total_days }}</h5> <h5 id="date_discriminator_hours">{{ total_days }}</h5>
</div> </div>
<div id="date_discriminator"> <div id="date_discriminator">
Expand Down
2 changes: 1 addition & 1 deletion pto/apps/dates/templates/dates/list.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<table id="filters" border="0"> <table id="filters" border="0">
<tr> <tr>
<td> <td>
PTO between: Vacation between:
</td> </td>
<td> <td>
{{ form.date_from|safe }} {{ form.date_from|safe }}
Expand Down
2 changes: 1 addition & 1 deletion pto/apps/dates/templates/dates/notification.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
--> -->
#} #}


{{ user.first_name }} {{ user.last_name }} has submitted {{ entry.total_days }} days of PTO starting {{ start_date }}{% if not entry.details %}.{% else %} with the details: {{ user.first_name }} {{ user.last_name }} has submitted {{ entry.total_days }} days of vacation starting {{ start_date }}{% if not entry.details %}.{% else %} with the details:
{{ line_indent(entry.details) }}{% endif %} {{ line_indent(entry.details) }}{% endif %}


-- --
Expand Down
2 changes: 1 addition & 1 deletion pto/apps/dates/tests/test_views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def test_notify_basics(self):
ok_(entry.details in email.body) ok_(entry.details in email.body)
ok_(entry.start.strftime(settings.DEFAULT_DATE_FORMAT) ok_(entry.start.strftime(settings.DEFAULT_DATE_FORMAT)
in email.body) in email.body)
ok_('submitted 1.5 days of PTO' in email.body) ok_('submitted 1.5 days of vacation' in email.body)


eq_(email.cc, [peter.email]) eq_(email.cc, [peter.email])
ok_('--\n%s' % settings.EMAIL_SIGNATURE in email.body) ok_('--\n%s' % settings.EMAIL_SIGNATURE in email.body)
Expand Down
8 changes: 4 additions & 4 deletions pto/apps/dates/views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def is_blacklisted(user):
@login_required @login_required
def notify(request): def notify(request):
data = {} data = {}
data['page_title'] = "Notify about new PTO" data['page_title'] = "Notify about new vacation"
if request.method == 'POST': if request.method == 'POST':
form = forms.AddForm(request.user, data=request.POST) form = forms.AddForm(request.user, data=request.POST)
if form.is_valid(): if form.is_valid():
Expand Down Expand Up @@ -493,7 +493,7 @@ def hours(request, pk):
assert success assert success


#messages.info(request, #messages.info(request,
# '%s hours of PTO logged.' % total_hours # '%s hours of vacation logged.' % total_hours
#) #)
recently_created = make_entry_title(entry, request.user) recently_created = make_entry_title(entry, request.user)
cache_key = 'recently_created_%s' % request.user.pk cache_key = 'recently_created_%s' % request.user.pk
Expand Down Expand Up @@ -971,7 +971,7 @@ def calendar_vcal(request, key):
RequestSite(request).domain) RequestSite(request).domain)
home_url = base_url + '/' home_url = base_url + '/'
cal = vobject.iCalendar() cal = vobject.iCalendar()
cal.add('x-wr-calname').value = 'Mozilla PTO' cal.add('x-wr-calname').value = 'Mozilla Vacation'


try: try:
user = UserKey.objects.get(key=key).user user = UserKey.objects.get(key=key).user
Expand Down Expand Up @@ -1021,7 +1021,7 @@ def make_list_url(entry):
return _list_base_url + '?' + urlencode(data, True) return _list_base_url + '?' + urlencode(data, True)
for entry in entries: for entry in entries:
event = cal.add('vevent') event = cal.add('vevent')
event.add('summary').value = '%s PTO' % make_entry_title(entry, user, event.add('summary').value = '%s Vacation' % make_entry_title(entry, user,
include_details=False) include_details=False)
event.add('dtstart').value = entry.start event.add('dtstart').value = entry.start
event.add('dtend').value = entry.end event.add('dtend').value = entry.end
Expand Down
2 changes: 1 addition & 1 deletion pto/apps/mobile/templates/mobile/base.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<link rel="apple-touch-icon-precomposed" href="{{ static('mobile/img/apple-touch-icon.png') }}"> <link rel="apple-touch-icon-precomposed" href="{{ static('mobile/img/apple-touch-icon.png') }}">
<link rel="shortcut icon" href="{{ static('mobile/img/apple-touch-icon.png') }}"> <link rel="shortcut icon" href="{{ static('mobile/img/apple-touch-icon.png') }}">


<title>{% block page_title %}Mozilla PTO{% endblock %}</title> <title>{% block page_title %}Mozilla Vacation{% endblock %}</title>


{% compress css %} {% compress css %}
<link rel="stylesheet" href="{{ static("css/libs/jquery.mobile-1.1.0.min.css") }}"> <link rel="stylesheet" href="{{ static("css/libs/jquery.mobile-1.1.0.min.css") }}">
Expand Down
1 change: 0 additions & 1 deletion pto/apps/mobile/templates/mobile/home.html

This file was deleted.

6 changes: 3 additions & 3 deletions pto/apps/mobile/templates/mobile/mobile.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ <h1>{{ page_title }}</h1>




<ul data-role="listview"> <ul data-role="listview">
<li><a href="#notify">Notify of new PTO</a></li> <li><a href="#notify">Notify of new Vacation</a></li>
<li><a href="#taken">How much PTO have I taken?</a></li> <li><a href="#taken">How much vacation have I taken?</a></li>
<li><a href="#rightnow">Who is on PTO right now?</a></li> <li><a href="#rightnow">Who is on vacation right now?</a></li>
<li><a href="#settings">Settings</a></li> <li><a href="#settings">Settings</a></li>
<li><a href="#logout">Log out</a></li> <li><a href="#logout">Log out</a></li>
</ul> </ul>
Expand Down
2 changes: 1 addition & 1 deletion pto/apps/mobile/templates/mobile/page.left.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div data-role="page" id="left" data-add-back-btn="true"><!-- left page --> <div data-role="page" id="left" data-add-back-btn="true"><!-- left page -->


<div data-role="header"> <div data-role="header">
<h1>PTO left</h1> <h1>Vacation left</h1>
{% include "mobile/homeicon.html" %} {% include "mobile/homeicon.html" %}
</div> </div>


Expand Down
6 changes: 3 additions & 3 deletions pto/apps/mobile/templates/mobile/page.rightnow.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
<div data-role="page" id="rightnow" data-add-back-btn="true"><!-- right now page --> <div data-role="page" id="rightnow" data-add-back-btn="true"><!-- right now page -->


<div data-role="header"> <div data-role="header">
<h1>PTO right now</h1> <h1>Vacation right now</h1>
{% include "mobile/homeicon.html" %} {% include "mobile/homeicon.html" %}
</div> </div>


<div data-role="content"> <div data-role="content">
<h3>People on PTO right now:</h3> <h3>People on vacation right now:</h3>
<p class="loading">figuring that out...</p> <p class="loading">figuring that out...</p>
<dl class="now"></dl> <dl class="now"></dl>


<h3>Upcoming PTO:</h3> <h3>Upcoming Vacation:</h3>
<p class="loading">figuring that out...</p> <p class="loading">figuring that out...</p>
<dl class="upcoming"></dl> <dl class="upcoming"></dl>
</div> </div>
Expand Down
2 changes: 1 addition & 1 deletion pto/apps/mobile/templates/mobile/page.taken.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div data-role="page" id="taken" data-add-back-btn="true"><!-- left page --> <div data-role="page" id="taken" data-add-back-btn="true"><!-- left page -->


<div data-role="header"> <div data-role="header">
<h1>PTO taken</h1> <h1>Vacation taken</h1>
{% include "mobile/homeicon.html" %} {% include "mobile/homeicon.html" %}
</div> </div>


Expand Down
69 changes: 36 additions & 33 deletions pto/apps/mobile/views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file, # License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/. # You can obtain one at http://mozilla.org/MPL/2.0/.


import time
import datetime import datetime
from django import http from django import http
from django.db.models import Q
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.db import transaction from django.db import transaction
from django.views.decorators.http import require_POST from django.views.decorators.http import require_POST
Expand All @@ -22,7 +24,7 @@


def home(request): def home(request):
data = {} data = {}
data['page_title'] = 'Mozilla PTO' data['page_title'] = 'Mozilla Vacation'
# not fully developed so disabled for now # not fully developed so disabled for now
data['use_manifest'] = False#True#not settings.DEBUG data['use_manifest'] = False#True#not settings.DEBUG


Expand All @@ -40,33 +42,31 @@ def appcache(request):
def right_now(request): def right_now(request):
if not request.user.is_authenticated(): # XXX improve this if not request.user.is_authenticated(): # XXX improve this
return {'error': 'Not logged in'} return {'error': 'Not logged in'}
from pto.apps.dates.views import get_right_nows, get_upcomings
from pto.apps.dates.helpers import format_date from pto.apps.dates.helpers import format_date
right_nows, right_now_users = get_right_nows() from pto.apps.dates.views import get_observed_users, make_entry_title
upcomings, upcoming_users = get_upcomings(14)


now = [] now = []
for user in right_now_users:
descriptions = []
for days_left, entry in right_nows[user]:
description = 'ends in '
if days_left == 1:
description += '1 day '
else:
description += '%d days ' % days_left
description += 'on %s' % format_date(None, entry.end, shorter=True)
descriptions.append(description)
name = user.get_full_name()
if not name:
name = user.username
now.append({'name': name,
'email': user.email,
'descriptions': descriptions})

upcoming = [] upcoming = []
for user in upcoming_users: user_ids = [request.user.pk]
descriptions = [] for user_ in get_observed_users(request.user, max_depth=2):
for days, entry in upcomings[user]: user_ids.append(user_.pk)

start = today = datetime.datetime.utcnow()
end = start + datetime.timedelta(days=90)
for entry in (Entry.objects
.filter(user__in=user_ids,
total_hours__gte=0,
total_hours__isnull=False)
.select_related('user')
.exclude(Q(end__lt=start) | Q(start__gt=end))):
row = {}
name = entry.user.get_full_name()
if not name:
name = entry.user.username
row['name'] = name
row['email'] = entry.user.email
if entry.start > today.date():
days = (entry.start - today.date()).days
description = 'starts in ' description = 'starts in '
if days == 1: if days == 1:
description += '1 day ' description += '1 day '
Expand All @@ -77,15 +77,18 @@ def right_now(request):
else: else:
description += '%d days ' % days description += '%d days ' % days
description += 'on %s' % format_date(None, entry.end, shorter=True) description += 'on %s' % format_date(None, entry.end, shorter=True)
descriptions.append(description) row['descriptions'] = [description]
name = user.get_full_name() upcoming.append(row)
if not name: else:
name = user.username days_left = (entry.end - today.date()).days
upcoming.append({ description = 'ends in '
'name': name, if days_left == 1:
'email': user.email, description += '1 day '
'descriptions': descriptions else:
}) description += '%d days ' % days_left
description += 'on %s' % format_date(None, entry.end, shorter=True)
row['descriptions'] = [description]
now.append(row)


return {'now': now, 'upcoming': upcoming} return {'now': now, 'upcoming': upcoming}


Expand Down
Binary file added pto/base/static/css/images/pto-dino.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 14 additions & 11 deletions pto/base/static/css/style.less
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ html {
color:#ffffff; color:#ffffff;
} }
h1 { h1 {
font-size:180%;
font-weight:bold;
margin-bottom:20px; margin-bottom:20px;
a { a {
left:10%; font-size:250%;
height:47px; font-weight:bold;
width:0; color: white;
padding-left:275px; text-shadow: 1px 1px 1px rgba(20, 20, 20, 1);
background:url(/static/css/images/pto.png) no-repeat; background:url(/static/css/images/pto-dino.png) no-repeat;
overflow:hidden; padding-left: 70px;
display:block; }
a:hover {
text-decoration: none;
} }
} }
h2 { h2 {
Expand Down Expand Up @@ -55,8 +55,11 @@ em {
width:90%; width:90%;
margin:0 auto; margin:0 auto;
position:relative; position:relative;
a { /* do this nesting to avoid styling the header */
color:#0489b7; section {
a {
color:#0489b7;
}
} }
} }
section { section {
Expand Down
2 changes: 1 addition & 1 deletion pto/base/templates/500.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<body> <body>
<div id="page"> <div id="page">
<header> <header>
<h1><a href="/">PTO Notification</a></h1> <h1><a href="/">Vacation Notification</a></h1>
</header> </header>


<section id="content"> <section id="content">
Expand Down
7 changes: 3 additions & 4 deletions pto/base/templates/base.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="shortcut icon" href="{{ static("img/favicon.ico") }}"> <link rel="shortcut icon" href="{{ static("img/favicon.ico") }}">
<link rel="shortcut icon" type="image/x-icon" href="{{ static("img/favicon.ico") }}"> <link rel="shortcut icon" type="image/x-icon" href="{{ static("img/favicon.ico") }}">
<title>{% block page_title %}Mozilla PTO{% endblock %}</title> <title>{% block page_title %}Mozilla Vacation{% endblock %}</title>


{#<link rel="stylesheet" href="{{ static("css/style.css") }}">#}
{% compress css %} {% compress css %}
<link type="text/less" rel="stylesheet" href="{{ static("css/style.less") }}"> <link type="text/less" rel="stylesheet" href="{{ static("css/style.less") }}">
<link rel="stylesheet" href="{{ static("css/libs/jquery_ui/redmond/jquery-ui-1.8.20.datepicker.autocomplete.dialog.css") }}"> <link rel="stylesheet" href="{{ static("css/libs/jquery_ui/redmond/jquery-ui-1.8.20.datepicker.autocomplete.dialog.css") }}">
{% endcompress %} {% endcompress %}

{% block extra_site_css %} {% block extra_site_css %}
{% endblock %} {% endblock %}
</head> </head>
<body> <body>
<div id="page"> <div id="page">


<header> <header>
<h1><a href="/">PTO Notification</a></h1> <h1><a href="/">Mozilla Vacation</a></h1>
{% if request.user.is_authenticated() %} {% if request.user.is_authenticated() %}
<nav> <nav>
<ul id="menu"> <ul id="menu">
Expand Down
10 changes: 5 additions & 5 deletions pto/settings/base.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@


MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES) MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
MIDDLEWARE_CLASSES.remove('funfactory.middleware.LocaleURLMiddleware') MIDDLEWARE_CLASSES.remove('funfactory.middleware.LocaleURLMiddleware')
MIDDLEWARE_CLASSES.append('mobility.middleware.DetectMobileMiddleware')
MIDDLEWARE_CLASSES.append('mobility.middleware.XMobileMiddleware')
MIDDLEWARE_CLASSES = tuple(MIDDLEWARE_CLASSES) MIDDLEWARE_CLASSES = tuple(MIDDLEWARE_CLASSES)
MIDDLEWARE_CLASSES += ( MIDDLEWARE_CLASSES += (
'mobility.middleware.DetectMobileMiddleware',
'mobility.middleware.XMobileMiddleware',
'commonware.middleware.ScrubRequestOnException', 'commonware.middleware.ScrubRequestOnException',
) )


Expand Down Expand Up @@ -111,9 +111,9 @@
DEFAULT_DATE_FORMAT = '%A, %B %d, %Y' DEFAULT_DATE_FORMAT = '%A, %B %d, %Y'
WORK_DAY = 8 # hours WORK_DAY = 8 # hours


EMAIL_SUBJECT = 'PTO notification from %(first_name)s %(last_name)s' EMAIL_SUBJECT = 'Vacation notification from %(first_name)s %(last_name)s'
EMAIL_SUBJECT_EDIT = 'PTO update from %(first_name)s %(last_name)s' EMAIL_SUBJECT_EDIT = 'Vacation update from %(first_name)s %(last_name)s'
EMAIL_SIGNATURE = "The Mozilla PTO" EMAIL_SIGNATURE = "Mozilla Vacation"
FALLBACK_TO_ADDRESS = 'jvandeven@mozilla.com' FALLBACK_TO_ADDRESS = 'jvandeven@mozilla.com'


# People you're not allowed to notify additionally # People you're not allowed to notify additionally
Expand Down

0 comments on commit ad9c99d

Please sign in to comment.