Example #1
0
class ExhibitionCardBlock(blocks.StructBlock):
    title = blocks.CharBlock()
    image = ImageChooserBlock()
    start_date = blocks.DateBlock()
    end_date = blocks.DateBlock()
    body = blocks.StreamBlock([
        ('paragraph', RichTextBlock()),
        ('button', ButtonBlock()),
        ('accordion', AccordionBlock()),
        ('link', LinkBlock()),
    ])

    class Meta:
        icon = "fa-picture-o"

    def clean(self, value):
        errors = {}
        if value['start_date'] > value['end_date']:
            errors['start_date'] = ErrorList(
                ['Start date should be less than End Date.'])
            errors['end_date'] = ErrorList(
                ['End date should be greater than Start Date.'])

        if errors:
            raise ValidationError('Validation error in ExhibitionCardBlock',
                                  params=errors)

        return super().clean(value)
Example #2
0
class PersonPage(Page):
    info = StreamField([
        ('birthplace', blocks.CharBlock(required=False)),
        ('birth_date', blocks.DateBlock(required=False)),
        ('death_date', blocks.DateBlock(required=False)),
        ('email', blocks.EmailBlock(required=False)),
        ('facebook', blocks.URLBlock(required=False)),
        ('twitter', blocks.URLBlock(required=False)),
        ('linkedin', blocks.URLBlock(required=False)),
        ('website', blocks.URLBlock(required=False)),
    ])
    content = RichTextField(blank=True)
    tags = ClusterTaggableManager(through=PersonPageTag, blank=True)
    image = models.ForeignKey(Image,
                              null=True,
                              blank=True,
                              on_delete=models.SET_NULL,
                              related_name='+')
    feed_image = models.ForeignKey(Image,
                                   null=True,
                                   blank=True,
                                   on_delete=models.SET_NULL,
                                   related_name='+')

    indexed_fields = (
        'info',
        'content',
    )
Example #3
0
class WorkExperienceBlock(blocks.StructBlock):
    class Meta:
        template = "wagtail_resume/blocks/work_experience_block.html"
        icon = "doc-full-inverse"

    heading = blocks.CharBlock(default="Work experience")
    fa_icon = blocks.CharBlock(default="fas fa-tools")
    experiences = blocks.ListBlock(
        blocks.StructBlock(
            [
                ("role", blocks.CharBlock()),
                ("company", blocks.CharBlock()),
                ("url", blocks.URLBlock()),
                ("from_date", blocks.DateBlock()),
                ("to_date", blocks.DateBlock(required=False)),
                (
                    "currently_working_here",
                    blocks.BooleanBlock(
                        help_text=
                        "Check this box if you are currently working here and it will indicate so on the resume.",
                        required=False,
                    ),
                ),
                ("text", MarkdownBlock()),
            ],
            icon="folder-open-inverse",
        ))
Example #4
0
class IgcTimelineBlock(blocks.StructBlock):
    date = blocks.CharBlock(required=True)
    title = blocks.CharBlock(required=False)
    body = blocks.RichTextBlock(
        features=['bold', 'italic', 'link'],
        required=False,
    )
    location = blocks.CharBlock(required=False)
    countries_represented = ImageChooserBlock(required=False)
    outcomes = blocks.StreamBlock(
        [
            ('outcome',
             blocks.StructBlock([
                 ('date', blocks.DateBlock(required=False)),
                 ('text',
                  blocks.RichTextBlock(
                      features=['bold', 'italic', 'link'],
                      required=False,
                  )),
             ])),
        ],
        required=False,
    )
    witnesses = blocks.StreamBlock(
        [
            ('witness_date',
             blocks.StructBlock([
                 ('date', blocks.DateBlock(required=False)),
                 ('witnesses',
                  blocks.StreamBlock([
                      ('witnesses_full_session',
                       blocks.StructBlock([
                           ('title', blocks.CharBlock(required=False)),
                           ('witness_transcript',
                            blocks.URLBlock(required=False)),
                           ('witness_video', blocks.URLBlock(required=False)),
                       ])),
                      ('witness',
                       blocks.StructBlock([
                           ('name', blocks.CharBlock(required=False)),
                           ('title', blocks.CharBlock(required=False)),
                           ('witness_transcript',
                            blocks.URLBlock(required=False)),
                           ('witness_video', blocks.URLBlock(required=False)),
                       ])),
                  ], )),
             ])),
        ],
        required=False,
    )

    class Meta:
        icon = 'arrows-up-down'
        label = 'IGC Timeline'
        template = 'streams/igc_timeline_block.html'
