Un-pro-ing things.

master
Nick Sergeant 2013-08-13 14:20:46 -04:00
parent e978960e89
commit 6d79fe2df8
17 changed files with 112 additions and 170 deletions

View File

@ -20,11 +20,10 @@
<li>
<a href="/password/change/">Change password</a>
</li>
<li ng-show="user.is_pro" class="nav-header">Pro</li>
<li ng-show="user.is_pro" ng-class="{active: route.current.scope.section == 'Blogging'}">
<li ng-class="{active: route.current.scope.section == 'Blogging'}">
<a href="/account/blogging/">Blogging</a>
</li>
<li ng-show="user.is_pro" ng-class="{active: route.current.scope.section == 'Editor'}">
<li ng-class="{active: route.current.scope.section == 'Editor'}">
<a href="/account/editor/">Editor</a>
</li>
<li ng-show="user.is_pro" ng-class="{active: route.current.scope.section == 'Billing'}">

View File

@ -12,9 +12,6 @@ def account(request):
@render_to('stats.html')
def stats(request):
if not request.user.profile.is_pro:
return HttpResponseRedirect('/pro/')
snipts = Snipt.objects.filter(user=request.user).order_by('-views')
return {

View File

@ -19,13 +19,13 @@
{% block js %}
{{ block.super }}
window.blog_post = true;
{% if blog_user.profile.is_pro and blog_user.profile.gittip_username %}
{% if blog_user.profile.gittip_username %}
window.gittip_username = '{{ blog_user.profile.gittip_username }}';
{% endif %}
{% endblock %}
{% block css %}
{% if blog_user.profile.is_pro and custom_css %}
{% if custom_css %}
<style type="text/css">
{{ custom_css.code }}
</style>
@ -68,7 +68,7 @@
{{ sidebar.stylized|safe }}
</section>
{% endif %}
{% if blog_user.profile.is_pro and blog_user.profile.google_ad_client %}
{% if blog_user.profile.google_ad_client %}
<div class="google-ads">
<script type="text/javascript">
google_ad_client = '{{ blog_user.profile.google_ad_client }}';

View File

@ -1,16 +1,9 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
{% if request.blog_user.profile.is_pro %}
<atom:link href="{% if request.blog_user.profile.get_primary_blog_domain and request.blog_user.profile.blog_domain != '' %}http://{{ request.blog_user.profile.blog_domain }}/?rss{% else %}https://{{ request.blog_user.username }}.snipt.net/?rss{% endif %}" rel="self" type="application/rss+xml" />
<description>{% firstof request.blog_user.profile.blog_title request.blog_user.username %}</description>
<title>{% firstof request.blog_user.profile.blog_title request.blog_user.username %}</title>
<link>{% if request.blog_user.profile.get_primary_blog_domain %}http://{{ request.blog_user.profile.blog_domain }}/?rss{% else %}https://{{ request.blog_user.username }}.snipt.net/?rss{% endif %}</link>
{% else %}
<atom:link href="https://{{ request.blog_user.username }}.snipt.net/?rss" rel="self" type="application/rss+xml" />
<description>{{ request.blog_user.username }}</description>
<title>{{ request.blog_user.username }}</title>
<link>https://{{ request.blog_user.username }}.snipt.net/?rss</link>
{% endif %}
<atom:link href="{% if request.blog_user.profile.get_primary_blog_domain and request.blog_user.profile.blog_domain != '' %}http://{{ request.blog_user.profile.blog_domain }}/?rss{% else %}https://{{ request.blog_user.username }}.snipt.net/?rss{% endif %}" rel="self" type="application/rss+xml" />
<description>{% firstof request.blog_user.profile.blog_title request.blog_user.username %}</description>
<title>{% firstof request.blog_user.profile.blog_title request.blog_user.username %}</title>
<link>{% if request.blog_user.profile.get_primary_blog_domain %}http://{{ request.blog_user.profile.blog_domain }}/?rss{% else %}https://{{ request.blog_user.username }}.snipt.net/?rss{% endif %}</link>
{% for snipt in snipts %}
<item>
<title>{{ snipt.title }}</title>

View File

@ -46,18 +46,14 @@ def blog_list(request, username_or_custom_slug=None):
context['snipts'] = context['snipts'][:20]
return rss(request, context)
if request.blog_user.profile.is_pro:
template = THEME_CHOICES[request.blog_user.profile.blog_theme]
else:
template = THEME_CHOICES['D']
template = THEME_CHOICES[request.blog_user.profile.blog_theme]
template = '{}/list.html'.format(template)
return render_to_response(
template,
context,
context_instance=RequestContext(request)
)
template,
context,
context_instance=RequestContext(request))
def blog_post(request, username_or_custom_slug):
@ -100,10 +96,7 @@ def blog_post(request, username_or_custom_slug):
'snipts': snipts,
}
if request.blog_user.profile.is_pro:
template = THEME_CHOICES[request.blog_user.profile.blog_theme]
else:
template = THEME_CHOICES['D']
template = THEME_CHOICES[request.blog_user.profile.blog_theme]
template = '{}/post.html'.format(template)

