Ejemplo n.º 1
0
 def test_Field_id(self):
     fd = field_description_from_view_field(
         self.testcoll, 
         { ANNAL.CURIE.field_id: "Field_id" }, 
         {}
         )
     expect_placement = Placement(
         width   = make_field_width(sw=12, mw=6, lw=6),
         offset  = make_field_offset(so=0, mo=0, lo=0),
         display = make_field_display(sd=True, md=True, ld=True),
         field = 'small-12 medium-6 columns', 
         label = 'small-12 medium-4 columns', 
         value = 'small-12 medium-8 columns'
         )
     expect_field_desc = (
         { 'field_id':                   'Field_id'
         , 'field_name':                 'entity_id'
         , 'field_value_type':          ANNAL.CURIE.Slug
         , 'field_label':                'Field Id'
         , 'field_render_type':          'EntityId'
         , 'field_value_mode':           'Value_direct'
         , 'field_property_uri':         ANNAL.CURIE.id
         , 'field_placeholder':          '(field id)'
         , 'field_default_value':        None
         , 'field_placement':            expect_placement
         , 'field_ref_type':             None
         , 'field_choices':              None
         , 'field_ref_restriction':      'ALL'
         , 'field_group_ref':            None
         })
     # print repr(fd)
     self.assertDictionaryMatch(fd, expect_field_desc)
     return
Ejemplo n.º 2
0
 def test_Field_id(self):
     fd = field_description_from_view_field(
         self.testcoll, {ANNAL.CURIE.field_id: "Field_id"}, {})
     expect_placement = Placement(width=make_field_width(sw=12, mw=6, lw=6),
                                  offset=make_field_offset(so=0, mo=0,
                                                           lo=0),
                                  display=make_field_display(sd=True,
                                                             md=True,
                                                             ld=True),
                                  field="small-12 medium-6 columns",
                                  label="small-12 medium-4 columns",
                                  value="small-12 medium-8 columns")
     expect_field_desc = ({
         "field_id": "Field_id",
         "field_name": "entity_id",
         "field_value_type": ANNAL.CURIE.EntityRef,
         "field_label": "Field Id",
         "field_render_type": "EntityId",
         "field_value_mode": "Value_direct",
         "field_property_uri": ANNAL.CURIE.id,
         "field_placeholder": "(field id)",
         "field_default_value": "",
         "field_placement": expect_placement,
         "field_ref_type": None,
         "field_choices": None,
         "field_ref_restriction": "ALL",
         "field_group_ref": None
     })
     # print repr(fd)
     self.assertDictionaryMatch(fd, expect_field_desc)
     return
Ejemplo n.º 3
0
 def test_Field_InitialValues(self):
     fd = field_description_from_view_field(
         self.testcoll, {ANNAL.CURIE.field_id: layout.INITIAL_VALUES_ID},
         {})
     expect_placement = Placement(width=make_field_width(sw=12,
                                                         mw=12,
                                                         lw=12),
                                  offset=make_field_offset(so=0, mo=0,
                                                           lo=0),
                                  display=make_field_display(sd=True,
                                                             md=True,
                                                             ld=True),
                                  field="small-12 columns",
                                  label="small-12 medium-2 columns",
                                  value="small-12 medium-10 columns")
     expect_field_desc = ({
         "field_id": layout.INITIAL_VALUES_ID,
         "field_name": layout.INITIAL_VALUES_ID,
         "field_value_type": "",
         "field_label": "",
         "field_help": "",
         "field_render_type": "Text",
         "field_value_mode": "Value_direct",
         "field_property_uri": "",
         "field_placeholder": "",
         "field_default_value": None,
         "field_placement": expect_placement,
         "field_ref_type": None,
         "field_choices": None,
         "field_ref_restriction": "ALL",
         "field_group_ref": None
     })
     # print repr(fd)
     self.assertDictionaryMatch(fd, expect_field_desc)
     return
Ejemplo n.º 4
0
 def test_Field_InitialValues(self):
     fd = field_description_from_view_field(
         self.testcoll, {ANNAL.CURIE.field_id: "_initial_values"}, {})
     expect_placement = Placement(field='small-12 columns',
                                  label='small-12 medium-2 columns',
                                  value='small-12 medium-10 columns')
     expect_field_desc = ({
         'field_id': '_initial_values',
         'field_name': '_initial_values',
         'field_value_type': ANNAL.CURIE.Text,
         'field_label': '',
         'field_help': '',
         'field_property_uri': '',
         'field_placeholder': '',
         'field_default_value': None,
         'field_placement': expect_placement,
         'field_options_typeref': None,
         'field_choice_links': None,
         'field_restrict_values': 'ALL',
         'field_group_ref': None,
         'field_render_type': 'Text'
     })
     # print repr(fd)
     self.assertDictionaryMatch(fd, expect_field_desc)
     return
