{"html_url": "https://github.com/simonw/datasette/issues/1064#issuecomment-719104883", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1064", "id": 719104883, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTEwNDg4Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-30T00:50:01Z", "updated_at": "2020-10-30T00:52:29Z", "author_association": "OWNER", "body": "Here's what the prototype looks like so far:\r\n\r\n![menu](https://user-images.githubusercontent.com/9599/97647443-7eda4f00-1a0f-11eb-8d78-b703b7a13616.gif)\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": 732798913, "label": "Navigation menu plus plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1064#issuecomment-719105197", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1064", "id": 719105197, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTEwNTE5Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-30T00:51:16Z", "updated_at": "2020-10-30T00:51:16Z", "author_association": "OWNER", "body": "I used a `
` for this: https://github.com/simonw/datasette/blob/0d7ac764861d84be24d661cf4104ce61ea11a82a/datasette/templates/base.html#L16-L36\r\n\r\nI added a bit of JavaScript so that clicking outside the menu would close it: https://github.com/simonw/datasette/blob/0d7ac764861d84be24d661cf4104ce61ea11a82a/datasette/templates/base.html#L59-L74", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 732798913, "label": "Navigation menu plus plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1064#issuecomment-719105641", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1064", "id": 719105641, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTEwNTY0MQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-30T00:53:00Z", "updated_at": "2020-10-30T00:53:00Z", "author_association": "OWNER", "body": "Tips for making this accessible: https://css-tricks.com/accessible-svgs/", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 732798913, "label": "Navigation menu plus plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1064#issuecomment-719106174", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1064", "id": 719106174, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTEwNjE3NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-30T00:55:12Z", "updated_at": "2020-10-30T00:55:12Z", "author_association": "OWNER", "body": "So what should go in this menu?\r\n\r\nIf the user is logged in as root, I'll link to the various debug pages.\r\n\r\nIf they're not logged in at all I don't think the menu should appear.\r\n\r\nIf they are logged in as anyone, it should display to give them access to the \"log out\" button.\r\n\r\nPlugins can add links to it. If those plugins add links, the menu will display.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 732798913, "label": "Navigation menu plus plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1064#issuecomment-719109770", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1064", "id": 719109770, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTEwOTc3MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-30T01:08:14Z", "updated_at": "2020-10-30T01:08:14Z", "author_association": "OWNER", "body": "How should the plugin hook work?\r\n\r\nHere's the first version of the HTML:\r\n```html\r\n
\r\n \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": 732798913, "label": "Navigation menu plus plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1064#issuecomment-719110582", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1064", "id": 719110582, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTExMDU4Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-30T01:11:13Z", "updated_at": "2020-10-30T01:11:13Z", "author_association": "OWNER", "body": "Should plugins be able to add forms like the logout form here, or should they be restricted to adding navigation links?\r\n\r\nI can't think of a reason a plugin would need to add a form. The logout form is a special case to protect against logout-csrf attacks.\r\n\r\nSo I think plugins get to return a list of dictionaries, each with a `label` and an `href`:\r\n\r\n```python\r\nreturn [{\r\n \"label\": \"Upload CSVs\",\r\n \"href\": datasette.urls.path(\"/-/upload-csvs\")\r\n}]\r\n```\r\nBut... is there an argument for returning headings, to divide up the menu?\r\n\r\nI think so. I also like the idea that a default plugin checks for the `root` user and outputs links to the different debugging tools - maybe those should be wrapped in a section heading.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 732798913, "label": "Navigation menu plus plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1064#issuecomment-719110808", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1064", "id": 719110808, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTExMDgwOA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-30T01:12:09Z", "updated_at": "2020-10-30T01:12:19Z", "author_association": "OWNER", "body": "Or... plugins could return HTML - maybe optionally using helper functions to generate common HTML such that plugins which use the helpers can have their HTML modified in the future.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 732798913, "label": "Navigation menu plus plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1064#issuecomment-719111373", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1064", "id": 719111373, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTExMTM3Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-30T01:14:13Z", "updated_at": "2020-10-30T01:14:13Z", "author_association": "OWNER", "body": "Plugins returning HTML makes more sense for some of the other areas that plugins will be able to inject content - e.g. injecting content on the table or row page above the table.\r\n\r\nIf I'm going to have that as a pattern though it may make sense to use HTML here, since that will be consistent with other places that plugins can inject additional content.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 732798913, "label": "Navigation menu plus plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1064#issuecomment-719111597", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1064", "id": 719111597, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTExMTU5Nw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-30T01:15:05Z", "updated_at": "2020-10-30T01:15:05Z", "author_association": "OWNER", "body": "I'm torn on this one. I think I have a very slight preference for plugins returning structured objects as opposed to HTML. Less likely to regret that choice in the future?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 732798913, "label": "Navigation menu plus plugin hook"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1064#issuecomment-719117185", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1064", "id": 719117185, "node_id": "MDEyOklzc3VlQ29tbWVudDcxOTExNzE4NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2020-10-30T01:35:17Z", "updated_at": "2020-10-30T01:35:17Z", "author_association": "OWNER", "body": "I'm going to go with a list of `{\"label\": ..., \"href\": ...}` as the first iteration of this. The logout link will not be returned as part of the plugin output. A default plugin will provide the debug tools if the user is logged in as root.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 732798913, "label": "Navigation menu plus plugin hook"}, "performed_via_github_app": null}