From 6ab522b2b35b565ff6f4458657dec70aa073c177 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 18 Aug 2021 14:30:35 +0100 Subject: [PATCH] Convert account setting menu to tabs, and include on other pages This makes it easier to navigate around these pages. Since each tab corresponds to a given controller, this makes the selection of active tabs straightforward. --- app/views/application/_settings_menu.html.erb | 18 ++++++++++++++++++ app/views/oauth2_applications/edit.html.erb | 2 ++ app/views/oauth2_applications/index.html.erb | 2 ++ app/views/oauth2_applications/new.html.erb | 2 ++ app/views/oauth2_applications/show.html.erb | 2 ++ .../index.html.erb | 2 ++ app/views/oauth_clients/edit.html.erb | 2 ++ app/views/oauth_clients/index.html.erb | 2 ++ app/views/oauth_clients/new.html.erb | 2 ++ app/views/oauth_clients/show.html.erb | 2 ++ app/views/users/account.html.erb | 8 ++------ config/locales/en.yml | 9 +++++---- test/integration/client_applications_test.rb | 2 +- 13 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 app/views/application/_settings_menu.html.erb diff --git a/app/views/application/_settings_menu.html.erb b/app/views/application/_settings_menu.html.erb new file mode 100644 index 000000000..03d8c74c2 --- /dev/null +++ b/app/views/application/_settings_menu.html.erb @@ -0,0 +1,18 @@ +<% content_for :heading_class, "pb-0" %> + +<% content_for :heading do %> + +<% end %> diff --git a/app/views/oauth2_applications/edit.html.erb b/app/views/oauth2_applications/edit.html.erb index 94b51893e..0069e7e60 100644 --- a/app/views/oauth2_applications/edit.html.erb +++ b/app/views/oauth2_applications/edit.html.erb @@ -2,6 +2,8 @@

<%= t ".title" %>

<% end %> +<%= render :partial => "settings_menu" %> + <%= bootstrap_form_for @application, :url => oauth_application_path(@application), :html => { :method => :put } do |f| %> <%= render :partial => "form", :locals => { :f => f } %> <% end %> diff --git a/app/views/oauth2_applications/index.html.erb b/app/views/oauth2_applications/index.html.erb index 240b34d31..119bf5878 100644 --- a/app/views/oauth2_applications/index.html.erb +++ b/app/views/oauth2_applications/index.html.erb @@ -2,6 +2,8 @@

<%= t ".title" %>

<% end %> +<%= render :partial => "settings_menu" %> + <% if @applications.length > 0 %> diff --git a/app/views/oauth2_applications/new.html.erb b/app/views/oauth2_applications/new.html.erb index a9d6f4a49..a2b26c962 100644 --- a/app/views/oauth2_applications/new.html.erb +++ b/app/views/oauth2_applications/new.html.erb @@ -2,6 +2,8 @@

<%= t ".title" %>

<% end %> +<%= render :partial => "settings_menu" %> + <%= bootstrap_form_for @application, :url => { :action => :create } do |f| %> <%= render :partial => "form", :locals => { :f => f } %> <% end %> diff --git a/app/views/oauth2_applications/show.html.erb b/app/views/oauth2_applications/show.html.erb index e8ab7836d..296705811 100644 --- a/app/views/oauth2_applications/show.html.erb +++ b/app/views/oauth2_applications/show.html.erb @@ -2,6 +2,8 @@

<%= @application.name %>

<% end %> +<%= render :partial => "settings_menu" %> + <% secret = flash[:application_secret].presence || @application.plaintext_secret %>
diff --git a/app/views/oauth2_authorized_applications/index.html.erb b/app/views/oauth2_authorized_applications/index.html.erb index 336de1406..b9599a919 100644 --- a/app/views/oauth2_authorized_applications/index.html.erb +++ b/app/views/oauth2_authorized_applications/index.html.erb @@ -2,6 +2,8 @@

<%= t ".title" %>

<% end %> +<%= render :partial => "settings_menu" %> + <% if @applications.length > 0 %>
diff --git a/app/views/oauth_clients/edit.html.erb b/app/views/oauth_clients/edit.html.erb index f31063ae0..b0299689a 100644 --- a/app/views/oauth_clients/edit.html.erb +++ b/app/views/oauth_clients/edit.html.erb @@ -2,6 +2,8 @@

<%= t ".title" %>

