コード例 #1
0
class StreamPage(Page):
    body = StreamField([('map', GeoBlock()),
                        ('map_struct',
                         blocks.StructBlock([
                             ('address', blocks.CharBlock(required=True)),
                             ('map', GeoBlock(address_field='address')),
                         ],
                                            icon='user'))])

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]
コード例 #2
0
class GeoStreamPage(Page):
    body = StreamField([('map', GeoBlock()),
                        ('map_struct',
                         blocks.StructBlock([
                             ('address', GeoAddressBlock(required=True)),
                             ('map', GeoBlock(address_field='address')),
                         ],
                                            icon='user'))])

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

    def get_context(self, request):
        data = super(GeoStreamPage, self).get_context(request)
        return data
コード例 #3
0
class LocationBlock(blocks.StructBlock):
    name = blocks.CharBlock()
    address = AddressBlock(required=False)
    point = GeoBlock(required=False)
    departments = blocks.ListBlock(DepartmentBlock(label="department", required=False))
    opening_times = blocks.ListBlock(OpeningTimeBlock(required=False))
    primary = blocks.BooleanBlock(default=False, required=False)
コード例 #4
0
class GMapBlock(StructBlock):
    address = CharBlock(label=_('Address'),
                        help_text=_("Location's address"),
                        required=False)
    map = GeoBlock(address_field='address', label=_('Map'))

    class Meta:
        icon = 'site'
        template = 'blocks/address.html'
コード例 #5
0
ファイル: blocks.py プロジェクト: devinit/DIwebsite-redesign
class WhereWeWorkLocationBlock(StructBlock):
    """
    Allows the addition of a single where we work location
    """
    name = TextBlock()
    phone = TextBlock(required=False)
    google_map = GeoBlock()

    class Meta():
        icon = 'fa-map'
コード例 #6
0
ファイル: models.py プロジェクト: sergiobrr/chambray
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'
コード例 #7
0
ファイル: models.py プロジェクト: Frojd/wagtail-geo-widget
class GeoStreamPage(Page):
    body = StreamField([
        ("map", GoogleMapsBlock()),
        ("map_with_leaflet", LeafletBlock()),
        (
            "map_struct",
            blocks.StructBlock(
                [
                    ("address", GeoAddressBlock(required=True)),
                    ("map", GoogleMapsBlock(address_field="address")),
                ],
                icon="user",
            ),
        ),
        (
            "map_struct_with_deprecated_geopanel",
            blocks.StructBlock(
                [
                    ("address", blocks.CharBlock(required=True)),
                    ("map", GeoBlock(address_field="address")),
                ],
                icon="user",
            ),
        ),
        (
            "map_struct_with_leaflet",
            blocks.StructBlock(
                [
                    ("address", GeoAddressBlock(required=True)),
                    ("map", LeafletBlock(address_field="address")),
                ],
                icon="user",
            ),
        ),
        (
            "map_struct_with_zoom",
            blocks.StructBlock(
                [
                    ("address", GeoAddressBlock(required=True)),
                    ("zoom", GeoZoomBlock(required=False)),
                    (
                        "map",
                        GoogleMapsBlock(address_field="address",
                                        zoom_field="zoom"),
                    ),
                ],
                icon="user",
            ),
        ),
        (
            "map_struct_leaflet_with_zoom",
            blocks.StructBlock(
                [
                    ("address", GeoAddressBlock(required=True)),
                    ("zoom", GeoZoomBlock(required=False)),
                    (
                        "map",
                        LeafletBlock(address_field="address",
                                     zoom_field="zoom"),
                    ),
                ],
                icon="user",
            ),
        ),
    ])

    content_panels = Page.content_panels + [
        StreamFieldPanel("body"),
    ]

    def get_context(self, request):
        data = super(GeoStreamPage, self).get_context(request)
        return data
コード例 #8
0
ファイル: models.py プロジェクト: Frojd/wagtail-geo-widget
class StreamPage(Page):
    body = StreamField([
        ("map", GoogleMapsBlock()),
        ("map_leaflet", LeafletBlock()),
        (
            "map_struct",
            blocks.StructBlock(
                [
                    ("address", GeoAddressBlock(required=True)),
                    ("map", GoogleMapsBlock(address_field="address")),
                ],
                icon="user",
            ),
        ),
        (
            "map_struct_with_deprecated_geopanel",
            blocks.StructBlock(
                [
                    ("address", blocks.CharBlock(required=True)),
                    ("map", GeoBlock(address_field="address")),
                ],
                icon="user",
            ),
        ),
        (
            "map_struct_leaflet",
            blocks.StructBlock(
                [
                    (
                        "address",
                        GeoAddressBlock(required=True,
                                        geocoder=geocoders.MAPBOX),
                    ),
                    ("map", LeafletBlock(address_field="address")),
                ],
                icon="user",
            ),
        ),
        (
            "map_struct_with_zoom",
            blocks.StructBlock(
                [
                    ("address", GeoAddressBlock(required=True)),
                    ("zoom", GeoZoomBlock(required=False)),
                    (
                        "map",
                        GoogleMapsBlock(address_field="address",
                                        zoom_field="zoom"),
                    ),
                ],
                icon="user",
            ),
        ),
        (
            "map_struct_leaflet_with_zoom",
            blocks.StructBlock(
                [
                    ("address", GeoAddressBlock(required=True)),
                    ("zoom", GeoZoomBlock(required=False)),
                    (
                        "map",
                        LeafletBlock(address_field="address",
                                     zoom_field="zoom"),
                    ),
                ],
                icon="user",
            ),
        ),
    ])

    content_panels = Page.content_panels + [
        StreamFieldPanel("body"),
    ]
