コード例 #1
0
class FabricationStreamBlock(StreamBlock):
    title_text_image = TitleTextImageBlock()
    image_title_text = ImageTitleTextBlock()
    title_text_imagelist = TitleTextImageListBlock()
    item_list = ListBlock(TitleAndTextBlock(), icon='list-ul')
    numbered_item_list = ListBlock(TitleAndTextBlock(), icon='list-ol')
    paragraph = RichTextBlock(icon="pilcrow")
    image = ImageChooserBlock()
    video = EmbedBlock()
コード例 #2
0
class BaseStreamBlock(StreamBlock):
    heading_block = HeadingBlock()
    button_block = ButtonBlock()
    image_block = ImageBlock()
    accordion_block = AccordionBlock()
    embed_block = EmbedBlock()
    unorderd_list_block = ListBlock(
        (RichTextBlock(label="Unordered list item")),
        template="blocks/unorderd_list_block.html",
        icon="list-ul")
    orderd_list_block = ListBlock((RichTextBlock(label="Ordered list item")),
                                  template="blocks/orderd_list_block.html",
                                  icon="list-ol")
    rich_text_block = RichTextBlock()
    raw_html_block = RawHTMLBlock()
コード例 #3
0
class SupportersBlock(StructBlock):
    supporters = ListBlock(SupporterBlock)

    class Meta:
        icon = 'fa fa-male'
        template = 'blocks/supporters_block.html'

    def get_context(self, value, parent_context=None):
        context = super(SupportersBlock,
                        self).get_context(value, parent_context=parent_context)
        context['supporters'] = []
        for supporter in value.get('supporters'):
            supp_dict = {
                'name': supporter.get('name'),
                'text': supporter.get('content')
            }
            # for contact in supporter.get('contacts'):
            #     n, w, e = contact.get('name'), contact.get('website'), contact.get('email')
            #     supp_dict['text'] += "<p>{n} <a target='_blank' href='{w}'><i class='fa fa-external-link' aria-hidden='true'></i></a> " \
            #                            "<a target='_blank' href='mailto:{e}'><i class='fa fa-envelope' aria-hidden='true'></i></a></p>".format(n=n, w=w, e=e)
            try:
                supp_dict['image'] = {
                    'url':
                    supporter.get('image').get_rendition(
                        'fill-500x500-c100').url,
                    'name':
                    supporter.get('image').title
                }
            except:
                pass

            context['supporters'] += [supp_dict]
        return context
コード例 #4
0
ファイル: models.py プロジェクト: khashashin/nike_blog
class BlogPage(Page):
    date = models.DateField("Post date")
    intro = models.CharField(max_length=250)
    intro_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True, blank=True,
        on_delete=models.SET_NULL,
        related_name='+'
    )
    last_modified = models.DateField(
        "Date article modified", blank=True, auto_now=True
    )
    body = RichTextField(blank=True)
    slider = StreamField([
        ('image', ListBlock(ImageCarouselBlock(), icon="image")),
    ], blank=True)

    search_fields = Page.search_fields + [
        index.SearchField('intro'),
        index.SearchField('body'),
    ]

    parent_page_types = ['home.HomePage']

    content_panels = Page.content_panels + [
        FieldPanel('date'),
        FieldPanel('intro'),
        ImageChooserPanel('intro_image'),
        FieldPanel('body', classname="full"),
        StreamFieldPanel('slider'),
    ]
コード例 #5
0
class TitleTextImageListBlock(StructBlock):
    image_list = ListBlock(TitleTextImageBlock())
    title = CharBlock()
    text = RichTextBlock(features=['bold', 'italic', 'ul', 'ol', 'link'])

    class Meta:
        template = 'core/blocks/title_text_imagelist.html'
コード例 #6
0
ファイル: blocks.py プロジェクト: anurag-compile/website-1
class StatementBlock(StructBlock):
    title = CharBlock()
    subtitles = ListBlock(CharBlock(required=False), required=False)
    call_to_action = ListBlock(CallToActionBlock(),
                               required=False,
                               help_text='Large button to direct user to '
                               'specific content. Last element '
                               'has greatest emphasis.')
    signup_form = BooleanBlock(required=False,
                               help_text='Check to display an email '
                               'signup form in this frame.')
    caveats = ListBlock(CharBlock(required=False), required=False)

    class Meta:
        icon = 'pilcrow'
        template = 'blocks/statement.html'
