0004-backoffice-add-mini-map-to-geolocated-forms-10581.patch
tests/test_backoffice_pages.py | ||
---|---|---|
703 | 703 |
assert 'test_backoffice_submission_context' in resp.body |
704 | 704 |
assert 'http://www.example.com/summary' in resp.body |
705 | 705 | |
706 |
def test_backoffice_geolocation_info(pub): |
|
707 |
user = create_user(pub) |
|
708 |
create_environment(pub) |
|
709 |
formdef = FormDef.get_by_urlname('form-title') |
|
710 |
formdef.geolocations = {'base': 'Geolocafoobar'} |
|
711 |
formdef.store() |
|
712 |
form_class = FormDef.get_by_urlname('form-title').data_class() |
|
713 |
number31 = [x for x in form_class.select() if x.data['1'] == 'FOO BAR 30'][0] |
|
714 |
app = login(get_app(pub)) |
|
715 |
resp = app.get('/backoffice/management/form-title/') |
|
716 |
assert re.findall('<tbody.*\/tbody>', resp.body, re.DOTALL)[0].count('<tr') == 17 |
|
717 | ||
718 |
# click on a formdata |
|
719 |
resp = resp.click(href='%s/' % number31.id) |
|
720 |
assert (' with the number %s.' % number31.get_display_id()) in resp.body |
|
721 | ||
722 |
# check there's nothing in the sidebar |
|
723 |
assert not 'Geolocation' in resp.body |
|
724 | ||
725 |
number31.geolocations = {'base': {'lat': 48.83, 'lon': 2.32}} |
|
726 |
number31.store() |
|
727 |
resp = app.get('/backoffice/management/form-title/') |
|
728 |
resp = resp.click(href='%s/' % number31.id) |
|
729 |
assert 'Geolocafoobar' in resp.body |
|
730 |
assert 'class="qommon-map"' in resp.body |
|
731 |
assert 'data-init-lng="2.32"' in resp.body |
|
732 |
assert 'data-init-lat="48.83' in resp.body |
|
706 | 733 | |
707 | 734 |
def test_backoffice_info_text(pub): |
708 | 735 |
create_user(pub) |
wcs/backoffice/management.py | ||
---|---|---|
1773 | 1773 |
r += htmltext('<p>%s</p>') % formdata.get_user().display_name |
1774 | 1774 |
r += htmltext('</div>') |
1775 | 1775 | |
1776 |
if formdata.formdef.geolocations and formdata.geolocations: |
|
1777 |
r += htmltext('<div class="geolocations">') |
|
1778 |
for geoloc_key in formdata.formdef.geolocations: |
|
1779 |
if not geoloc_key in formdata.geolocations: |
|
1780 |
continue |
|
1781 |
r += htmltext('<h3>%s</h3>') % formdata.formdef.geolocations[geoloc_key] |
|
1782 |
geoloc_value = formdata.geolocations[geoloc_key] |
|
1783 |
map_widget = MapWidget('geoloc_%s' % geoloc_key, |
|
1784 |
readonly=True, |
|
1785 |
value='%(lat)s;%(lon)s' % geoloc_value) |
|
1786 |
r += map_widget.render() |
|
1787 |
r += htmltext('</div>') |
|
1788 | ||
1776 | 1789 |
if formdata.user_id and get_publisher().is_using_postgresql(): |
1777 | 1790 |
# display list of open formdata for the same user |
1778 | 1791 |
user_roles = [logged_users_role().id] + (get_request().user.roles or []) |
wcs/qommon/static/css/dc2/admin.css | ||
---|---|---|
1332 | 1332 |
div.bo-block.data-source-preview tt { |
1333 | 1333 |
padding-right: 1ex; |
1334 | 1334 |
} |
1335 | ||
1336 |
div#sidebar div.MapWidget { |
|
1337 |
margin: 0 1px; |
|
1338 |
border: 1px solid #888; |
|
1339 |
} |
|
1335 |
- |