Ejemplo n.º 5
0
 def test_Group_field_sel(self):
     fd = field_description_from_view_field(
         self.testcoll, {ANNAL.CURIE.field_id: "Group_field_sel"}, {})
     expect_placement = Placement(field='small-6 columns',
                                  label='small-12 medium-4 columns',
                                  value='small-12 medium-8 columns')
     expect_choice_ids = ([
         'Entity_comment', 'Entity_id', 'Entity_label', 'Entity_type'
     ])
     expect_choice_labels = OrderedDict([(id, id)
                                         for id in expect_choice_ids])
     expect_choice_links = OrderedDict([(id,
                                         entity_url("testcoll", "_field",
                                                    id))
                                        for id in expect_choice_ids])
     expect_field_desc = ({
         'field_id': 'Group_field_sel',
         'field_name': 'Field_id',
         'field_value_type': ANNAL.CURIE.Slug,
         'field_label': 'Field id',
         'field_property_uri': ANNAL.CURIE.field_id,
         'field_placeholder': '(field sel)',
         'field_default_value': '',
         'field_placement': expect_placement,
         'field_options_typeref': '_field',
         'field_choice_labels': expect_choice_labels,
         'field_choice_links': expect_choice_links,
         'field_restrict_values':
         '[annal:field_entity_type] in entity[annal:record_type]',
         'field_group_ref': None,
         'field_render_type': 'Field'
     })
     # print repr(fd)
     self.assertDictionaryMatch(fd, expect_field_desc)
     return
Ejemplo n.º 6
0
 def test_Group_field_sel(self):
     fd = field_description_from_view_field(
         self.testcoll, 
         { ANNAL.CURIE.field_id: "Group_field_sel" }, 
         {}
         )
     expect_placement = Placement(
         width   = make_field_width(sw=12, mw=6, lw=6),
         offset  = make_field_offset(so=0, mo=0, lo=0),
         display = make_field_display(sd=True, md=True, ld=True),
         field='small-12 medium-6 columns', 
         label='small-12 medium-4 columns', 
         value='small-12 medium-8 columns'
         )
     # expect_choice_id_labels = (
     #     [ ('Entity_comment',  "Comment")
     #     , ('Entity_id',       "Id"     )
     #     , ('Entity_label',    "Label"  )
     #     , ('Entity_type',     "Type"   )
     #     ])
     expect_choices = OrderedDict(
         [ (fc.id, fc) 
           for fc in no_selection("(field sel)") + 
                     get_site_default_entity_fields_linked("testcoll") 
         ])
     expect_field_desc = (
         { 'field_id':                   'Group_field_sel'
         , 'field_name':                 'Field_id'
         , 'field_value_type':           ANNAL.CURIE.Slug
         , 'field_label':                'Field id'
         , 'field_render_type':          'Enum_optional'
         , 'field_value_mode':           'Value_direct'
         , 'field_property_uri':         ANNAL.CURIE.field_id
         , 'field_placeholder':          '(field sel)'
         , 'field_default_value':        ''
         , 'field_placement':            expect_placement
         , 'field_ref_type':             '_field'
         , 'field_choices':              expect_choices
         , 'field_ref_restriction':      'entity[annal:record_type] subtype [annal:field_entity_type]'
         , 'field_group_ref':            None
         })
     # print repr(fd)
     self.assertDictionaryMatch(fd, expect_field_desc)
     return
Ejemplo n.º 7
0
def get_padding_field_desc(pad_s, pad_m, pad_l):
    if pad_s == 0:
        if pad_m == 0:
            if pad_l == 0:
                # No padding
                return None
            else:
                # Pad for large only
                disp = "show-for-large-up large-%d columns" % (pad_l, )
        else:
            if pad_l == 0:
                # Pad for medium only
                disp = "show-for-medium-only medium-%d columns" % (pad_m, )
            else:
                disp = "hide-for-small-only medium-%d large-%d columns" % (
                    pad_m, pad_l)
    else:
        if pad_m == 0:
            if pad_l == 0:
                # Pad for small only
                disp = "show-for-small-only small-%d" % (pad_s, )
            else:
                # Pad for small and large
                disp = "hide-for-medium-only small-%d large-%d" % (pad_s,
                                                                   pad_l)
        else:
            if pad_l == 0:
                # Pad for small and medium
                disp = "hide-for-large-up small-%d medium-%d" % (pad_s, pad_m)
            else:
                # Pad all sizes
                disp = "small-%d medium-%d large-%d" % (pad_s, pad_m, pad_l)
    placement = Placement(width=make_field_width(sw=pad_s, mw=pad_m, lw=pad_l),
                          offset=make_field_offset(so=0, mo=0, lo=0),
                          display=make_field_display(sd=bool(pad_s),
                                                     md=bool(pad_m),
                                                     ld=bool(pad_l)),
                          field=disp,
                          label="small-4 columns",
                          value="small-8 columns")
    pad_desc = FieldDescription(None,
                                padding_field_data,
                                field_placement_classes=placement)
    return pad_desc
