Permalink
Browse files

- Share button plugin almost works (needs an actual template now :))

  • Loading branch information...
1 parent b0bd645 commit d07db41f47a7d853ea7036f421c799fc76adee30 @chrisglass chrisglass committed Oct 19, 2010
@@ -15,11 +15,16 @@ class LikeBoxPlugin(BasePlugin):
name = 'Facebook LikeBox Plugin'
render_template = 'cms_facebook/likebox.html'
-
+class ShareButtonPlugin(BasePlugin):
+ model = models.ShareButton
+ name = 'Facebook "Share" button plugin'
+ render_template = "cms_facebook/sharebutton.html"
+
class LikeButtonPlugin(BasePlugin):
model = models.LikeButton
name = 'Facebook Like Button Plugin'
render_template = 'cms_facebook/likebutton.html'
plugin_pool.register_plugin(LikeBoxPlugin)
-plugin_pool.register_plugin(LikeButtonPlugin)
+plugin_pool.register_plugin(LikeButtonPlugin)
+plugin_pool.register_plugin(ShareButtonPlugin)
@@ -0,0 +1,85 @@
+# encoding: 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):
+
+ # Adding model 'ShareButton'
+ db.create_table('cmsplugin_sharebutton', (
+ ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
+ ('style', self.gf('django.db.models.fields.CharField')(max_length=12)),
+ ))
+ db.send_create_signal('cms_facebook', ['ShareButton'])
+
+
+ def backwards(self, orm):
+
+ # Deleting model 'ShareButton'
+ db.delete_table('cmsplugin_sharebutton')
+
+
+ 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'}),
+ 'publisher_is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
+ 'publisher_public': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'publisher_draft'", 'unique': 'True', 'null': 'True', 'to': "orm['cms.CMSPlugin']"}),
+ 'publisher_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': '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'})
+ },
+ 'cms_facebook.facebookpage': {
+ 'Meta': {'object_name': 'FacebookPage'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'pageid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'}),
+ 'pageurl': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
+ },
+ 'cms_facebook.likebox': {
+ 'Meta': {'object_name': 'LikeBox', 'db_table': "'cmsplugin_likebox'", '_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'}),
+ 'width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'})
+ },
+ 'cms_facebook.likebutton': {
+ 'Meta': {'object_name': 'LikeButton', 'db_table': "'cmsplugin_likebutton'", '_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'})
+ },
+ 'cms_facebook.sharebutton': {
+ 'Meta': {'object_name': 'ShareButton', 'db_table': "'cmsplugin_sharebutton'", '_ormbases': ['cms.CMSPlugin']},
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
+ 'style': ('django.db.models.fields.CharField', [], {'max_length': '12'})
+ }
+ }
+
+ complete_apps = ['cms_facebook']
@@ -27,6 +27,12 @@
('dark', _('dark')),
]
+SHARE_BUTTON_STYLES = (
+ ('button', 'Simple "share" button'),
+ ('button_count', 'Share button with count'),
+ ('box_count', 'Share button with count displayed above'),
+)
+
class FacebookPage(models.Model):
name = models.CharField(max_length=255)
pageurl = models.CharField(max_length=255, unique=True)
@@ -35,6 +41,9 @@ class FacebookPage(models.Model):
def __unicode__(self):
return self.name
+class ShareButton(CMSPlugin):
+ style = models.CharField(max_length=12,choices=SHARE_BUTTON_STYLES)
+
class LikeBox(CMSPlugin):
pageurl = models.URLField(_("URL to like"))
width = models.PositiveSmallIntegerField(_("Width"), default=None, null=True,
@@ -0,0 +1,7 @@
+<!-- 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>
+ -->

0 comments on commit d07db41

Please sign in to comment.