0001-admin-make-data-sources-accessible-from-forms-workfl.patch
tests/test_admin_pages.py | ||
---|---|---|
2635 | 2635 |
create_superuser(pub) |
2636 | 2636 |
app = login(get_app(pub)) |
2637 | 2637 |
app.get('/backoffice/settings/data-sources/') |
2638 |
# also check it's accessible from forms and workflows sections |
|
2639 |
app.get('/backoffice/forms/data-sources/') |
|
2640 |
app.get('/backoffice/workflows/data-sources/') |
|
2638 | 2641 | |
2639 | 2642 |
def test_data_sources_new(pub): |
2640 | 2643 |
create_superuser(pub) |
wcs/admin/forms.py | ||
---|---|---|
44 | 44 |
from wcs.forms.root import qrcode |
45 | 45 | |
46 | 46 |
from fields import FieldDefPage, FieldsDirectory |
47 |
from .data_sources import NamedDataSourcesDirectory |
|
47 | 48 | |
48 | 49 |
def get_categories(): |
49 | 50 |
t = sorted([(misc.simplify(x.name), x.id, x.name, x.id) for x in Category.select()]) |
... | ... | |
1452 | 1453 |
self.formdef.store() |
1453 | 1454 | |
1454 | 1455 | |
1456 |
class NamedDataSourcesDirectoryInForms(NamedDataSourcesDirectory): |
|
1457 |
def _q_traverse(self, path): |
|
1458 |
get_response().breadcrumb.append(('forms/', _('Forms'))) |
|
1459 |
return super(NamedDataSourcesDirectoryInForms, self)._q_traverse(path) |
|
1460 | ||
1461 | ||
1455 | 1462 |
class FormsDirectory(AccessControlled, Directory): |
1456 |
_q_exports = ['', 'new', ('import', 'p_import')] |
|
1463 |
_q_exports = ['', 'new', ('import', 'p_import'), |
|
1464 |
('data-sources', 'data_sources')] |
|
1457 | 1465 | |
1466 |
data_sources = NamedDataSourcesDirectoryInForms() |
|
1458 | 1467 |
formdef_page_class = FormDefPage |
1459 | 1468 | |
1460 | 1469 |
def html_top(self, title): |
... | ... | |
1499 | 1508 |
r += htmltext('<ul id="sidebar-actions">') |
1500 | 1509 |
r += htmltext(' <li><a class="new-item" href="new" rel="popup">%s</a></li>') % _('New Form') |
1501 | 1510 |
r += htmltext(' <li><a href="import" rel="popup">%s</a></li>') % _('Import') |
1511 |
r += htmltext(' <li><a href="data-sources/">%s</a></li>') % _('Data sources') |
|
1502 | 1512 |
r += htmltext('</ul>') |
1503 | 1513 |
return r.getvalue() |
1504 | 1514 |
wcs/admin/workflows.py | ||
---|---|---|
36 | 36 |
from wcs.formdef import FormDef |
37 | 37 |
from wcs.formdata import Evolution |
38 | 38 |
from .fields import FieldDefPage, FieldsDirectory |
39 |
from .data_sources import NamedDataSourcesDirectory |
|
39 | 40 | |
40 | 41 | |
41 | 42 |
def svg(tag): |
... | ... | |
1602 | 1603 |
return redirect('../%s/' % self.workflow_ui.workflow.id) |
1603 | 1604 | |
1604 | 1605 | |
1606 |
class NamedDataSourcesDirectoryInWorkflows(NamedDataSourcesDirectory): |
|
1607 |
def _q_traverse(self, path): |
|
1608 |
get_response().breadcrumb.append(('workflows/', _('Workflows'))) |
|
1609 |
return super(NamedDataSourcesDirectoryInWorkflows, self)._q_traverse(path) |
|
1610 | ||
1611 | ||
1605 | 1612 |
class WorkflowsDirectory(Directory): |
1606 |
_q_exports = ['', 'new', ('import', 'p_import')] |
|
1613 |
_q_exports = ['', 'new', ('import', 'p_import'), |
|
1614 |
('data-sources', 'data_sources')] |
|
1615 | ||
1616 |
data_sources = NamedDataSourcesDirectoryInWorkflows() |
|
1607 | 1617 | |
1608 | 1618 |
def html_top(self, title): |
1609 | 1619 |
return html_top('workflows', title) |
... | ... | |
1631 | 1641 |
r += htmltext('<ul id="sidebar-actions">') |
1632 | 1642 |
r += htmltext(' <li><a class="new-item" rel="popup" href="new">%s</a></li>') % _('New Workflow') |
1633 | 1643 |
r += htmltext(' <li><a href="import" rel="popup">%s</a></li>') % _('Import') |
1644 |
r += htmltext(' <li><a href="data-sources/">%s</a></li>') % _('Data sources') |
|
1634 | 1645 |
r += htmltext('</ul>') |
1635 | 1646 |
return r.getvalue() |
1636 | 1647 | |
1637 |
- |