Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add links to specific event components #423

Open
wants to merge 29 commits into
base: development
Choose a base branch
from

Conversation

lcduong
Copy link
Contributor

@lcduong lcduong commented Nov 8, 2024

This PR PR resolves #391
Implement links to specific event components in eventyay-common and tickets control:

NOTE: please note that this PR did not change how URL being generated in template, I just move it into a div tags

  1. In detail of event in eventyay-common:

image

If video plugin is not enabled or video plugin settings missing config, will disable 'Video' button

image

  1. On all event tickets pages (except pages from external plugin)

image

image

Summary by Sourcery

Add links to specific event components, including video access, in the eventyay-common and tickets control sections. Refactor navigation headers to include a consistent event navigation bar with component links.

New Features:

  • Introduce links to specific event components, including video access, in the eventyay-common and tickets control sections.

Enhancements:

  • Refactor navigation headers across multiple templates to include a consistent event navigation bar with component links.

Summary by Sourcery

Add links to specific event components, including video access, in the eventyay-common and tickets control sections. Refactor navigation headers to include a consistent event navigation bar with component links.

New Features:

  • Introduce links to specific event components, including video access, in the eventyay-common and tickets control sections.

Enhancements:

  • Refactor navigation headers across multiple templates to include a consistent event navigation bar with component links.

Copy link

sourcery-ai bot commented Nov 8, 2024

Reviewer's Guide by Sourcery

This PR implements a navigation header with links to specific event components (Tickets, Talk, Videos) across multiple pages in the application. The implementation includes adding video access functionality, refactoring the header layout, and ensuring consistent navigation across different views.

Class Diagram for Video Access and Plugin Management

classDiagram
    class EventView {
        +get_queryset()
        +get_context_data()
        +get_plugins(plugin_list)
    }
    class VideoAccessAuthenticator {
        +get(request, *args, **kwargs)
        +generate_token_url(request)
    }
    EventView <|-- VideoAccessAuthenticator
    class PluginHelper {
        +_get_plugins(plugin_list)
        +_is_video_enabled(event)
    }
    EventView o-- PluginHelper
    VideoAccessAuthenticator o-- PluginHelper
Loading

File-Level Changes

Change Details Files
Added video access functionality with authentication and token generation
  • Created VideoAccessAuthenticator class to handle video access requests
  • Added plugin and configuration validation logic
  • Implemented JWT token generation for video system access
  • Added helper methods to parse and validate plugin configurations
src/pretix/eventyay_common/views/event.py
src/pretix/eventyay_common/urls.py
Implemented consistent navigation header across multiple templates
  • Created a reusable component_link.html template for navigation buttons
  • Added navigation header with Tickets, Talk, and Videos links
  • Implemented conditional rendering of video access button based on plugin status
  • Wrapped existing page titles in the new navigation header structure
src/pretix/control/templates/pretixcontrol/event/component_link.html
src/pretix/control/templates/pretixcontrol/checkin/index.html
src/pretix/eventyay_common/templates/eventyay_common/event/settings.html
src/pretix/control/templates/pretixcontrol/orders/overview.html
Added styling for the navigation header
  • Created custom SCSS file for navigation styling
  • Implemented responsive flexbox layout for navigation elements
  • Added hover and active states for navigation buttons
  • Styled navigation header borders and spacing
src/pretix/static/eventyay-common/scss/custom.scss
src/pretix/static/pretixcontrol/scss/main.scss
Added context data for video functionality
  • Added video plugin status check to default context
  • Included talk edit URL in context data
  • Added helper functions for plugin list parsing
src/pretix/control/context.py

Assessment against linked issues

Issue Objective Addressed Explanation
#391 Add an internal menu with four items (Home, Tickets, Talk, Video) linking to specific event areas in eventyay-common
#391 Add the same internal menu with four items on all event tickets pages, with the current component highlighted in blue

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@lcduong lcduong marked this pull request as ready for review November 8, 2024 03:19
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lcduong - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using template inheritance or includes to reduce duplication of the navigation header code across multiple templates. This would make future maintenance easier.
  • The _get_plugins() and _is_video_enabled() functions are duplicated between event.py and context.py. Consider extracting these into a shared utility module to avoid code duplication.
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -78,12 +84,23 @@ def get_queryset(self):
query_set = self.filter_form.filter_qs(query_set)
return query_set

def get_plugins(self, plugin_list):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This get_plugins() method is duplicated with _get_plugins() - should be consolidated into a single utility function

Consider moving this to a shared utility module since it's used in multiple places. This will reduce code duplication and make maintenance easier.

return []
return [p.strip() for p in plugin_list.split(",") if p.strip()]

def _is_video_enabled(self):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This _is_video_enabled() method is duplicated in context.py - should be consolidated

This same logic appears in context.py. Consider extracting to a shared location to avoid maintaining duplicate code.

border-radius: 0;
}
.header-nav.active {
background-color: $hover-button-color !important;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Avoid using !important in CSS rules

Instead of using !important, consider restructuring the CSS selectors to achieve the desired specificity through proper hierarchy.

Suggested change
background-color: $hover-button-color !important;
background-color: $hover-button-color;

@@ -406,7 +406,7 @@ def test_paid(self):
def test_sent_days(self):
self.event.settings.mail_days_order_expire_warning = 9
send_expiry_warnings(sender=self.event)
assert len(djmail.outbox) == 0
assert len(djmail.outbox) == 1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (testing): Test assertion change needs explanation or additional test cases

The test assertion has been changed from expecting 0 emails to expecting 1 email, but there's no explanation for this change. Either this is fixing a bug (in which case we should add test cases to verify the fix) or this might be an unintended change. Please clarify and add appropriate test coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add links to specific event components
3 participants