snapshot: fields are not sortable (#57524)
gitea-wip/wcs/pipeline/head There was a failure building this commit
Details
gitea-wip/wcs/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
d59ee3cb65
commit
ae06861242
|
@ -9,7 +9,7 @@ from quixote.http_request import Upload
|
|||
from wcs.blocks import BlockDef
|
||||
from wcs.carddef import CardDef
|
||||
from wcs.data_sources import NamedDataSource
|
||||
from wcs.fields import ItemField
|
||||
from wcs.fields import ItemField, StringField
|
||||
from wcs.formdef import FormDef
|
||||
from wcs.mail_templates import MailTemplate
|
||||
from wcs.qommon.form import UploadedFile
|
||||
|
@ -45,7 +45,7 @@ def pub(request, emails):
|
|||
def formdef_with_history(pub):
|
||||
formdef = FormDef()
|
||||
formdef.name = 'testform'
|
||||
formdef.fields = []
|
||||
formdef.fields = [StringField(id='1', label='Test', type='string')]
|
||||
formdef.store()
|
||||
|
||||
for i in range(5):
|
||||
|
@ -404,6 +404,7 @@ def test_form_snapshot_browse(pub, formdef_with_history):
|
|||
resp = app.get('/backoffice/forms/%s/history/' % formdef_with_history.id)
|
||||
resp = resp.click(href='%s/view/' % (snapshot.id - 1))
|
||||
resp = resp.click(href='fields/')
|
||||
assert 'sortable readonly' in resp.text
|
||||
assert '<a class="button" href="../../../%s/view/fields/">≪</a>' % snapshot.id in resp.text
|
||||
assert '<a class="button" href="../../../%s/view/fields/"><</a>' % snapshot.id in resp.text
|
||||
assert '<a class="button" href="../../../%s/view/fields/">></a>' % (snapshot.id - 2) in resp.text
|
||||
|
@ -562,6 +563,7 @@ def test_workflow_with_form_snapshot_browse(pub):
|
|||
display_form.id = '_x'
|
||||
display_form.varname = 'xxx'
|
||||
display_form.formdef = WorkflowFormFieldsFormDef(item=display_form)
|
||||
display_form.formdef.fields.append(StringField(id='1', label='Test', type='string'))
|
||||
st1.items.append(display_form)
|
||||
display_form.parent = st1
|
||||
wf.store()
|
||||
|
@ -572,6 +574,7 @@ def test_workflow_with_form_snapshot_browse(pub):
|
|||
'/backoffice/workflows/%s/history/%s/view/status/st1/items/_x/fields/' % (wf.id, snapshot.id)
|
||||
)
|
||||
assert 'The fields are readonly' in resp.text # ok, no error
|
||||
assert 'sortable readonly' in resp.text
|
||||
|
||||
|
||||
def test_wscall_snapshot_browse(pub):
|
||||
|
|
|
@ -276,6 +276,8 @@ class FieldsDirectory(Directory):
|
|||
extra_classes = []
|
||||
if [x for x in self.objectdef.fields if x.type == 'page']:
|
||||
extra_classes.append('multipage')
|
||||
if self.objectdef.is_readonly():
|
||||
extra_classes.append('readonly')
|
||||
|
||||
r += htmltext(
|
||||
'<ul id="fields-list" class="biglist sortable %s" data-page-no-label="%s">'
|
||||
|
|
|
@ -24,7 +24,7 @@ $(document).ready(
|
|||
}
|
||||
});
|
||||
|
||||
$('ul.biglist.sortable').sortable(
|
||||
$('ul.biglist.sortable:not(.readonly)').sortable(
|
||||
{
|
||||
handle: '.handle',
|
||||
accept: 'biglistitem',
|
||||
|
|
Loading…
Reference in New Issue