-
Notifications
You must be signed in to change notification settings - Fork 26
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
Introduce a 'Create New Hyphae' special url and top bar highlight #123
Conversation
roselandgoose
commented
Dec 29, 2021
- Adds a /new handler which simply redirects to a queried page.
- Prevents redirect on empty input by sending NO CONTENT
- Recognizes special case header link /new and creates input bar.
- uses height+margin for vertical centering of search bar - improves support for long admin usernames
- Adds a /new handler which simply redirects to a queried page. - Prevents redirect on empty input by sending NO CONTENT - Recognizes special case header link /new and creates input bar.
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.
Thanks for the contribution! Left some nitpicks during the review, but otherwise looks very good to me. Here's how it looks in Chrome:
And the same thing but if I add it to the end:
The "replacing /new links with an input field" idea seems clever to me! Not sure if it fits well in the top bar, though; it looks messy, especially with those dark heavy outlines (you could blame Chrome for that, but there were styles that removed it before). Maybe @bouncepaw can think of a better placement for it? He also had an idea of a big "New" button for creating hyphae, and I had an idea of an ultimate JavaScript-enhanced field with existing hyphae autocompletion and fast editing shortcuts.
I'd also love some way of creating new hyphae relative to the one the user is currently at. So, if the user is currently browsing Fruits/Apple and they want to add a subhypha, they can type in "./Nutrients" and have Fruits/Apple/Nutrients hypha opened for editing. You just need to resolve the new path relative to the URL the user is coming from (Referer
HTTP header), like it's done for links in Mycomarkup.
@@ -656,6 +656,17 @@ kbd { | |||
display: block; | |||
padding: 0 .5rem; | |||
} | |||
.top-bar__highlight-new { | |||
display: block; |
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.
Nitpick: indentation
@@ -35,6 +35,14 @@ func initStuff(r *mux.Router) { | |||
r.HandleFunc("/favicon.ico", func(w http.ResponseWriter, rq *http.Request) { | |||
http.Redirect(w, rq, "/static/favicon.ico", http.StatusSeeOther) | |||
}) | |||
r.HandleFunc("/new", func(w http.ResponseWriter, rq *http.Request) { | |||
new_path := rq.URL.Query().Get("new-path") |
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.
Nitpick: prefer camelCase for variable names
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.
Although I like the whole idea of having a way to create a hypha, this pull request does not solve the problem.
The proposed input line in the top bar plays the role of a stripped-down address bar in the browser. @handlerug had an idea of relative names in that input; it is already supported by the address bar.
What would work is a link to a page where you create a hypha. A link, not an input, to not force users to think of the name beforehand.
{% if link.Href == "/new" %} | ||
<li class="top-bar__highlight"> | ||
<form class="top-bar__highlight-new" method="GET" action="/new"> | ||
<input class="top-bar__highlight-new-input" size="{%s inputSize(link.Display) %}" type="text" name="new-path" placeholder="{%s link.Display %}"> |
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.
Few things.
- A second input line in the top bar is not a good idea.
- This input offers nothing more than the address bar in any browser.
I'm closing this pull request for now because it does not solve the problem and offers nothing new. Nonetheless, we sure need something like that! I will open an issue regarding that. Thanks for bringing the attention to the topic. |