-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
730 additions
and
879 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
from Acquisition import aq_inner | ||
from plone import api | ||
from plone.api.exc import InvalidParameterError | ||
from Products.Five import BrowserView | ||
from Products.CMFCore.utils import getToolByName | ||
|
||
from zope.interface import implements | ||
from zope.i18nmessageid import MessageFactory | ||
|
||
from sc.social.like.interfaces import ISocialLikeSettings | ||
from sc.social.like.interfaces import ISocialLikes | ||
|
||
_ = MessageFactory('sc.social.like') | ||
from zope.interface import implements | ||
|
||
|
||
class SocialLikes(BrowserView): | ||
""" | ||
""" | ||
implements(ISocialLikes) | ||
|
||
enabled_portal_types = [] | ||
implements(ISocialLikes) | ||
|
||
def __init__(self, context, request, *args, **kwargs): | ||
super(SocialLikes, self).__init__(context, request, *args, **kwargs) | ||
context = aq_inner(context) | ||
def __init__(self, context, request): | ||
self.context = context | ||
pp = getToolByName(context, 'portal_properties') | ||
self.sheet = getattr(pp, 'sc_social_likes_properties', None) | ||
if self.sheet: | ||
self.enabled_portal_types = self.sheet.getProperty( | ||
'enabled_portal_types' | ||
) | ||
self.request = request | ||
|
||
@property | ||
def enabled(self): | ||
"""Validates if social bookmarks should be enabled | ||
for this context""" | ||
context = self.context | ||
enabled_portal_types = self.enabled_portal_types | ||
return context.portal_type in enabled_portal_types | ||
"""Validates if social bookmarks should be enabled in this context.""" | ||
record = ISocialLikeSettings.__identifier__ + '.enabled_portal_types' | ||
try: | ||
enabled_portal_types = api.portal.get_registry_record(record) | ||
except InvalidParameterError: | ||
enabled_portal_types = [] | ||
|
||
return self.context.portal_type in enabled_portal_types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding:utf-8 -*- | ||
from plone.app.registry.browser import controlpanel | ||
from sc.social.like import LikeMessageFactory as _ | ||
from sc.social.like.interfaces import ISocialLikeSettings | ||
|
||
|
||
class SocialLikeSettingsEditForm(controlpanel.RegistryEditForm): | ||
|
||
"""Control panel edit form.""" | ||
|
||
schema = ISocialLikeSettings | ||
label = _(u'Social Like') | ||
description = _(u'Settings for the sc.social.like package') | ||
|
||
|
||
class SocialLikeSettingsControlPanel(controlpanel.ControlPanelFormWrapper): | ||
|
||
"""Control panel form wrapper.""" | ||
|
||
form = SocialLikeSettingsEditForm |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.