Conversation
|
This took a while to get back to, but I incorporated whatever feedback I could from the other PR and I think it's ready to be merged now if you think so too @toy |
toy
left a comment
There was a problem hiding this comment.
Awesome, thank you! I noted just few cleanup things and ideas
|
|
||
| ## Tools | ||
|
|
||
| - **User switcher**: A dropdown in the top navigation bar listing all active users. Click any user to immediately switch to them. |
There was a problem hiding this comment.
Thought for future additions - it may be nice to be able to easily switch them on/off, like if they conflict with something or someone prefers to not have them all on
| module OpenProject | ||
| module DevTools | ||
| end | ||
| end |
|
|
||
| register "openproject-dev_tools", | ||
| author_url: "https://www.openproject.org", | ||
| bundled: false, |
There was a problem hiding this comment.
Doesn't need to be explicitly specified
| bundled: false, |
| #++ | ||
|
|
||
| OpenProject::Application.routes.draw do | ||
| scope module: :dev_tools, path: "dev_tools", as: :dev_tools do |
There was a problem hiding this comment.
I think using namespace has same effect:
| scope module: :dev_tools, path: "dev_tools", as: :dev_tools do | |
| namespace :dev_tools do |
| classes: "op-app-menu--item", | ||
| style: "order: 1", | ||
| menu_id: "op-dev-user-switcher-menu", | ||
| select_variant: :single |
There was a problem hiding this comment.
In some cases the menu renders narrower wrapping user names, so I think it is better to set size (probably to :small, as it is enough and the smallest one), this also resolves it jumping from bottom to side when user list doesn't fit vertically
| end | ||
|
|
||
| users.each do |user| | ||
| menu .with_item( |
There was a problem hiding this comment.
| menu .with_item( | |
| menu.with_item( |
| render( | ||
| Primer::Alpha::ActionMenu.new( | ||
| classes: "op-app-menu--item", | ||
| style: "order: 1", |
There was a problem hiding this comment.
I have a feeling that some people would ask you to not use inline styles if it would be in the main project, but I don't mind in dev module, up to you
|
|
||
| current_user_name | ||
| end | ||
|
|
There was a problem hiding this comment.
Not sure about this, but maybe first user should be «Anonymous», as a quick way to see things logged out, also next menu has sign out
|
|
||
| if user&.active? | ||
| login_user(user) | ||
| flash[:notice] = I18n.t("dev_tools.user_switcher.switched", name: user.name) |
There was a problem hiding this comment.
I assume it is not important, but logging in from logged out state doesn't show the notice
| title: "Switch User (Dev Only)" | ||
| tooltip: "Switch User (Dev Only)" | ||
| heading: "Switch User (Dev Only)" | ||
| active_users: "Active Users" |
Continuing from opf/openproject#22016