Skip to content

Commit

Permalink
Org: Editmode Buttons
Browse files Browse the repository at this point in the history
Hide send button if layout.editmode is true

TYPE: Bugfix
  • Loading branch information
BreathingFlesh authored Nov 28, 2024
1 parent ddf9e27 commit f47e8e1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
32 changes: 17 additions & 15 deletions src/onegov/org/templates/macros.pt
Original file line number Diff line number Diff line change
Expand Up @@ -309,21 +309,23 @@
</tal:b>
</tal:b>
<metal:b define-slot="before-submit" />
<tal:b condition="cancel|nothing">
<a class="button secondary cancel-button" href="${cancel}" i18n:translate="" role="button">
<tal:b condition="not:cancel_text|nothing">
Cancel
</tal:b>
<tal:b condition="cancel_text|nothing">
${cancel_text}
</tal:b>
</a>
</tal:b>
<tal:b condition="not: button_text|nothing">
<input type="submit" value="Submit" class="button" i18n:attributes="value">
</tal:b>
<tal:b condition="button_text|nothing">
<input type="submit" value="${button_text}" class="button" role="button">
<tal:b condition="not: layout.edit_mode|False">
<tal:b condition="cancel|nothing">
<a class="button secondary cancel-button" href="${cancel}" i18n:translate="" role="button">
<tal:b condition="not:cancel_text|nothing">
Cancel
</tal:b>
<tal:b condition="cancel_text|nothing">
${cancel_text}
</tal:b>
</a>
</tal:b>
<tal:b condition="not: button_text|nothing">
<input type="submit" value="Submit" class="button" i18n:attributes="value">
</tal:b>
<tal:b condition="button_text|nothing">
<input type="submit" value="${button_text}" class="button" role="button">
</tal:b>
</tal:b>
</form>
</metal:form>
Expand Down
24 changes: 12 additions & 12 deletions tests/onegov/org/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_browse_directory_uploads(browser, org_app, field):
browser.fill('name', "Seven Seas Motel")
browser.fill('description', "First victim of Ice Truck Killer")
browser.fill('photo', photo.name)
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()

assert browser.is_text_present("Seven Seas Motel")
assert browser.is_element_present_by_css('.field-display img')
Expand All @@ -90,7 +90,7 @@ def test_browse_directory_uploads(browser, org_app, field):
# elect to keep the picture (default)
browser.find_by_css('.edit-link').click()
browser.fill('name', "Seven Seas Motel, Miami")
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()

assert browser.is_text_present("Seven Seas Motel, Miami")
assert browser.is_element_present_by_css('.field-display img')
Expand All @@ -102,15 +102,15 @@ def test_browse_directory_uploads(browser, org_app, field):
browser.find_by_css('.edit-link').click()
browser.choose('photo', 'replace')
browser.find_by_name('photo')[3].value = photo.name
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()

assert browser.is_element_present_by_css('.field-display img')
assert browser.find_by_css('.field-display img')['src'] != src

# elect to delete the picture
browser.find_by_css('.edit-link').click()
browser.choose('photo', 'delete')
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()

if field.startswith('Photo ='):
assert not browser.is_element_present_by_css('.field-display img')
Expand Down Expand Up @@ -150,13 +150,13 @@ def test_upload_image_with_error(browser, org_app):
browser.visit('/directories/crime-scenes/+new')
browser.fill('name', "Seven Seas Motel")
browser.fill('photo', photo.name)
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()

assert browser.is_text_present("Dieses Feld wird benötigt")

# try again with the missing field present
browser.fill('description', "First victim of Ice Truck Killer")
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()

assert browser.is_text_present("Seven Seas Motel")

Expand Down Expand Up @@ -302,15 +302,15 @@ def test_browse_directory_coordinates(browser, org_app):
assert browser.is_element_present_by_css('.add-point-active', wait_time=5)
browser.execute_script('document.leafletmaps[0].panBy([-100, 100]);')
browser.find_by_css('.add-point-active').click()
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()

browser.visit('/directories/restaurants/+new')
browser.fill('name', "City Sushi")
browser.fill('tables', "20")
assert browser.is_element_present_by_css('.add-point-active', wait_time=5)
browser.execute_script('document.leafletmaps[0].panBy([100, -100]);')
browser.find_by_css('.add-point-active').click()
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()

# make sure the restaurants are visible in the overview
browser.visit('/directories/restaurants')
Expand Down Expand Up @@ -475,7 +475,7 @@ def test_context_specific_function_are_displayed_in_person_directory(browser,
'last_name': 'Boolean'
})

browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()
person = (
client.app.session().query(Person)
.filter(Person.last_name == 'Boolean')
Expand All @@ -492,7 +492,7 @@ def test_context_specific_function_are_displayed_in_person_directory(browser,
'people-0-context_specific_function': 'Logician',
'people-0-display_function_in_person_directory': True,
})
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()

browser.visit(f"/person/{person.id.hex}")
browser.find_by_text('All About Berry: Logician')
Expand Down Expand Up @@ -610,7 +610,7 @@ def test_script_escaped_in_user_submitted_html(browser, org_app):
browser.find_by_css(new_directory_button).click()

browser.fill('name', "Seven Seas Motel")
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()

browser.visit('/directories/clubs')
browser.find_by_value("Konfigurieren").click()
Expand Down Expand Up @@ -657,7 +657,7 @@ def test_link_hashtags(browser, org_app):
https://www.seven-seas-motel.com/rooms#luxury-suite
#fantastic
""")
browser.find_by_value("Absenden").click()
browser.find_by_value("Speichern").click()
assert browser.is_text_present("Seven Seas Motel")

# Only hashtags should be links, URL anchors should not be seen as hashtags
Expand Down

0 comments on commit f47e8e1

Please sign in to comment.