Ejemplo n.º 8
0
 def test_View_field_sel(self):
     fd = field_description_from_view_field(
         self.testcoll, {ANNAL.CURIE.field_id: "View_field_sel"}, {})
     expect_placement = Placement(width=make_field_width(sw=12, mw=6, lw=6),
                                  offset=make_field_offset(so=0, mo=0,
                                                           lo=0),
                                  display=make_field_display(sd=True,
                                                             md=True,
                                                             ld=True),
                                  field="small-12 medium-6 columns",
                                  label="small-12 medium-4 columns",
                                  value="small-12 medium-8 columns")
     # expect_choice_id_labels = (
     #     [ ("Entity_comment",  "Comment")
     #     , ("Entity_id",       "Id"     )
     #     , ("Entity_label",    "Label"  )
     #     , ("Entity_type",     "Type"   )
     #     ])
     expect_choices = OrderedDict([
         (fc.id, fc) for fc in no_selection("(field reference)") +
         get_site_default_entity_fields_linked("testcoll")
     ])
     expect_field_desc = ({
         "field_id": "View_field_sel",
         "field_name": "View_field_sel",
         "field_value_type": ANNAL.CURIE.EntityRef,
         "field_label": "Field ref",
         "field_render_type": "Enum_optional",
         "field_value_mode": "Value_direct",
         "field_property_uri": ANNAL.CURIE.field_id,
         "field_placeholder": "(field reference)",
         "field_default_value": "",
         "field_placement": expect_placement,
         "field_ref_type": "_field",
         "field_choices": expect_choices,
         "field_ref_restriction":
         "entity[annal:view_entity_type] subtype [annal:field_entity_type]",
         "field_group_ref": None
     })
     # print repr(fd)
     self.assertDictionaryMatch(fd, expect_field_desc)
     return
Ejemplo n.º 9
0
 def test_Field_id(self):
     fd = field_description_from_view_field(
         self.testcoll, {ANNAL.CURIE.field_id: "Field_id"}, {})
     expect_placement = Placement(field='small-6 columns',
                                  label='small-12 medium-4 columns',
                                  value='small-12 medium-8 columns')
     expect_field_desc = ({
         'field_id': 'Field_id',
         'field_name': 'entity_id',
         'field_value_type': ANNAL.CURIE.Slug,
         'field_label': 'Id',
         'field_property_uri': ANNAL.CURIE.id,
         'field_placeholder': '(field id)',
         'field_default_value': None,
         'field_placement': expect_placement,
         'field_options_typeref': None,
         'field_choice_links': None,
         'field_restrict_values': 'ALL',
         'field_group_ref': None,
         'field_render_type': 'EntityId'
     })
     # print repr(fd)
     self.assertDictionaryMatch(fd, expect_field_desc)
     return
