from more.webassets import WebassetsApp
from onegov.core.security import Public
from onegov.form import _
from onegov.form.errors import FormError
from onegov.form.parser.core import flatten_fieldsets, parse_formcode
from onegov.form.parser.snippets import Snippets
from onegov.form.utils import disable_required_attribute_in_html_inputs
from yaml.parser import ParserError
from typing import Any, TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Iterator
from onegov.core.request import CoreRequest
from onegov.core.types import JSON_ro
@FormApp.path(path='formcode-snippets', model=Snippets)
@FormApp.path(path='formcode-fields', model=FormcodeParseFields)
@FormApp.json(model=Snippets, permission=Public)
@FormApp.json(model=FormcodeParseFields, permission=Public,
request_method='GET')
@FormApp.json(model=FormcodeParseFields, permission=Public,
request_method='POST')
@FormApp.webasset_path()
[docs]
def get_js_path() -> str:
return 'assets/js'
@FormApp.webasset_path()
[docs]
def get_css_path() -> str:
return 'assets/css'
@FormApp.webasset('formcode')
@FormApp.webasset('iconwidget')
@FormApp.webasset('preview-widget-handler')
@FormApp.webasset('text-module-picker')
[docs]
def get_text_module_picker_asset() -> 'Iterator[str]':
yield 'text-module-picker.css'
yield 'text-module-picker.js'
@FormApp.webasset('lazy-wolves')
[docs]
def get_honeypot_asset() -> 'Iterator[str]':
yield 'honeypot.css'
@FormApp.webasset(
'chosen',
filters={'css': ['datauri', 'custom-rcssmin']}
)
[docs]
def get_chosen_asset() -> 'Iterator[str]':
# Make sure your app includes jQuery!
yield 'chosen.css'
yield 'chosen.fixes.css'
yield 'chosen.jquery.js'
yield 'chosen-init.js'
@FormApp.webasset('typeahead-standalone')
[docs]
def get_typeahead_asset() -> 'Iterator[str]':
yield 'typeahead-standalone.css'
yield 'typeahead-standalone.js'
yield 'typeahead-standalone-init.js'