Skip to content

Commit

Permalink
feat: reorganize backend form
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Jun 30, 2023
1 parent 3fcb49c commit ce3c409
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 70 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog
2.0.0 (unreleased)
------------------

- reorganize backend form
[mamico]

- booking_type filter in @months-slots
[mamico]

Expand Down
51 changes: 0 additions & 51 deletions src/redturtle/prenotazioni/browser/add_edit_view.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/redturtle/prenotazioni/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,6 @@

<include package=".stats" />


<browser:page
name="edit"
for="..content.prenotazioni_folder.IPrenotazioniFolder"
class=".add_edit_view.DefaultEditView"
permission="cmf.ModifyPortalContent"
/>

<adapter
factory=".add_edit_view.DefaultAddView"
provides="zope.publisher.interfaces.browser.IBrowserPage"
for="Products.CMFPlone.interfaces.siteroot.IPloneSiteRoot
zope.publisher.interfaces.browser.IDefaultBrowserLayer
plone.dexterity.interfaces.IDexterityFTI"
name="PrenotazioniFolder"
/>

<include package="plone.app.contentmenu" />


Expand Down
42 changes: 40 additions & 2 deletions src/redturtle/prenotazioni/content/prenotazioni_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class IWeekTableRow(model.Schema):
day = schema.TextLine(
title=_("day_label", default="Day of week"), required=True, default=""
)
form.mode(day="display")
morning_start = schema.Choice(
title=_("morning_start_label", default="Start time in the morning"),
vocabulary="redturtle.prenotazioni.VocOreInizio",
Expand Down Expand Up @@ -138,6 +139,8 @@ class IPrenotazioniFolder(model.Schema):
description=_("Inserire il testo di presentazione dell'agenda corrente"),
)

form.mode(descriptionAgenda="display")

cosa_serve = schema.Text(
required=False,
title=_("Cosa serve", default="Cosa serve"),
Expand Down Expand Up @@ -277,7 +280,13 @@ def get_options():
],
)
form.widget(
"week_table", DataGridFieldFactory, frontendOptions={"widget": "data_grid"}
"week_table",
DataGridFieldFactory,
allow_insert=False,
allow_delete=False,
allow_reorder=False,
auto_append=False,
frontendOptions={"widget": "data_grid"},
)

week_table_overrides = schema.SourceText(
Expand Down Expand Up @@ -441,13 +450,42 @@ def data_validation(data):
raise Invalid(_("Afternoon start should not be greater than end."))

# TODO: definire o descrivere quando avviee la notifica
# TODO: inserire qui la chiave IO ? o su un config in zope.conf/environment ?
app_io_enabled = schema.Bool(
title=_("App IO notification"),
default=False,
required=False,
)

# TODO: inserire qui la chiave IO ? o su un config in zope.conf/environment ?
model.fieldset(
"dates",
label=_("Date validità"),
fields=[
"daData",
"aData",
"same_day_booking_disallowed",
"holidays",
"futureDays",
"notBeforeDays",
"pause_table",
],
)

model.fieldset(
"week_table",
label=_("Week table"),
fields=[
"week_table",
],
)

model.fieldset(
"week_table_overrides",
label=_("week_table_overrides_label", default="Week table overrides"),
fields=[
"week_table_overrides",
],
)

model.fieldset(
"contacts",
Expand Down

0 comments on commit ce3c409

Please sign in to comment.