|
8 | 8 |
|
9 | 9 | from textwrap import dedent |
10 | 10 | from urllib.parse import urljoin |
| 11 | +from waffle import flag_is_active |
11 | 12 |
|
12 | 13 | import structlog |
13 | 14 | from bs4 import BeautifulSoup |
@@ -269,6 +270,179 @@ def get_v3_context_data(self, **kwargs): |
269 | 270 | return {"last_updated": "2024-02-17"} |
270 | 271 |
|
271 | 272 |
|
| 273 | +class LearnPageView(V3Mixin, TemplateView): |
| 274 | + v3_template_name = "v3/learn_page.html" |
| 275 | + |
| 276 | + def dispatch(self, request, *args, **kwargs): |
| 277 | + if not flag_is_active(request, "v3"): |
| 278 | + return HttpResponseNotFound() |
| 279 | + return super().dispatch(request, *args, **kwargs) |
| 280 | + |
| 281 | + def get_v3_context_data(self, **kwargs): |
| 282 | + ctx = self.get_context_data(**kwargs) |
| 283 | + ctx["learn_card_data"] = [ |
| 284 | + { |
| 285 | + "title": "I want to learn:", |
| 286 | + "text": "How to install Boost, use its libraries, build projects, and get help when you need it.", |
| 287 | + "links": [ |
| 288 | + { |
| 289 | + "label": "Explore common use cases", |
| 290 | + "url": "https://www.example.com", |
| 291 | + }, |
| 292 | + {"label": "Build with CMake", "url": "https://www.example.com"}, |
| 293 | + {"label": "Visit the FAQ", "url": "https://www.example.com"}, |
| 294 | + ], |
| 295 | + "url": "https://www.example.com", |
| 296 | + "label": "Learn more about Boost", |
| 297 | + "image_src": f"{ settings.STATIC_URL }/img/v3/examples/Learn_Card_Image.png", |
| 298 | + "mobile_image_src": f"{ settings.STATIC_URL }/img/v3/examples/Cheetah_Mobile.png", |
| 299 | + }, |
| 300 | + { |
| 301 | + "title": "I want to learn:", |
| 302 | + "text": "How to install Boost, use its libraries, build projects, and get help when you need it.", |
| 303 | + "links": [ |
| 304 | + { |
| 305 | + "label": "Explore common use cases", |
| 306 | + "url": "https://www.example.com", |
| 307 | + }, |
| 308 | + {"label": "Build with CMake", "url": "https://www.example.com"}, |
| 309 | + {"label": "Visit the FAQ", "url": "https://www.example.com"}, |
| 310 | + ], |
| 311 | + "url": "https://www.example.com", |
| 312 | + "label": "Learn more about Boost", |
| 313 | + "image_src": f"{ settings.STATIC_URL}img/v3/examples/Learn_Octopus.png", |
| 314 | + "mobile_image_src": f"{ settings.STATIC_URL }/img/v3/examples/Octopus_Mobile.png", |
| 315 | + }, |
| 316 | + ] |
| 317 | + |
| 318 | + demo_cards = [ |
| 319 | + { |
| 320 | + "title": "Get help", |
| 321 | + "description": "Tap into quick answers, networking, and chat with 24,000+ members.", |
| 322 | + "cta_label": "Start here", |
| 323 | + "cta_href": reverse("community"), |
| 324 | + }, |
| 325 | + { |
| 326 | + "title": "Documentation", |
| 327 | + "description": "Browse library docs, examples, and release notes in one place.", |
| 328 | + "cta_label": "View docs", |
| 329 | + "cta_href": reverse("docs"), |
| 330 | + }, |
| 331 | + { |
| 332 | + "title": "Community", |
| 333 | + "description": "Mailing lists, GitHub, and community guidelines for contributors.", |
| 334 | + "cta_label": "Join", |
| 335 | + "cta_href": reverse("community"), |
| 336 | + }, |
| 337 | + { |
| 338 | + "title": "Releases", |
| 339 | + "description": "Latest releases, download links, and release notes.", |
| 340 | + "cta_label": "Download", |
| 341 | + "cta_href": reverse("releases-most-recent"), |
| 342 | + }, |
| 343 | + { |
| 344 | + "title": "Libraries", |
| 345 | + "description": "Explore the full catalog of Boost C++ libraries with docs and metadata.", |
| 346 | + "cta_label": "Browse libraries", |
| 347 | + "cta_href": reverse("libraries"), |
| 348 | + }, |
| 349 | + { |
| 350 | + "title": "News", |
| 351 | + "description": "Blog posts, announcements, and community news from the Boost project.", |
| 352 | + "cta_label": "Read news", |
| 353 | + "cta_href": reverse("news"), |
| 354 | + }, |
| 355 | + { |
| 356 | + "title": "Getting started", |
| 357 | + "description": "Step-by-step guides to build and use Boost in your projects.", |
| 358 | + "cta_label": "Get started", |
| 359 | + "cta_href": reverse("getting-started"), |
| 360 | + }, |
| 361 | + { |
| 362 | + "title": "Resources", |
| 363 | + "description": "Learning resources, books, and other materials for Boost users.", |
| 364 | + "cta_label": "View resources", |
| 365 | + "cta_href": reverse("resources"), |
| 366 | + }, |
| 367 | + { |
| 368 | + "title": "Calendar", |
| 369 | + "description": "Community events, meetings, and review schedule.", |
| 370 | + "cta_label": "View calendar", |
| 371 | + "cta_href": reverse("calendar"), |
| 372 | + }, |
| 373 | + { |
| 374 | + "title": "Donate", |
| 375 | + "description": "Support the Boost Software Foundation and open-source C++.", |
| 376 | + "cta_label": "Donate", |
| 377 | + "cta_href": reverse("donate"), |
| 378 | + }, |
| 379 | + ] |
| 380 | + |
| 381 | + ctx["library_cards"] = demo_cards |
| 382 | + ctx["why_boost_cards"] = demo_cards[:6] |
| 383 | + ctx["calendar_card"] = { |
| 384 | + "title": "Boost is released three times a year", |
| 385 | + "text": "Each release has updates to existing libraries, and any new libraries that have passed the rigorous acceptance process.", |
| 386 | + "primary_button_url": "www.example.com", |
| 387 | + "primary_button_label": "View the Release Calendar", |
| 388 | + "secondary_button_url": "www.example.com", |
| 389 | + "secondary_button_label": "Secondary Button", |
| 390 | + "image": f"{ settings.STATIC_URL }/img/v3/demo_page/Calendar.png", |
| 391 | + } |
| 392 | + ctx["info_card"] = { |
| 393 | + "title": "How we got here", |
| 394 | + "text": "Since 1998, Boost has been where C++ innovation happens. What started with three developers has grown into the foundation of modern C++ development.", |
| 395 | + "primary_button_url": "www.example.com", |
| 396 | + "primary_button_label": "Explore Our History", |
| 397 | + } |
| 398 | + ctx["post_cards_data"] = { |
| 399 | + "heading": "Posts from the Boost Community", |
| 400 | + "view_all_url": "#", |
| 401 | + "view_all_label": "View All Posts", |
| 402 | + "variant": "Content Card", |
| 403 | + "posts": 4 |
| 404 | + * [ |
| 405 | + { |
| 406 | + "title": "A talk by Richard Thomson at the Utah C++ Programmers Group", |
| 407 | + "url": "#", |
| 408 | + "description": "Lorem Ispum Sum Delores", |
| 409 | + "date": "03/03/2025", |
| 410 | + "category": "Issues", |
| 411 | + "tag": "beast", |
| 412 | + "author": { |
| 413 | + "name": "Richard Thomson", |
| 414 | + "role": "Contributor", |
| 415 | + "show_badge": True, |
| 416 | + "avatar_url": "/static/img/v3/demo_page/Avatar.png", |
| 417 | + }, |
| 418 | + } |
| 419 | + ], |
| 420 | + } |
| 421 | + ctx["boost_community_data"] = { |
| 422 | + "heading": "The Boost community", |
| 423 | + "view_all_url": "#", |
| 424 | + "view_all_label": "Explore the community", |
| 425 | + "posts": 3 |
| 426 | + * [ |
| 427 | + { |
| 428 | + "title": "A talk by Richard Thomson at the Utah C++ Programmers Group", |
| 429 | + "description": "Lorem Ispum Sum Delores", |
| 430 | + "url": "#", |
| 431 | + "date": "03/03/2025", |
| 432 | + "category": "Issues", |
| 433 | + "tag": "beast", |
| 434 | + "author": { |
| 435 | + "name": "Richard Thomson", |
| 436 | + "role": "Contributor", |
| 437 | + "show_badge": True, |
| 438 | + "avatar_url": "/static/img/v3/demo_page/Avatar.png", |
| 439 | + }, |
| 440 | + } |
| 441 | + ], |
| 442 | + } |
| 443 | + return ctx |
| 444 | + |
| 445 | + |
272 | 446 | class ContentNotFoundException(Exception): |
273 | 447 | pass |
274 | 448 |
|
|
0 commit comments