Example #1
0
class RelatedLinks(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    paragraph = blocks.RichTextBlock(required=False)
    links = blocks.ListBlock(atoms.Hyperlink())

    class Meta:
        icon = 'grip'
        template = '_includes/molecules/related-content.html'
        label = 'Related content'
Example #2
0
class PersonBlock(blocks.StructBlock):
    first_name = blocks.CharBlock()
    surname = blocks.CharBlock()        
    email = blocks.EmailBlock()
    photo = ImageChooserBlock(required=False)
    biography = blocks.RichTextBlock()

    class Meta:
        icon = 'user'
Example #3
0
class HomePageWithHtml(Page):
    body = StreamField([
        ('rich_text', blocks.RichTextBlock(icon='doc-full', label='Rich Text')),
        ('html', blocks.RawHTMLBlock(icon='site', label='HTML'))
    ])

    content_panels = Page.content_panels + [
        StreamFieldPanel('body')
    ]
Example #4
0
class Expandable(BaseExpandable):
    content = blocks.StreamBlock([
        ('paragraph', blocks.RichTextBlock(required=False)),
        ('links', atoms.Hyperlink()),
        ('email', ContactEmail()),
        ('phone', ContactPhone()),
        ('address', ContactAddress()),
    ],
                                 blank=True)
Example #5
0
class CareerItemBlock(blocks.StructBlock):
    url = blocks.URLBlock(max_length=250, default='', label='URL')
    name = blocks.CharBlock(max_length=150, default='', label='Firma')
    start_date = blocks.DateBlock(label='Datum Antritt')
    end_date = blocks.DateBlock(label='Datum Austritt', required=False)
    text = blocks.RichTextBlock(label='Beschreibung')

    class Meta:
        template = 'blocks/career_item.html'
Example #6
0
class CallToAction(blocks.StructBlock):
    slug_text = blocks.CharBlock(required=False)
    paragraph_text = blocks.RichTextBlock(required=False)
    button = atoms.Hyperlink()

    class Meta:
        template = '_includes/molecules/call-to-action.html'
        icon = 'grip'
        label = 'Call to action'
Example #7
0
class CarouselBlock(blocks.StructBlock):
    """ Single Carousel slide"""
    image = ImageChooserBlock()
    caption = blocks.CharBlock()
    text = blocks.RichTextBlock()
    link = blocks.PageChooserBlock()

    class Meta:
        template = 'home/carousel_block.html'
Example #8
0
class HomePage(Page):
    tagline = models.CharField(max_length=255, null=True, blank=True)
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('image', ImageChooserBlock()),
        ('embeded_content', EmbedBlock()),
        ('raw_HTML', RawHTMLBlock()),
    ])
Example #9
0
class PomahejPage(Page):
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()), ('image', ImageChooserBlock()),
        ('embed', EmbedBlock()), ('rawHtml', blocks.RawHTMLBlock()),
        ('medailon',
         blocks.StructBlock([
             ('title', blocks.CharBlock(required=True)),
             ('pic', ImageChooserBlock(required=True)),
             ('description', blocks.RichTextBlock(required=True)),
         ],
                            template='blocks/medailon.html',
                            icon='user'))
    ])

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]
Example #10
0
class SliderBlock(blocks.StructBlock):

    afbeeldingen = blocks.ListBlock(CarouselImageBlock())
    bijhorende_tekst = blocks.RichTextBlock()

    class Meta:
        template = 'home/blocks/slider_block.html'
        label = 'slider'
        icon = 'image'
Example #11
0
class SpotlightBubbleBlock(StructBlockWithStyle):
    image = ImageChooserBlock()
    title = blocks.CharBlock(required=True, max_length=35)
    description = blocks.RichTextBlock(required=True)

    class Meta:
        template = 'common/blocks/spotlight_bubble_block.html'
        icon = 'image'
        label = 'Spotlight Bubble Block'