Ejemplo n.º 10
0
 def test_View_fields(self):
     fd = field_description_from_view_field(
         self.testcoll, {ANNAL.CURIE.field_id: "View_fields"}, {})
     expect_placement = Placement(width=make_field_width(sw=12,
                                                         mw=12,
                                                         lw=12),
                                  offset=make_field_offset(so=0, mo=0,
                                                           lo=0),
                                  display=make_field_display(sd=True,
                                                             md=True,
                                                             ld=True),
                                  field="small-12 columns",
                                  label="small-12 medium-2 columns",
                                  value="small-12 medium-10 columns")
     expect_field_list = ([{
         "annal:property_uri": "annal:field_id",
         "annal:field_placement": "small:0,12;medium:0,4",
         "annal:field_id": "_field/View_field_sel"
     }, {
         "annal:property_uri": "annal:property_uri",
         "annal:field_placement": "small:0,12;medium:4,4",
         "annal:field_id": "_field/View_field_property"
     }, {
         "annal:property_uri": "annal:field_placement",
         "annal:field_placement": "small:0,12;medium:8,4",
         "annal:field_id": "_field/View_field_placement"
     }])
     expect_field_desc = ({
         "field_id": "View_fields",
         "field_name": "View_fields",
         "field_value_type": ANNAL.CURIE.View_field,
         "field_label": "Fields",
         "field_render_type": "Group_Seq_Row",
         "field_value_mode": "Value_direct",
         "field_property_uri": ANNAL.CURIE.view_fields,
         "field_placeholder": "(repeat field description)",
         "field_default_value": None,
         "field_placement": expect_placement,
         "field_ref_type": None,
         "field_choices": None,
         "field_ref_restriction": "ALL",
         "field_group_ref": None,
         "group_field_list": expect_field_list
     })
     self.assertDictionaryMatch(fd, expect_field_desc)
     self.assertEqual(fd["field_render_type"], "Group_Seq_Row")
     expect_group_details = ({
         "group_id":
         "View_fields",
         "group_label":
         "Fields",
         "group_add_label":
         "Add field",
         "group_delete_label":
         "Remove selected field(s)"
     })
     self.assertDictionaryMatch(fd, expect_group_details)
     self.assertEqual(len(fd["group_field_descs"]), 3)
     # Field type selector
     expect_field0_placement = Placement(width=make_field_width(sw=12,
                                                                mw=4,
                                                                lw=4),
                                         offset=make_field_offset(so=0,
                                                                  mo=0,
                                                                  lo=0),
                                         display=make_field_display(
                                             sd=True, md=True, ld=True),
                                         field="small-12 medium-4 columns",
                                         label="small-12 medium-6 columns",
                                         value="small-12 medium-6 columns")
     expect_field0_desc = ({
         "field_id": "View_field_sel",
         "field_name": "View_field_sel",
         "field_value_type": ANNAL.CURIE.EntityRef,
         "field_label": "Field ref",
         "field_render_type": "Enum_optional",
         "field_value_mode": "Value_direct",
         "field_property_uri": ANNAL.CURIE.field_id,
         "field_placement": expect_field0_placement
     })
     self.assertDictionaryMatch(fd["group_field_descs"][0],
                                expect_field0_desc)
     # Field property URI
     expect_field1_placement = Placement(width=make_field_width(sw=12,
                                                                mw=4,
                                                                lw=4),
                                         offset=make_field_offset(so=0,
                                                                  mo=4,
                                                                  lo=4),
                                         display=make_field_display(
                                             sd=True, md=True, ld=True),
                                         field="small-12 medium-4 columns",
                                         label="small-12 medium-6 columns",
                                         value="small-12 medium-6 columns")
     expect_field1_desc = ({
         "field_id": "View_field_property",
         "field_name": "View_field_property",
         "field_value_type": ANNAL.CURIE.Identifier,
         "field_label": "Property URI",
         "field_render_type": "Identifier",
         "field_value_mode": "Value_direct",
         "field_property_uri": ANNAL.CURIE.property_uri,
         "field_placement": expect_field1_placement
     })
     self.assertDictionaryMatch(fd["group_field_descs"][1],
                                expect_field1_desc)
     # Field placement (within group)
     expect_field2_placement = Placement(width=make_field_width(sw=12,
                                                                mw=4,
                                                                lw=4),
                                         offset=make_field_offset(so=0,
                                                                  mo=8,
                                                                  lo=8),
                                         display=make_field_display(
                                             sd=True, md=True, ld=True),
                                         field="small-12 medium-4 columns",
                                         label="small-12 medium-6 columns",
                                         value="small-12 medium-6 columns")
     expect_field2_desc = ({
         "field_id": "View_field_placement",
         "field_name": "View_field_placement",
         "field_value_type": ANNAL.CURIE.Placement,
         "field_label": "Position/size",
         "field_render_type": "Placement",
         "field_value_mode": "Value_direct",
         "field_property_uri": ANNAL.CURIE.field_placement,
         "field_placement": expect_field2_placement
     })
     self.assertDictionaryMatch(fd["group_field_descs"][2],
                                expect_field2_desc)
     return
