From 8b5861a30740346313bfc5815e2fce718075c938 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= <fpeters@entrouvert.com>
Date: Thu, 7 Nov 2019 08:48:04 +0100
Subject: [PATCH 1/3] misc: update card related labels (#37510)

---
 tests/test_admin_pages.py         |  4 ++--
 tests/test_backoffice_pages.py    |  8 +++----
 wcs/admin/settings.py             |  4 ++--
 wcs/backoffice/cards.py           | 38 +++++++++++++++----------------
 wcs/backoffice/data_management.py |  4 ++--
 wcs/backoffice/root.py            |  6 ++---
 6 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/tests/test_admin_pages.py b/tests/test_admin_pages.py
index a92e30110..e90bff1d8 100644
--- a/tests/test_admin_pages.py
+++ b/tests/test_admin_pages.py
@@ -5372,7 +5372,7 @@ def test_cards_new(pub, studio):
     create_superuser(pub)
     app = login(get_app(pub))
     resp = app.get('/backoffice/cards/')
-    resp = resp.click('New Card')
+    resp = resp.click('New Card Model')
     resp.form['name'] = 'card title'
     resp = resp.form.submit()
     assert resp.location == 'http://example.net/backoffice/cards/1/'
@@ -5399,7 +5399,7 @@ def test_card_workflow_change(pub, studio):
     create_superuser(pub)
     app = login(get_app(pub))
     resp = app.get('/backoffice/cards/')
-    resp = resp.click('New Card')
+    resp = resp.click('New Card Model')
     resp.form['name'] = 'card title'
     resp = resp.form.submit()
     resp = resp.follow()
diff --git a/tests/test_backoffice_pages.py b/tests/test_backoffice_pages.py
index dffcc695c..5781b9833 100644
--- a/tests/test_backoffice_pages.py
+++ b/tests/test_backoffice_pages.py
@@ -5070,7 +5070,7 @@ def test_carddata_management(pub, studio):
     user = create_user(pub)
     app = login(get_app(pub))
     resp = app.get('/backoffice/')
-    assert not 'Cards Data' in resp.body
+    assert not 'Cards' in resp.body
     carddef = CardDef()
     carddef.name = 'foo'
     carddef.fields = [
@@ -5079,18 +5079,18 @@ def test_carddata_management(pub, studio):
     carddef.store()
 
     resp = app.get('/backoffice/')
-    assert not 'Cards Data' in resp.body
+    assert not 'Cards' in resp.body
 
     carddef.backoffice_submission_roles = user.roles
     carddef.store()
     resp = app.get('/backoffice/')
-    assert 'Cards Data' in resp.body
+    assert 'Cards' in resp.body
 
     carddef.backoffice_submission_roles = None
     carddef.workflow_roles = {'_editor': user.roles[0]}
     carddef.store()
     resp = app.get('/backoffice/')
-    assert 'Cards Data' in resp.body
+    assert 'Cards' in resp.body
 
     resp = app.get('/backoffice/data/')
     resp = resp.click('foo')
diff --git a/wcs/admin/settings.py b/wcs/admin/settings.py
index e572431eb..54409e8fa 100644
--- a/wcs/admin/settings.py
+++ b/wcs/admin/settings.py
@@ -559,7 +559,7 @@ class SettingsDirectory(QommonSettingsDirectory):
         permission_keys = []
         admin_sections = [
                 ('forms', N_('Forms')),
-                ('carddefs', N_('Cards')),
+                ('carddefs', N_('Card Models')),
                 ('workflows', N_('Workflows')),
                 ('users', N_('Users')),
                 ('roles', N_('Roles')),
@@ -865,7 +865,7 @@ class SettingsDirectory(QommonSettingsDirectory):
         form = Form(enctype="multipart/form-data")
         form.add(CheckboxWidget, 'formdefs', title = _('Forms'), value = True)
         if StudioDirectory.is_visible():
-            form.add(CheckboxWidget, 'carddefs', title=_('Cards'), value=True)
+            form.add(CheckboxWidget, 'carddefs', title=_('Card Models'), value=True)
         form.add(CheckboxWidget, 'workflows', title = _('Workflows'), value = True)
         if not get_cfg('sp', {}).get('idp-manage-roles'):
             form.add(CheckboxWidget, 'roles', title = _('Roles'), value = True)
diff --git a/wcs/backoffice/cards.py b/wcs/backoffice/cards.py
index 7749c0251..30477b888 100644
--- a/wcs/backoffice/cards.py
+++ b/wcs/backoffice/cards.py
@@ -44,13 +44,13 @@ class CardDefPage(FormDefPage):
     formdef_ui_class = CardDefUI
     formdef_default_workflow = '_carddef_default'
 
-    delete_message = N_('You are about to irrevocably delete this card.')
-    delete_title = N_('Deleting Card:')
+    delete_message = N_('You are about to irrevocably delete this card model.')
+    delete_title = N_('Deleting Card Model:')
     overwrite_message = N_(
-        'You can replace this card by uploading a file '
+        'You can replace this card model by uploading a file '
         'or by pointing to a form URL.')
     overwrite_success_message = N_(
-        'The card has been successfully overwritten. '
+        'The card model has been successfully overwritten. '
         'Do note it kept its existing address and role and workflow parameters.')
 
     def html_top(self, title):
@@ -206,31 +206,31 @@ class CardsDirectory(FormsDirectory):
     formdef_page_class = CardDefPage
     formdef_ui_class = CardDefUI
 
-    import_title = N_('Import Card')
-    import_submit_label = N_('Import Card')
+    import_title = N_('Import Card Model')
+    import_submit_label = N_('Import Card Model')
     import_paragraph = N_(
-        'You can install a new card by uploading a file '
-        'or by pointing to the card URL.')
-    import_loading_error_message = N_('Error loading card (%s).')
+        'You can install a new card model by uploading a file '
+        'or by pointing to the card model URL.')
+    import_loading_error_message = N_('Error loading card model (%s).')
     import_success_message = N_(
-        'This card has been successfully imported. ')
+        'This card model has been successfully imported. ')
     import_error_message = N_(
-        'Imported card contained errors and has been automatically fixed, '
+        'Imported card model contained errors and has been automatically fixed, '
         'you should nevertheless check everything is ok. ')
 
     def html_top(self, title):
         return html_top('cards', title)
 
     def _q_index(self):
-        get_response().breadcrumb.append(('cards/', _('Cards')))
-        self.html_top(title=_('Cards'))
+        get_response().breadcrumb.append(('cards/', _('Card Models')))
+        self.html_top(title=_('Card Models'))
         r = TemplateIO(html=True)
 
         r += htmltext('<div id="appbar">')
-        r += htmltext('<h2>%s</h2>') % _('Cards')
+        r += htmltext('<h2>%s</h2>') % _('Card Models')
         r += htmltext('<span class="actions">')
         r += htmltext('<a href="import" rel="popup">%s</a>') % _('Import')
-        r += htmltext('<a class="new-item" href="new" rel="popup">%s</a>') % _('New Card')
+        r += htmltext('<a class="new-item" href="new" rel="popup">%s</a>') % _('New Card Model')
         r += htmltext('</span>')
         r += htmltext('</div>')
 
@@ -239,7 +239,7 @@ class CardsDirectory(FormsDirectory):
         return r.getvalue()
 
     def new(self):
-        get_response().breadcrumb.append(('cards/', _('Cards')))
+        get_response().breadcrumb.append(('cards/', _('Card Models')))
         get_response().breadcrumb.append(('new', _('New')))
         formdefui = self.formdef_ui_class(None)
         form = formdefui.new_form_ui()
@@ -256,9 +256,9 @@ class CardsDirectory(FormsDirectory):
             else:
                 return redirect(str(formdef.id) + '/')
 
-        self.html_top(title=_('New Card'))
+        self.html_top(title=_('New Card Model'))
         r = TemplateIO(html=True)
-        r += htmltext('<h2>%s</h2>') % _('New Card')
+        r += htmltext('<h2>%s</h2>') % _('New Card Model')
         r += form.render()
         return r.getvalue()
 
@@ -270,5 +270,5 @@ class CardsDirectory(FormsDirectory):
         return response
 
     def _q_lookup(self, component):
-        get_response().breadcrumb.append(('cards/', _('Cards')))
+        get_response().breadcrumb.append(('cards/', _('Card Models')))
         return self.formdef_page_class(component)
diff --git a/wcs/backoffice/data_management.py b/wcs/backoffice/data_management.py
index 486579a3b..d4763bff0 100644
--- a/wcs/backoffice/data_management.py
+++ b/wcs/backoffice/data_management.py
@@ -29,7 +29,7 @@ class DataManagementDirectory(ManagementDirectory):
     _q_exports = ['']
 
     def _q_traverse(self, path):
-        get_response().breadcrumb.append(('data/', _('Cards Data')))
+        get_response().breadcrumb.append(('data/', _('Cards')))
         return super(ManagementDirectory, self)._q_traverse(path)
 
     def is_accessible(self, user):
@@ -45,7 +45,7 @@ class DataManagementDirectory(ManagementDirectory):
         return False
 
     def _q_index(self):
-        html_top('data_management', _('Data'))
+        html_top('data_management', _('Cards'))
         formdefs = CardDef.select(order_by='name', ignore_errors=True, lightweight=True)
         if len(formdefs) == 0:
             return self.empty_site_message(_('Cards'))
diff --git a/wcs/backoffice/root.py b/wcs/backoffice/root.py
index d1793b001..2163738db 100644
--- a/wcs/backoffice/root.py
+++ b/wcs/backoffice/root.py
@@ -62,10 +62,10 @@ class RootDirectory(BackofficeRootDirectory):
     menu_items = [
         ('submission/', N_('Submission')),
         ('management/', N_('Management')),
-        ('data/', N_('Cards Data'), {'check_display_function': studio.is_visible}),
+        ('data/', N_('Cards'), {'check_display_function': studio.is_visible}),
         ('studio/', N_('Studio'), {'check_display_function': studio.is_visible}),
         ('forms/', N_('Forms Workshop'), {'sub': True}),
-        ('cards/', N_('Cards'), {'sub': True, 'check_display_function': studio.is_visible}),
+        ('cards/', N_('Card Models'), {'sub': True, 'check_display_function': studio.is_visible}),
         ('workflows/', N_('Workflows Workshop'), {'sub': True}),
         ('users/', N_('Users'), {'check_display_function': roles.is_visible}),
         ('roles/', N_('Roles'), {'check_display_function': roles.is_visible}),
@@ -273,7 +273,7 @@ class RootDirectory(BackofficeRootDirectory):
                 if slug == 'forms':
                     label = misc.site_encode(pgettext('studio', 'Forms'))
                 elif slug == 'cards':
-                    label = misc.site_encode(pgettext('studio', 'Cards'))
+                    label = misc.site_encode(pgettext('studio', 'Card Models'))
                 elif slug == 'workflows':
                     label = misc.site_encode(pgettext('studio', 'Workflows'))
             menu_items.append({
-- 
2.24.0

