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

Feature/search improvement #21

Merged
merged 4 commits into from
Dec 9, 2020
Merged

Feature/search improvement #21

merged 4 commits into from
Dec 9, 2020

Conversation

mpuckett159
Copy link
Collaborator

Closes #20

Two main commits here, one to enable query params, second to cut the HTML code over to make use of them.

app.py:

 * imports
Add request, redirect, url_for from flask library to support query parameter usage and redirecting from the root page to the license page.

 * /
Change behavior of root to redirect to license page.

 * /license
Add get for parameter, then check if the parameter was passed and load the page if so. If not, load the default HTML.

 * /badge
Same changes as license.

 * /name
Same changes as license.

This change is adding the ability for users to use query parameters if they want. Next commit will be to update the HTML to utilize these new changes.
Copy/paste doh. Change the license Flask app to use the license_lookup function instead of the badge_lookup function.
This commit cuts over the website from the URL parsing format to utilize query parameters.

app.py:
 * LICENSE_CONTEXT
Add query_param to render HTML form properly. Change lookup_url to redirect back to the same url.

 * BADGE_CONTEXT
Same changes as LICENSE_CONTEXT

 * NAME_CONTEXT
Same changes as LICENSE_CONTEXT.

index.html:
Changing root form to be explicitly a license form.
Change form actions to execute GET request with query parameters as defined in the various context dicts.
Remove jquery stuff because it isn't needed anymore.
Copy link
Collaborator

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

Dang, this is awesome! You're right, way easier than I was expecting. I checked that the old links are still preserved and they are! One comment about formatting, then I think this is good to go 🚀

src/views/index.html Show resolved Hide resolved
src/app.py Outdated Show resolved Hide resolved
Simplifying the HTML rendering for the Flask app. This removes some redundancy.
Copy link
Collaborator

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

Way to go 😎

@mpuckett159 mpuckett159 merged commit 0e1766f into main Dec 9, 2020
@mpuckett159 mpuckett159 deleted the feature/search-improvement branch December 9, 2020 02:52
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.

Allow URL query parameters
2 participants