Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'use-current-page' of https://github.com/richardbarran/c…

…msplugin_facebook into richardbarran-use-current-page

Removed conflicts - normally this should make the current trunk work.

Conflicts:
	cmsplugin_facebook/models.py
	cmsplugin_facebook/templates/cmsplugin_facebook/sharebutton.html
  • Loading branch information...
commit 545ff0ed5f50fb3f87acfb3c3a111a8c8a49d70f 2 parents b2e58a3 + 61c34c0
@chrisglass authored
View
5 cmsplugin_facebook/cms_plugins.py
@@ -6,7 +6,10 @@ class BasePlugin(CMSPluginBase):
name = None
def render(self, context, instance, placeholder):
- context.update({'instance': instance, 'name': self.name})
+ context.update({'instance': instance,
+ 'name': self.name,
+ 'url': instance.pageurl or \
+ context['request'].build_absolute_uri()})
return context
class FacebookLikeBoxPlugin(BasePlugin):
View
79 ...migrations/0003_auto__chg_field_facebooklikebox_pageurl__chg_field_facebooklikebutton_.py
@@ -0,0 +1,79 @@
+# -*- 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):
+
+ # Changing field 'FacebookLikeBox.pageurl'
+ db.alter_column('cmsplugin_facebooklikebox', 'pageurl', self.gf('django.db.models.fields.URLField')(max_length=200, null=True))
+
+ # Changing field 'FacebookLikeButton.pageurl'
+ db.alter_column('cmsplugin_facebooklikebutton', 'pageurl', self.gf('django.db.models.fields.URLField')(max_length=200, null=True))
+
+ def backwards(self, orm):
+
+ # User chose to not deal with backwards NULL issues for 'FacebookLikeBox.pageurl'
+ raise RuntimeError("Cannot reverse this migration. 'FacebookLikeBox.pageurl' and its values cannot be restored.")
+
+ # User chose to not deal with backwards NULL issues for 'FacebookLikeButton.pageurl'
+ raise RuntimeError("Cannot reverse this migration. 'FacebookLikeButton.pageurl' and its values cannot be restored.")
+
+ 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', 'null': 'True', 'blank': 'True'}),
+ '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', 'null': 'True', 'blank': 'True'}),
+ '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'})
+ },
+ 'cmsplugin_facebook.facebooksharebutton': {
+ 'Meta': {'object_name': 'FacebookShareButton', 'db_table': "'cmsplugin_facebooksharebutton'", '_ormbases': ['cms.CMSPlugin']},
+ 'button_text': ('django.db.models.fields.CharField', [], {'default': "u'Share'", 'max_length': '255'}),
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
+ 'share_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'style': ('django.db.models.fields.CharField', [], {'max_length': '12'})
+ }
+ }
+
+ complete_apps = ['cmsplugin_facebook']
View
69 ...migrations/0004_auto__del_field_facebooksharebutton_share_url__add_field_facebookshare.py
@@ -0,0 +1,69 @@
+# -*- 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):
+ db.rename_column('cmsplugin_facebooksharebutton', 'share_url', 'pageurl')
+
+ def backwards(self, orm):
+ db.rename_column('cmsplugin_facebooksharebutton', 'pageurl', 'share_url')
+
+ 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', 'null': 'True', 'blank': 'True'}),
+ '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', 'null': 'True', 'blank': 'True'}),
+ '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'})
+ },
+ 'cmsplugin_facebook.facebooksharebutton': {
+ 'Meta': {'object_name': 'FacebookShareButton', 'db_table': "'cmsplugin_facebooksharebutton'", '_ormbases': ['cms.CMSPlugin']},
+ 'button_text': ('django.db.models.fields.CharField', [], {'default': "u'Share'", 'max_length': '255'}),
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
+ 'pageurl': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'style': ('django.db.models.fields.CharField', [], {'max_length': '12'})
+ }
+ }
+
+ complete_apps = ['cmsplugin_facebook']
View
6 cmsplugin_facebook/models.py
@@ -29,7 +29,8 @@
class FacebookLikeBox(CMSPlugin):
- pageurl = models.URLField(_("URL to like"))
+ pageurl = models.URLField(_("URL to like"), help_text=_("If blank, the page where it's displayed will be used"),
+ null=True, blank=True)
width = models.PositiveSmallIntegerField(_("Width"), default=None, null=True,
blank=True, help_text=_("Leave empty for auto scaling"))
height = models.PositiveSmallIntegerField(_("Height"), default=587)
@@ -56,7 +57,8 @@ def __unicode__(self):
class FacebookLikeButton(CMSPlugin):
- pageurl = models.URLField(_("URL to like"))
+ pageurl = models.URLField(_("URL to like"), help_text=_("If blank, the page where it's displayed will be used"),
+ null=True, blank=True)
layout = models.CharField(_("Layout Style"), choices=LAYOUT_CHOICES, default="standard", max_length=50)
show_faces = models.BooleanField(_("Show Faces"), default=True,
help_text=_("Show profile pictures below the like button"))
View
2  cmsplugin_facebook/templates/cmsplugin_facebook/likebox.html
@@ -17,7 +17,7 @@
</iframe> -->
{% endcomment %}
{% spaceless %}
-<iframe src="http://www.facebook.com/plugins/likebox.php?href={% autoescape on %}{{ instance.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 }}"
+<iframe src="http://www.facebook.com/plugins/likebox.php?href={% autoescape on %}{{ url }}{% 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;"
View
2  cmsplugin_facebook/templates/cmsplugin_facebook/likebutton.html
@@ -15,7 +15,7 @@
</iframe> -->
{% endcomment %}
{% spaceless %}
-<iframe src="http://www.facebook.com/plugins/like.php?href={% autoescape on %}{{ instance.pageurl }}{% endautoescape %}&amp;layout={% if instance.layout %}{{instance.layout}}{% endif %}&amp;show_faces={{instance.show_faces}}&amp;width={% if instance.width %}{{ instance.width }}{% else %}{{ width|default:295 }}{% endif %}&amp;height={{ instance.height }}&amp;action=like&amp;colorscheme=light"
+<iframe src="http://www.facebook.com/plugins/like.php?href={% autoescape on %}{{ url }}{% endautoescape %}&amp;layout={% if instance.layout %}{{instance.layout}}{% endif %}&amp;show_faces={{instance.show_faces}}&amp;width={% if instance.width %}{{ instance.width }}{% else %}{{ width|default:295 }}{% endif %}&amp;height={{ instance.height }}&amp;action=like&amp;colorscheme=light"
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">
Please sign in to comment.
Something went wrong with that request. Please try again.