Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4 from richardbarran/share-button-deprecated

Share button deprecated
  • Loading branch information...
commit e4e589222ce1b813bad498d517d3dac05b7c584b 2 parents b1353d8 + da6e80e
@chrisglass authored
View
2  cms_facebook/templatetags/cms_facebook_tags.py
@@ -23,4 +23,4 @@ def cms_facebook_likebutton(likebutton_name):
except LookupError:
return "LikeButton Settings not found"
instance = LikeButton(**likebutton)
- return render_to_string("cms_facebook/likebutton.html", {"instance" : instance})
+ return render_to_string("cms_facebook/likebutton.html", {"instance" : instance})
View
10 cmsplugin_facebook/cms_plugins.py
@@ -4,7 +4,7 @@
class BasePlugin(CMSPluginBase):
name = None
-
+
def render(self, context, instance, placeholder):
context.update({'instance': instance, 'name': self.name})
return context
@@ -13,17 +13,11 @@ class FacebookLikeBoxPlugin(BasePlugin):
model = models.FacebookLikeBox
name = 'Facebook Like Box Plugin'
render_template = 'cmsplugin_facebook/likebox.html'
-
-class FacebookShareButtonPlugin(BasePlugin):
- model = models.FacebookShareButton
- name = 'Facebook "Share" button plugin'
- render_template = "cmsplugin_facebook/sharebutton.html"
class FacebookLikeButtonPlugin(BasePlugin):
model = models.FacebookLikeButton
name = 'Facebook Like Button Plugin'
render_template = 'cmsplugin_facebook/likebutton.html'
-
+
plugin_pool.register_plugin(FacebookLikeBoxPlugin)
plugin_pool.register_plugin(FacebookLikeButtonPlugin)
-plugin_pool.register_plugin(FacebookShareButtonPlugin)
View
77 cmsplugin_facebook/migrations/0005_auto__del_facebooksharebutton.py
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Deleting model 'FacebookShareButton'
+ db.delete_table('cmsplugin_facebooksharebutton')
+
+ if not db.dry_run:
+ plugins_to_delete = orm['cms.CMSPlugin'].objects.filter(plugin_type='FacebookShareButtonPlugin')
+ if plugins_to_delete:
+ print 'Deleting {0} "Share" button plugins - these will need replacing with "Like" buttons.'.format(len(plugins_to_delete))
+ plugins_to_delete.delete()
+
+ def backwards(self, orm):
+ # Adding model 'FacebookShareButton'
+ db.create_table('cmsplugin_facebooksharebutton', (
+ ('style', self.gf('django.db.models.fields.CharField')(max_length=12)),
+ ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
+ ('button_text', self.gf('django.db.models.fields.CharField')(default=u'Share', max_length=255)),
+ ('share_url', self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True)),
+ ))
+ db.send_create_signal('cmsplugin_facebook', ['FacebookShareButton'])
+
+
+ models = {
+ 'cms.cmsplugin': {
+ 'Meta': {'object_name': 'CMSPlugin'},
+ 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
+ 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}),
+ 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}),
+ 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
+ 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
+ },
+ 'cms.placeholder': {
+ 'Meta': {'object_name': 'Placeholder'},
+ 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'})
+ },
+ 'cmsplugin_facebook.facebooklikebox': {
+ 'Meta': {'object_name': 'FacebookLikeBox', 'db_table': "'cmsplugin_facebooklikebox'", '_ormbases': ['cms.CMSPlugin']},
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
+ 'connections': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '10'}),
+ 'header': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'height': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '587'}),
+ 'pageurl': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+ 'stream': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'transparent': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'})
+ },
+ 'cmsplugin_facebook.facebooklikebutton': {
+ 'Meta': {'object_name': 'FacebookLikeButton', 'db_table': "'cmsplugin_facebooklikebutton'", '_ormbases': ['cms.CMSPlugin']},
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
+ 'color_scheme': ('django.db.models.fields.CharField', [], {'default': "'light'", 'max_length': '50'}),
+ 'font': ('django.db.models.fields.CharField', [], {'default': "'verdana'", 'max_length': '50'}),
+ 'height': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '80'}),
+ 'layout': ('django.db.models.fields.CharField', [], {'default': "'standard'", 'max_length': '50'}),
+ 'pageurl': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+ 'show_faces': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'verb': ('django.db.models.fields.CharField', [], {'default': "'like'", 'max_length': '50'}),
+ 'width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'})
+ }
+ }
+
+ complete_apps = ['cmsplugin_facebook']
View
35 cmsplugin_facebook/models.py
@@ -27,19 +27,6 @@
('dark', _('dark')),
]
-SHARE_BUTTON_STYLES = (
- ('button', 'Simple "share" button'),
- ('button_count', 'Share button with count'),
- ('box_count', 'Share button with count displayed above'),
-)
-
-
-class FacebookShareButton(CMSPlugin):
- style = models.CharField(max_length=12,choices=SHARE_BUTTON_STYLES)
- share_url = models.URLField(_("URL to share"), help_text=_("If blank, the page where it's displayed will be used"),
- null=True, blank=True)
- button_text = models.CharField(_("Button text"),help_text=_("This text will be displayed in the \"Share\" button"),
- max_length=255,default=_("Share"))
class FacebookLikeBox(CMSPlugin):
pageurl = models.URLField(_("URL to like"))
@@ -50,24 +37,24 @@ class FacebookLikeBox(CMSPlugin):
transparent = models.BooleanField(_("Transparent"), default=True)
stream = models.BooleanField(_("Show stream"), default=True)
header = models.BooleanField(_("Show header"), default=True)
-
+
fb_bits = [
'id',
'connections',
'stream',
'header',
]
-
+
fb_aliases = {
- 'id': lambda r,c,i: i.fbpage.pageid,
+ 'id': lambda r, c, i: i.fbpage.pageid,
}
-
+
fb_default_width = 295
def __unicode__(self):
return "LikeBox (%s)" % (self.pageurl)
-
-
+
+
class FacebookLikeButton(CMSPlugin):
pageurl = models.URLField(_("URL to like"))
layout = models.CharField(_("Layout Style"), choices=LAYOUT_CHOICES, default="standard", max_length=50)
@@ -79,7 +66,7 @@ class FacebookLikeButton(CMSPlugin):
verb = models.CharField(_("Verb to display"), choices=VERB_CHOICES, default='like', max_length=50)
font = models.CharField(_("Font"), choices=FONT_CHOICES, default='verdana', max_length=50)
color_scheme = models.CharField(_("Color Scheme"), choices=COLOR_CHOICES, default='light', max_length=50)
-
+
fb_bits = [
'href',
'layout',
@@ -88,12 +75,12 @@ class FacebookLikeButton(CMSPlugin):
'font',
'color_scheme',
]
-
+
fb_aliases = {
- 'href': lambda r,c,i: i.url if i.url else r.build_absolute_uri(),
+ 'href': lambda r, c, i: i.url if i.url else r.build_absolute_uri(),
}
-
+
fb_default_width = 295
def __unicode__(self):
- return "LikeButton (%s)" % (self.pageurl)
+ return "LikeButton (%s)" % (self.pageurl)
View
14 cmsplugin_facebook/templates/cmsplugin_facebook/sharebutton.html
@@ -1,14 +0,0 @@
-{% comment %}
-<!-- Example from Facebook -->
-<!-- <a
- name="fb_share"
- type="button" # Can be button, button_count or box_count (box_count is above, button_count is inline)
- href="http://www.facebook.com/sharer.php">Share</a>
- <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
- -->
-{{ instance.style }} can be "button", "button_count" or "box_count" (box_count is above, button_count is inline)
-{% endcomment %}
-{% spaceless %}
-<a name="fb_share" type="{{ instance.style }}" href="http://www.facebook.com/sharer.php"{% if instance.share_url %} share_url="{{ instance.share_url }}"{% endif %}>{{ instance.button_text }}</a>
-<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
-{% endspaceless %}
View
18 setup.py
@@ -3,21 +3,21 @@
version = __import__('cmsplugin_facebook').__version__
setup(
- name = 'cmsplugin_facebook',
- version = version,
- license= 'BSD',
- description = 'Django CMS Facebook Plugins',
- author = 'Christopher Glass',
- author_email = 'christopher.glass@divio.ch',
- url = 'http://github.com/chrisglass/cmsplugin_facebook',
- packages = find_packages(),
+ name='cmsplugin_facebook',
+ version=version,
+ license='BSD',
+ description='Django CMS Facebook Plugins',
+ author='Christopher Glass',
+ author_email='christopher.glass@divio.ch',
+ url='http://github.com/chrisglass/cmsplugin_facebook',
+ packages=find_packages(),
zip_safe=False,
package_data={
'cmsplugin_facebook': [
'templates/cmsplugin_facebook/*.html',
]
},
- classifiers = [
+ classifiers=[
'Development Status :: 4 - Beta',
'Framework :: Django',
'Intended Audience :: Developers',
Please sign in to comment.
Something went wrong with that request. Please try again.