Example #5
0
class TimelineEraBlock(blocks.StructBlock):
    title = blocks.CharBlock(required=True)
    start_date = blocks.DateBlock(required=True)
    end_date = blocks.DateBlock(required=False)
    date_display_type = blocks.ChoiceBlock(
        [
            ('year', 'Year'),
            ('month', 'Month'),
            ('day', 'Day'),
        ],
        default='year',
        help_text="Controls how specific the date is displayed")
Example #6
0
class TimelineEventBlock(blocks.StructBlock):
    title = blocks.CharBlock(required=True)
    italicize_title = blocks.BooleanBlock(default=False, required=False)
    description = blocks.RichTextBlock(required=False)
    category = blocks.CharBlock(required=False, )
    start_date = blocks.DateBlock(required=True)
    end_date = blocks.DateBlock(required=False)
    date_display_type = blocks.ChoiceBlock(
        [
            ('year', 'Year'),
            ('month', 'Month'),
            ('day', 'Day'),
        ],
        default='year',
        help_text="Controls how specific the date is displayed")
Example #7
0
class JobBlock(blocks.StructBlock):
    """Block for job experience"""

    institution = blocks.CharBlock(required=True, help_text="Intitutição")
    job = blocks.CharBlock(required=True, help_text="Título")
    description = blocks.TextBlock(required=True,
                                   help_text="Descreva o trabalho")
    begining_date = blocks.DateBlock(required=True, help_text="Data de Incio")
    finishing_date = blocks.DateBlock(required=False,
                                      help_text="Data de Término")

    class Meta:  # noqa
        template = "streams/job_block.html"
        icon = "fa-building"
        label = "Experiência profissional"
Example #8
0
class WritingsBlock(blocks.StructBlock):
    class Meta:
        template = "wagtail_resume/blocks/writings_block.html"
        icon = "edit"

    heading = blocks.CharBlock(default="Writing")
    fa_icon = blocks.CharBlock(default="fas fa-pencil-alt")
    posts = blocks.StreamBlock(
        [
            (
                "internal_post",
                blocks.StructBlock([("post", blocks.PageChooserBlock())],
                                   icon="doc-full-inverse"),
            ),
            (
                "external_post",
                blocks.StructBlock(
                    [
                        ("title", blocks.CharBlock()),
                        ("url", blocks.URLBlock()),
                        ("date", blocks.DateBlock()),
                    ],
                    icon="doc-full-inverse",
                ),
            ),
        ],
        icon="folder-open-inverse",
    )
Example #9
0
class ActionBlock(blocks.StructBlock):
    action = blocks.CharBlock(
        verbose_name="Actie",
        help_text=
        "Tekst wat linksboven in de afbeelding komt. Bijvoorbeeld: Blog")
    color = ColorPickerBlock(
        label='Achtergrond kleur',
        help_text='Achtergrond kleur voor actie',
        required=False,
    )
    image = ImageChooserBlock()
    datum = blocks.DateBlock(
        required=False,
        help_text="Optioneel. Bijvoorbeeld voor blogs of speciale events.")
    title = blocks.CharBlock(
        verbose_name="Titel",
        help_text=
        "Titel van je actieblok. Voorbeeld: Review: De nieuwe HP Latex 570")
    link = blocks.CharBlock(
        verbose_name="Link url",
        help_text=
        "Vul hier een url handmatig in. Bijvoorbeeld: /contact/ of www.google.nl"
    )
    link_text = blocks.CharBlock(
        verbose_name="Link tekst",
        help_text=
        "Vul hier een url tekst handmatig in. Bijvoorbeeld: bekijk alle blogartikelen of bekijk alle reviews. "
    )
Example #10
0
class DayBlock(blocks.StructBlock):
    date = blocks.DateBlock(required=True)
    program = blocks.ListBlock(ProgramEntryBlock())

    class Meta:
        template = 'program/blocks/day_block.html'
        icon = 'date'
        label = 'Day'
Example #11
0
class StreamFieldBlock(blocks.StreamBlock):
    heading = blocks.CharBlock(classname="full title")
    paragraph = blocks.RichTextBlock()
    image = ImageChooserBlock()
    decimal = blocks.DecimalBlock()
    date = blocks.DateBlock()
    datetime = blocks.DateTimeBlock()
    gallery = ImageGalleryBlock()
