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

Message styling #144

Open
chrislawlor opened this issue May 23, 2013 · 2 comments
Open

Message styling #144

chrislawlor opened this issue May 23, 2013 · 2 comments

Comments

@chrislawlor
Copy link
Contributor

Bootstrap alerts make a great fit for messages:

unstyled_message

Becomes:

message_alert

Usually, I'd do this by setting MESSAGE_TAGS to directly map message tags to bootstrap alert classes.

# Map django message levels to bootstrap alert classes
MESSAGE_TAGS = {
    message_constants.DEBUG: 'alert-info',
    message_constants.INFO: 'alert-info',
    message_constants.SUCCESS: 'alert-success',
    message_constants.WARNING: 'alert-error',
    message_constants.ERROR: 'alert-error',
}

but AFAIK there's no way for a third party app to define settings like this so that they only apply to the app.

I believe using LESS mixins to map default message classes to Bootstrap alert classes, as in the blog post linked by @sehmaschine here #125 (comment), would be a great way to approach this. The markup would be something like:

# base.html - simplified for clarity
{% for message in messages %}
    <li class="message-{{ message.tags }}">{{ message }}</li>
{% endfor %}

# style.less
.message-info {
    .alert
    .alert-info
}

message-success {
    .alert
    .alert-success
}
...

Obviously, this relies on moving to LESS for our styling. The discussion around this is mostly in issue #125.

@pydanny
Copy link
Member

pydanny commented May 23, 2013

I think I want to see how @sehmaschine and @audreyr weigh in before deciding on SASS/LESS/COMPASS items.

@pydanny
Copy link
Member

pydanny commented Jul 1, 2013

Not sure how to handle this. I would prefer this to be purely a theme issue, but I don't want developers working on the core library to have to know LESS.

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

No branches or pull requests

3 participants