View File

@ -145,11 +145,10 @@ window.ui_halted=false;},events:{'showKeyboardShortcuts':'showKeyboardShortcuts'
(function(Snipt){Snipt.SniptModel=Backbone.Model.extend({toSafe:function(){var snipt=this.toJSON();snipt.code=this.escape('code');snipt.title=this.escape('title');snipt.tags_list=this.escape('tags_list');if(typeof snipt.tags==='object'){for(var i;i<snipt.tags.length;i++){snipt.tags[i].name=_.escape(snipt.tags[i].name);}}
return snipt;}});Snipt.SniptView=Backbone.View.extend({tagName:'article',initialize:function(){this.model.view=this;this.model.bind('change',this.render,this);this.template=_.template($('#snipt').html());this.editTemplate=_.template($('#edit').html());this.initLocalVars();this.initLineNumbers();},events:{'click a.copy':'copyFromClick','click a.edit':'edit','click a.favorite':'favoriteToggle','click a.embed':'embedFromClick','click a.expand':'expand','click .container':'selectFromClick','copyClose':'copyClose','copyRaw':'copy','detail':'detail','deselect':'deselect','destroy':'destroy','edit':'edit','embed':'embed','embedClose':'embedClose','expand':'expand','fadeAndRemove':'fadeAndRemove','goToAuthor':'goToAuthor','next':'next','prev':'prev','selectSnipt':'select'},copy:function(){$('textarea',this.$copyModal).remove();window.ui_halted=true;this.$copyModalBody.append('<textarea class="raw"></textarea>');$textarea=$('textarea.raw',this.$copyModalBody).val(this.model.get('code'));this.$copyModal.modal('show');$textarea.select();},copyClose:function(){$('textarea',this.$copyModal).remove();},copyFromClick:function(){this.copy();return false;},deselect:function(){this.$el.removeClass('selected');window.$selected=false;},detail:function(){window.location=this.model.get('absolute_url');},destroy:function(){this.model.destroy();},edit:function(){window.editing=true;window.ui_halted=true;this.select();that=this;var editPane=this.editTemplate({snipt:this.model.toSafe()});window.site.$main.hide();window.site.$body.addClass('detail editing');window.site.$main_edit.html(editPane);$('option[value="'+this.model.get('lexer')+'"]',window.site.$main_edit).attr('selected','selected');var $selectLexer=$('select#id_lexer',window.site.$main_edit);$selectLexer.chosen();$('label.blog-post input',window.site.$main_edit).on('change',function(){var $checkbox=$(this);var $label=$checkbox.parent();var $publish_date=$label.siblings('label.publish-date');if($checkbox.attr('checked')){$label.removeClass('is-not-blog-post').addClass('is-blog-post');$publish_date.show();}else{$label.addClass('is-not-blog-post').removeClass('is-blog-post');$publish_date.hide();}
return false;}).trigger('change');$('label.public input',window.site.$main_edit).on('change',function(){var $checkbox=$(this);var $label=$checkbox.parent();if($checkbox.attr('checked')){$label.removeClass('is-private').addClass('is-public');}else{$label.addClass('is-private').removeClass('is-public');}
return false;}).trigger('change');window.site.$main_edit.show();this.$editorCodeMirror=$('div.editor',window.site.$main_edit);this.$editorTextarea=$('textarea.editor',window.site.$main_edit);window.editor=CodeMirror(this.$editorCodeMirror.get(0),{autofocus:true,fixedGutter:true,gutter:true,indentUnit:4,lineNumbers:true,javascriptHint:true,matchBrackets:true,mode:that.guessCodeMirrorLexer($selectLexer.val()),value:that.model.get('code')});$selectLexer.change(function(){var $selectedLexer=$('option:selected',$selectLexer);var lexer=$selectLexer.val();window.editor.setOption('mode',that.guessCodeMirrorLexer($selectedLexer.val()));if(lexer==='markdown'||lexer==='text'){window.editor.setOption('lineWrapping',true);}else{window.editor.setOption('lineWrapping',false);}});$selectLexer.trigger('change');window.editorHeight=$(window).height()-147;window.editor.setSize('100%',window.editorHeight);this.$editorTextarea.height(window.editorHeight-8);$('textarea, input',window.site.$main_edit).bind('keydown','esc',function(e){$(this).blur();return false;});if(window.user_is_pro){var $selectEditor=$('select#id_editor',window.site.$main_edit);var $selectTheme=$('select#id_theme',window.site.$main_edit);$selectEditor.chosen();$selectEditor.change(function(){var newEditor=$selectEditor.val();if(newEditor==='textarea'){that.$editorCodeMirror.hide();that.$editorTextarea.show();that.$editorTextarea.val(window.editor.getValue());}
return false;}).trigger('change');window.site.$main_edit.show();this.$editorCodeMirror=$('div.editor',window.site.$main_edit);this.$editorTextarea=$('textarea.editor',window.site.$main_edit);window.editor=CodeMirror(this.$editorCodeMirror.get(0),{autofocus:true,fixedGutter:true,gutter:true,indentUnit:4,lineNumbers:true,javascriptHint:true,matchBrackets:true,mode:that.guessCodeMirrorLexer($selectLexer.val()),value:that.model.get('code')});$selectLexer.change(function(){var $selectedLexer=$('option:selected',$selectLexer);var lexer=$selectLexer.val();window.editor.setOption('mode',that.guessCodeMirrorLexer($selectedLexer.val()));if(lexer==='markdown'||lexer==='text'){window.editor.setOption('lineWrapping',true);}else{window.editor.setOption('lineWrapping',false);}});$selectLexer.trigger('change');window.editorHeight=$(window).height()-147;window.editor.setSize('100%',window.editorHeight);this.$editorTextarea.height(window.editorHeight-8);$('textarea, input',window.site.$main_edit).bind('keydown','esc',function(e){$(this).blur();return false;});var $selectEditor=$('select#id_editor',window.site.$main_edit);var $selectTheme=$('select#id_theme',window.site.$main_edit);$selectEditor.chosen();$selectEditor.change(function(){var newEditor=$selectEditor.val();if(newEditor==='textarea'){that.$editorCodeMirror.hide();that.$editorTextarea.show();that.$editorTextarea.val(window.editor.getValue());}
if(newEditor==='codemirror'){that.$editorTextarea.hide();that.$editorCodeMirror.show();window.editor.setValue(that.$editorTextarea.val());}});$selectTheme.chosen();$selectTheme.change(function(){window.editor.setOption('theme',$selectTheme.val());});if(window.editor_theme!='default'){$selectTheme.val(window.editor_theme);$selectTheme.trigger('liszt:updated');$selectTheme.trigger('change');}
if(window.default_editor!='codemirror'){$selectEditor.val(window.default_editor);$selectEditor.trigger('liszt:updated');$selectEditor.trigger('change');}
this.setupCodeMirrorFullScreen();}
$('button.delete',window.site.$main_edit).on('click',function(){if(confirm('Are you sure you want to delete this snipt?')){that.model.destroy();window.site.snipt_list.escapeUI(true);}
this.setupCodeMirrorFullScreen();$('button.delete',window.site.$main_edit).on('click',function(){if(confirm('Are you sure you want to delete this snipt?')){that.model.destroy();window.site.snipt_list.escapeUI(true);}
return false;});$('button.cancel',window.site.$main_edit).on('click',function(){window.site.snipt_list.escapeUI();return false;});$('button.save',window.site.$main_edit).on('click',function(){$('button.cancel').text('Close');that.save();return false;});$('button.save-and-close',window.site.$main_edit).on('click',function(){that.save();window.site.snipt_list.escapeUI();return false;});window.scrollTo(0,0);return false;},embed:function(){$('textarea',this.$embedModal).remove();window.ui_halted=true;this.$embedModalBody.append('<textarea class="raw"></textarea>');$textarea=$('textarea.raw',this.$embedModalBody).val('<script type="text/javascript" src="'+this.model.get('embed_url')+'"></script>');this.$embedModal.modal('show');$textarea.select();},embedFromClick:function(){this.embed();return false;},embedClose:function(){$('textarea',this.$embedModal).remove();},expand:function(){this.$container.toggleClass('expanded',100);this.$tags.toggleClass('expanded');this.select(true);return false;},fadeAndRemove:function(){var $toRemove=$(this.el);var $nextSnipt=$toRemove.next('article.snipt');window.$selected=false;$toRemove.fadeOut('fast',function(){$(this).remove();$nextSnipt.trigger('selectSnipt');});return false;},goToAuthor:function(){window.location=this.model.get('user').absolute_url;},guessCodeMirrorLexer:function(val){if(val==='html'){return'htmlmixed';}
if(val==='js')return'javascript';if(val==='rb')return'ruby';return val;},favoriteToggle:function(){var that=this;if(this.$el.hasClass('favorited')){$.ajax('/api/private/favorite/'+this.model.get('favorite_id')+'/',{type:'delete',success:function(){that.$el.removeClass('favorited');that.$favorite.text('Favorite');},headers:{'Authorization':'ApiKey '+window.user+':'+window.api_key}});}else{$.ajax('/api/private/favorite/',{data:'{"snipt": '+this.model.get('id')+'}',contentType:'application/json',type:'post',success:function(resp){that.$el.addClass('favorited');that.model.set({'favorite_id':resp.id},{'silent':true});that.$favorite.text('Favorited');},headers:{'Authorization':'ApiKey '+window.user+':'+window.api_key}});}
return false;},initEmbeddedTweets:function(){var $embeddedTweets=$('div.embedded-tweet');if($embeddedTweets.length){$.each($embeddedTweets,function(){var $tweetPlaceholder=$(this);var tweetID=$tweetPlaceholder.attr('data-tweet-id');$.ajax({url:'https://api.twitter.com/1/statuses/oembed.json?id='+tweetID+'&align=center',dataType:'jsonp',type:'get',success:function(resp){$tweetPlaceholder.replaceWith($(resp.html));}});});}},initLineNumbers:function(){var lines=$('span.special',this.$el);var that=this;$.each(lines,function(){var l=$(this);var num=l.text().trim();var url=that.model.get('absolute_url');l.replaceWith('<a href="'+url+'#line-'+num+'">'+num+'</a>');});},initLocalVars:function(){this.$aside=$('aside',this.$el);this.$container=$('div.container',this.$el);this.$copyModal=$('div.copy-modal',this.$el);this.$copyModalBody=$('div.modal-body',this.$copyModal);this.$embedModal=$('div.embed-modal',this.$el);this.$embedModalBody=$('div.modal-body',this.$embedModal);this.$favorite=$('a.favorite',this.$el);this.$h1=$('header h1 a',this.$el);this.$tags=$('section.tags ul',this.$aside);this.$copyModal.on('hidden',function(e){$(this).parent().trigger('copyClose');window.ui_halted=false;window.from_modal=true;});this.$embedModal.on('hidden',function(e){$(this).parent().trigger('embedClose');window.ui_halted=false;window.from_modal=true;});},next:function(){if(!window.ui_halted){nextSnipt=this.$el.next('article.snipt');if(nextSnipt.length){return nextSnipt.trigger('selectSnipt');}}},prev:function(){if(!window.ui_halted){prevSnipt=this.$el.prev('article.snipt');if(prevSnipt.length){return prevSnipt.trigger('selectSnipt');}}},remove:function(){return false;},render:function(){this.$el.html(this.template({snipt:this.model.toSafe()}));this.initLocalVars();this.initLineNumbers();this.initEmbeddedTweets();if(this.model.get('blog_post')===true){this.$el.addClass('blog-post');}else{this.$el.removeClass('blog-post');}

View File

@ -183,50 +183,47 @@
});
// Editor settings
if (window.user_is_pro) {
var $selectEditor = $('select#id_editor', window.site.$main_edit);
var $selectTheme = $('select#id_theme', window.site.$main_edit);
var $selectEditor = $('select#id_editor', window.site.$main_edit);
var $selectTheme = $('select#id_theme', window.site.$main_edit);
$selectEditor.chosen();
$selectEditor.change(function() {
var newEditor = $selectEditor.val();
$selectEditor.chosen();
$selectEditor.change(function() {
var newEditor = $selectEditor.val();
if (newEditor === 'textarea') {
that.$editorCodeMirror.hide();
that.$editorTextarea.show();
if (newEditor === 'textarea') {
that.$editorCodeMirror.hide();
that.$editorTextarea.show();
// TODO: if we introduce other editors, we'll want to make this smarter, obviously.
that.$editorTextarea.val(window.editor.getValue());
}
if (newEditor === 'codemirror') {
that.$editorTextarea.hide();
that.$editorCodeMirror.show();
// TODO: Ditto above.
window.editor.setValue(that.$editorTextarea.val());
}
});
$selectTheme.chosen();
$selectTheme.change(function() {
window.editor.setOption('theme', $selectTheme.val());
});
if (window.editor_theme != 'default') {
$selectTheme.val(window.editor_theme);
$selectTheme.trigger('liszt:updated');
$selectTheme.trigger('change');
// TODO: if we introduce other editors, we'll want to make this smarter, obviously.
that.$editorTextarea.val(window.editor.getValue());
}
if (window.default_editor != 'codemirror') {
$selectEditor.val(window.default_editor);
$selectEditor.trigger('liszt:updated');
$selectEditor.trigger('change');
if (newEditor === 'codemirror') {
that.$editorTextarea.hide();
that.$editorCodeMirror.show();
// TODO: Ditto above.
window.editor.setValue(that.$editorTextarea.val());
}
});
// Full-screen mode.
this.setupCodeMirrorFullScreen();
$selectTheme.chosen();
$selectTheme.change(function() {
window.editor.setOption('theme', $selectTheme.val());
});
if (window.editor_theme != 'default') {
$selectTheme.val(window.editor_theme);
$selectTheme.trigger('liszt:updated');
$selectTheme.trigger('change');
}
if (window.default_editor != 'codemirror') {
$selectEditor.val(window.default_editor);
$selectEditor.trigger('liszt:updated');
$selectEditor.trigger('change');
}
// Full-screen mode.
this.setupCodeMirrorFullScreen();
// Edit buttons
$('button.delete', window.site.$main_edit).on('click', function() {

View File

@ -166,9 +166,6 @@ class UserProfileValidation(Validation):
def is_valid(self, bundle, request=None):
errors = {}
if not bundle.request.user.profile.is_pro:
return 'You must be a Pro to change these settings.'
for field in bundle.data:
if bundle.data[field]:
if not re.match('^[ A-Za-z0-9\/\@\._-]*$', bundle.data[field]):
@ -368,10 +365,8 @@ class PrivateSniptResource(ModelResource):
bundle.data['tags_list'] = edit_string_for_tags(bundle.obj.tags.all())
bundle.data['full_absolute_url'] = bundle.obj.get_full_absolute_url()
bundle.data['description_rendered'] = linebreaksbr(urlize(bundle.obj.description))
if bundle.data['user'].data['is_pro']:
bundle.data['views'] = bundle.obj.views
bundle.data['favs'] = bundle.obj.favs()
bundle.data['views'] = bundle.obj.views
bundle.data['favs'] = bundle.obj.favs()
if bundle.data['publish_date']:
bundle.data['publish_date'] = date(bundle.data['publish_date'], 'M d, Y \\a\\t h:i A')

View File

@ -146,7 +146,7 @@ class Snipt(models.Model):
def get_absolute_url(self):
if self.blog_post:
if self.user.profile.is_pro and self.user.profile.blog_domain:
if self.user.profile.blog_domain:
return u'http://{}/{}/'.format(self.user.profile.blog_domain.split(' ')[0], self.slug)
else:
return u'https://{}.snipt.net/{}/'.format(self.user.username.replace('_', '-'), self.slug)
@ -162,7 +162,7 @@ class Snipt(models.Model):
def get_full_absolute_url(self):
if self.blog_post:
if self.user.profile.is_pro and self.user.profile.blog_domain:
if self.user.profile.blog_domain:
return u'http://{}/{}/'.format(self.user.profile.blog_domain.split(' ')[0], self.slug)
else:
return u'https://{}.snipt.net/{}/'.format(self.user.username, self.slug)

View File

@ -68,37 +68,35 @@
<textarea name="description" placeholder='optional'><% if (snipt.description && snipt.description !== 'None') { %><%= snipt.description %><% } %></textarea>
</label>
</div>
<% if (window.user_is_pro) { %>
<div class="editor-settings">
<h2>Pro settings <a href="/account/" target="blank">change defaults</a></h2>
<h4>F11 or Cmd+Enter toggles fullscreen mode</h4>
<label class="lexer"><span>Editor<span></label>
<select name="editor" id="id_editor">
<option value="codemirror" selected="selected">CodeMirror</option>
<option value="textarea">Textarea</option>
</select>
<label class="lexer"><span>Theme<span></label>
<select name="theme" id="id_theme">
<option value="default">Default</option>
<option value="ambiance">Ambiance</option>
<option value="blackboard">Blackboard</option>
<option value="cobalt">Cobalt</option>
<option value="eclipse">Eclipse</option>
<option value="elegant">Elegant</option>
<option value="erlang-dark">Erlang Dark</option>
<option value="lesser-dark">Lesser Dark</option>
<option value="monokai">Monokai</option>
<option value="neat">Neat</option>
<option value="night">Night</option>
<option value="rubyblue">Ruby Blue</option>
<option value="solarized dark">Solarized Dark</option>
<option value="solarized light">Solarized Light</option>
<option value="twilight">Twilight</option>
<option value="vibrant-ink">Vibrant Ink</option>
<option value="xq-dark">XQ Dark</option>
</select>
</div>
<% } %>
<div class="editor-settings">
<h2>Editor settings <a href="/account/" target="blank">change defaults</a></h2>
<h4>F11 or Cmd+Enter toggles fullscreen mode</h4>
<label class="lexer"><span>Editor<span></label>
<select name="editor" id="id_editor">
<option value="codemirror" selected="selected">CodeMirror</option>
<option value="textarea">Textarea</option>
</select>
<label class="lexer"><span>Theme<span></label>
<select name="theme" id="id_theme">
<option value="default">Default</option>
<option value="ambiance">Ambiance</option>
<option value="blackboard">Blackboard</option>
<option value="cobalt">Cobalt</option>
<option value="eclipse">Eclipse</option>
<option value="elegant">Elegant</option>
<option value="erlang-dark">Erlang Dark</option>
<option value="lesser-dark">Lesser Dark</option>
<option value="monokai">Monokai</option>
<option value="neat">Neat</option>
<option value="night">Night</option>
<option value="rubyblue">Ruby Blue</option>
<option value="solarized dark">Solarized Dark</option>
<option value="solarized light">Solarized Light</option>
<option value="twilight">Twilight</option>
<option value="vibrant-ink">Vibrant Ink</option>
<option value="xq-dark">XQ Dark</option>
</select>
</div>
</aside>
</div>
</article>

View File

@ -60,14 +60,12 @@
<% } %>
</ul>
</section>
<% if (snipt.user.profile.is_pro) { %>
<section class="meta stats">
<ul>
<li><%= snipt.views %> views</li>
<li><%= snipt.favs %> favs</li>
</ul>
</section>
<% } %>
<section class="meta stats">
<ul>
<li><%= snipt.views %> views</li>
<li><%= snipt.favs %> favs</li>
</ul>
</section>
</aside>
</div>
<footer>

View File

@ -143,7 +143,7 @@
</ul>
</section>
{% endif %}
{% if request.user.profile.is_pro and snipt.user == request.user %}
{% if snipt.user == request.user %}
<section class="meta stats">
<ul>
<li>{{ snipt.views|intcomma }} view{{ snipt.views|pluralize }}
@ -164,9 +164,9 @@
<a href="{{ snipt.user.get_absolute_url }}">{{ snipt.user.username }}</a>
{% if snipt.user.profile.is_pro %}
<span class="pro"><a href="/pro/">Pro</a></span>
{% if snipt.user.profile.gittip_username %}
<span class="gittip"><a href="https://www.gittip.com/{{ snipt.user.profile.gittip_username }}/">Tip</a></span>
{% endif %}
{% endif %}
{% if snipt.user.profile.gittip_username %}
<span class="gittip"><a href="https://www.gittip.com/{{ snipt.user.profile.gittip_username }}/">Tip</a></span>
{% endif %}
</li>
{% endblock %}

View File

@ -278,7 +278,7 @@ def search(request, template='search/search.html', load_all=True,
# We have a query.
if request.GET.get('q'):
if request.user.is_authenticated() and request.user.profile.is_pro and '--mine' in request.GET.get('q'):
if request.user.is_authenticated() and '--mine' in request.GET.get('q'):
searchqueryset = SearchQuerySet().filter(author=request.user).order_by('-pub_date')
else:
searchqueryset = SearchQuerySet().filter(Q(public=True) | Q(author=request.user)).order_by('-pub_date')

View File

@ -137,14 +137,12 @@
Profile
</a>
</li>
{% if request.user.profile.is_pro %}
<li>
<a href="/account/stats/">
<i class="icon-star icon-white"></i>
Stats
</a>
</li>
{% endif %}
<li>
<a href="/account/stats/">
<i class="icon-star icon-white"></i>
Stats
</a>
</li>
<li>
<a href="/account/">
<i class="icon-cog icon-white"></i>
@ -408,16 +406,12 @@
{% endblock %}
{% if request.user.profile.is_pro %}
window.user_is_pro = true;
window.default_editor = '{{ request.user.profile.get_default_editor_display|lower }}';
window.editor_theme = '{{ request.user.profile.editor_theme }}';
{% else %}
window.user_is_pro = false;
{% endif %}
window.default_editor = '{{ request.user.profile.get_default_editor_display|lower }}';
window.editor_theme = '{{ request.user.profile.editor_theme }}';
</script>
{% endblock %}
{% if has_snipts and detail %}

View File

@ -13,33 +13,14 @@
snip<span>t</span> <span class="pro">Pro</span>
</div>
<div class="static-box">
<p>
Go Pro to get a more streamlined Snipt interface, as well as unlock powerful blogging features.<br />
We're always adding new features for Pro users, so check this list often or follow us on <a href="https://twitter.com/snipt/">Twitter</a>.
</p>
<h6>Interface features:</h6>
<ul>
<li>No ads.</li>
<li><span class="pro">Pro</span> badge throughout the site.</li>
<li>Ability to search through "only my snipts".</li>
<li>Statistics for "views" and "favorites" of your snipts.</li>
<li>Multiple editors: CodeMirror (rich-code editing) or a plain-old textarea.</li>
<li>17 CodeMirror editor themes to choose from.</li>
<li>Full-screen editor mode.</li>
</ul>
<h6>Blogging features:</h6>
<h6>Going Pro gets you:</h6>
<ul>
<li>Custom domain for your <a href="/blogging/">Snipt blog</a>.</li>
<li>Customize CSS in your blog theme.</li>
<li>Exclusive Pro-only theme for your blog. <a href="http://nicksergeant.com/">Here's a preview</a> of the first available theme (working on more).</li>
<li><a href="https://www.gittip.com/">GitTip</a> integration ("tip" link on every snipt next to your username, and on your profile). <a href="https://snipt.net/nick/">Sample</a>.</li>
<li>Use your own <a href="http://disqus.com">Disqus</a> account for comments on your Snipt blog.</li>
<li>Use your own <a href="http://analytics.google.com">Google Analytics</a> account for tracking visits to your Snipt blog.</li>
<li>Use your own <a href="http://get.gaug.es/">Gauges</a> account for tracking visits to your Snipt blog.</li>
<li>Display your own <a href="https://www.google.com/adsense/">Google Ads</a> in the sidebar of your Snipt blog.</li>
<li><span class="pro">Pro</span> badge throughout the site.</li>
<li>No ads.</li>
</ul>
{% if request.user.profile.is_pro %}
<h3>You're already a Pro. You know that ;)</h3>
<h3>You're already a Pro.</h3>
{% else %}
<h3><span><span class="pro">Pro</span> is only</span> $3/month.</h3>
<h4><a href="/pro/signup/" class="btn btn-large btn-success">Buy Now</a></h4>

View File

@ -15,7 +15,7 @@
{% else %}
<div class="member-since">Member since {{ user.date_joined|date:"Y" }}</div>
{% endif %}
{% if user.profile.is_pro and user.profile.get_blog_posts %}
{% if user.profile.get_blog_posts %}
<div class="urls">
Snipt Blog:
<a href="{{ user.profile.get_user_profile_url }}">
@ -26,8 +26,8 @@
</div>
{% if user.profile.is_pro %}
<a class="pro" href="/pro/">Pro</a>
{% if user.profile.gittip_username %}
<a class="gittip" href="https://www.gittip.com/{{ user.profile.gittip_username }}/">Tip</a>
{% endif %}
{% endif %}
{% if user.profile.gittip_username %}
<a class="gittip" href="https://www.gittip.com/{{ user.profile.gittip_username }}/">Tip</a>
{% endif %}
</div>

View File

@ -27,11 +27,9 @@
ng-init="search.query='{{ query|escapejs }}'"
placeholder="Search snipts" id="id_q"
value="{{ query }}" />
{% if request.user.profile.is_pro %}
<label class="checkbox inline mine-only" ng-click="toggleMineOnly()">
<input {% if '--mine' in query %}checked="checked"{% endif %} ng-model="search.mineOnly" type="checkbox" id="inlineCheckbox1" value="option1"> Mine only
</label>
{% endif %}
<label class="checkbox inline mine-only" ng-click="toggleMineOnly()">
<input {% if '--mine' in query %}checked="checked"{% endif %} ng-model="search.mineOnly" type="checkbox" id="inlineCheckbox1" value="option1"> Mine only
</label>
<button type="submit" class="btn">Search</button>
</form>
</div>