]> git.openstreetmap.org Git - rails.git/commitdiff
Convert account setting menu to tabs, and include on other pages
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 18 Aug 2021 13:30:35 +0000 (14:30 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 18 Aug 2021 13:30:35 +0000 (14:30 +0100)
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.

13 files changed:
app/views/application/_settings_menu.html.erb [new file with mode: 0644]
app/views/oauth2_applications/edit.html.erb
app/views/oauth2_applications/index.html.erb
app/views/oauth2_applications/new.html.erb
app/views/oauth2_applications/show.html.erb
app/views/oauth2_authorized_applications/index.html.erb
app/views/oauth_clients/edit.html.erb
app/views/oauth_clients/index.html.erb
app/views/oauth_clients/new.html.erb
app/views/oauth_clients/show.html.erb
app/views/users/account.html.erb
config/locales/en.yml
test/integration/client_applications_test.rb

diff --git a/app/views/application/_settings_menu.html.erb b/app/views/application/_settings_menu.html.erb
new file mode 100644 (file)
index 0000000..03d8c74
--- /dev/null
@@ -0,0 +1,18 @@
+<% content_for :heading_class, "pb-0" %>
+
+<% content_for :heading do %>
+  <ul class="nav nav-tabs flex-column flex-sm-row">
+    <li class="nav-item">
+      <%= link_to t(".account_settings"), user_account_path(current_user), :class => "nav-link #{'active' if controller_name == 'users'}" %>
+    </li>
+    <li class="nav-item">
+      <%= link_to t(".oauth1_settings"), oauth_clients_path(current_user), :class => "nav-link #{'active' if controller_name == 'oauth_clients'}" %>
+    </li>
+    <li class="nav-item">
+      <%= link_to t(".oauth2_applications"), oauth_applications_path, :class => "nav-link #{'active' if controller_name == 'oauth2_applications'}" %>
+    </li>
+    <li class="nav-item">
+      <%= link_to t(".oauth2_authorizations"), oauth_authorized_applications_path, :class => "nav-link #{'active' if controller_name == 'oauth2_authorized_applications'}" %>
+    </li>
+  </ul>
+<% end %>
index 94b51893e8c0765041edb388f8ba22b68c4a148e..0069e7e60e6dccc83b49457c3f3209c4e7da0bd9 100644 (file)
@@ -2,6 +2,8 @@
   <h1><%= t ".title" %></h1>
 <% 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 %>
index 240b34d31c6312dcda05739ab3e910dce18d748f..119bf587807ea184f873219f24ccfcdb8b4bbc72 100644 (file)
@@ -2,6 +2,8 @@
   <h1><%= t ".title" %></h1>
 <% end %>
 
+<%= render :partial => "settings_menu" %>
+
 <% if @applications.length > 0 %>
   <table class="table table-borderless table-striped">
     <thead>
index a9d6f4a49d3d1401257264c6f961dd686a769c97..a2b26c96203a6f5fb2968a2033f53a5fe7bfc7b8 100644 (file)
@@ -2,6 +2,8 @@
   <h1><%= t ".title" %></h1>
 <% end %>
 
+<%= render :partial => "settings_menu" %>
+
 <%= bootstrap_form_for @application, :url => { :action => :create } do |f| %>
   <%= render :partial => "form", :locals => { :f => f } %>
 <% end %>
index e8ab7836dbca5a1b282e868635458ac58158867a..2967058119e457fbb864b74033dfda01b7538673 100644 (file)
@@ -2,6 +2,8 @@
   <h1><%= @application.name %></h1>
 <% end %>
 
+<%= render :partial => "settings_menu" %>
+
 <% secret = flash[:application_secret].presence || @application.plaintext_secret %>
 
 <table class="table table-borderless">
index 336de14060d7f9a106b213f6926a061019812dc0..b9599a9193b1735171897ac9dd40ec189a01c8c5 100644 (file)
@@ -2,6 +2,8 @@
   <h1><%= t ".title" %></h1>
 <% end %>
 
+<%= render :partial => "settings_menu" %>
+
 <% if @applications.length > 0 %>
   <table class="table table-borderless table-striped">
     <thead>
index f31063ae02fc57c4da5773cfda5425cbe678b929..b0299689ac1a8d8afea91432ab72ee70ba689890 100644 (file)
@@ -2,6 +2,8 @@
   <h1><%= t ".title" %></h1>
 <% 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 %>
index 1db5d9db4e6e6254ab26213ff8092228719212fd..7c956d53166c70fa6230d45ac1e2ae8650d24ef0 100644 (file)
@@ -2,6 +2,8 @@
   <h1><%= t ".title" %></h1>
 <% end %>
 
+<%= render :partial => "settings_menu" %>
+
 <% unless @tokens.empty? %>
 <h3><%= t ".my_tokens" %></h3>
 <p><%= t ".list_tokens" %></p>
index 7b4ea5bb0593cd7e238bd781ea5134fcb7b618fe..a048f3da14832c2e4e123d272b707781a6579274 100644 (file)
@@ -2,6 +2,8 @@
   <h1><%= t ".title" %></h1>
 <% end %>
 
+<%= render :partial => "settings_menu" %>
+
 <%= bootstrap_form_for @client_application, :url => { :action => :create } do |f| %>
   <%= render :partial => "form", :locals => { :f => f } %>
 <% end %>
index e6aa85e3e7307f908c6bdc36bfd9187ec8a5c21c..c7b10f1379ebd6c19d4fa4142abe2ffb21de3ed6 100644 (file)
@@ -2,6 +2,8 @@
   <h1><%= t(".title", :app_name => @client_application.name) %></h1>
 <% end %>
 
+<%= render :partial => "settings_menu" %>
+
 <dl class="row">
   <dt class="col-sm-3"><%= t ".key" %></dt>
   <dd class="col-sm-9"><%= @client_application.key %></dt>
index 26d8402107e68eacd9c91a0b34dc25a289386e88..f647cc84ffa8e7e42e7a4e60c6061e98b1e577d8 100644 (file)
@@ -4,14 +4,10 @@
 
 <% content_for :heading do %>
   <h1><%= t ".my settings" %></h1>
-  <ul class='secondary-actions clearfix'>
-    <li><%= link_to t(".return to profile"), user_path(current_user) %></li>
-    <li><%= link_to t(".oauth1 settings"), oauth_clients_path %></li>
-    <li><%= link_to t(".oauth2 applications"), oauth_applications_path %></li>
-    <li><%= link_to t(".oauth2 authorizations"), oauth_authorized_applications_path %></li>
-  </ul>
 <% 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 %>
index 5b1686c6b81b6eddf6c2f63304d00b9428bcde85..0b745aa7cf5e4e7828d4ecc8a547e4f50835977d 100644 (file)
@@ -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:
index f8055ebc76f7d8d7616514b7f211b0a8eb2ccd02..269d3633d0f8dc9c4568187b138184789fd004e4 100644 (file)
@@ -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