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

Provide "you are logged in" UI element #5

Closed
simonw opened this issue Jul 4, 2019 · 4 comments
Closed

Provide "you are logged in" UI element #5

simonw opened this issue Jul 4, 2019 · 4 comments

Comments

@simonw
Copy link
Owner

simonw commented Jul 4, 2019

Can the plugin add this to the template without needing to first modify Datasette core?

@simonw
Copy link
Owner Author

simonw commented Jul 5, 2019

No obvious hooks in https://github.com/simonw/datasette/blob/master/datasette/templates/base.html - also the Datasette design doesn't actually have any universal navigation that would be a good fit for a "you are logged in as" widget. Not obvious how to proceed with this one.

@simonw
Copy link
Owner Author

simonw commented Jul 5, 2019

For the moment I could put this in the footer? That's not easy to customize right now - it's hard-coded into the base.html template - but I could modify Datasette core to turn that into an overridable block (or an include, or both) to make this easier to hook into.

@simonw
Copy link
Owner Author

simonw commented Jul 5, 2019

If I'm going to need to modify the core templates for this anyway, it's probably time to introduce a universal navigation bar at the top of the page, rather than mess around too much with the footer.

It's fine to couple this to a new Datasette release because this plugin already uses a new plugin hook which will need to be released with Datasette 0.29.

@simonw
Copy link
Owner Author

simonw commented Jul 5, 2019

Here's a base.html template that takes advantage of the new code in simonw/datasette#540

{% extends "default:base.html" %}

{% block extra_head %}
<style type="text/css">
.hd .logout {
    float: right;
    text-align: right;
    padding-left: 1em;
}
</style>
{% endblock %}

{% block nav %}
    {{ super() }}
    <p class="logout">
        <a href="/-/logout">Log out</a>
    </p>
{% endblock %}

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

No branches or pull requests

1 participant