-
Notifications
You must be signed in to change notification settings - Fork 3
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
UI improvement: Upload success/error messages #72
Conversation
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.
Awesome work!
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.
Love it! I can't actually see what it looks like because of migration issues...but seems like it should be fine :).
I have a thing against leaving old commented-out code in the codebase, so I would prefer that it's removed, but not a big deal.
{% if messages %} | ||
{% for message in messages %} | ||
<div class="text-center"> | ||
{% if message.level == DEFAULT_MESSAGE_LEVELS.SUCCESS %} |
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.
If you stick the following into settings.py, we'll get full messages<->Bootstrap compat and then you can then do something like ...other classes... alert-{{ message.tags }}
instead of the if/else casing for the level. (or, since it seems like we aren't using alert-*
styling b/c of the background color, just {{ message.tags }}
)
# at the top of the file
from django.contrib.messages import constants as messages
# wherever you want
MESSAGE_TAGS = {
messages.ERROR: 'danger'
}
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.
Oh, thanks, I'll look into that later! Good to know--I felt like the if/else casing was a bit unwieldy
<input class="form-control-file" id="file" type="file" name="file" accept="application/pdf" required> | ||
</div> | ||
<div class="form-group col-md"> | ||
<div id="message" class="alert d-inline-block warning" style="display: none !important;" role="alert"> </div> |
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.
Question: since there's nothing in here by default, would it even display anything if you removed the display: none
?
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.
Yep, removing that would display a nice red block that houses no text by default
Mostly worked on the messages on the /upload page. There are some minor unrelated changes elsewhere.