Example #12
0
class NewsMentionBlock(blocks.StructBlock):
    source = NewsMentionChooserBlock(NewsSource)
    url = blocks.URLBlock()
    headline = blocks.CharBlock()
    date = blocks.DateBlock()

    class Meta:
        icon = 'document'
Example #13
0
class HomePage(Page):
    advert = models.ForeignKey('home.Advert',
                               null=True,
                               blank=True,
                               on_delete=models.SET_NULL,
                               related_name='+')

    body = StreamField([
        ('Paragraph', blocks.RichTextBlock()),
        ('Image', ImageChooserBlock()),
        ('OtherImgBlock', OtherImgBlock()),
        ('Text', blocks.TextBlock()),
        ('Heading', blocks.CharBlock()),
        ('BlockQuote', blocks.BlockQuoteBlock()),
        ('Email', blocks.EmailBlock()),
        ('URL', blocks.URLBlock()),
        ('Boolean', blocks.BooleanBlock()),
        ('Integer', blocks.IntegerBlock()),
        ('Float', blocks.FloatBlock()),
        ('Decimal', blocks.DecimalBlock()),
        ('Date', blocks.DateBlock()),
        ('Time', blocks.TimeBlock()),
        ('DateTime', blocks.DateTimeBlock()),
        ('RawHTML', blocks.RawHTMLBlock()),
        ('Choice', blocks.ChoiceBlock()),
        ('PageChooser', blocks.PageChooserBlock()),
        ('DocumentChooser', DocumentChooserBlock()),
        ('Banner', BannerBlock()),
        ('Embed', EmbedBlock()),
        ('RecommendCourse',
         blocks.StructBlock([('title', blocks.CharBlock()),
                             ('courses', blocks.ListBlock(CourseBlock()))],
                            template='home/blocks/recommend_courses.html')),
        ('SeriesCourse',
         blocks.StructBlock([('title', blocks.CharBlock()),
                             ('series', blocks.ListBlock(SeriesBlock()))],
                            template='home/blocks/series_list.html')),
        ('StoryBlock', StoryBlock()),
        ('ProfessorBlock', ProfessorBlock()),
        ('CategoriesListBlock', CategoriesListBlock()),
        ('SubjectCourse',
         blocks.StructBlock(
             [('required_course', blocks.ListBlock(SeriesBlock())),
              ('optional_course', blocks.ListBlock(SeriesBlock()))],
             template='home/blocks/subject_course.html')),
        ('VipBlock', VipBlock()),
        ('SeriesProcessBlock', SeriesProcessBlock()),
    ])

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
        SnippetChooserPanel('advert'),
    ]

    api_fields = [
        APIField('body'),
    ]
Example #14
0
class CourseBlock(blocks.StructBlock):
    """Block for courses"""

    institution = blocks.CharBlock(required=True, help_text="Intitutição")
    courses = blocks.ListBlock(blocks.CharBlock(required=True,
                                                help_text="Curso",
                                                icon='plus'),
                               required=True)
    note = blocks.CharBlock(required=True,
                            help_text="Descreva o estado ou nota final")
    begining_date = blocks.DateBlock(required=True, help_text="Data de Incio")
    finishing_date = blocks.DateBlock(required=False,
                                      help_text="Data de Término")

    class Meta:  # noqa
        template = "streams/course_block.html"
        icon = "fa-book"
        label = "Curso Formal"
class ExternalResourceBlock(blocks.StructBlock):
    title = blocks.CharBlock()
    info = blocks.CharBlock()
    url = blocks.URLBlock()
    date = blocks.DateBlock()

    class Meta:
        icon = 'link'
        template = 'dalme_public/blocks/_external_resource.html'
Example #16
0
class Picture(blocks.StructBlock):
    picture = blocks.StructBlock([
        ('image', ImageChooserBlock()),
        ('caption', blocks.CharBlock(required=False)),
        ('date', blocks.DateBlock(required=False)),
    ])

    class Meta:
        template = 'blog/blocks/picture.html'
        icon = 'image'
Example #17
0
class NewsBlock(blocks.StructBlock):
    """Text and date and nothing else."""

    text = blocks.CharBlock(required=True, help_text="Add news main line")
    date_of_event = blocks.DateBlock(blank=False, null=True)

    class Meta:  # noqa
        template = "streams/news_and_date_block.html"
        icon = "edit"
        label = "Text & Date"
