-
Notifications
You must be signed in to change notification settings - Fork 749
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
base: main
Are you sure you want to change the base?
2300 tagging strategy or moment from category page #2337
Conversation
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. |
…github.com/LucasKay64/ifme into 2300_strategy_or_moment_from_category_page
category = Category.friendly.find_by(slug: params[:category]) | ||
ids << category.id if category | ||
end | ||
ids |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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?
There was a problem hiding this 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.
Thank you! Sure thing. Will do. :) |
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
Corresponding Issue
#2300