3
0
Fork 0

feat: improve page linkage between role/user/person

- show Users grid when viewing a Role
- add hyperlinks between things
This commit is contained in:
Lance Edgar 2024-08-21 14:38:34 -05:00
parent 9d261de45a
commit 770c4612d5
16 changed files with 440 additions and 21 deletions

View file

@ -10,6 +10,7 @@ from pyramid import testing
from wuttjamaican.conf import WuttaConfig
from wuttaweb.forms import base, widgets
from wuttaweb import helpers
from wuttaweb.grids import Grid
class TestForm(TestCase):
@ -405,6 +406,29 @@ class TestForm(TestCase):
self.assertIn('<script type="text/x-template" id="wutta-form-template">', html)
self.assertNotIn('@submit', html)
def test_add_grid_vue_data(self):
form = self.make_form()
# grid must have key
grid = Grid(self.request)
self.assertRaises(ValueError, form.add_grid_vue_data, grid)
# otherwise it works
grid = Grid(self.request, key='foo')
self.assertEqual(len(form.grid_vue_data), 0)
form.add_grid_vue_data(grid)
self.assertEqual(len(form.grid_vue_data), 1)
self.assertIn('foo', form.grid_vue_data)
self.assertEqual(form.grid_vue_data['foo'], [])
# calling again with same key will replace data
records = [{'foo': 1}, {'foo': 2}]
grid = Grid(self.request, key='foo', columns=['foo'], data=records)
form.add_grid_vue_data(grid)
self.assertEqual(len(form.grid_vue_data), 1)
self.assertIn('foo', form.grid_vue_data)
self.assertEqual(form.grid_vue_data['foo'], records)
def test_render_vue_finalize(self):
form = self.make_form()
html = form.render_vue_finalize()