Example #18
0
class BulletinItemBlock(blocks.StructBlock):
    title = blocks.CharBlock()
    date = blocks.DateBlock(required=False)
    contact_name = blocks.CharBlock(required=False)
    contact_email = blocks.EmailBlock(required=False)
    contact_phone = blocks.CharBlock(max_length=20, required=False)
    body = blocks.RichTextBlock(blank=True)

    class Meta:
        template = "blocks/bulletin_item.html"
Example #19
0
class WorkExperienceBlock(blocks.StructBlock):
    class Meta:
        template = "wagtail_resume/blocks/work_experience_block.html"
        icon = "doc-full-inverse"

    heading = blocks.CharBlock(default="Work experience")
    fa_icon = blocks.CharBlock(default="fas fa-tools")
    experiences = blocks.ListBlock(
        blocks.StructBlock(
            [
                ("role", blocks.CharBlock()),
                ("company", blocks.CharBlock()),
                ("url", blocks.URLBlock()),
                ("from_date", blocks.DateBlock()),
                ("to_date", blocks.DateBlock()),
                ("text", MarkdownBlock()),
            ],
            icon="folder-open-inverse",
        )
    )
Example #20
0
class Gallery(blocks.StructBlock):
    pictures = blocks.ListBlock(
        blocks.StructBlock([
            ('image', ImageChooserBlock()),
            ('caption', blocks.CharBlock(required=False)),
            ('date', blocks.DateBlock(required=False)),
        ]))

    class Meta:
        template = 'blog/blocks/gallery.html'
        icon = 'image'
Example #21
0
class StreamFieldBlock(blocks.StreamBlock):
    heading = blocks.CharBlock(classname="full title")
    paragraph = blocks.RichTextBlock()
    image = ImageChooserBlock()
    decimal = blocks.DecimalBlock()
    date = blocks.DateBlock()
    datetime = blocks.DateTimeBlock()
    gallery = ImageGalleryBlock()
    video = VideoBlock()
    objectives = blocks.ListBlock(blocks.CharBlock())
    carousel = CarouselBlock()
Example #22
0
class BlogPage(GrapplePageMixin, Page):
    author = models.CharField(max_length=255)
    date = models.DateField("Post date")
    advert = models.ForeignKey('home.Advert',
                               null=True,
                               blank=True,
                               on_delete=models.SET_NULL,
                               related_name='+')
    cover = models.ForeignKey('wagtailimages.Image',
                              null=True,
                              blank=True,
                              on_delete=models.SET_NULL,
                              related_name='+')
    book_file = models.ForeignKey('wagtaildocs.Document',
                                  null=True,
                                  blank=True,
                                  on_delete=models.SET_NULL,
                                  related_name='+')
    featured_media = models.ForeignKey('wagtailmedia.Media',
                                       null=True,
                                       blank=True,
                                       on_delete=models.SET_NULL,
                                       related_name='+')
    body = StreamField([
        ("heading", blocks.CharBlock(classname="full title")),
        ("paraagraph", blocks.RichTextBlock()),
        ("image", ImageChooserBlock()),
        ("decimal", blocks.DecimalBlock()),
        ("date", blocks.DateBlock()),
        ("datetime", blocks.DateTimeBlock()),
    ])

    content_panels = Page.content_panels + [
        FieldPanel("author"),
        FieldPanel("date"),
        ImageChooserPanel('cover'),
        StreamFieldPanel("body"),
        InlinePanel('related_links', label="Related links"),
        SnippetChooserPanel('advert'),
        DocumentChooserPanel('book_file'),
        MediaChooserPanel('featured_media'),
    ]

    graphql_fields = [
        GraphQLString("heading"),
        GraphQLString("date"),
        GraphQLString("author"),
        GraphQLStreamfield("body"),
        GraphQLForeignKey("related_links", "home.blogpagerelatedlink", True),
        GraphQLSnippet('advert', 'home.Advert'),
        GraphQLImage('cover'),
        GraphQLDocument('book_file'),
        GraphQLMedia('featured_media'),
    ]
Example #23
0
class EventBlock(blocks.StructBlock):
    date = blocks.DateBlock('日期')
    event = blocks.CharBlock('事件', max_length=32)
    direction = blocks.ChoiceBlock(choices=(
        ('left', '向左'),
        ('right', '向右'),
    ),
                                   default='left')

    class Meta:
        template = 'aboutus/milestone_block.html'
