diff --git a/media/js/src/modules/snipt.js b/media/js/src/modules/snipt.js index d11194f..45dc54d 100644 --- a/media/js/src/modules/snipt.js +++ b/media/js/src/modules/snipt.js @@ -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: { diff --git a/snipts/api.py b/snipts/api.py index 0144089..e619c65 100644 --- a/snipts/api.py +++ b/snipts/api.py @@ -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 diff --git a/snipts/templates/snipts/detail.html b/snipts/templates/snipts/detail.html index 94feb91..e479f68 100644 --- a/snipts/templates/snipts/detail.html +++ b/snipts/templates/snipts/detail.html @@ -50,8 +50,6 @@
{% 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" %} diff --git a/snipts/templates/snipts/list.html b/snipts/templates/snipts/list.html index 20d6bea..e67ef46 100644 --- a/snipts/templates/snipts/list.html +++ b/snipts/templates/snipts/list.html @@ -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 %} diff --git a/snipts/templates/snipts/snipt-edit-js-template.html b/snipts/templates/snipts/snipt-edit-js-template.html index b50194f..e0e43ed 100644 --- a/snipts/templates/snipts/snipt-edit-js-template.html +++ b/snipts/templates/snipts/snipt-edit-js-template.html @@ -23,6 +23,9 @@
+

 

diff --git a/templates/ad-leaderboard-pro.html b/templates/ad-leaderboard-pro.html index 6ac3f8d..abf2936 100644 --- a/templates/ad-leaderboard-pro.html +++ b/templates/ad-leaderboard-pro.html @@ -1,4 +1,4 @@ - - - Announcing Snipt for Teams!
Starting at just $49/month. +
+ + Sign up for Snipt!
Post public snipts for free. Private snipts just $5/mo.
diff --git a/templates/base.html b/templates/base.html index b811a7e..a42ba2d 100644 --- a/templates/base.html +++ b/templates/base.html @@ -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 }}; diff --git a/templates/pro.html b/templates/pro.html index 745b766..79e2a04 100644 --- a/templates/pro.html +++ b/templates/pro.html @@ -22,11 +22,6 @@ {% endblock %} {% block content %} - {% if request.GET.expired %} -
- Your trial has expired. You'll need to go Pro in order to create new snipts. -
- {% endif %} {% if request.GET.declined %}
{{ request.GET.declined }} You have not been charged. Please try again. @@ -37,7 +32,8 @@
Go Pro for just $5/month.

- As a paid Snipt member, you'll have unrestricted access to the app, API, + As a paid Snipt member you'll unlock the ability to post private snipts, + have unrestricted access to the app, API, custom-domain blogging, instant chat support, and more.

diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html index f923ef6..3574f46 100644 --- a/templates/registration/registration_form.html +++ b/templates/registration/registration_form.html @@ -21,12 +21,8 @@ {% endif %} {% endif %}

-
- Free for 7 days, then just $5/month. -

- Your free trial comes with unrestricted access to the app,
- API, instant chat support, and more. -

+
+ Free to post public snipts,
just $5/month for private snipts.