Move some teams stuff around.

master
Nick Sergeant 2015-09-22 10:29:29 -04:00
parent 29fed4e6eb
commit e7f660782a
6 changed files with 88 additions and 108 deletions

View File

@ -13,12 +13,16 @@
<form class="form-horizontal static-box" id="pro-signup" method="post" action="/pro/complete/">
<fieldset>
<div class="info">
You rock.
<p class="sub" style="padding: 0 120px;">
We'll email you to get more information about your team and to help you get your first team created.
If you ever need anything at all, <a href="mailto:support@snipt.net">email support</a>, or use the chat in the bottom right.
</p>
Team created successfully.
</div>
<ul>
<li>
<a href="/{{ team.user.username }}">Add some members</a>
</li>
<li>
<a href=""></a>
</li>
</ul>
</fieldset>
</form>
{% endblock %}

View File

@ -0,0 +1,43 @@
{% extends "base.html" %}
{% block page-title %}Request beta access to Snipt for Teams{% endblock %}
{% block body-class %}{{ block.super }} static signup pro pro-signup{% endblock %}
{% block breadcrumb %}
<li><a href="/for-teams/">Snipt for Teams</a></li>
{% endblock %}
{% block content %}
<form class="form-horizontal static-box" id="pro-signup" method="post" action="/for-teams/complete/">
<fieldset>
<div class="info">
Snipt for Teams
<ul class="features">
<li>Team profile at snipt.net/{team-name}.</li>
<li>Members can create public or private snipts on a team.</li>
<li>Public team posts are public to the world, as they are now.</li>
<li>Private team posts are editable by all team members.</li>
<li>All team members are automatically granted personal <span class="pro">Pro</span> accounts.</li>
<li>Plans starting at $49/month.</li>
</ul>
</div>
<div class="control-group">
<label class="control-label" for="name">Team name:</label>
<div class="controls">
<input required type="text" class="input-xlarge" name="name" id="name" />
</div>
<div class="form-actions">
{% csrf_token %}
<button type="submit" class="btn btn-success">Request more info &raquo;</button>
</div>
</fieldset>
</form>
{% endif %}
{% endblock %}
{% block analytics %}
{% if not debug %}
window.ll('tagScreen', 'Team beta signup view');
{% endif %}
{% endblock %}

34
teams/views.py Normal file
View File

@ -0,0 +1,34 @@
from annoying.decorators import render_to
from django.contrib.auth.models import User
from django.http import HttpResponseBadRequest
from teams.models import Team
@render_to('teams/for-teams.html')
def for_teams(request):
if request.user.is_authenticated():
profile = request.user.profile
profile.teams_beta_seen = True
profile.save()
return {}
@render_to('teams/for-teams-complete.html')
def for_teams_complete(request):
if request.method == 'POST' and request.user.is_authenticated():
team = Team(name=request.POST['name'],
email='nick@snipt.net',
owner=request.user)
team.save()
user = User.objects.create_user(team.slug, team.email, 'password')
team.user = user
team.save()
return {
}
else:
return HttpResponseBadRequest()

View File

@ -1,76 +0,0 @@
{% extends "base.html" %}
{% block page-title %}Request beta access to Snipt for Teams{% endblock %}
{% block body-class %}{{ block.super }} static signup pro pro-signup{% endblock %}
{% block breadcrumb %}
<li><a href="/for-teams/">Snipt for Teams</a></li>
{% endblock %}
{% block content %}
{% if request.user.profile.teams_beta_applied %}
<div class="alert alert-success" style="margin: 30px;">
You've successfully applied for the beta program - we'll email you as soon as we're ready!
</div>
{% else %}
<form class="form-horizontal static-box" id="teams-signup" method="post" action="/for-teams/complete/">
<fieldset>
<div class="info">
Snipt for Teams
<ul class="features">
<li>Team profile at snipt.net/{team-name}.</li>
<li>Members can create public or private snipts on a team.</li>
<li>Public team posts are public to the world, as they are now.</li>
<li>Private team posts are editable by all team members.</li>
<li>All team members are automatically granted personal <span class="pro">Pro</span> accounts.</li>
<li>Plans starting at $49/month.</li>
</ul>
</div>
{% if not request.user.is_authenticated %}
<div class="control-group">
<label class="control-label" for="name">Your name:</label>
<div class="controls">
<input required type="text" class="input-xlarge" name="username" id="username" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="name">Your email:</label>
<div class="controls">
<input required type="email" class="input-xlarge" name="email" id="email" />
</div>
</div>
{% endif %}
<div class="control-group">
<label class="control-label" for="name">Team name:</label>
<div class="controls">
<input required type="text" class="input-xlarge" name="name" id="name" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="members">How many users?</label>
<div class="controls">
<input required type="number" class="input-medium" name="members" id="members" />
</div>
</div>
<div class="control-group">
<label style="float: none; width: auto; text-align: left; padding-left: 180px; margin-bottom: 10px;" class="control-label" for="members">Tell us a bit about your organization and how<br />you'd like to use Snipt for your team:</label>
<div class="controls">
<textarea required name="info" name="info" id="info" class="input-xlarge" style="height: 100px;"></textarea>
</div>
</div>
<div style="margin-left: 180px;" class="g-recaptcha" data-sitekey="6LerYA0TAAAAAFJaMf7JMnlQR2wzqd_3dMRvLd-4"></div>
<div class="form-actions">
{% csrf_token %}
<button type="submit" class="btn btn-success">Request more info &raquo;</button>
</div>
</fieldset>
</form>
{% endif %}
{% endblock %}
{% block analytics %}
{% if not debug %}
window.ll('tagScreen', 'Team beta signup view');
{% endif %}
{% endblock %}

View File

@ -10,9 +10,10 @@ from snipts.api import (PublicSniptResource,
PrivateUserResource, PublicTagResource)
from snipts.views import search
from tastypie.api import Api
from teams.views import for_teams, for_teams_complete
from utils.views import SniptRegistrationView
from views import (homepage, lexers, login_redirect, pro, sitemap, tags,
pro_complete, user_api_key, for_teams, for_teams_complete)
pro_complete, user_api_key)
public_api = Api(api_name='public')
public_api.register(PublicSniptResource())

View File

@ -16,32 +16,6 @@ from django.template import RequestContext
from snipts.models import Snipt
from snipts.utils import get_lexers_list
from taggit.models import Tag
from teams.models import Team
@render_to('for-teams.html')
def for_teams(request):
if request.user.is_authenticated():
profile = request.user.profile
profile.teams_beta_seen = True
profile.save()
return {}
@render_to('for-teams-complete.html')
def for_teams_complete(request):
if request.method == 'POST' and request.user.is_authenticated():
team = Team(name=request.POST['name'],
email='nick@snipt.net',
owner=request.user)
user = User.objects.create_user(team.slug, team.email, 'password')
team.user = user
team.save()
return {}
else:
return HttpResponseBadRequest()
@render_to('homepage.html')