コード例 #7
0
class ProtocolBlock(StructBlock):
    complete_pdf = DocumentChooserBlock(label='Complete PDF')
    pdfs = ListBlock(PDFBlock(), label='Chapter PDFs')
    image = ImageBlock()
    version = CharBlock()

    class Meta:
        icon = 'fa fa-newspaper-o'
        template = 'blocks/protocol_block.html'

    def get_context(self, value, parent_context=None):
        context = super(ProtocolBlock,
                        self).get_context(value, parent_context=parent_context)
        context['links'] = []
        for pdf in value.get('pdfs'):
            context['links'] += [{
                'fontawesome': 'file-pdf-o',
                'href': pdf.get('file').url,
                'text': pdf.get('description')
            }]
        try:
            rendition = value.get('image').get_rendition('max-500x500')
            context['image'] = {
                'url': rendition.url,
                'name': value.get('image').title
            }
        except:
            pass
        return context
コード例 #8
0
class ServicePanel(StructBlock):
    services = ListBlock(Service)
    title = CharBlock(help_text='title for the block')

    class Meta:
        icon = "fa-quote-left"
        template = "blocks/services_panel.html"
コード例 #9
0
class ProcessPanel(StructBlock):
    title = CharBlock(help_text='title for the panel')
    processes = ListBlock(ProcessBlock)

    class Meta:
        icon = "fa-quote-left"
        template = "blocks/process.html"
コード例 #10
0
ファイル: blocks.py プロジェクト: anurag-compile/website-1
class DefinitionListBlock(ContentBlock):
    definitions = ListBlock(
        StructBlock([('title', CharBlock()), ('definition', CharBlock())]))

    class Meta:
        icon = 'tag'
        template = 'blocks/definition_list.html'
コード例 #11
0
ファイル: models.py プロジェクト: my2020m/hra
class NavigationSettings(BaseSetting, ClusterableModel):
    header_links = StreamField([
        ('item', OverrideablePageChooserBlock()),
    ],
                               blank=True)
    footer_links = StreamField([
        ('column',
         StructBlock([
             ('column_heading', TextBlock()),
             ('subitems',
              ListBlock(OverrideablePageChooserBlock(label="Sub-item"))),
         ])),
    ],
                               blank=True)
    footer_secondary_links = StreamField([
        ('item', OverrideablePageChooserBlock()),
    ],
                                         blank=True)

    panels = [
        StreamFieldPanel('header_links'),
        StreamFieldPanel('footer_links'),
        StreamFieldPanel('footer_secondary_links'),
    ]

    def save(self, *args, **kwargs):
        super().save(*args, **kwargs)
        purge_esi()

    def delete(self, *args, **kwargs):
        super().delete(*args, **kwargs)
        purge_esi()
コード例 #12
0
class HomePage(Page):
    body = StreamField([('carousel',
                         ListBlock(CarouselFrame(),
                                   icon='cogs',
                                   template='blocks/carousel.html',
                                   help_text='A horizontal '
                                   'scrolling set '
                                   'of images with text '
                                   'overlaid.')),
                        ('short_hero', ShortHeroBlock()),
                        ('section', SectionBlock()),
                        ('quotations', QuotationsBlock()),
                        ('stats', StatsBlock()),
                        ('statement', StatementBlock()),
                        ('team_carousel',
                         ListBlock(TeamMemberBlock(),
                                   icon='group',
                                   template='blocks/'
                                   'team_carousel.'
                                   'html')), ('soundcloud', SoundCloudBlock()),
                        ('section_carousel',
                         ListBlock(ImageChooserBlock(),
                                   icon='image',
                                   template='blocks/'
                                   'section_'
                                   'carousel'
                                   '.html')),
                        ('content_carousel',
                         ListBlock(ContentCarouselFrame(),
                                   icon='image',
                                   template='blocks/'
                                   'content_'
                                   'carousel'
                                   '.html'))],
                       blank=True)
    search_image = models.ForeignKey('wagtailimages.Image',
                                     null=True,
                                     blank=True,
                                     on_delete=models.SET_NULL,
                                     related_name='+')

    social_image = models.ForeignKey('wagtailimages.Image',
                                     null=True,
                                     blank=True,
                                     on_delete=models.SET_NULL,
                                     related_name='+')