コード例 #9
0
class BasicPage(Page):
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('image', ImageChooserBlock()),
        ('table', TableBlock()),
        ('BlockQuoteBlock', BlockQuoteBlock()),
        ('URLBlock', URLBlock()),
        ('EmailBlock', EmailBlock()),
        ('DateBlock', DateBlock()),
        ('TimeBlock', TimeBlock()),
        ('DateTimeBlock', DateBlock()),
        ('PageChooserBlock', PageChooserBlock()),
        ('DocumentChooserBlock', DocumentChooserBlock()),
        ('IframeBlock', TextBlock()),
        ('EmbedBlock', EmbedBlock()),
        ('form', WagtailFormBlock()),
        ('show_business_hours',
         BooleanBlock(
             required=False,
             help_text="If checked, the library hours will display on the page",
             template='basic_page/blocks/business_hours.html',
             icon='user')),
        ('show_next_closure',
         BooleanBlock(
             required=False,
             help_text="If checked, the next library closure will display",
             template='basic_page/blocks/next_closure.html',
             icon='user')),
        ('show_all_closures',
         BooleanBlock(
             required=False,
             help_text=
             "If checked, all upcoming library closures will be shown",
             template='basic_page/blocks/all_closures.html',
             icon='user')),
        ('map',
         blocks.StructBlock([
             ('address', GeoAddressBlock(required=True)),
             ('map', GeoBlock(address_field='address')),
         ],
                            template='basic_page/blocks/map.html',
                            icon='user')),
        ('bookClub',
         blocks.StructBlock(
             [('book_club_name', blocks.CharBlock()),
              ('book_club_day_of_the_week', blocks.TextBlock()),
              ('book_club_PDF', DocumentChooserBlock(required=False)),
              ('book_club_time', blocks.TimeBlock()),
              ('books',
               blocks.StreamBlock([
                   (
                       'book',
                       blocks.StructBlock(
                           [
                               ('book_name', blocks.CharBlock()),
                               ('author_name', blocks.CharBlock()),
                               ('reading_date', blocks.DateBlock()),
                               ('book_description', blocks.RichTextBlock()),
                               ('book_cover',
                                ImageChooserBlock(required=False)),
                           ],
                           template='basic_page/blocks/books.html'),
                   ),
               ]))],
             template='basic_page/blocks/book_club.html',
             icon='openquote')),
        ('panel',
         blocks.StructBlock([
             ('panel_name', blocks.CharBlock()),
             ('show_by_default',
              blocks.BooleanBlock(
                  required=False,
                  help_text="Display Panel as open by default")),
             ('panel_body',
              blocks.StreamBlock([
                  (
                      'panel_items',
                      blocks.StructBlock([
                          ('panel_item_title', blocks.CharBlock()),
                          ('panel_link',
                           URLBlock(
                               required=False,
                               help_text="Use this for images you wish to link"
                           )),
                          ('panel_image',
                           ImageChooserBlock(
                               required=False,
                               help_text="Use this for images you wish to link"
                           )),
                          ('panel_description', blocks.RichTextBlock()),
                      ],
                                         template=
                                         'basic_page/blocks/panel_items.html'),
                  ),
              ]))
         ],
                            template='basic_page/blocks/panel.html',
                            icon='collapse-down')),
    ],
                       blank=True)

    def get_context(self, request):
        data = super(BasicPage, self).get_context(request)
        return data

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

    # Search index configuration
    search_fields = Page.search_fields + [
        index.SearchField('body'),
    ]
コード例 #10
0
)

registry.register_list(
    tag='any',
    blocks=[
        (
            'events_list',
            blocks.StaticBlock(group='various',
                               label='Список событий',
                               icon='list-ul'),
        ),
        (
            'big_contacts',
            blocks.StructBlock(
                [
                    ('map', GeoBlock(label='Координаты')),
                    ('address', blocks.CharBlock(label='Адрес')),
                    ('phone', blocks.CharBlock(label='Телефон')),
                    ('email', blocks.CharBlock(label='Email')),
                    ('text', blocks.CharBlock(label='Текст')),
                ],
                group='various',
                label='Карта с адресом',
                icon='site',
            ),
        ),
        (
            'photo_ribbon',
            blocks.ListBlock(ImageChooserBlock(),
                             group='various',
                             label='Лента фоток'),