Ejemplo n.º 11
0
 def test_View_fields(self):
     fd = field_description_from_view_field(
         self.testcoll, {ANNAL.CURIE.field_id: "View_fields"}, {})
     expect_placement = Placement(field='small-12 columns',
                                  label='small-12 medium-2 columns',
                                  value='small-12 medium-10 columns')
     expect_field_desc = ({
         'field_id': 'View_fields',
         'field_name': 'View_fields',
         'field_value_type': ANNAL.CURIE.Field_group,
         'field_label': 'Fields',
         'field_property_uri': ANNAL.CURIE.view_fields,
         'field_placeholder': '(repeat field description)',
         'field_default_value': None,
         'field_placement': expect_placement,
         'field_options_typeref': None,
         'field_choice_labels': None,
         'field_choice_links': None,
         'field_restrict_values': 'ALL',
         'field_group_ref': 'View_field_group'
     })
     self.assertDictionaryMatch(fd, expect_field_desc)
     self.assertEqual(fd['field_render_type'], "RepeatGroupRow")
     self.assertEqual(fd['field_render_colhead'],
                      "field/annalist_head_any.html")
     self.assertEqual(fd['field_render_colview'],
                      "field/annalist_item_none.html")
     self.assertIsInstance(fd['field_render_view'], RenderRepeatGroup)
     self.assertIsInstance(fd['field_render_edit'], RenderRepeatGroup)
     expect_group_details = ({
         'group_id':
         "View_fields",
         'group_label':
         "Fields",
         'group_add_label':
         "Add field",
         'group_delete_label':
         "Remove selected field(s)"
     })
     self.assertDictionaryMatch(fd, expect_group_details)
     self.assertEqual(len(fd['group_field_descs']), 3)
     # Field type selector
     expect_field0_placement = Placement(field='small-12 medium-4 columns',
                                         label='small-12 medium-6 columns',
                                         value='small-12 medium-6 columns')
     expect_field0_desc = ({
         'field_id': 'Group_field_sel',
         'field_name': 'Field_id',
         'field_value_type': ANNAL.CURIE.Slug,
         'field_label': 'Field id',
         'field_render_type': 'Field',
         'field_property_uri': ANNAL.CURIE.field_id,
         'field_placement': expect_field0_placement
     })
     self.assertDictionaryMatch(fd['group_field_descs'][0],
                                expect_field0_desc)
     # Field property URI
     expect_field1_placement = Placement(field='small-12 medium-4 columns',
                                         label='small-12 medium-6 columns',
                                         value='small-12 medium-6 columns')
     expect_field1_desc = ({
         'field_id': 'Group_field_property',
         'field_name': 'Field_property',
         'field_value_type': ANNAL.CURIE.Identifier,
         'field_label': 'Property',
         'field_render_type': 'Identifier',
         'field_property_uri': ANNAL.CURIE.property_uri,
         'field_placement': expect_field1_placement
     })
     self.assertDictionaryMatch(fd['group_field_descs'][1],
                                expect_field1_desc)
     # Field placement (within group)
     expect_field2_placement = Placement(field='small-12 medium-4 columns',
                                         label='small-12 medium-6 columns',
                                         value='small-12 medium-6 columns')
     expect_field2_desc = ({
         'field_id': 'Group_field_placement',
         'field_name': 'Field_placement',
         'field_value_type': ANNAL.CURIE.Placement,
         'field_label': 'Position/size',
         'field_render_type': 'Placement',
         'field_property_uri': ANNAL.CURIE.field_placement,
         'field_placement': expect_field2_placement
     })
     self.assertDictionaryMatch(fd['group_field_descs'][2],
                                expect_field2_desc)
     return
Ejemplo n.º 12
0
def field_view_context_data(coll_id="testcoll",
                            field_id=None,
                            orig_id=None,
                            continuation_url=None,
                            field_label=None,
                            field_render_type="Text",
                            field_value_mode="Value_direct",
                            field_entity_type="",
                            field_value_type="annal:Text",
                            field_property="",
                            field_placement="",
                            field_superproperty_uris=None,
                            field_placeholder="",
                            field_tooltip=None,
                            field_default=None,
                            field_typeref=None,
                            field_fieldref=None,
                            field_viewref=None,
                            field_fields=None,
                            field_repeat_label_add="Add",
                            field_repeat_label_delete="Remove",
                            field_restrict=None,
                            action=None,
                            update="Field"):
    if field_label is None:
        if field_id:
            field_label = "%s %s/_field/%s" % (update, coll_id, field_id)
        else:
            field_label = "%s data ... (testcoll/_field)" % (update)
    padding_placement = Placement(
        width=make_field_width(sw=0, mw=6, lw=6),
        offset=make_field_offset(so=0, mo=0, lo=0),
        display=make_field_display(sd=False, md=True, ld=True),
        field="hide-for-small-only medium-6 large-6 columns",
        label="small-4 columns",
        value="small-8 columns")
    if field_label:
        title = "%s - Field definition - Collection %s" % (field_label,
                                                           coll_id)
    else:
        title = "Field definition - Collection %s" % (coll_id)
    context_dict = ({
        "title":
        title,
        'heading':
        "Field definition",
        'coll_id':
        coll_id,
        'type_id':
        "_field"
        # , 'orig_id':            "orig_field_id"
        ,
        'fields': [
            context_field_row(
                get_bound_field("Field_id", field_id),  # 0 (0,0)
                get_bound_field("Field_render_type",
                                field_render_type)  # 1 (0,1)
            ),
            context_field_row(
                get_bound_field("Field_label", field_label)  # 2 (1,0)
            ),
            context_field_row(get_bound_field("Field_help")  # 3 (2,0)
                              ),
            context_field_row(
                get_bound_field("Field_property", field_property),  # 4 (3,0)
                get_bound_field("Field_placement", field_placement)  # 5 (3,1)
            ),
            get_bound_field('Field_superproperty_uris',
                            field_superproperty_uris),
            context_field_row(
                get_bound_field("Field_value_type",
                                field_value_type),  # 7 (5,0)
                get_bound_field("Field_value_mode",
                                field_value_mode)  # 8 (5,1)
            ),
            context_field_row(
                get_bound_field("Field_entity_type",
                                field_entity_type)  # 9 (6,0)
            ),
            context_field_row(
                get_bound_field("Field_typeref", field_typeref),  # 10 (7,0)
                get_bound_field("Field_fieldref", field_fieldref)  # 11 (7,1)
            ),
            context_field_row(
                get_bound_field("Field_default", field_default)  # 12 (8,0)
            ),
            context_field_row(
                get_bound_field("Field_placeholder",
                                field_placeholder)  # 13 (9,0)
            ),
            context_field_row(
                get_bound_field("Field_tooltip", field_tooltip)  # 14 (10,0)
            ),
            get_bound_field("Field_fields", field_fields)  # 15 (11,0)
            ,
            context_field_row(
                get_bound_field("Field_repeat_label_add",
                                field_repeat_label_add),
                # 16 (12,0)
                get_bound_field("Field_repeat_label_delete",
                                field_repeat_label_delete)
                # 17 (12,1)
            ),
            context_field_row(
                get_bound_field("Field_restrict", field_restrict)  # 18 (18,0)
            )
        ]
    })
    if orig_id is not None:
        context_dict['orig_id'] = orig_id
    if action:
        context_dict['action'] = action
    if continuation_url is None:
        context_dict['continuation_url'] = entitydata_list_type_url(
            coll_id, "_field")
    else:
        context_dict['continuation_url'] = continuation_url
    return context_dict
