{"html_url": "https://github.com/simonw/datasette/issues/540#issuecomment-508769380", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/540", "id": 508769380, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODc2OTM4MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T14:04:12Z", "updated_at": "2019-07-05T14:04:12Z", "author_association": "OWNER", "body": "Need to figure out a sensible mobile version of this too.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464449570, "label": "Add a universal navigation bar which can be modified by plugins"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/540#issuecomment-508771246", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/540", "id": 508771246, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODc3MTI0Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T14:10:35Z", "updated_at": "2019-07-05T14:10:35Z", "author_association": "OWNER", "body": "https://css-tricks.com/off-canvas-menu-with-css-target/ could be fun. See also https://medium.com/@heyoka/responsive-pure-css-off-canvas-hamburger-menu-aebc8d11d793", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464449570, "label": "Add a universal navigation bar which can be modified by plugins"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/540#issuecomment-508806571", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/540", "id": 508806571, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODgwNjU3MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T16:14:55Z", "updated_at": "2019-07-05T16:14:55Z", "author_association": "OWNER", "body": "I think I'll start with something ridiculously simple along these lines:\r\n\r\n\"fixtures__roadside_attraction_characteristics\"\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464449570, "label": "Add a universal navigation bar which can be modified by plugins"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/540#issuecomment-508819126", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/540", "id": 508819126, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODgxOTEyNg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T17:14:52Z", "updated_at": "2019-07-05T17:14:52Z", "author_association": "OWNER", "body": "Having this be customized by a single plugin seems easy enough - define a named block region in the template, the plugin can then provide a template which extends the base template, over-rides the named block, adds some stuff, then calls [super](http://jinja.pocoo.org/docs/2.10/templates/#super-blocks) to include the default content.\r\n\r\nBut... how would this work if there are multiple plugins that want to add to the menu area?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464449570, "label": "Add a universal navigation bar which can be modified by plugins"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/540#issuecomment-508827948", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/540", "id": 508827948, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODgyNzk0OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T17:56:57Z", "updated_at": "2019-07-05T17:56:57Z", "author_association": "OWNER", "body": "For the moment I'm going to ignore the multiple plugins case. I shall revisit that at some point in the future, once I actually have multiple plugins that want to be able to customize the navigation at the same time.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464449570, "label": "Add a universal navigation bar which can be modified by plugins"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/540#issuecomment-508858510", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/540", "id": 508858510, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg1ODUxMA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T20:43:20Z", "updated_at": "2019-07-05T20:43:20Z", "author_association": "OWNER", "body": "https://latest.datasette.io/fixtures/attraction_characteristic/1 now looks like this:\r\n\r\n\"fixtures__attraction_characteristic\"\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464449570, "label": "Add a universal navigation bar which can be modified by plugins"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/540#issuecomment-508858729", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/540", "id": 508858729, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg1ODcyOQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T20:44:50Z", "updated_at": "2019-07-05T20:44:50Z", "author_association": "OWNER", "body": "Here's an example custom `base.html` template that appears to have the desired effect:\r\n```html+django\r\n{% extends \"default:base.html\" %}\r\n\r\n{% block extra_head %}\r\n\r\n{% endblock %}\r\n\r\n{% block nav %}\r\n {{ super() }}\r\n

\r\n Log out\r\n

\r\n{% endblock %}\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464449570, "label": "Add a universal navigation bar which can be modified by plugins"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/541#issuecomment-508871981", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/541", "id": 508871981, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg3MTk4MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T22:15:35Z", "updated_at": "2019-07-05T22:15:35Z", "author_association": "OWNER", "body": "Example usage:\r\n```python\r\n@hookimpl\r\ndef extra_template_vars(request):\r\n return {\r\n \"auth\": request.scope.get(\"auth\"),\r\n }\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464779810, "label": "Plugin hook for adding extra template context variables"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/541#issuecomment-508872137", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/541", "id": 508872137, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg3MjEzNw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T22:16:57Z", "updated_at": "2019-07-05T22:16:57Z", "author_association": "OWNER", "body": "It should allow for awaitables too, to allow for execution of SQL. For example:\r\n\r\n```python\r\n@hookimpl\r\ndef extra_template_vars(datasette):\r\n async def inner():\r\n first_db = list(datasette.databases.keys())[0]\r\n return {\r\n \"sqlite_version\": (\r\n await datasette.execute(first_db, \"select sqlite_version()\")\r\n ).rows[0][0]\r\n }\r\n return inner\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464779810, "label": "Plugin hook for adding extra template context variables"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/542#issuecomment-508873079", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/542", "id": 508873079, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg3MzA3OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T22:25:33Z", "updated_at": "2019-07-05T22:25:33Z", "author_association": "OWNER", "body": "I'm getting this weird failure again:\r\n```\r\nself = \r\n @contextlib.contextmanager\r\n def isolated_filesystem(self):\r\n \"\"\"A context manager that creates a temporary folder and changes\r\n the current working directory to it for isolated filesystem tests.\r\n \"\"\"\r\n> cwd = os.getcwd()\r\nE FileNotFoundError: [Errno 2] No such file or directory\r\n```\r\nI saw this the other day too, but managed to avoid it by skipping any code that messed around with temporary files.\r\n\r\nBaffled as to why this is showing up now, as none of the changes I'm making here have any relevance to the way temporary files are created or the current working directory is set.\r\n\r\nI understand the root cause here to be that the working directory for the tests was deleted while the tests were still running, which would seem to indicate that something to do with a `tmpdir` fixture is at fault.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464786717, "label": "extra_template_vars plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/542#issuecomment-508873216", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/542", "id": 508873216, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg3MzIxNg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T22:27:00Z", "updated_at": "2019-07-05T22:27:00Z", "author_association": "OWNER", "body": "I bet that error is something to do with this:\r\nhttps://github.com/simonw/datasette/blob/e06e083240522a281b280b6461e935bf4b47bdbc/tests/test_plugins.py#L195-L197", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464786717, "label": "extra_template_vars plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/542#issuecomment-508875041", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/542", "id": 508875041, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg3NTA0MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T22:43:53Z", "updated_at": "2019-07-05T22:43:53Z", "author_association": "OWNER", "body": "I've confirmed that it's the `template_dir=` line quoted above. It isn't the fault of `pathlib` - if you hard-code in the path string like this I still get the same failures:\r\n```\r\n template_dir = \"/Users/simonw/Dropbox/Development/datasette/tests/test_templates\"\r\n for client in make_app_client(\r\n template_dir=template_dir\r\n ):\r\n```\r\nSo for some reason setting `template_dir` to a concrete directory breaks those other tests.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464786717, "label": "extra_template_vars plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/542#issuecomment-508876259", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/542", "id": 508876259, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg3NjI1OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T22:55:27Z", "updated_at": "2019-07-05T22:55:46Z", "author_association": "OWNER", "body": "Here's what `isolated_filesystem()` does:\r\n\r\n> A context manager that creates a temporary folder and changes the current working directory to it for isolated filesystem tests.\r\n\r\nhttps://github.com/pallets/click/issues/395 is a four year old issue suggesting allowing it to have a parent tmp directory passed to it, but since that issue was never closed I don't think it's going to help me.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464786717, "label": "extra_template_vars plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/542#issuecomment-508876468", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/542", "id": 508876468, "node_id": "MDEyOklzc3VlQ29tbWVudDUwODg3NjQ2OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-07-05T22:57:32Z", "updated_at": "2019-07-05T22:57:32Z", "author_association": "OWNER", "body": "This looks relevant: https://github.com/pytest-dev/pytest/issues/1235 - \"pytest explodes if getcwd fails\"", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 464786717, "label": "extra_template_vars plugin hook"}, "performed_via_github_app": null}