From dabd892a25b26268f39e0efb33c60d1344fa12d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Thu, 13 Apr 2023 16:21:48 +0200 Subject: [PATCH] Improve RS OAuth UI --- app/views/icons/_alert-triangle.html.erb | 2 +- app/views/rs/oauth/new.html.erb | 74 ++++++++++++------------ 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/app/views/icons/_alert-triangle.html.erb b/app/views/icons/_alert-triangle.html.erb index 6dcb096..36b0133 100644 --- a/app/views/icons/_alert-triangle.html.erb +++ b/app/views/icons/_alert-triangle.html.erb @@ -1 +1 @@ - \ No newline at end of file + diff --git a/app/views/rs/oauth/new.html.erb b/app/views/rs/oauth/new.html.erb index 5cee5b4..d34001b 100644 --- a/app/views/rs/oauth/new.html.erb +++ b/app/views/rs/oauth/new.html.erb @@ -1,38 +1,38 @@ -<%= render HeaderComponent.new(title: "App Authorization") %> +<%= render HeaderCompactComponent.new(title: "Storage") %> -<%= render MainSimpleComponent.new do %> -
-

- The app +<%= render MainCompactComponent.new do %> +

+

+ The app on <%= link_to @client_id, "https://#{@client_id}", class: "ks-text-link" %> is asking for access to these folders:

-

- <% if @root_access_requested %> - - - <%= render partial: "icons/asterisk", locals: { custom_class: "inline-block align-middle mb-1" } %> - All files and directories - - <% if (@scopes & [":r"]).any? %> - (read only) - <% end %> - - <% else %> - <% @scopes.each do |scope| %> - - - <%= render partial: "icons/folder", locals: { custom_class: "inline-block align-middle mb-2" } %> - <%= scope_name(scope) %> - - <% if scope_permissions(scope) == "r" %> - (read only) - <% end %> - - <% end %> + <% if @root_access_requested %> +

+ + <%= render partial: "icons/alert-triangle", + locals: { custom_class: "inline-block align-bottom mr-1.5" } %> + All files and directories + + <% if (@scopes & [":r"]).any? %> + (read only) <% end %>

+ <% else %> + <% @scopes.each do |scope| %> +

+ + <%= render partial: "icons/folder", + locals: { custom_class: "inline-block align-bottom mr-1.5" } %> + <%= scope_name(scope) %> + + <% if scope_permissions(scope) == "r" %> + (read only) + <% end %> +

+ <% end %> + <% end %> <%= form_with(url: rs_oauth_path, method: :post, data: { turbo: false }) do |f| %> <%= f.hidden_field :redirect_uri, value: @redirect_uri %> @@ -40,20 +40,18 @@ <%= f.hidden_field :user_id, value: @user.id %> <%= f.hidden_field :client_id, value: @client_id %> <%= f.hidden_field :state, value: @state %> -

- <%= f.label :expire_at, "Expire:" %> +

+ <%= f.label :expire_at, "Permission expires:", class: "mr-1.5" %> <%= f.select :expire_at, options_for_select(@expire_at_dates) %>

-

+

You can revoke access for this app at any time on your storage dashboard.

-
- <%= f.submit class: "btn-md btn-blue w-full sm:w-auto", data: { disable_with: "Saving..." } do %> - Allow - <% end %> - <%= link_to @denial_url, class: "btn-md btn-red w-full sm:w-auto" do %> - Deny - <% end %> +

+ <%= f.submit "Allow", + class: "btn-md btn-blue w-full sm:order-last sm:grow", + data: { disable_with: "Saving..." } %> + <%= link_to "Deny", @denial_url, class: "btn-md btn-gray text-red-700 w-full sm:grow" %>

<% end %>