-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to select content type to use glossary
- Loading branch information
Showing
5 changed files
with
45 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
PROJECTNAME = 'collective.glossary' | ||
|
||
# by default, all standard content types will be searchable | ||
DEFAULT_ENABLED_CONTENT_TYPES = [ | ||
'Document', | ||
'News Item' | ||
] |
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 |
---|---|---|
|
@@ -24,5 +24,6 @@ | |
<include package=".browser" /> | ||
|
||
<include file="profiles.zcml" /> | ||
<include file="vocabulary.zcml" /> | ||
|
||
</configure> |
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,18 @@ | ||
# -*- coding: utf-8 -*- | ||
from plone.app.vocabularies.types import ReallyUserFriendlyTypesVocabulary | ||
from zope.schema.vocabulary import SimpleVocabulary | ||
|
||
|
||
class AvailableContentTypesVocabulary(ReallyUserFriendlyTypesVocabulary): | ||
""" | ||
Inherit from plone.app.vocabularies.ReallyUserFriendlyTypes; and filter | ||
the results. We don't want glossary to be listed. | ||
""" | ||
|
||
def __call__(self, context): | ||
items = super(AvailableContentTypesVocabulary, self).__call__(context) | ||
items = [i for i in items if i.token not in ('Glossary', 'Term')] | ||
return SimpleVocabulary(items) | ||
|
||
|
||
availableContentTypesVocabulary = AvailableContentTypesVocabulary() |
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,9 @@ | ||
<configure xmlns="http://namespaces.zope.org/zope"> | ||
|
||
<utility | ||
provides="zope.schema.interfaces.IVocabularyFactory" | ||
component=".vocabulary.availableContentTypesVocabulary" | ||
name="collective.glossary.AvailableContentTypes" | ||
/> | ||
|
||
</configure> |