Example #12
0
def get_slide_detail(album):
    response_data = {}
    response_data['slides'] = []
    photographers = []
    slide_photo_graphers = []
    for slide in album.slides.all():
        slide_photo_graphers.extend(
            map(
                lambda photographer_name: photographer_name.name.encode('UTF-8'
                                                                        ),
                slide.image.photographers.all()))
    photographers_of_album = list(set(slide_photo_graphers))
    for index, slide in enumerate(album.slides.all(), start=0):
        slide_dict = dict([('type', 'image'), ('show_title', "True"),
                           ('album_title', album.title)])
        slide_dict['src'] = slide.image.file.url
        slide_dict['src_resized'] = slide.image.get_rendition('height-876').url
        block = blocks.RichTextBlock()
        description_value = RichText(slide.description)
        slide_dict['description'] = block.render(description_value)
        slide_dict['album_description'] = album.description
        slide_dict['url'] = album.get_absolute_url()
        slide_dict['slide_photographer'] = map(
            lambda photographer_name: photographer_name.name.encode('UTF-8'),
            slide.image.photographers.all())
        if index == 0:
            slide_dict['slide_photographer'] = photographers_of_album
            print index
        photographers.extend(set(slide.image.photographers.all()))
        if album.first_published_at:
            published_date = datetime.datetime.strptime(
                str(album.first_published_at)[:10], "%Y-%m-%d")
        else:
            published_date = datetime.datetime.now()
        date = published_date.strftime('%d %b,%Y')
        slide_dict['image_captured_date'] = date
        image_location = slide.image.locations.first()
        slide_dict['slide_location'] = "%s, %s" % (
            image_location.district,
            image_location.state) if image_location else ''
        slide_dict['track_id'] = slide.audio
        response_data['slides'].append(slide_dict)

    response_data['authors'] = []
    for photographer in set(photographers):
        photographer_dict = dict([
            ('type', 'inline'), ('show_title', "False"),
            ('name', photographer.name), ('bio', photographer.bio_en),
            ('twitter_username', photographer.twitter_handle),
            ('facebook_username', photographer.facebook_username),
            ('email', photographer.email), ('website', photographer.website),
            ('author_url',
             reverse('author-detail', kwargs={'slug': photographer.slug}))
        ])
        response_data['authors'].append(photographer_dict)
    return JsonResponse(response_data)
Example #13
0
class PageCardBlock(blocks.StructBlock):
    """ Represents the card for a page. Has a link, text and some """
    """ image. """
    image = ImageChooserBlock()
    link = blocks.PageChooserBlock()
    caption = blocks.CharBlock()
    text = blocks.RichTextBlock()

    class Meta:
        template = 'home/page_card_block.html'
Example #14
0
class FeaturedMenuContent(blocks.StructBlock):
    draft = blocks.BooleanBlock(
        required=False,
        default=False,
        label='Mark block as draft',
        help_text='If checked, this block will only show '
        'on our sharing site (Content).')
    link = Link(required=False, label="H4 link")
    body = blocks.RichTextBlock(required=False)
    image = atoms.ImageBasic(required=False)
Example #15
0
class GuidelinesPage(Page):
    strap = models.TextField(blank=True)
    template = 'core/guidelines.html'
    content = StreamField([
        ("heading_title", blocks.CharBlock()),
        ("heading_content", blocks.RichTextBlock()),
        ("sub_section_with_heading", SubSectionBlock()),
        ("sub_section_without_heading", blocks.RichTextBlock()),
    ],
                          blank=True)
    language = models.CharField(max_length=7,
                                choices=settings.LANGUAGES,
                                default="English")

    content_panels = Page.content_panels + [
        FieldPanel('strap'),
        MultiFieldPanel([StreamFieldPanel('content')],
                        heading="Content",
                        classname="collapsible "),
        FieldPanel('language'),
    ]

    search_fields = Page.search_fields + [
        index.FilterField('content', partial_match=True),
        index.SearchField('content'),
        index.FilterField('language'),
        index.SearchField('language')
    ]

    def get_context(self, request, *args, **kwargs):
        guideline_dict = construct_guidelines(self.content)
        return {
            'page': self,
            'request': request,
            'page_content': guideline_dict,
            "tab": 'about-pari'
        }

    def __str__(self):
        return _("GuidelinesPage")

    def get_absolute_url(self):
        return reverse("static_page", kwargs={"slug": self.slug})
