Make it free to post public snipts.

master
Nick Sergeant 2015-08-25 12:01:48 -04:00
parent 5e50c3be21
commit f13dc219c5
9 changed files with 32 additions and 41 deletions

View File

@ -111,12 +111,12 @@
$selectLexer.chosen();
// Blog post
$('label.blog-post input', window.site.$main_edit).on('change', function() {
$('label.blog-post input', window.site.$main_edit).change(function() {
var $checkbox = $(this);
var $label = $checkbox.parent();
var $publish_date = $label.siblings('label.publish-date');
if ($checkbox.attr('checked')) {
if ($checkbox.is(':checked')) {
$label.removeClass('is-not-blog-post').addClass('is-blog-post');
$publish_date.show();
} else {
@ -124,20 +124,23 @@
$publish_date.hide();
}
return false;
}).trigger('change');
}).change();
// Public / private
$('label.public input', window.site.$main_edit).on('change', function() {
$('label.public input', window.site.$main_edit).change(function() {
var $checkbox = $(this);
var $label = $checkbox.parent();
if ($checkbox.attr('checked')) {
$('div.alert-not-pro').hide();
if ($checkbox.is(':checked')) {
$label.removeClass('is-private').addClass('is-public');
if (!window.user_is_pro) $('div.alert-not-pro').hide();
} else {
$label.addClass('is-private').removeClass('is-public');
if (!window.user_is_pro) $('div.alert-not-pro').show();
}
return false;
}).trigger('change');
}).change();
window.site.$main_edit.show();
@ -488,7 +491,7 @@
window.site.$main_edit).removeAttr('disabled');
},
error: function(model, response) {
alert('There was a problem saving your snipt. We\'ve been notified. Sorry about that!');
alert(JSON.stringify(response.responseJSON.snipt));
}
});
},
@ -588,11 +591,7 @@
$('span.cmd-ctrl').text(cmd);
$('button#add-snipt').click(function() {
if (window.user_account_age > 7 && !window.user_is_pro) {
window.location = '/pro/?expired=true';
} else {
that.addNewSnipt();
}
that.addNewSnipt();
});
},
@ -682,7 +681,7 @@
lexer: 'text',
lexer_name: 'Text only',
new_from_js: true,
public: false,
public: true,
user: {
username: '',
profile: {

View File

@ -145,12 +145,14 @@ class SniptValidation(Validation):
def is_valid(self, bundle, request=None):
errors = {}
if 'pk' not in bundle.data and \
request.user.profile.get_account_age() > 7 and \
print bundle.data['public']
if bundle.data['public'] is False and \
request.user.profile.is_pro is False:
errors['expired'] = """Your trial has expired. You'll need
to go Pro (https://snipt.net/pro/)
in order to create new snipts."""
errors['not-pro'] = ("You'll need to go Pro "
"(https://snipt.net/pro/) "
"in order to create private "
"snipts.")
return errors
@ -162,9 +164,9 @@ class UserProfileValidation(Validation):
for field in bundle.data:
if bundle.data[field]:
if not re.match('^[ A-Za-z0-9\/\@\._-]*$', bundle.data[field]):
errors[field] = """Only spaces, letters, numbers,
underscores, dashes, periods, forward
slashes, and "at sign" are valid."""
errors[field] = ("Only spaces, letters, numbers, "
"underscores, dashes, periods, forward "
"slashes, and \"at sign\" are valid.")
return errors

View File

@ -50,8 +50,6 @@
<section class="snipts" id="snipts">
{% if not request.user.is_authenticated %}
{% include 'ad-leaderboard-pro.html' %}
{% elif not request.user.profile.teams_beta_seen %}
{% include 'ad-leaderboard-pro.html' %}
{% endif %}
{% with 'true' as detail %}
{% include "snipts/snipt-list.html" %}

View File

@ -18,8 +18,6 @@
{% endif %}>
{% if not request.user.is_authenticated %}
{% include 'ad-leaderboard-pro.html' %}
{% elif not request.user.profile.teams_beta_seen %}
{% include 'ad-leaderboard-pro.html' %}
{% endif %}
{% autopaginate snipts 10 %}
{% for snipt in snipts %}

View File

@ -23,6 +23,9 @@
<div class="group">
<div class="container">
<header>
<div class="alert alert-error alert-not-pro" style="display: none; margin: 10px 10px -10px 10px;">
You'll need to go Pro (<a href="https://snipt.net/pro/">https://snipt.net/pro/</a>) in order to create private snipts.
</div>
<h2>&nbsp;</h2>
<h1>
<input type="text" id="snipt_title" placeholder="Title" value="<% if (snipt.title != 'Untitled') { %><%= snipt.title %><% } %>" />

View File

@ -1,4 +1,4 @@
<a href="/for-teams/" class="snipt-promo">
<button class="btn btn-success btn-large pull-right">More info &raquo;</button>
Announcing Snipt for Teams! <br />Starting at just $49/month.
<a href="/signup" class="snipt-promo">
<button class="btn btn-success btn-large pull-right">Sign up &raquo;</button>
Sign up for Snipt!<br /><span style="font-size: 16px;">Post public snipts for free. Private snipts just $5/mo.</span>
</a>

View File

@ -369,7 +369,6 @@
window.user_ip = '{{ request.META.REMOTE_ADDR }}';
window.user_profile_id = {% firstof request.user.profile.id 'null' %};
window.user_email = '{{ request.user.email }}';
window.user_account_age = {% firstof request.user.profile.get_account_age 'null' %};
{% if public %}
window.pub = {{ public|lower }};

View File

@ -22,11 +22,6 @@
{% endblock %}
{% block content %}
{% if request.GET.expired %}
<div class="alert alert-error" style="margin: 30px; padding-right: 14px;">
<strong>Your trial has expired.</strong> You'll need to go Pro in order to create new snipts.
</div>
{% endif %}
{% if request.GET.declined %}
<div class="alert alert-error" style="margin: 30px;">
<strong>{{ request.GET.declined }}</strong> You have not been charged. Please try again.
@ -37,7 +32,8 @@
<div class="info">
Go <span class="pro">Pro</span> for just <span>$5/month</span>.
<p class="sub">
As a paid Snipt member, you'll have unrestricted access to the app, <a href="/api/">API</a>,
As a paid Snipt member you'll unlock the ability to post private snipts,
have unrestricted access to the app, <a href="/api/">API</a>,
custom-domain <a href="/blogging/">blogging</a>, instant chat support, and more.
</p>
<p class="sub" style="font-size: .6em; margin-top: 15px;">

View File

@ -21,12 +21,8 @@
{% endif %}
{% endif %}
<fieldset>
<div class="info">
Free for 7 days, then just <span>$5/month</span>.
<p class="sub">
Your free trial comes with unrestricted access to the app,<br />
<a href="/api/">API</a>, instant chat support, and more.
</p>
<div class="info" style="line-height: 35px;">
Free to post public snipts,<br />just <span>$5/month</span> for private snipts.
</div>
<div class="control-group {% if form.errors.username %}error{% endif %}">
<label class="control-label" for="id_username">Username</label>