コード例 #13
0
class CounterPanel(StructBlock):
    title = CharBlock()
    subtitle = CharBlock()
    counters = ListBlock(CounterBlock)

    class Meta:
        icon = "title"
        template = "blocks/counter_panel.html"
コード例 #14
0
class PapersBlock(StructBlock):
    see_all_offset = IntegerBlock(default=8,
                                  help_text='Show "See all" after x entries.')
    papers = ListBlock(PaperBlock)

    class Meta:
        icon = 'fa fa-file-text'
        template = 'blocks/outcomes_block.html'
コード例 #15
0
ファイル: blocks.py プロジェクト: v-hunt/chiropractor-site
class WhyChooseUsSectionBlock(StructBlock):
    headline = CharBlock(label='Заголовок секции', )
    text = TextBlock(label='Текст')
    cards = ListBlock(_WhyChoseUsBlock, label='Список карточек', max_num=4)

    class Meta:
        min_num = 1
        max_num = 1
        template = 'home/blocks/why_choose_us_section_block.html'
コード例 #16
0
ファイル: blocks.py プロジェクト: v-hunt/chiropractor-site
class DiseaseSectionBlock(StructBlock):
    headline = CharBlock(label='Заголовок секции', )
    text = TextBlock(label='Текст')
    diseases = ListBlock(_SingleDiseaseBlock, label='Список заболеваний')

    class Meta:
        min_num = 1
        max_num = 1
        template = 'home/blocks/disease_section_block.html'
コード例 #17
0
ファイル: blocks.py プロジェクト: eea/eea.docker.flis
class InstitutionsBlock(StructBlock):
    block_heading = CharBlock(required=True)

    items = ListBlock(
        SnippetChooserBlock(target_model=Institution, required=True))

    class Meta:
        image = 'pages/images/streamfield_blocks/institutions.jpg'
        template = 'pages/streamfield_blocks/institutions.html'
コード例 #18
0
class OrderedListBlock(StructBlock):
    title = CharBlock(required=False)
    items = ListBlock(
        StructBlock([('title', CharBlock()), ('description', TextBlock())]))
    label = CharBlock(required=False)
    page = PageChooserBlock(required=False)

    class Meta:
        template = 'cms/blocks/ordered_list_block.html'
コード例 #19
0
ファイル: blocks.py プロジェクト: eea/eea.docker.flis
class TopicGridBlock(StructBlock):
    block_heading = CharBlock(required=True)
    larger_images = BooleanBlock(default=False, required=False)
    items = ListBlock(PageChooserBlock(target_model='topics.TopicIndexPage'))
    read_more_button = ReadMoreButtonBlock(required=False)

    class Meta:
        image = 'pages/images/streamfield_blocks/topic_grid.jpg'
        template = 'pages/streamfield_blocks/topic_grid.html'
コード例 #20
0
ファイル: blocks.py プロジェクト: anurag-compile/website-1
class SkillbarBlock(ContentBlock):

    skills = ListBlock(
        StructBlock([('skill_percentage', CharBlock()),
                     ('skill_name', CharBlock())]))

    class Meta:
        icon = 'form'
        template = 'blocks/skillbar.html'
コード例 #21
0
class FeaturedPageBlock(StructBlock):
    title = CharBlock(required=False)
    starred_page = PageChooserBlock(required=False,
                                    help_text='''
        Leave this blank to randomise the starred item
        from the items below.''')
    items = ListBlock(PageChooserBlock(), required=False)

    class Meta:
        template = 'cms/blocks/featured_page_block.html'