Example #16
0
class AccordionBlock(blocks.StructBlock):
    title = blocks.CharBlock(
        label = 'Titel',
        max_length = 50,
        help_text = 'Tekst in de titel.',
    )
    content = blocks.RichTextBlock(
        label = 'Inhoud',
        help_text = 'Inhoud van de tab.',
    )
Example #17
0
class BigSideImageBlock(blocks.StructBlock):
    image = ImageChooserBlock(label='Изображение', required=True)
    text = blocks.RichTextBlock(label='Текст',
                                editor='tinymce',
                                language='ru',
                                required=True)

    class Meta:
        label = 'Большое фото, описание справа'
        template = 'content/stream_fields/big_side_image.html'
Example #18
0
class BankingComparisonBlock(StructBlock):
    title = blocks.CharBlock()
    body = blocks.RichTextBlock()
    url = blocks.URLBlock()
    image = ImageChooserBlock()

    class Meta:
        icon = "form"
        template = "banking/blocks/banking_comparison.html"
        label = "Banking Comparison Block"
Example #19
0
class SimpleBodyBlock(blocks.StreamBlock):
    Heading = HeadingBlock()
    Paragraph = ParagraphBlock()
    Image = ImageBlock()
    Embed = EmbedBlock(icon="site")
    List = blocks.ListBlock(blocks.RichTextBlock(label="item"), icon="list-ul")
    Sharable = SharableBlock()
    PullQuote = PullQuoteBlock()
    Quote = SimpleQuoteBlock()
    RelatedItems = RelatedItemsBlock()
Example #20
0
class ImageText2575(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    body = blocks.RichTextBlock(required=False)
    image = atoms.ImageBasic()
    links = blocks.ListBlock(atoms.Hyperlink(), required=False)
    has_rule = blocks.BooleanBlock(required=False)

    class Meta:
        icon = 'image'
        template = '_includes/molecules/image-text-25-75.html'
Example #21
0
class StreamPage(Page):
    """just a testing page"""
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('image', ImageChooserBlock()),
    ])
    content_panels = Page.content_panels + [
        StreamFieldPanel('body')
    ]
Example #22
0
class GuidelinesPage(Page):
    strap = models.TextField(blank=True)
    content = StreamField([
        ("heading_title", blocks.CharBlock()),
        ("heading_content", blocks.RichTextBlock()),
        ("sub_section_with_heading", SubSectionBlock()),
        ("sub_section_without_heading", blocks.RichTextBlock()),
    ],
                          blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('strap'),
        MultiFieldPanel([StreamFieldPanel('content')],
                        heading="Content",
                        classname="collapsible "),
    ]

    def __str__(self):
        return _("GuidelinesPage")
