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

2300 tagging strategy or moment from category page #2337

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

LucasKay64
Copy link

@LucasKay64 LucasKay64 commented Nov 25, 2024

Description

Added the ability to create a new strategy or moment from a concrete category page with tagging of the related category in the form for creating that new strategy or moment.

More Details

Added buttons aligned right to the title. They take the user to the form for creating a new strategy or moment. The tagged category from which the user clicked the buttons is stored in the URL query string and is read by the corresponding form. Also added some styling for mobile responsiveness.

The new @page_new_buttons handles multiple buttons for any title on any page for further use in the future although if one adds too many buttons, new CSS media query will be required to add as well.

Screenshots

image
image
image

Corresponding Issue

#2300

Copy link

welcome bot commented Nov 25, 2024

Thank you for opening this pull request with us! Be sure to follow our Pull Request Practices. Let us know if you have any questions on Slack.

@LucasKay64 LucasKay64 self-assigned this Nov 26, 2024
category = Category.friendly.find_by(slug: params[:category])
ids << category.id if category
end
ids
Copy link
Member

Choose a reason for hiding this comment

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

Can you write unit tests for this?

checked = @strategy.categories.include?(item)

if params[:category].present? && @strategy.new_record? && !checked
checked = item.slug == params[:category]
Copy link
Member

Choose a reason for hiding this comment

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

Can you write unit tests for this?

Copy link
Member

@julianguyen julianguyen left a comment

Choose a reason for hiding this comment

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

Great work! I think the last thing we want to do before we merge is write tests! I pointed places you can write unit tests in the helpers. And I also think we could write E2E tests as well.

@LucasKay64
Copy link
Author

LucasKay64 commented Nov 28, 2024

Thank you! Sure thing. Will do. :)

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.

2 participants