Skip to content

Commit

Permalink
Added the industry field as a vocabulary #33
Browse files Browse the repository at this point in the history
  • Loading branch information
alfadestroyer committed Jul 26, 2023
1 parent 5f7fb9a commit dfdef96
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI +ZONE\n"
"POT-Creation-Date: 2023-07-26 02:53+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -180,6 +180,14 @@ msgstr ""
msgid "Indico profile."
msgstr ""

#: slc_web/schema/communitysponsor.xml
msgid "Industry"
msgstr ""

#: slc_web/schema/communitysponsor.xml
msgid "Industry sector to which it belongs"
msgstr ""

#: slc_web/schema/communitysponsor.xml
msgid "Information"
msgstr ""
Expand Down
12 changes: 10 additions & 2 deletions backend/src/slc_web/src/slc_web/locales/es/LC_MESSAGES/slc_web.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
msgid ""
msgstr ""
"Project-Id-Version: slc_web\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI +ZONE\n"
"PO-Revision-Date: 2023-07-24 14:49-0600\n"
"POT-Creation-Date: 2023-07-26 02:53+0000\n"
"PO-Revision-Date: 2023-07-25 21:42-0400\n"
"Last-Translator: Leonardo J. Caballero G. <leonardocaballero@gmail.com>\n"
"Language-Team: ES <LL@li.org>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -185,6 +185,14 @@ msgstr "Indico"
msgid "Indico profile."
msgstr "Perfil Indico."

#: slc_web/schema/communitysponsor.xml
msgid "Industry"
msgstr "Industria"

#: slc_web/schema/communitysponsor.xml
msgid "Industry sector to which it belongs"
msgstr "Sector industrial al que pertenece"

#: slc_web/schema/communitysponsor.xml
msgid "Information"
msgstr "Información"
Expand Down
12 changes: 10 additions & 2 deletions backend/src/slc_web/src/slc_web/locales/slc_web.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2023-07-24 20:49+0000\n"
"POT-Creation-Date: 2023-07-26 02:53+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -183,6 +183,14 @@ msgstr ""
msgid "Indico profile."
msgstr ""

#: slc_web/src/slc_web/schema/communitysponsor.xml
msgid "Industry"
msgstr ""

#: slc_web/src/slc_web/schema/communitysponsor.xml
msgid "Industry sector to which it belongs"
msgstr ""

#: slc_web/src/slc_web/schema/communitysponsor.xml
msgid "Information"
msgstr ""
Expand Down Expand Up @@ -370,7 +378,7 @@ msgid "Skills"
msgstr ""

#: slc_web/src/slc_web/schema/communitymember.xml
msgid "Skills of the community member.
msgid "Skills of the community member.
Select different skills pushing Ctrl + Click."
msgstr ""

Expand Down
9 changes: 9 additions & 0 deletions backend/src/slc_web/src/slc_web/schema/communitysponsor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
<element i18n:translate="">Person</element>
</values>
</field>
<field indexer:searchable="true"
name="industry"
security:read-permission="slc_web.communitysponsor.view"
type="zope.schema.Choice"
>
<description i18n:translate="">Industry sector to which it belongs</description>
<title i18n:translate="">Industry</title>
<vocabulary>slc_web.vocabulary.industries</vocabulary>
</field>
</fieldset>
<fieldset description="Sponsor Contact Data"
label="Contact Data"
Expand Down
43 changes: 43 additions & 0 deletions backend/src/slc_web/src/slc_web/tests/test_vocabularies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""Vocabularies tests for this package."""
from slc_web import PACKAGE_NAME
from slc_web.testing import SLC_WEB_INTEGRATION_TESTING
from slc_web.vocabularies import industries_vocabulary
from zope.component import getUtility
from zope.schema.interfaces import IVocabularyFactory

import unittest


class IndustriesVocabularyTest(unittest.TestCase):
"""Test fot the slc_web Vocabularies.
Args:
unittest (class): unittest TestCase
"""

layer = SLC_WEB_INTEGRATION_TESTING

def setUp(self):
"""Custom shared utility setup for tests."""
self.portal = self.layer["portal"]

def test_vocabulary(self):
"""Check that the vocabulary exists."""
self.assertTrue(industries_vocabulary)

def test_vocabulary_industries_total(self):
"""Checkout the industries vocabulary total size."""
factory = getUtility(
IVocabularyFactory, f"{PACKAGE_NAME}.vocabulary.industries"
)
vocabulary = factory(self.portal)
self.assertEqual(len(vocabulary), 7)

def test_vocabulary_industry_exits(self):
"""Check that 'NGO' item is in the vocabulary."""
factory = getUtility(
IVocabularyFactory, f"{PACKAGE_NAME}.vocabulary.industries"
)
vocabulary = factory(self.portal)
industries = [industry.title for industry in vocabulary]
self.assertIn("NGO", industries)
10 changes: 5 additions & 5 deletions backend/src/slc_web/src/slc_web/vocabularies/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Vocabularies for this package."""
from slc_web import _
from zope.interface import provider
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary


Expand All @@ -19,8 +19,8 @@

@provider(IVocabularyFactory)
def industries_vocabulary(context):
"""Vocabulary of industries."""
terms = []
"""Industries vocabulary."""
industries = []
for id_, title in INDUSTRIES:
terms.append(SimpleTerm(id_, id_, title))
return SimpleVocabulary(terms)
industries.append(SimpleVocabulary.createTerm(id_, id_, title))
return SimpleVocabulary(industries)
3 changes: 1 addition & 2 deletions backend/src/slc_web/src/slc_web/vocabularies/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<configure xmlns="http://namespaces.zope.org/zope">

<!-- Example vocabulary
<!-- Custom vocabularies -->
<utility
name="slc_web.vocabulary.industries"
component=".industries_vocabulary"
/>
-->

</configure>
1 change: 1 addition & 0 deletions docs/source/backend/communitysponsor.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class CommunitySponsor {
+information : String
+logo_photo : File
+type : String
+industry : String
+website : String
#email : String
#phone : Integer
Expand Down

0 comments on commit dfdef96

Please sign in to comment.