def recordfield_entity_view_context_data(coll_id="testcoll",
                                         field_id=None,
                                         orig_id=None,
                                         type_ids=[],
                                         action=None,
                                         update="Field"):
    if field_id:
        field_label = "%s %s/_field/%s" % (update, coll_id, field_id)
        field_descr = "%s help for %s in collection %s" % (update, field_id,
                                                           coll_id)
    else:
        field_label = "%s data ... (testcoll/_field)" % (update)
        field_descr = "%s description ... (testcoll/_field)" % (update)
    padding_placement = Placement(
        width=make_field_width(sw=0, mw=6, lw=6),
        offset=make_field_offset(so=0, mo=0, lo=0),
        display=make_field_display(sd=False, md=True, ld=True),
        field="hide-for-small-only medium-6 large-6 columns",
        label="small-4 columns",
        value="small-8 columns")
    context_dict = ({
        "title":
        "%s - Field definition - Collection %s" % (field_label, coll_id),
        'heading':
        "Field definition",
        'coll_id':
        coll_id,
        'type_id':
        "_field",
        'orig_id':
        "orig_field_id",
        'fields': [
            context_field_row(
                {
                    'field_id':
                    "Field_id"  # 0 (0,0)
                    ,
                    'field_name':
                    "entity_id",
                    'field_label':
                    "Field Id",
                    'field_value_type':
                    "annal:Slug",
                    'field_render_type':
                    "EntityId",
                    'field_value_mode':
                    "Value_direct",
                    'field_property_uri':
                    "annal:...",
                    'field_placement':
                    get_placement_classes('small:0,12;medium:0,6'),
                    'field_property_uri':
                    'annal:id',
                    'field_ref_type':
                    None,
                    'field_ref_field':
                    None,
                    'field_placeholder':
                    "(field id)",
                    'field_default_value':
                    None
                    # , 'field_value':          (Supplied separately)
                    ,
                    'options': []
                },
                {
                    'field_id':
                    "Field_render_type"  # 1 (0,1)
                    ,
                    'field_name':
                    "Field_render_type",
                    'field_label':
                    "Render type",
                    'field_value_type':
                    "annal:Slug",
                    'field_render_type':
                    "Enum_choice",
                    'field_value_mode':
                    "Value_direct",
                    'field_property_uri':
                    "annal:field_render_type",
                    'field_placement':
                    get_placement_classes('small:0,12;medium:6,6'),
                    'field_ref_type':
                    "Enum_render_type",
                    'field_ref_field':
                    None,
                    'field_placeholder':
                    "(field render type)",
                    'field_default_value':
                    "Text",
                    'field_value':
                    "Text",
                    'options': []
                }),
            context_field_row(
                {
                    'field_id':
                    "Field_value_type"  # 2 (1,0)
                    ,
                    'field_name':
                    "Field_value_type",
                    'field_label':
                    "Value type",
                    'field_value_type':
                    "annal:Identifier",
                    'field_render_type':
                    "Identifier",
                    'field_value_mode':
                    "Value_direct",
                    'field_property_uri':
                    "annal:field_value_type",
                    'field_placement':
                    get_placement_classes('small:0,12;medium:0,6'),
                    'field_ref_type':
                    None,
                    'field_ref_field':
                    None,
                    'field_placeholder':
                    "(field value type)",
                    'field_default_value':
                    "annal:Text",
                    'field_value':
                    "annal:Text",
                    'options': []
                },
                {
                    'field_id':
                    "Field_value_mode"  # 3 (1,1)
                    ,
                    'field_name':
                    "Field_value_mode",
                    'field_label':
                    "Value mode",
                    'field_value_type':
                    "annal:Slug",
                    'field_render_type':
                    "Enum_choice",
                    'field_value_mode':
                    "Value_direct",
                    'field_property_uri':
                    "annal:field_value_mode",
                    'field_placement':
                    get_placement_classes('small:0,12;medium:6,6'),
                    'field_ref_type':
                    "Enum_value_mode",
                    'field_ref_field':
                    None,
                    'field_placeholder':
                    "(field value mode)",
                    'field_default_value':
                    "Value_direct",
                    'field_value':
                    "Value_direct",
                    'options': []
                }),
            context_field_row({
                'field_id':
                "Field_label"  # 4 (2,0)
                ,
                'field_name':
                "Field_label",
                'field_label':
                "Label",
                'field_value_type':
                "annal:Text",
                'field_render_type':
                "Text",
                'field_value_mode':
                "Value_direct",
                'field_property_uri':
                "rdfs:label",
                'field_placement':
                get_placement_classes('small:0,12'),
                'field_ref_type':
                None,
                'field_ref_field':
                None,
                'field_placeholder':
                "(field label)",
                'field_default_value':
                "",
                'field_value':
                field_label,
                'options': []
            }),
            context_field_row({
                'field_id':
                "Field_comment"  # 5 (3,0)
                ,
                'field_name':
                "Field_comment",
                'field_label':
                "Help",
                'field_value_type':
                "annal:Longtext",
                'field_render_type':
                "Textarea",
                'field_value_mode':
                "Value_direct",
                'field_property_uri':
                "rdfs:comment",
                'field_placement':
                get_placement_classes('small:0,12'),
                'field_ref_type':
                None,
                'field_ref_field':
                None,
                'field_placeholder':
                "(field usage commentary or help text)",
                'field_default_value':
                "",
                'field_value':
                field_descr,
                'options': []
            }),
            context_field_row(
                {
                    'field_id':
                    "Field_property"  # 6 (4,0)
                    ,
                    'field_name':
                    "Field_property",
                    'field_label':
                    "Property URI",
                    'field_value_type':
                    "annal:Identifier",
                    'field_render_type':
                    "Identifier",
                    'field_value_mode':
                    "Value_direct",
                    'field_property_uri':
                    "annal:property_uri",
                    'field_placement':
                    get_placement_classes('small:0,12;medium:0,6'),
                    'field_ref_type':
                    None,
                    'field_ref_field':
                    None,
                    'field_placeholder':
                    "(field URI or CURIE)",
                    'field_default_value':
                    "",
                    'field_value':
                    "",
                    'options': []
                },
                {
                    'field_id':
                    "Field_placement"  # 7 (4,1)
                    ,
                    'field_name':
                    "Field_placement",
                    'field_label':
                    "Position/size",
                    'field_value_type':
                    "annal:Placement",
                    'field_render_type':
                    "Placement",
                    'field_value_mode':
                    "Value_direct",
                    'field_property_uri':
                    "annal:field_placement",
                    'field_placement':
                    get_placement_classes('small:0,12;medium:6,6'),
                    'field_ref_type':
                    None,
                    'field_ref_field':
                    None,
                    'field_placeholder':
                    "(field position and size)",
                    'field_default_value':
                    "",
                    'field_value':
                    "",
                    'options': []
                }),
            context_field_row(
                {
                    'field_id':
                    "Field_typeref"  # 8 (5,0)
                    ,
                    'field_name':
                    "Field_typeref",
                    'field_label':
                    "Refer to type",
                    'field_value_type':
                    "annal:Slug",
                    'field_render_type':
                    "Enum_optional",
                    'field_value_mode':
                    "Value_direct",
                    'field_property_uri':
                    "annal:field_ref_type",
                    'field_placement':
                    get_placement_classes('small:0,12;medium:0,6'),
                    'field_ref_type':
                    "_type",
                    'field_ref_field':
                    None,
                    'field_placeholder':
                    "(no type selected)",
                    'field_default_value':
                    "",
                    'field_value':
                    "",
                    'options': []
                },
                {
                    'field_id':
                    "Field_fieldref"  # 9 (5,1)
                    ,
                    'field_name':
                    "Field_fieldref",
                    'field_label':
                    "Refer to field",
                    'field_value_type':
                    "annal:Identifier",
                    'field_render_type':
                    "Identifier",
                    'field_value_mode':
                    "Value_direct",
                    'field_property_uri':
                    "annal:field_ref_field",
                    'field_placement':
                    get_placement_classes('small:0,12;medium:6,6'),
                    'field_ref_type':
                    None,
                    'field_ref_field':
                    None,
                    'field_placeholder':
                    "(field URI or CURIE)",
                    'field_default_value':
                    "",
                    'field_value':
                    "",
                    'options': []
                }),
            context_field_row({
                'field_id':
                "Field_placeholder"  # 10 (6,0)
                ,
                'field_name':
                "Field_placeholder",
                'field_label':
                "Placeholder",
                'field_value_type':
                "annal:Text",
                'field_render_type':
                "Text",
                'field_value_mode':
                "Value_direct",
                'field_property_uri':
                "annal:placeholder",
                'field_placement':
                get_placement_classes('small:0,12'),
                'field_ref_type':
                None,
                'field_ref_field':
                None,
                'field_placeholder':
                "(placeholder text)",
                'field_default_value':
                "",
                'field_value':
                "",
                'options': []
            }),
            context_field_row({
                'field_id':
                "Field_default"  # 11 (7,0)
                ,
                'field_name':
                "Field_default",
                'field_label':
                "Default",
                'field_value_type':
                "annal:Text",
                'field_render_type':
                "Text",
                'field_value_mode':
                "Value_direct",
                'field_property_uri':
                "annal:default_value",
                'field_placement':
                get_placement_classes('small:0,12'),
                'field_ref_type':
                None,
                'field_ref_field':
                None,
                'field_placeholder':
                "(field default value)",
                'field_default_value':
                "",
                'field_value':
                "",
                'options': []
            }),
            context_field_row({
                'field_id':
                "Field_groupref"  # 12 (8,0)
                ,
                'field_name':
                "Field_groupref",
                'field_label':
                "Field group",
                'field_value_type':
                "annal:Slug",
                'field_render_type':
                "Enum_optional",
                'field_value_mode':
                "Value_direct",
                'field_property_uri':
                "annal:group_ref",
                'field_placement':
                get_placement_classes('small:0,12;medium:0,6'),
                'field_ref_type':
                "_group",
                'field_ref_field':
                None,
                'field_placeholder':
                "(no field group selected)",
                'field_default_value':
                "",
                'field_value':
                "",
                'options': []
            }),
            context_field_row(
                {
                    'field_id':
                    "Field_repeat_label_add"  # 13 (9,0)
                    ,
                    'field_name':
                    "Field_repeat_label_add",
                    'field_label':
                    "Add value label",
                    'field_value_type':
                    "annal:Text",
                    'field_render_type':
                    "Text",
                    'field_value_mode':
                    "Value_direct",
                    'field_property_uri':
                    "annal:repeat_label_add",
                    'field_placement':
                    get_placement_classes('small:0,12;medium:0,6'),
                    'field_ref_type':
                    None,
                    'field_ref_field':
                    None
                    # , 'field_placeholder':      "..."
                    ,
                    'field_default_value':
                    "",
                    'field_value':
                    "",
                    'options': []
                },
                {
                    'field_id':
                    "Field_repeat_label_delete"  # 14 (9,1)
                    ,
                    'field_name':
                    "Field_repeat_label_delete",
                    'field_label':
                    "Delete value label",
                    'field_value_type':
                    "annal:Text",
                    'field_render_type':
                    "Text",
                    'field_value_mode':
                    "Value_direct",
                    'field_property_uri':
                    "annal:repeat_label_delete",
                    'field_placement':
                    get_placement_classes('small:0,12;medium:6,6'),
                    'field_ref_type':
                    None,
                    'field_ref_field':
                    None
                    # , 'field_placeholder':      "..."
                    ,
                    'field_default_value':
                    "",
                    'field_value':
                    "",
                    'options': []
                }),
            context_field_row({
                'field_id':
                "Field_entity_type"  # 15 (10,0)
                ,
                'field_name':
                "Field_entity_type",
                'field_label':
                "Entity type",
                'field_value_type':
                "annal:Identifier",
                'field_render_type':
                "Identifier",
                'field_value_mode':
                "Value_direct",
                'field_property_uri':
                "annal:field_entity_type",
                'field_placement':
                get_placement_classes('small:0,12'),
                'field_ref_type':
                None,
                'field_ref_field':
                None
                # , 'field_placeholder':      "..."
                ,
                'field_default_value':
                "",
                'field_value':
                "",
                'options': []
            }),
            context_field_row({
                'field_id':
                "Field_restrict"  # 16 (11,0)
                ,
                'field_name':
                "Field_restrict",
                'field_label':
                "Value restriction",
                'field_value_type':
                "annal:Text",
                'field_render_type':
                "Text",
                'field_value_mode':
                "Value_direct",
                'field_property_uri':
                "annal:field_ref_restriction",
                'field_placement':
                get_placement_classes('small:0,12'),
                'field_ref_type':
                None,
                'field_ref_field':
                None
                # , 'field_placeholder':      "..."
                ,
                'field_default_value':
                "",
                'field_value':
                "",
                'options': []
            })
        ],
        'continuation_url':
        entitydata_list_type_url(coll_id, "_field")
    })
    if field_id:
        context_dict['fields'][0]['row_field_descs'][0][
            'field_value'] = field_id
        context_dict['orig_id'] = field_id
    if orig_id:
        context_dict['orig_id'] = orig_id
    if action:
        context_dict['action'] = action
    return context_dict