');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('
'+num+'');});},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');}
diff --git a/media/js/src/modules/snipt.js b/media/js/src/modules/snipt.js
index 8293caa..ac50291 100644
--- a/media/js/src/modules/snipt.js
+++ b/media/js/src/modules/snipt.js
@@ -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() {
diff --git a/snipts/api.py b/snipts/api.py
index 5ccf0c4..296de08 100644
--- a/snipts/api.py
+++ b/snipts/api.py
@@ -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')
diff --git a/snipts/models.py b/snipts/models.py
index 10f28ee..22e6b59 100644
--- a/snipts/models.py
+++ b/snipts/models.py
@@ -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)
diff --git a/snipts/templates/snipts/snipt-edit-js-template.html b/snipts/templates/snipts/snipt-edit-js-template.html
index 7c6a1fb..08373d1 100644
--- a/snipts/templates/snipts/snipt-edit-js-template.html
+++ b/snipts/templates/snipts/snipt-edit-js-template.html
@@ -68,37 +68,35 @@
- <% if (window.user_is_pro) { %>
-