Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Like box now works

- Rationalized templates (did we really need a template tag for this?)
- Facebook API apparently now takes urls instead of IDs for pages...
  • Loading branch information...
commit abfdf621fe328d0ecb8e9da15fe46874f4d80135 1 parent de35349
Chris Glass chrisglass authored
5 cms_facebook/cms_plugins.py
View
@@ -12,8 +12,9 @@ def render(self, context, instance, placeholder):
class LikeBoxPlugin(BasePlugin):
model = models.LikeBox
- name = 'likebox'
-
+ name = 'Facebook LikeBox Plugin'
+ render_template = 'cms_facebook/likebox.html'
+
class LikeButtonPlugin(BasePlugin):
model = models.LikeButton
76 cms_facebook/migrations/0004_auto__add_field_facebookpage_pageurl.py
View
@@ -0,0 +1,76 @@
+# 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 field 'FacebookPage.pageurl'
+ db.add_column('cms_facebook_facebookpage', 'pageurl', self.gf('django.db.models.fields.CharField')(default='', unique=True, max_length=255), keep_default=False)
+
+
+ def backwards(self, orm):
+
+ # Deleting field 'FacebookPage.pageurl'
+ db.delete_column('cms_facebook_facebookpage', 'pageurl')
+
+
+ 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'}),
+ 'fbpage': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'like_boxes'", 'to': "orm['cms_facebook.FacebookPage']"}),
+ 'header': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'height': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '587'}),
+ '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'}),
+ 'show_faces': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True', 'blank': '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 = ['cms_facebook']
1  cms_facebook/models.py
View
@@ -29,6 +29,7 @@
class FacebookPage(models.Model):
name = models.CharField(max_length=255)
+ pageurl = models.CharField(max_length=255, unique=True)
pageid = models.CharField(max_length=32, unique=True)
def __unicode__(self):
33 cms_facebook/templates/cms_facebook/likebox.html
View
@@ -1 +1,32 @@
-<iframe src="http://www.facebook.com/plugins/likebox.php?id={{ instance.page.id }}&amp;width={% if instance.width %}{{ instance.width }}{% else %}{{ width|default:295 }}{% endif %}&amp;connections={{ instance.connections }}&amp;stream={% if instance.stream %}true{% else %}false{% endif %}&amp;header={% if instance.header %}true{% else %}false{% endif %}&amp;height={{ instance.height }}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{% if instance.width %}{{ instance.width }}{% else %}{{ width|default:295 }}{% endif %}px; height:{{ instance.height %}}px;" allowTransparency="true"></iframe>
+<!-- Example from Facebook website: -->
+<!--
+<iframe src="http://www.facebook.com/plugins/likebox.php?
+ href=http%3A%2F%2Fwww.facebook.com%2Fplatform&amp;width=292&amp;
+ colorscheme=light&amp;connections=10&amp;
+ stream=true&amp;
+ header=true&amp;
+ height=587"
+ scrolling="no"
+ frameborder="0"
+ style="border:none;
+ overflow:hidden;
+ width:292px;
+ height:587px;"
+ allowTransparency="true">
+</iframe> -->
+
+<iframe src="http://www.facebook.com/plugins/likebox.php?
+ href={% autoescape on %}{{ instance.fbpage.pageurl }}{% endautoescape %}&amp;
+ width={% if instance.width %}{{ instance.width }}{% else %}{{ width|default:295 }}{% endif %}&amp;
+ connections={{ instance.connections }}&amp;
+ stream={% if instance.stream %}true{% else %}false{% endif %}&amp;
+ header={% if instance.header %}true{% else %}false{% endif %}&amp;
+ height={{ instance.height }}"
+ scrolling="no"
+ frameborder="0"
+ style="border:none;
+ overflow:hidden;
+ width:{% if instance.width %}{{ instance.width }}{% else %}{{ width|default:295 }}{% endif %}px;
+ height:{{ instance.height }}px;"
+ allowTransparency="true">
+</iframe>
Please sign in to comment.
Something went wrong with that request. Please try again.