Example #24
0
class AboutTestimonialBlock(blocks.StructBlock):
    feedback = blocks.TextBlock(required=True, help_text='Add Client Feedback')
    client_name = blocks.CharBlock(max_length=40,
                                   required=True,
                                   help_text='Add Client Name')
    date = blocks.DateBlock()
    photo = ImageChooserBlock(required=True, help_text='Upload slide image')

    class Meta:
        template = "about/testimonials.html"
        icon = "edit"
        label = "Testimonial"
Example #25
0
class NewsBlock(blocks.StructBlock):
    news = blocks.ListBlock(
        blocks.StructBlock([
            ("image", ImageChooserBlock(required=True)),
            ("title", blocks.CharBlock(required=True, max_length=50)),
            ("content", blocks.CharBlock(required=True, max_length=100)),
            ("author", blocks.CharBlock(required=True, max_length=50)),
            ("date", blocks.DateBlock(required=True, )),
        ]))

    class Meta:
        template = "streams/news_block.html"
        icon = "plus"
        label = "News"
Example #26
0
class StreamFieldBlock(blocks.StreamBlock):
    heading = blocks.CharBlock(classname="full title")
    paragraph = blocks.RichTextBlock()
    image = ImageChooserBlock()
    decimal = blocks.DecimalBlock()
    date = blocks.DateBlock()
    datetime = blocks.DateTimeBlock()
    gallery = ImageGalleryBlock()
    video = VideoBlock()
    objectives = blocks.ListBlock(blocks.CharBlock())
    carousel = CarouselBlock()
    callout = CalloutBlock()
    text_and_buttons = TextAndButtonsBlock()
    page = blocks.PageChooserBlock()
    text_with_callable = TextWithCallableBlock()
Example #27
0
class BureauStructure(blocks.StructBlock):
    last_updated_date = blocks.DateBlock(required=False)
    download_image = DocumentChooserBlock(icon='image', required=False)
    director = blocks.CharBlock()
    divisions = blocks.ListBlock(BureauStructureDivision())
    office_of_the_director = blocks.ListBlock(BureauStructureOffices(),
                                              label='Office of the Director')

    class Meta:
        icon = None
        template = '_includes/organisms/bureau-structure.html'
        icon = "table"

    class Media:
        js = ['bureau-structure.js']
Example #28
0
class EventDetailBlock(blocks.StructBlock):
    """
	Represents the details of an event
	from start date to address and
	location on a map
	"""
    start_date = blocks.DateBlock()
    start_time = blocks.TimeBlock()
    end_date = blocks.DateBlock()
    end_time = blocks.TimeBlock()
    address = blocks.CharBlock()
    location = GeoBlock(address_field='address', required=False)

    class Meta:
        icon = 'site'
        template = 'blog/event_details.html'
        default = {
            'start_date': datetime.date.today(),
            'start_time': datetime.datetime.now().time(),
            'end_date': datetime.date.today(),
            'end_time': datetime.datetime.now().time(),
            'address': 'Mgarr Road, Xewkija XWK 9014, Malta'
        }
        label = 'Event details'
Example #29
0
class ImagePersonBlock(blocks.StructBlock):
    image = ImageChooserBlock(required=True, help_text="choose image")
    name = blocks.CharBlock(required=True,
                            max_length=255,
                            help_text="add name and surname")
    title = blocks.CharBlock(required=True,
                             max_length=255,
                             help_text="add title")
    appointed = blocks.DateBlock(required=False)
    biography = blocks.TextBlock(required=True, help_text="biography about")
    committees = blocks.CharBlock(required=False, max_length=255)

    class Meta:
        template = "streams/image_person_block.html"
        icon = "user"
        label = "Person panel"
Example #30
0
class DownloadBlock(blocks.StructBlock):
    title = blocks.CharBlock(required=False, max_length=255)
    headings_text_colour = TitleColorChooserBlock(required=False)
    news = blocks.ListBlock(
        blocks.StructBlock([
            ('date', blocks.DateBlock(required=True)),
            ('file_name',
             blocks.CharBlock(required=True,
                              max_length=255,
                              help_text="file name")),
            ('source_type', DownloadSourceTypeBlock(required=False)),
        ]))

    class Meta:
        template = "streams/download_block.html"
        icon = "download"
        label = "Download panel"