<% end %> +<%= render :partial => "settings_menu" %> + <%= bootstrap_form_for @client_application, :url => oauth_client_path(@client_application.user.display_name, @client_application), :html => { :method => :put } do |f| %> <%= render :partial => "form", :locals => { :f => f } %> <% end %> diff --git a/app/views/oauth_clients/index.html.erb b/app/views/oauth_clients/index.html.erb index 1db5d9db4..7c956d531 100644 --- a/app/views/oauth_clients/index.html.erb +++ b/app/views/oauth_clients/index.html.erb @@ -2,6 +2,8 @@

<%= t ".title" %>

<% end %> +<%= render :partial => "settings_menu" %> + <% unless @tokens.empty? %>

<%= t ".my_tokens" %>

<%= t ".list_tokens" %>

diff --git a/app/views/oauth_clients/new.html.erb b/app/views/oauth_clients/new.html.erb index 7b4ea5bb0..a048f3da1 100644 --- a/app/views/oauth_clients/new.html.erb +++ b/app/views/oauth_clients/new.html.erb @@ -2,6 +2,8 @@

<%= t ".title" %>

<% end %> +<%= render :partial => "settings_menu" %> + <%= bootstrap_form_for @client_application, :url => { :action => :create } do |f| %> <%= render :partial => "form", :locals => { :f => f } %> <% end %> diff --git a/app/views/oauth_clients/show.html.erb b/app/views/oauth_clients/show.html.erb index e6aa85e3e..c7b10f137 100644 --- a/app/views/oauth_clients/show.html.erb +++ b/app/views/oauth_clients/show.html.erb @@ -2,6 +2,8 @@

<%= t(".title", :app_name => @client_application.name) %>

<% end %> +<%= render :partial => "settings_menu" %> +
<%= t ".key" %>
<%= @client_application.key %> diff --git a/app/views/users/account.html.erb b/app/views/users/account.html.erb index 26d840210..f647cc84f 100644 --- a/app/views/users/account.html.erb +++ b/app/views/users/account.html.erb @@ -4,14 +4,10 @@ <% content_for :heading do %>

<%= t ".my settings" %>

-
    -
  • <%= link_to t(".return to profile"), user_path(current_user) %>
  • -
  • <%= link_to t(".oauth1 settings"), oauth_clients_path %>
  • -
  • <%= link_to t(".oauth2 applications"), oauth_applications_path %>
  • -
  • <%= link_to t(".oauth2 authorizations"), oauth_authorized_applications_path %>
  • -
<% end %> +<%= render :partial => "settings_menu", :locals => { :selected => "account" } %> + <%= bootstrap_form_for current_user, :url => { :action => :account }, :method => :post, :html => { :multipart => true, :id => "accountForm", :autocomplete => :off } do |f| %> <%= f.text_field :display_name %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 5b1686c6b..0b745aa7c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2304,6 +2304,11 @@ en: blocked_zero_hour: "You have an urgent message on the OpenStreetMap web site. You need to read the message before you will be able to save your edits." blocked: "Your access to the API has been blocked. Please log-in to the web interface to find out more." need_to_see_terms: "Your access to the API is temporarily suspended. Please log-in to the web interface to view the Contributor Terms. You do not need to agree, but you must view them." + settings_menu: + account_settings: Account Settings + oauth1_settings: OAuth 1 settings + oauth2_applications: OAuth 2 applications + oauth2_authorizations: OAuth 2 authorizations oauth: authorize: title: "Authorize access to your account" @@ -2570,10 +2575,6 @@ en: link text: "what is this?" save changes button: Save Changes make edits public button: Make all my edits public - return to profile: Return to profile - oauth1 settings: OAuth 1 settings - oauth2 applications: OAuth 2 applications - oauth2 authorizations: OAuth 2 authorizations flash update success confirm needed: "User information updated successfully. Check your email for a note to confirm your new email address." flash update success: "User information updated successfully." set_home: diff --git a/test/integration/client_applications_test.rb b/test/integration/client_applications_test.rb index f8055ebc7..269d3633d 100644 --- a/test/integration/client_applications_test.rb +++ b/test/integration/client_applications_test.rb @@ -23,7 +23,7 @@ class ClientApplicationsTest < ActionDispatch::IntegrationTest # check that the form to allow new client application creations exists assert_in_heading do - assert_select "ul.secondary-actions li a[href='/user/#{ERB::Util.u(user.display_name)}/oauth_clients']" + assert_select "ul.nav.nav-tabs li.nav-item a[href='/user/#{ERB::Util.u(user.display_name)}/oauth_clients']" end # now we follow the link to the oauth client list -- 2.43.2