コード例 #22
0
ファイル: blocks.py プロジェクト: anurag-compile/website-1
class TeamMemberBlock(StructBlock):
    name = CharBlock()
    title = CharBlock(required=False)
    qualifications = CharBlock(required=False)
    image = ImageChooserBlock()
    links = ListBlock(LinkBlock(), required=False)

    class Meta:
        icon = 'user'
        template = 'blocks/team_member.html'
コード例 #23
0
class ImageListBlock(StructBlock):
    title = CharBlock(required=False)
    items = ListBlock(
        StructBlock([('title', CharBlock()), ('subtitle', CharBlock()),
                     ('description', RichTextBlock()),
                     ('image', ImageChooserBlock()),
                     ('page', PageChooserBlock(required=False))]))

    class Meta:
        template = 'cms/blocks/image_list_block.html'
コード例 #24
0
class AccordionBlock(StructBlock):
    class Meta:
        icon = "arrow-down-big"
        template = "blocks/accordion_block.html"

    accordion_group_title = TextBlock(required=False, blank=True, default="")
    accordion_items = ListBlock(
        StructBlock([
            ('accordion_title', CharBlock(required=True)),
            ('accordion_content', RichTextBlock(required=True)),
        ]))
コード例 #25
0
ファイル: blocks.py プロジェクト: demiurg/geokit
class VisualizationGroupBlock(StructBlock):
    visualizations = ListBlock(VisualizationBlock)

    class Meta:
        template = 'builder/blocks/visualization.html'

    def render(self, value):
        # Iterate through vis blocks and grab variable dimensions.
        # Validate that they have a common dimension, and then pass
        # the union of their dimensions to the VisGroup react component.
        return super(VisualizationGroupBlock, self).render(value)
コード例 #26
0
class GalleriesPage(Page):
    body = StreamField([
        ('image', ListBlock(ImageBlock(), template='blocks/galleries.html')),
    ],
                       blank=True,
                       null=True)

    content_panels = Page.content_panels + [StreamFieldPanel('body')]
    template = 'home/default_page.html'
    parent_page_types = ['EventListPage']
    subpage_types = []
コード例 #27
0
class ImageGridBlock(StructBlock):
    title = CharBlock(required=False)
    items = ListBlock(
        StructBlock([('image', ImageChooserBlock()),
                     ('url', URLBlock(required=False)),
                     ('page', PageChooserBlock(required=False))]))

    class Meta:
        help_text = '''
        Use either URL or page, if both are filled in URL takes precedence.'''
        template = 'cms/blocks/image_grid_block.html'
コード例 #28
0
ファイル: blocks.py プロジェクト: anurag-compile/website-1
class SidebarCallOutBlock(StructBlock):
    title = CharBlock()
    body = RichTextBlock(required=False)
    icon = CharBlock(required=False,
                     help_text='Text block passed as the icon selected. '
                     'Choose between Ionic Icons or FontAwesome.')
    links = ListBlock(LinkBlock(), required=False)

    class Meta:
        icon = 'radio-empty'
        template = 'blocks/sidebar_callout.html'
コード例 #29
0
ファイル: blocks.py プロジェクト: v-hunt/chiropractor-site
class SelectedMethodsSection(StructBlock):
    headline = CharBlock(label='Заголовок секции', )
    text = TextBlock(label='Текст')
    selected_methods = ListBlock(
        _MethodBlock,
        label='Методики',
        min_num=3,
        max_num=3,
    )

    class Meta:
        template = 'home/blocks/selected_methods_section_block.html'
コード例 #30
0
ファイル: custom_blocks.py プロジェクト: jianshen92/egg_cms
class ImageGrid(StructBlock):
    images = ListBlock(ImageGridItem())
    # width = WidthChoiceBlock(required=True, default="width-100")
    width = ChoiceBlock(choices=[
        ('width-100', '100% stretched'),
        ('width-150', '150% stretched'),
        ('width-50', '50% stretched')
    ], default='width-100', label='Grid width')

    class Meta:
        template = 'base/image_grid_block.html'
        form_classname = "fieldname-image_grid"