Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Buff the UI just a little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed May 13, 2015
1 parent 6f06e26 commit 3beff72
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
25 changes: 19 additions & 6 deletions www/new.spt
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ title = _("Apply for a New Team")

{% block content %}
<div class="col0">
<style>
textarea {
width: 100%;
height: 200px;
}
</style>
<form action="/teams/create.json" method="POST" id="new-team">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}" />

<label><h2>{{ _("Name") }}</h2></label>
<input type="text" name="name" required />
<label><h2>{{ _("Team Name") }}</h2></label>
<input type="text" name="name" required autofocus />

<label><h2>{{ _("Homepage") }}</h2></label>
<input type="text" name="homepage" required />
Expand All @@ -38,10 +44,17 @@ title = _("Apply for a New Team")
<label><h2>{{ _("How do you share revenue with contributors?") }}</h2></label>
<textarea name="getting_paid" required></textarea>

<div class="clear"></div>
<input type="checkbox" value="true" name="agree_terms"> {{ _("I agree to the terms and conditions") }}
<div class="clear"></div>

<br>
<br>
<input type="checkbox" value="true" name="agree_terms" id="agree_terms">
<label for="agree_terms">
{{ _( "I agree to the {0}terms of service{1}"
, '<a href="/about/policies/terms-of-service">'|safe
, '</a>'|safe
) }}
</label>
<br>
<br>
<button type="submit">{{ _("Apply") }}</button>
</form>
</div>
Expand Down
17 changes: 9 additions & 8 deletions www/teams/create.json.spt
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,30 @@ from gratipay.models.team import Team
request.allow('POST')

field_names = {
'name': 'Name',
'name': 'Team Name',
'homepage': 'Homepage',
'product_or_service': 'Product or Service',
'getting_paid': 'How do you share revenue',
'getting_involved': 'How can other people get involved'
'getting_paid': 'How do you share revenue?',
'getting_involved': 'How can other people get involved?'
}

if user.ANON:
raise Response(401, _("You must sign in to apply for a new team"))
raise Response(401, _("You must sign in to apply for a new team."))

if not request.body.get('agree_terms', False):
raise Response(400, _("Please agree to the terms and conditions"))
raise Response(400, _("Please agree to the terms of service."))

if request.method == 'POST':
fields = {}

# Validate inputs

for field in field_names.keys():
if not request.body.get(field, ''):
raise Response(400, _("Please fill out the '{0}' field", field_names[field]))
value = request.body.get(field, '')
if not value:
raise Response(400, _("Please fill out the '{0}' field.", field_names[field]))

fields[field] = request.body.get(field, '')
fields[field] = value

fields['slug'] = slugize(fields['name'])

Expand Down

0 comments on commit 3beff72

Please sign in to comment.