Exemplo n.º 1
0
 def SCHEMA(cls, title, announcement_email):
     schema = FieldRegistry(title)
     schema.add_property(SchemaField(
         'key', 'ID', 'string', editable=False,
         extra_schema_dict_values={'className': 'inputEx-Field keyHolder'}))
     schema.add_property(SchemaField(
         'title', 'Title', 'string', optional=True))
     schema.add_property(SchemaField(
         'html', 'Body', 'html', optional=True,
         extra_schema_dict_values={
             'supportCustomTags': tags.CAN_USE_DYNAMIC_TAGS.value,
             'excludedCustomTags': tags.EditorBlacklists.COURSE_SCOPE}))
     schema.add_property(SchemaField(
         'date', 'Date', 'date',
         optional=True, extra_schema_dict_values={
             '_type': 'date', 'dateFormat': 'Y-m-d',
             'valueFormat': 'Y-m-d'}))
     schema.add_property(FieldArray(
         'label_groups', 'Labels',
          item_type=LabelGroupsHelper.make_labels_group_schema_field(),
          extra_schema_dict_values={
              'className': 'inputEx-Field label-group-list'}))
     schema.add_property(SchemaField(
         'send_email', 'Send Email', 'boolean', optional=True,
         extra_schema_dict_values={
             'description':
                 AnnouncementsItemRESTHandler.get_send_email_description(
                     announcement_email)}))
     schema.add_property(SchemaField(
         'is_draft', 'Status', 'boolean',
         select_data=[
             (True, resources_display.DRAFT_TEXT),
             (False, resources_display.PUBLISHED_TEXT)],
         extra_schema_dict_values={'className': 'split-from-main-group'}))
     return schema
 def SCHEMA(cls):
     schema = FieldRegistry('Announcement',
         extra_schema_dict_values={
             'className': 'inputEx-Group new-form-layout'})
     schema.add_property(SchemaField(
         'key', 'ID', 'string', editable=False, hidden=True))
     schema.add_property(SchemaField(
         'title', 'Title', 'string', optional=True))
     schema.add_property(SchemaField(
         'html', 'Body', 'html', optional=True,
         extra_schema_dict_values={
             'supportCustomTags': tags.CAN_USE_DYNAMIC_TAGS.value,
             'excludedCustomTags': tags.EditorBlacklists.COURSE_SCOPE}))
     schema.add_property(SchemaField(
         'date', 'Date', 'string',
         optional=True, extra_schema_dict_values={
             '_type': 'datetime',
             'className': 'inputEx-CombineField gcb-datetime '
             'inputEx-fieldWrapper date-only'}))
     schema.add_property(FieldArray(
         'label_groups', 'Labels',
          item_type=LabelGroupsHelper.make_labels_group_schema_field(),
          extra_schema_dict_values={
              'className': 'inputEx-Field label-group-list'}))
     schema.add_property(SchemaField(
         'is_draft', 'Status', 'boolean',
         select_data=[
             (True, resources_display.DRAFT_TEXT),
             (False, resources_display.PUBLISHED_TEXT)],
         extra_schema_dict_values={'className': 'split-from-main-group'}))
     return schema
Exemplo n.º 3
0
 def SCHEMA(cls, title, announcement_email):
     schema = FieldRegistry(title)
     schema.add_property(
         SchemaField('key',
                     'ID',
                     'string',
                     editable=False,
                     extra_schema_dict_values={
                         'className': 'inputEx-Field keyHolder'
                     }))
     schema.add_property(
         SchemaField('title', 'Title', 'string', optional=True))
     schema.add_property(
         SchemaField('html',
                     'Body',
                     'html',
                     optional=True,
                     extra_schema_dict_values={
                         'supportCustomTags':
                         tags.CAN_USE_DYNAMIC_TAGS.value,
                         'excludedCustomTags':
                         tags.EditorBlacklists.COURSE_SCOPE
                     }))
     schema.add_property(
         SchemaField('date',
                     'Date',
                     'date',
                     optional=True,
                     extra_schema_dict_values={
                         '_type': 'date',
                         'dateFormat': 'Y-m-d',
                         'valueFormat': 'Y-m-d'
                     }))
     schema.add_property(
         FieldArray(
             'label_groups',
             'Labels',
             item_type=LabelGroupsHelper.make_labels_group_schema_field(),
             extra_schema_dict_values={
                 'className': 'inputEx-Field label-group-list'
             }))
     schema.add_property(
         SchemaField(
             'send_email',
             'Send Email',
             'boolean',
             optional=True,
             extra_schema_dict_values={
                 'description':
                 AnnouncementsItemRESTHandler.get_send_email_description(
                     announcement_email)
             }))
     schema.add_property(
         SchemaField('is_draft',
                     'Status',
                     'boolean',
                     select_data=[(True, resources_display.DRAFT_TEXT),
                                  (False, resources_display.PUBLISHED_TEXT)
                                  ],
                     extra_schema_dict_values={
                         'className': 'split-from-main-group'
                     }))
     return schema