Example #23
0
class ResourceList(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    body = blocks.RichTextBlock(required=False)
    has_top_rule_line = blocks.BooleanBlock(
        default=False,
        required=False,
        help_text='Check this to add a horizontal rule line above this block.'
    )
    image = atoms.ImageBasic(required=False)
    actions_column_width = blocks.ChoiceBlock(
        label='Width of "Actions" column',
        required=False,
        help_text='Choose the width in % that you wish to set '
                  'the Actions column in a resource list.',
        choices=[
            ('70', '70%'),
            ('66', '66%'),
            ('60', '60%'),
            ('50', '50%'),
            ('40', '40%'),
            ('33', '33%'),
            ('30', '30%'),
        ],
    )
    show_thumbnails = blocks.BooleanBlock(
        required=False,
        help_text='If selected, each resource in the list will include a '
                  '150px-wide image from the resource\'s thumbnail field.'
    )
    actions = blocks.ListBlock(blocks.StructBlock([
        ('link_label', blocks.CharBlock(
            help_text='E.g., "Download" or "Order free prints"'
        )),
        ('snippet_field', blocks.ChoiceBlock(
            choices=[
                ('related_file', 'Related file'),
                ('alternate_file', 'Alternate file'),
                ('link', 'Link'),
                ('alternate_link', 'Alternate link'),
            ],
            help_text='The field that the action link should point to'
        )),
    ]))
    tags = blocks.ListBlock(
        blocks.CharBlock(label='Tag'),
        help_text='Enter tag names to filter the snippets. For a snippet to '
                  'match and be output in the list, it must have been tagged '
                  'with all of the tag names listed here. The tag names '
                  'are case-insensitive.'
    )

    class Meta:
        label = 'Resource List'
        icon = 'table'
        template = '_includes/organisms/resource-list.html'
Example #24
0
class HowWeWorkPage(Page):
    header_text = models.CharField(max_length=255)
    header_image = models.ForeignKey('wagtailimages.Image',
                                     null=True,
                                     blank=True,
                                     on_delete=models.SET_NULL,
                                     related_name='+')
    how_we_work_intro = RichTextField()
    what_we_do_title = models.CharField(max_length=255)
    what_we_do_image = models.ForeignKey('wagtailimages.Image',
                                         null=True,
                                         blank=True,
                                         on_delete=models.SET_NULL,
                                         related_name='+')
    what_we_do_content = StreamField([('what_we_do_content',
                                       blocks.StreamBlock([
                                           ('image', ImageChooserBlock()),
                                           ('title', blocks.RichTextBlock()),
                                           ('description',
                                            blocks.RichTextBlock()),
                                       ]))])

    the_process_title = RichTextField()

    the_process_content = StreamField([
        ('process_content',
         blocks.StructBlock([('title', blocks.CharBlock()),
                             ('icon_classes', blocks.CharBlock()),
                             ('description', blocks.RichTextBlock())],
                            template='streams/process_content.html'))
    ])

    content_panels = Page.content_panels + [
        FieldPanel('header_text'),
        ImageChooserPanel('header_image'),
        FieldPanel('how_we_work_intro'),
        FieldPanel('what_we_do_title'),
        ImageChooserPanel('what_we_do_image'),
        StreamFieldPanel('what_we_do_content'),
        FieldPanel('the_process_title'),
        StreamFieldPanel('the_process_content'),
    ]
Example #25
0
class InfoUnit(blocks.StructBlock):
    image = atoms.ImageBasic(required=False, )

    heading = HeadingBlock(required=False, default={'level': 'h3'})

    body = blocks.RichTextBlock(blank=True, required=False)
    links = blocks.ListBlock(atoms.Hyperlink(), required=False)

    class Meta:
        icon = 'image'
        template = '_includes/molecules/info-unit.html'
Example #26
0
class SnippetList(blocks.StructBlock):
    heading = blocks.CharBlock(required=False)
    body = blocks.RichTextBlock(required=False)
    has_top_rule_line = blocks.BooleanBlock(
        default=False,
        required=False,
        help_text=('Check this to add a horizontal rule line to top of '
                   'snippet list.'))
    image = atoms.ImageBasic(required=False)
    actions_column_width = blocks.ChoiceBlock(
        label='Width of "Actions" column',
        required=False,
        help_text='Choose the width in % that you wish to set '
        'the Actions column in a snippet list.',
        choices=[
            ('70', '70%'),
            ('66', '66%'),
            ('60', '60%'),
            ('50', '50%'),
            ('40', '40%'),
            ('33', '33%'),
            ('30', '30%'),
        ],
    )

    snippet_type = blocks.ChoiceBlock(choices=get_snippet_type_choices,
                                      required=True)
    show_thumbnails = blocks.BooleanBlock(
        required=False,
        help_text='If selected, each snippet in the list will include a 150px-'
        'wide image from the snippet\'s thumbnail field.')
    actions = blocks.ListBlock(
        blocks.StructBlock([
            ('link_label',
             blocks.CharBlock(
                 help_text='E.g., "Download" or "Order free prints"')),
            ('snippet_field',
             blocks.ChoiceBlock(
                 choices=get_snippet_field_choices,
                 help_text=
                 'Corresponds to the available fields for the selected '
                 'snippet type.')),
        ]))

    tags = blocks.ListBlock(
        blocks.CharBlock(label='Tag'),
        help_text='Enter tag names to filter the snippets. For a snippet to '
        'match and be output in the list, it must have been tagged '
        'with all of the tag names listed here. The tag names '
        'are case-insensitive.')

    class Meta:
        icon = 'table'
        template = '_includes/organisms/snippet-list.html'
Example #27
0
class HomePageSection(Page):
    main_image = models.ForeignKey(CustomImage,
                                   null=True,
                                   blank=True,
                                   on_delete=models.SET_NULL,
                                   related_name='+')
    orientation = models.CharField(max_length=50,
                                   choices=(('left', 'LEFT'),
                                            ('right', 'RIGHT'), ('centre',
                                                                 'CENTRE'),
                                            ('freeform', 'FREEFORM')),
                                   default='left')
    link_page = models.ForeignKey('wagtailcore.Page',
                                  null=True,
                                  blank=True,
                                  on_delete=models.SET_NULL,
                                  related_name='+')
    button_text = models.CharField(max_length=255,
                                   help_text="Button title",
                                   null=True,
                                   blank=True,
                                   default="button")
    sectionClassName = models.SlugField(max_length=100,
                                        help_text="no spaces",
                                        default="homepage-section")
    body = RichTextField(blank=True)
    streamBody = StreamField([
        ('heading', blocks.CharBlock(classname="full-title")),
        ('paragraph', blocks.RichTextBlock()),
        ('image', ImageChooserBlock()),
        ('markup', RawHTMLBlock()),
    ],
                             null=True,
                             blank=True)

    sectionBackgroundSelector = models.ForeignKey('wagtaildocs.Document',
                                                  null=True,
                                                  blank=True,
                                                  on_delete=models.SET_NULL,
                                                  related_name='+')
    content_panels = Page.content_panels + [
        FieldPanel('orientation'),
        FieldPanel('sectionClassName'),
        MultiFieldPanel(IndexLink.panels, "Related index page"),
        ImageChooserPanel('main_image'),
        DocumentChooserPanel('sectionBackgroundSelector'),
        FieldPanel('body', classname="section-body"),
        StreamFieldPanel('streamBody'),
        InlinePanel('related_links', label="Section link items"),
    ]

    def get_context(self, request):
        context = super(HomePageSection, self).get_context(request)
        return context
Example #28
0
class UnorderedListBlock(blocks.StructBlock):
    bullet_icon = ImageChooserBlock(
        label = _('Image icon'),
        help_text = _('The image icon per bullet.'),
        required=False,
    )
    content = blocks.ListBlock(
        blocks.RichTextBlock(),
        label = _('Bullets'),
        help_text = _('Content of the bullet.'),
    )
Example #29
0
class AccordionBlock(blocks.StructBlock):
    title = blocks.CharBlock(
        label = _('Title'),
        max_length = 50,
        help_text = _('Text in the title.'),
    )

    content = blocks.RichTextBlock(
        label = _('Content'),
        help_text = _('Contents of the tab.'),
    )
Example #30
0
class ExampleImage(blocks.StructBlock):
    """Creates an example module with an image and a caption, side-by-side
    Typically used for showing reporting Examples
    """
    title = blocks.CharBlock(required=False)
    caption = blocks.RichTextBlock(required=True)
    image = ImageChooserBlock(required=True)

    class Meta:
        template = 'blocks/example-image.html'
        icon = 'doc-empty'