コード例 #1
0
    def get_milestone_array_schema(cls,
                                   milestone,
                                   desc_fmt,
                                   trigger_cls=None,
                                   scope_css=None,
                                   avail_select=None):
        title = availability_options.option_to_title(milestone)

        if trigger_cls is None:
            trigger_cls = triggers.MilestoneTrigger
        if avail_select is None:
            avail_select = availability_options.COURSE_WITH_NONE_SELECT_DATA
        item_type = cls.get_milestone_trigger_schema(milestone, avail_select,
                                                     trigger_cls)

        if scope_css is None:
            scope_css = cls._COURSE_WIDE_SCOPE_CSS
        extra_css = (scope_css + ' ' +
                     availability_options.option_to_css(milestone))
        classname = trigger_cls.array_css(extra_css=extra_css)
        wrapper_classname = trigger_cls.array_wrapper_css(extra_css=extra_css)
        ms_text = availability_options.option_to_text(milestone)
        desc = desc_fmt.format(milestone=ms_text)
        return schema_fields.FieldArray(milestone,
                                        title,
                                        desc,
                                        item_type=item_type,
                                        optional=True,
                                        extra_schema_dict_values={
                                            'className': classname,
                                            'wrapperClassName':
                                            wrapper_classname
                                        })
コード例 #2
0
    def get_milestone_array_schema(cls, milestone, desc_fmt, trigger_cls=None,
                                   scope_css=None, avail_select=None):
        title = availability_options.option_to_title(milestone)

        if trigger_cls is None:
            trigger_cls = triggers.MilestoneTrigger
        if avail_select is None:
            avail_select = availability_options.COURSE_WITH_NONE_SELECT_DATA
        item_type = cls.get_milestone_trigger_schema(
            milestone, avail_select, trigger_cls)

        if scope_css is None:
            scope_css = cls._COURSE_WIDE_SCOPE_CSS
        extra_css = (scope_css + ' ' +
                     availability_options.option_to_css(milestone))
        classname = trigger_cls.array_css(extra_css=extra_css)
        wrapper_classname = trigger_cls.array_wrapper_css(
            extra_css=extra_css)
        ms_text = availability_options.option_to_text(milestone)
        desc = desc_fmt.format(milestone=ms_text)
        return schema_fields.FieldArray(
            milestone, title, desc, item_type=item_type, optional=True,
            extra_schema_dict_values={
                'className': classname,
                'wrapperClassName': wrapper_classname})
コード例 #3
0
    def get_milestone_trigger_schema(cls, milestone,
                                     avail_select, trigger_cls):
        title = '{} Availability'.format(
            availability_options.option_to_title(milestone))
        desc = messages.MILESTONE_TRIGGER_DESCRIPTION_FMT.format(milestone)
        milestone_trigger = schema_fields.FieldRegistry(title,
            description=services.help_urls.make_learn_more_message(
                desc, messages.MILESTONE_TRIGGERS_LEARN_MORE),
            extra_schema_dict_values={
                'className': trigger_cls.registry_css()})
        milestone_trigger.add_property(schema_fields.SchemaField(
            'milestone', '', 'string', i18n=False, hidden=True,
            extra_schema_dict_values={
                'className': trigger_cls.milestone_css()}))

        ms_text = availability_options.option_to_text(milestone)
        title = 'At {}, on this date & UTC hour:'.format(ms_text)
        desc = messages.MILESTONE_TRIGGER_WHEN_DESC_FMT.format(
            ms_text, ms_text)
        milestone_trigger.add_property(schema_fields.SchemaField(
            cls.DATETIME_FIELD, title, 'datetime', description=desc,
            i18n=False, optional=True, extra_schema_dict_values={
                'className': trigger_cls.when_css()}))

        title = 'Change {} availability to:'.format(milestone.split('_')[0])
        desc = messages.MILESTONE_TRIGGER_AVAIL_DESC_FMT.format(
            ms_text, availability_options.NONE_SELECTED_TITLE, ms_text)
        milestone_trigger.add_property(schema_fields.SchemaField(
            cls.AVAILABILITY_FIELD, title, 'string', description=desc,
            i18n=False, optional=True,
            select_data=avail_select, extra_schema_dict_values={
                'className': trigger_cls.availability_css()}))
        return milestone_trigger
