Stats for Pro.
parent
9beb544fc9
commit
f194b6cb8d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -110,6 +110,7 @@ header.main {
|
|||
}
|
||||
h1 {
|
||||
float: left;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
z-index: 50;
|
||||
|
||||
|
@ -191,6 +192,7 @@ header.main {
|
|||
}
|
||||
}
|
||||
button#add-snipt {
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
margin-top: -3px;
|
||||
padding: 7px 12px 9px 12px;
|
||||
|
@ -1254,18 +1256,6 @@ div.pagination {
|
|||
a {
|
||||
color: #3BAAF3;
|
||||
}
|
||||
&.next {
|
||||
a {
|
||||
line-height: 33px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
}
|
||||
&.prev {
|
||||
a {
|
||||
line-height: 33px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1529,6 +1519,11 @@ body.static {
|
|||
margin: 5px 0;
|
||||
}
|
||||
}
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
line-height: 36px;
|
||||
margin: 0;
|
||||
}
|
||||
h3 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
@ -1878,15 +1873,14 @@ body.pro {
|
|||
font-size: 13px;
|
||||
}
|
||||
div.security {
|
||||
background: #FCF8E3 url('/static/images/private-icon.png') 5px -12px no-repeat;
|
||||
background: #FCF8E3 url('/static/images/private-icon.png') 7px -15px no-repeat;
|
||||
border: 1px solid #FBEED5;
|
||||
color: #C09853;
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
margin-left: 10px;
|
||||
margin-top: 1px;
|
||||
padding: 5px 10px 5px 33px;
|
||||
vertical-align: -1px;
|
||||
margin-top: -1px;
|
||||
padding: 6px 10px 6px 33px;
|
||||
@include border-radius;
|
||||
|
||||
a {
|
||||
|
@ -1929,7 +1923,7 @@ body.pro {
|
|||
div.stripe {
|
||||
color: #C2C2C2;
|
||||
font: bold 11px/15px $Helvetica;
|
||||
margin: 10px 3px 0 80px;
|
||||
margin: 10px 65px 0 92px;
|
||||
text-align: center;
|
||||
|
||||
a {
|
||||
|
@ -1969,3 +1963,8 @@ body.tags {
|
|||
padding-top: 30px;
|
||||
}
|
||||
}
|
||||
body.stats {
|
||||
table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 12 KiB |
File diff suppressed because one or more lines are too long
|
@ -103,6 +103,14 @@
|
|||
View profile
|
||||
</a>
|
||||
</li>
|
||||
{% if request.user.profile.is_pro %}
|
||||
<li>
|
||||
<a href="/stats/">
|
||||
<i class="icon-user icon-white"></i>
|
||||
View stats
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
<a href="/api/">
|
||||
<i class="icon-fire icon-white"></i>
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
|
||||
{% block content %}
|
||||
<div class="static-box">
|
||||
<a href="https://stripe.com" title="Secure payment with Stripe" class="stripe">
|
||||
<img src="/static/images/stripe.png" alt="" />
|
||||
</a>
|
||||
<h2>Snipt <span class="pro">Pro</span> signup</h2>
|
||||
<form class="form-horizontal" id="pro-signup" method="post" action="/pro/signup/complete/">
|
||||
<fieldset>
|
||||
|
@ -89,10 +86,10 @@
|
|||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-success">Sign up</button>
|
||||
<div class="security">
|
||||
<a href="https://stripe.com/help/security">Secure</a> by default. Every page on Snipt is secured with HTTPS.
|
||||
<a href="https://stripe.com/help/security">Secure</a> by default. Every Snipt page is secure.
|
||||
</div>
|
||||
<div class="stripe">
|
||||
Your credit card is stored securely with <a href="https://stripe.com">Stripe</a> and we use <a href="https://stripe.com/docs/stripe.js">Stripe.js</a> for maximum security (<a href="/static/js/src/modules/site.js">view the source</a>).
|
||||
Your credit card is stored securely with <a href="https://stripe.com">Stripe</a> and we use <a href="https://stripe.com/docs/stripe.js">Stripe.js</a> for maximum security.
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% load pagination_tags %}
|
||||
|
||||
{% block page-title %}Stats {{ block.super }}{% endblock %}
|
||||
|
||||
{% block body-class %}{{ block.super }} static stats{% endblock %}
|
||||
|
||||
{% block breadcrumb %}
|
||||
<li><a href="/stats/">Stats</a></li>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="static-box">
|
||||
{% autopaginate snipts 100 %}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Snipt</th>
|
||||
<th>Views</th>
|
||||
<th>Favs</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for snipt in snipts %}
|
||||
<tr>
|
||||
<td><a href="{{ snipt.get_absolute_url }}">{{ snipt.title }}</a></td>
|
||||
<td>{{ snipt.views }}</td>
|
||||
<td>{{ snipt.favs }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% paginate %}
|
||||
</div>
|
||||
{% endblock %}
|
5
urls.py
5
urls.py
|
@ -1,4 +1,5 @@
|
|||
from views import amazon_search, amazon_image, lexers, pro_signup, sitemap, tags, pro_signup_complete
|
||||
from views import (amazon_search, amazon_image, lexers, pro_signup,
|
||||
sitemap, tags, pro_signup_complete, stats)
|
||||
from django.conf.urls.defaults import include, patterns, url
|
||||
from django.views.generic.simple import direct_to_template
|
||||
from utils.forms import SniptRegistrationForm
|
||||
|
@ -40,6 +41,8 @@ urlpatterns = patterns('',
|
|||
url(r'^pro/signup/$', pro_signup),
|
||||
url(r'^pro/signup/complete/$', pro_signup_complete),
|
||||
|
||||
url(r'^stats/$', stats),
|
||||
|
||||
url(r'^api/public/lexer/$', lexers),
|
||||
url(r'^api/public/a/$', amazon_search),
|
||||
url(r'^api/public/a/img/$', amazon_image),
|
||||
|
|
15
views.py
15
views.py
|
@ -1,4 +1,4 @@
|
|||
from django.http import HttpResponseRedirect, HttpResponseBadRequest
|
||||
from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequest
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from annoying.decorators import ajax_request, render_to
|
||||
from django.template.defaultfilters import striptags
|
||||
|
@ -8,6 +8,7 @@ from snipts.utils import get_lexers_list
|
|||
from django.db.models import Count
|
||||
from amazon.api import AmazonAPI
|
||||
from django.conf import settings
|
||||
from snipts.models import Snipt
|
||||
from taggit.models import Tag
|
||||
|
||||
import os, urllib
|
||||
|
@ -135,6 +136,18 @@ def sitemap(request):
|
|||
context_instance=RequestContext(request),
|
||||
mimetype='application/xml')
|
||||
|
||||
@render_to('stats.html')
|
||||
def stats(request):
|
||||
|
||||
if not request.user.profile.is_pro:
|
||||
raise Http404
|
||||
|
||||
snipts = Snipt.objects.filter(user=request.user).order_by('-views')
|
||||
|
||||
return {
|
||||
'snipts': snipts
|
||||
}
|
||||
|
||||
@render_to('tags.html')
|
||||
def tags(request):
|
||||
|
||||
|
|
Loading…
Reference in New Issue