Skip to content

Commit

Permalink
Revised Pulse Project Component (#1668)
Browse files Browse the repository at this point in the history
Related issue: #1639
  • Loading branch information
gvn committed Jul 12, 2018
1 parent 4dce054 commit 5000387
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 38 deletions.
70 changes: 59 additions & 11 deletions network-api/networkapi/wagtailpages/customblocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,28 +276,76 @@ def rev(self):

class PulseProjectList(blocks.StructBlock):
search_terms = blocks.CharBlock(
help_text='Fill in any number of pulse entry search terms (separated by spaces).',
help_text='Test your search at mozillapulse.org/search',
label='Search',
required=False,
)

max_number_of_results = blocks.IntegerBlock(
min_value=0,
default=0,
required=False,
help_text='The maximum number of results to fetch (use 0 for default maximum of 48)',
)

newest_first = blocks.BooleanBlock(
default=True,
help_text='Check this box to list entries "newest first".',
required=False,
max_value=12,
default=6,
required=True,
help_text='Choose 1-12. If you want visitors to see more, link to a search or tag on Pulse.',
)

only_featured_entries = blocks.BooleanBlock(
default=False,
help_text='Check this box to only get results from the featured entry list.',
label='Display only featured entries',
help_text='Featured items are selected by Pulse moderators.',
required=False,
)

newest_first = blocks.ChoiceBlock(
choices=[
('True', 'Show newer entries first'),
('False', 'Show older entries first'),
],
required=True,
label='Sort',
default='True',
)

advanced_filter_header = blocks.StaticBlock(
label=' ',
admin_text='-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------',
)

issues = blocks.ChoiceBlock(
choices=[
('all', 'All'),
('Decentralization', 'Decentralization'),
('Digital Inclusion', 'Digital Inclusion'),
('Online Privacy & Security', 'Online Privacy & Security'),
('Open Innovation', 'Open Innovation'),
('Web Literacy', 'Web Literacy'),
],
required=True,
default='all'
)

help = blocks.ChoiceBlock(
choices=[
('all', 'All'),
('Attend', 'Attend'),
('Create content', 'Create content'),
('Code', 'Code'),
('Design', 'Design'),
('Fundraise', 'Fundraise'),
('Join community', 'Join community'),
('Localize & translate', 'Localize & translate'),
('Mentor', 'Mentor'),
('Plan & organize', 'Plan & organize'),
('Promote', 'Promote'),
('Take action', 'Take action'),
('Test & feedback', 'Test & feedback'),
('Write documentation', 'Write documentation'),
],
required=True,
default='all',
label='Type of help needed',
)

class Meta:
template = 'wagtailpages/blocks/pulse_project_list.html'
icon = 'site'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-07-12 22:34
from __future__ import unicode_literals

from django.db import migrations
import wagtail.core.blocks
import wagtail.core.blocks.static_block
import wagtail.core.fields
import wagtail.images.blocks


class Migration(migrations.Migration):

dependencies = [
('wagtailpages', '0031_auto_20180607_1631'),
]

operations = [
migrations.AlterField(
model_name='modularpage',
name='body',
field=wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock()), ('paragraph', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'h2', 'h3', 'h4', 'h5', 'ol', 'ul', 'link', 'hr'])), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL that this caption should link out to.', required=False))))), ('image_text', wagtail.core.blocks.StructBlock((('text', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link'])), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True))))), ('ordering', wagtail.core.blocks.ChoiceBlock(choices=[('left', 'Image on the left'), ('right', 'Image on the right')]))))), ('image_text2', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('text', wagtail.core.blocks.RichTextBlock(features=['link', 'h2', 'h3', 'h4', 'h5', 'h6'])), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this image should link out to.', required=False)), ('small', wagtail.core.blocks.BooleanBlock(help_text='Use smaller, fixed image size (eg: icon)', required=False))))), ('figure', wagtail.core.blocks.StructBlock((('figure', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('', 'Do not apply any explicit alignment classes.'), ('left-align', 'Left-align this image with the page content.'), ('right-align', 'Right-align this image with the page content.'), ('center', 'Center this image with the page content.'), ('full-width', 'Make this image full-width.')], required=False))))), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False))))), ('figuregrid', wagtail.core.blocks.StructBlock((('grid_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('figure', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('', 'Do not apply any explicit alignment classes.'), ('left-align', 'Left-align this image with the page content.'), ('right-align', 'Right-align this image with the page content.'), ('center', 'Center this image with the page content.'), ('full-width', 'Make this image full-width.')], required=False))))), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False)))))),))), ('figuregrid2', wagtail.core.blocks.StructBlock((('grid_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False)))))),))), ('video', wagtail.core.blocks.StructBlock((('url', wagtail.core.blocks.CharBlock(help_text='Please make sure this is a proper embed URL, or your video will not show up on the page.')), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL for caption to link to.', required=False))))), ('iframe', wagtail.core.blocks.StructBlock((('url', wagtail.core.blocks.CharBlock(help_text='Please note that only URLs from white-listed domains will work.')), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL that this caption should link out to.', required=False))))), ('linkbutton', wagtail.core.blocks.StructBlock((('label', wagtail.core.blocks.CharBlock()), ('URL', wagtail.core.blocks.CharBlock()), ('styling', wagtail.core.blocks.ChoiceBlock(choices=[('btn-normal', 'Normal button'), ('btn-ghost', 'Ghost button')]))))), ('spacer', wagtail.core.blocks.StructBlock((('size', wagtail.core.blocks.ChoiceBlock(choices=[('1', 'quarter spacing'), ('2', 'half spacing'), ('3', 'single spacing'), ('4', 'one and a half spacing'), ('5', 'triple spacing')])),))), ('quote', wagtail.core.blocks.StructBlock((('quotes', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('quote', wagtail.core.blocks.CharBlock()), ('attribution', wagtail.core.blocks.CharBlock()))))),))), ('pulse_listing', wagtail.core.blocks.StructBlock((('search_terms', wagtail.core.blocks.CharBlock(help_text='Test your search at mozillapulse.org/search', label='Search', required=False)), ('max_number_of_results', wagtail.core.blocks.IntegerBlock(default=6, help_text='Choose 1-12. If you want visitors to see more, link to a search or tag on Pulse.', max_value=12, min_value=0, required=True)), ('only_featured_entries', wagtail.core.blocks.BooleanBlock(default=False, help_text='Featured items are selected by Pulse moderators.', label='Display only featured entries', required=False)), ('newest_first', wagtail.core.blocks.ChoiceBlock(choices=[('True', 'Show newer entries first'), ('False', 'Show older entries first')], label='Sort')), ('advanced_filter_header', wagtail.core.blocks.static_block.StaticBlock(admin_text='-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------', label=' ')), ('issues', wagtail.core.blocks.ChoiceBlock(choices=[('all', 'All'), ('Decentralization', 'Decentralization'), ('Digital Inclusion', 'Digital Inclusion'), ('Online Privacy & Security', 'Online Privacy & Security'), ('Open Innovation', 'Open Innovation'), ('Web Literacy', 'Web Literacy')])), ('help', wagtail.core.blocks.ChoiceBlock(choices=[('all', 'All'), ('Attend', 'Attend'), ('Create content', 'Create content'), ('Code', 'Code'), ('Design', 'Design'), ('Fundraise', 'Fundraise'), ('Join community', 'Join community'), ('Localize & translate', 'Localize & translate'), ('Mentor', 'Mentor'), ('Plan & organize', 'Plan & organize'), ('Promote', 'Promote'), ('Take action', 'Take action'), ('Test & feedback', 'Test & feedback'), ('Write documentation', 'Write documentation')], label='Type of help needed'))))))),
),
migrations.AlterField(
model_name='primarypage',
name='body',
field=wagtail.core.fields.StreamField((('heading', wagtail.core.blocks.CharBlock()), ('paragraph', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'h2', 'h3', 'h4', 'h5', 'ol', 'ul', 'link', 'hr'])), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL that this caption should link out to.', required=False))))), ('image_text', wagtail.core.blocks.StructBlock((('text', wagtail.core.blocks.RichTextBlock(features=['bold', 'italic', 'link'])), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True))))), ('ordering', wagtail.core.blocks.ChoiceBlock(choices=[('left', 'Image on the left'), ('right', 'Image on the right')]))))), ('image_text2', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('text', wagtail.core.blocks.RichTextBlock(features=['link', 'h2', 'h3', 'h4', 'h5', 'h6'])), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this image should link out to.', required=False)), ('small', wagtail.core.blocks.BooleanBlock(help_text='Use smaller, fixed image size (eg: icon)', required=False))))), ('figure', wagtail.core.blocks.StructBlock((('figure', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('', 'Do not apply any explicit alignment classes.'), ('left-align', 'Left-align this image with the page content.'), ('right-align', 'Right-align this image with the page content.'), ('center', 'Center this image with the page content.'), ('full-width', 'Make this image full-width.')], required=False))))), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False))))), ('figuregrid', wagtail.core.blocks.StructBlock((('grid_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('figure', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('altText', wagtail.core.blocks.CharBlock(help_text='Image description (for screen readers).', required=True)), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('', 'Do not apply any explicit alignment classes.'), ('left-align', 'Left-align this image with the page content.'), ('right-align', 'Right-align this image with the page content.'), ('center', 'Center this image with the page content.'), ('full-width', 'Make this image full-width.')], required=False))))), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False)))))),))), ('figuregrid2', wagtail.core.blocks.StructBlock((('grid_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('caption', wagtail.core.blocks.CharBlock(help_text='Please remember to properly attribute any images we use.', required=False)), ('url', wagtail.core.blocks.CharBlock(help_text='Optional URL that this figure should link out to.', required=False)))))),))), ('video', wagtail.core.blocks.StructBlock((('url', wagtail.core.blocks.CharBlock(help_text='Please make sure this is a proper embed URL, or your video will not show up on the page.')), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL for caption to link to.', required=False))))), ('iframe', wagtail.core.blocks.StructBlock((('url', wagtail.core.blocks.CharBlock(help_text='Please note that only URLs from white-listed domains will work.')), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('captionURL', wagtail.core.blocks.CharBlock(help_text='Optional URL that this caption should link out to.', required=False))))), ('linkbutton', wagtail.core.blocks.StructBlock((('label', wagtail.core.blocks.CharBlock()), ('URL', wagtail.core.blocks.CharBlock()), ('styling', wagtail.core.blocks.ChoiceBlock(choices=[('btn-normal', 'Normal button'), ('btn-ghost', 'Ghost button')]))))), ('spacer', wagtail.core.blocks.StructBlock((('size', wagtail.core.blocks.ChoiceBlock(choices=[('1', 'quarter spacing'), ('2', 'half spacing'), ('3', 'single spacing'), ('4', 'one and a half spacing'), ('5', 'triple spacing')])),))), ('quote', wagtail.core.blocks.StructBlock((('quotes', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock((('quote', wagtail.core.blocks.CharBlock()), ('attribution', wagtail.core.blocks.CharBlock()))))),))), ('pulse_listing', wagtail.core.blocks.StructBlock((('search_terms', wagtail.core.blocks.CharBlock(help_text='Test your search at mozillapulse.org/search', label='Search', required=False)), ('max_number_of_results', wagtail.core.blocks.IntegerBlock(default=6, help_text='Choose 1-12. If you want visitors to see more, link to a search or tag on Pulse.', max_value=12, min_value=0, required=True)), ('only_featured_entries', wagtail.core.blocks.BooleanBlock(default=False, help_text='Featured items are selected by Pulse moderators.', label='Display only featured entries', required=False)), ('newest_first', wagtail.core.blocks.ChoiceBlock(choices=[('True', 'Show newer entries first'), ('False', 'Show older entries first')], label='Sort')), ('advanced_filter_header', wagtail.core.blocks.static_block.StaticBlock(admin_text='-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------', label=' ')), ('issues', wagtail.core.blocks.ChoiceBlock(choices=[('all', 'All'), ('Decentralization', 'Decentralization'), ('Digital Inclusion', 'Digital Inclusion'), ('Online Privacy & Security', 'Online Privacy & Security'), ('Open Innovation', 'Open Innovation'), ('Web Literacy', 'Web Literacy')])), ('help', wagtail.core.blocks.ChoiceBlock(choices=[('all', 'All'), ('Attend', 'Attend'), ('Create content', 'Create content'), ('Code', 'Code'), ('Design', 'Design'), ('Fundraise', 'Fundraise'), ('Join community', 'Join community'), ('Localize & translate', 'Localize & translate'), ('Mentor', 'Mentor'), ('Plan & organize', 'Plan & organize'), ('Promote', 'Promote'), ('Take action', 'Take action'), ('Test & feedback', 'Test & feedback'), ('Write documentation', 'Write documentation')], label='Type of help needed'))))))),
),
]
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div
class="pulse-project-list my-default"
for="{{ value.query }}"
size="{{ value.size }}"
rev="{{ value.newest_first }}"
checked="{{ value.only_featured_entries}}"
></div>
data-featured="{{ value.only_featured_entries}}"
data-help="{{ value.help }}"
data-issues="{{ value.issues }}"
data-max="{{ value.size }}"
data-query="{{ value.query }}"
data-reversed="{{ value.newest_first }}" />
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ <h4 class="h2-heading">Trending projects</h4>
</div>
<div class="row">
<div class="col">
<div class="pulse-project-list" for="" size="6" checked="true"></div>
<div class="pulse-project-list" data-query="" data-max="6" data-featured="True" data-reversed="True"></div>
</div>
</div>
<div class="row">
Expand Down
Loading

0 comments on commit 5000387

Please sign in to comment.