|
8 | 8 | from django.views.generic import TemplateView |
9 | 9 |
|
10 | 10 | from core.calendar import extract_calendar_events, events_by_month, get_calendar |
| 11 | +from core.mixins import V3Mixin |
11 | 12 | from libraries.constants import LATEST_RELEASE_URL_PATH_STR |
12 | 13 | from libraries.mixins import ContributorMixin |
13 | 14 | from news.models import Entry |
14 | 15 | from testimonials.models import Testimonial |
| 16 | +from core.mock_data import SharedResources |
15 | 17 |
|
16 | 18 |
|
17 | 19 | logger = structlog.get_logger() |
18 | 20 |
|
19 | 21 |
|
20 | | -class HomepageView(ContributorMixin, TemplateView): |
| 22 | +class HomepageView(V3Mixin, ContributorMixin, TemplateView): |
21 | 23 | """ |
22 | 24 | Define all the pieces that will be displayed on the home page |
23 | 25 | """ |
24 | 26 |
|
25 | 27 | template_name = "homepage.html" |
26 | 28 |
|
| 29 | + v3_template_name = "v3/homepage.html" |
| 30 | + |
27 | 31 | def get_context_data(self, **kwargs): |
28 | 32 | context = super().get_context_data(**kwargs) |
29 | 33 | context["entries"] = Entry.objects.published().order_by("-publish_at")[:3] |
@@ -67,6 +71,107 @@ def get_events(self): |
67 | 71 |
|
68 | 72 | return dict(sorted_events) |
69 | 73 |
|
| 74 | + def get_v3_context_data(self, **kwargs): |
| 75 | + ctx = super().get_context_data(**kwargs) |
| 76 | + ctx["install_card_pkg_managers"] = SharedResources.install_card_pkg_managers |
| 77 | + ctx["install_card_system_install"] = SharedResources.install_card_system_install |
| 78 | + |
| 79 | + demo_cards = [ |
| 80 | + { |
| 81 | + "title": "Performant", |
| 82 | + "description": "Optimized for production at any scale, Boost outperforms many standard benchmarks.", |
| 83 | + "icon_name": "bullseye-arrow", |
| 84 | + }, |
| 85 | + { |
| 86 | + "title": "Peer-reviewed", |
| 87 | + "description": "Well tested by members of the C++ standards committee.", |
| 88 | + "icon_name": "get-help", |
| 89 | + }, |
| 90 | + { |
| 91 | + "title": "Portable", |
| 92 | + "description": "Works across all platforms, compilers, and C++ standards.", |
| 93 | + "icon_name": "link", |
| 94 | + }, |
| 95 | + { |
| 96 | + "title": "Innovative", |
| 97 | + "description": "Over 40 Boost libraries have become part of the C++ standard over the past 25 years.", |
| 98 | + "icon_name": "bullseye-arrow", |
| 99 | + }, |
| 100 | + { |
| 101 | + "title": "Community-powered", |
| 102 | + "description": "Contributing to Boost builds credibility, sharpens skills, and advances careers.", |
| 103 | + "icon_name": "human", |
| 104 | + }, |
| 105 | + { |
| 106 | + "title": "Known worldwide", |
| 107 | + "description": "Used in countless projects, you've probably encountered Boost without realizing it.", |
| 108 | + "icon_name": "link", |
| 109 | + }, |
| 110 | + { |
| 111 | + "title": "Free", |
| 112 | + "description": "Open source now and always, thanks to the Boost Software License.", |
| 113 | + "icon_name": "check", |
| 114 | + }, |
| 115 | + { |
| 116 | + "title": "Production-ready", |
| 117 | + "description": "Battle-tested in critical systems across industries around the globe.", |
| 118 | + "icon_name": "bullseye-arrow", |
| 119 | + }, |
| 120 | + ] |
| 121 | + |
| 122 | + ctx["library_cards"] = demo_cards |
| 123 | + ctx["why_boost_cards"] = demo_cards[:8] |
| 124 | + ctx["calendar_card"] = { |
| 125 | + "title": "Boost is released three times a year", |
| 126 | + "text": "Each release has updates to existing libraries, and any new libraries that have passed the rigorous acceptance process.", |
| 127 | + "primary_button_url": "www.example.com", |
| 128 | + "primary_button_label": "View the Release Calendar", |
| 129 | + "secondary_button_url": "www.example.com", |
| 130 | + "secondary_button_label": "Secondary Button", |
| 131 | + "image": f"{settings.STATIC_URL}/img/v3/demo_page/Calendar.png", |
| 132 | + } |
| 133 | + ctx["info_card"] = { |
| 134 | + "title": "How we got here", |
| 135 | + "text": "Since 1998, Boost has been where C++ innovation happens. What started with three developers has grown into the foundation of modern C++ development.", |
| 136 | + "primary_button_url": "www.example.com", |
| 137 | + "primary_button_label": "Explore Our History", |
| 138 | + } |
| 139 | + ctx["posts_from_the_boost_community"] = { |
| 140 | + "heading": "Posts from the Boost Community", |
| 141 | + "primary_cta_label": "View all posts", |
| 142 | + "primary_cta_url": "#", |
| 143 | + "variant": "card", |
| 144 | + "theme": "teal", |
| 145 | + "items": SharedResources.demo_posts[:5], |
| 146 | + } |
| 147 | + ctx["join_developers_building_the_future_of_cpp"] = { |
| 148 | + "items": SharedResources.demo_join_community_links[:5] |
| 149 | + } |
| 150 | + ctx["boost_community_data"] = { |
| 151 | + "heading": "The Boost community", |
| 152 | + "view_all_url": "#", |
| 153 | + "view_all_label": "Explore the community", |
| 154 | + "posts": SharedResources.demo_posts, |
| 155 | + } |
| 156 | + ctx["popular_terms"] = SharedResources.popular_terms |
| 157 | + ctx["demo_events_with_links"] = SharedResources.demo_events_with_links[:4] |
| 158 | + ctx["code_demo_hello"] = SharedResources.code_demo_hello |
| 159 | + ctx["stats_in_numbers"] = { |
| 160 | + "example_library_commits_bars": SharedResources.example_library_commits_bars |
| 161 | + } |
| 162 | + ctx["testimonial_data"] = {"testimonials": SharedResources.testimonials} |
| 163 | + |
| 164 | + ctx["library_intro"] = SharedResources.library_intro |
| 165 | + |
| 166 | + ctx["build_anything_with_boost"] = SharedResources.build_anything_with_boost |
| 167 | + |
| 168 | + ctx["hero_legacy_image_url_light"] = SharedResources.hero_legacy_image_url_light |
| 169 | + ctx["hero_legacy_image_url_dark"] = SharedResources.hero_legacy_image_url_dark |
| 170 | + ctx["hero_image_url"] = SharedResources.hero_image_url |
| 171 | + ctx["hero_image_url_light"] = SharedResources.hero_image_url_light |
| 172 | + ctx["hero_image_url_dark"] = SharedResources.hero_image_url_dark |
| 173 | + return ctx |
| 174 | + |
70 | 175 |
|
71 | 176 | class ForbiddenView(View): |
72 | 177 | """ |
|
0 commit comments