コード例 #4
0
ファイル: availability.py プロジェクト: blckt/lib
    def get_milestone_trigger_schema(cls, milestone, avail_select,
                                     trigger_cls):
        title = '{} Availability'.format(
            availability_options.option_to_title(milestone))
        desc = messages.MILESTONE_TRIGGER_DESCRIPTION_FMT.format(milestone)
        milestone_trigger = schema_fields.FieldRegistry(
            title,
            description=services.help_urls.make_learn_more_message(
                desc, messages.MILESTONE_TRIGGERS_LEARN_MORE),
            extra_schema_dict_values={'className': trigger_cls.registry_css()})
        milestone_trigger.add_property(
            schema_fields.SchemaField('milestone',
                                      '',
                                      'string',
                                      i18n=False,
                                      hidden=True,
                                      extra_schema_dict_values={
                                          'className':
                                          trigger_cls.milestone_css()
                                      }))

        ms_text = availability_options.option_to_text(milestone)
        title = 'At {}, on this date & UTC hour:'.format(ms_text)
        desc = messages.MILESTONE_TRIGGER_WHEN_DESC_FMT.format(
            ms_text, ms_text)
        milestone_trigger.add_property(
            schema_fields.SchemaField(
                cls.DATETIME_FIELD,
                title,
                'datetime',
                description=desc,
                i18n=False,
                optional=True,
                extra_schema_dict_values={'className':
                                          trigger_cls.when_css()}))

        title = 'Change {} availability to:'.format(milestone.split('_')[0])
        desc = messages.MILESTONE_TRIGGER_AVAIL_DESC_FMT.format(
            ms_text, availability_options.NONE_SELECTED_TITLE, ms_text)
        milestone_trigger.add_property(
            schema_fields.SchemaField(cls.AVAILABILITY_FIELD,
                                      title,
                                      'string',
                                      description=desc,
                                      i18n=False,
                                      optional=True,
                                      select_data=avail_select,
                                      extra_schema_dict_values={
                                          'className':
                                          trigger_cls.availability_css()
                                      }))
        return milestone_trigger
コード例 #5
0
 def get_milestone_trigger_schema(cls, milestone, avail_select,
                                  trigger_cls):
     title = '{} Availability'.format(
         availability_options.option_to_title(milestone))
     desc = messages.MILESTONE_TRIGGER_DESCRIPTION_FMT.format(milestone)
     milestone_trigger = schema_fields.FieldRegistry(
         title,
         description=services.help_urls.make_learn_more_message(
             desc, messages.MILESTONE_TRIGGERS_LEARN_MORE),
         extra_schema_dict_values={'className': trigger_cls.registry_css()})
     milestone_trigger.add_property(
         schema_fields.SchemaField('milestone',
                                   None,
                                   'string',
                                   i18n=False,
                                   hidden=True,
                                   extra_schema_dict_values={
                                       'className':
                                       trigger_cls.milestone_css()
                                   }))
     milestone_trigger.add_property(
         schema_fields.SchemaField(
             cls.DATETIME_FIELD,
             None,
             'datetime',
             i18n=False,
             optional=True,
             extra_schema_dict_values={'className':
                                       trigger_cls.when_css()}))
     milestone_trigger.add_property(
         schema_fields.SchemaField(cls.AVAILABILITY_FIELD,
                                   None,
                                   'string',
                                   i18n=False,
                                   optional=True,
                                   select_data=avail_select,
                                   extra_schema_dict_values={
                                       'className':
                                       trigger_cls.availability_css()
                                   }))
     return milestone_trigger
コード例 #6
0
 def get_milestone_trigger_schema(cls, milestone,
                                  avail_select, trigger_cls):
     title = '{} Availability'.format(
         availability_options.option_to_title(milestone))
     desc = messages.MILESTONE_TRIGGER_DESCRIPTION_FMT.format(milestone)
     milestone_trigger = schema_fields.FieldRegistry(title,
         description=services.help_urls.make_learn_more_message(
             desc, messages.MILESTONE_TRIGGERS_LEARN_MORE),
         extra_schema_dict_values={
             'className': trigger_cls.registry_css()})
     milestone_trigger.add_property(schema_fields.SchemaField(
         'milestone', None, 'string', i18n=False, hidden=True,
         extra_schema_dict_values={
             'className': trigger_cls.milestone_css()}))
     milestone_trigger.add_property(schema_fields.SchemaField(
         cls.DATETIME_FIELD, None, 'datetime',
         i18n=False, optional=True, extra_schema_dict_values={
             'className': trigger_cls.when_css()}))
     milestone_trigger.add_property(schema_fields.SchemaField(
         cls.AVAILABILITY_FIELD, None, 'string',
         i18n=False, optional=True,
         select_data=avail_select, extra_schema_dict_values={
             'className': trigger_cls.availability_css()}))
     return milestone_trigger