diff --git a/app/controllers/services/remotestorage_controller.rb b/app/controllers/services/remotestorage_controller.rb index 15726d4..4a7801e 100644 --- a/app/controllers/services/remotestorage_controller.rb +++ b/app/controllers/services/remotestorage_controller.rb @@ -8,8 +8,7 @@ class Services::RemotestorageController < Services::BaseController # unless current_user.service_enabled?(:remotestorage) # redirect_to service_remotestorage_info_path # end - @rs_auths = current_user.remote_storage_authorizations - # TODO sort by app name + # @rs_apps_connected = current_user.remote_storage_authorizations.any? end private diff --git a/app/controllers/services/rs_auths_controller.rb b/app/controllers/services/rs_auths_controller.rb index e31f046..2cbcb6c 100644 --- a/app/controllers/services/rs_auths_controller.rb +++ b/app/controllers/services/rs_auths_controller.rb @@ -3,7 +3,12 @@ class Services::RsAuthsController < Services::BaseController before_action :require_feature_enabled before_action :require_service_available # before_action :require_service_enabled - before_action :find_rs_auth + before_action :find_rs_auth, only: [:destroy, :launch_app] + + def index + @rs_auths = current_user.remote_storage_authorizations + # TODO sort by app name? + end def destroy @auth.destroy! diff --git a/app/views/services/remotestorage/show.html.erb b/app/views/services/remotestorage/show.html.erb index 58b7ed7..e73a415 100644 --- a/app/views/services/remotestorage/show.html.erb +++ b/app/views/services/remotestorage/show.html.erb @@ -2,15 +2,35 @@ <%= render MainSimpleComponent.new do %>
-

Connected Apps

- <% if @rs_auths.any? %> -
- <% @rs_auths.each do |auth| %> - <%= render RsAuthComponent.new(auth: auth) %> - <% end %> +

+ Store and synchronize your app data across different devices. +

+
+ + <%= render partial: "shared/tabnav_remotestorage" %> + +
+

Your Storage Address

+

+ In order to connect an app to your storage account, give it your address: +

+

+ disabled="disabled" + data-clipboard-target="source" /> + +

+
+ - <% else %> -

No apps connected yet.

- <% end %> <% end %> diff --git a/app/views/services/rs_auths/index.html.erb b/app/views/services/rs_auths/index.html.erb new file mode 100644 index 0000000..939df14 --- /dev/null +++ b/app/views/services/rs_auths/index.html.erb @@ -0,0 +1,33 @@ +<%= render HeaderComponent.new(title: "Storage") %> + +<%= render MainSimpleComponent.new do %> +
+

+ Store and synchronize your app data across different devices. +

+
+ + <%= render partial: "shared/tabnav_remotestorage" %> + +
+ <% if @rs_auths.any? %> +
+ <% @rs_auths.each do |auth| %> + <%= render RsAuthComponent.new(auth: auth) %> + <% end %> +
+ <% else %> +
+

+ <%= image_tag("/img/illustrations/undraw_friends_r511.svg", class: 'h-48') %> +

+

+ No apps connected +

+

+ When connected, your apps will show up here. +

+
+ <% end %> +
+<% end %> diff --git a/app/views/shared/_tabnav_remotestorage.html.erb b/app/views/shared/_tabnav_remotestorage.html.erb new file mode 100644 index 0000000..0e0f8e4 --- /dev/null +++ b/app/views/shared/_tabnav_remotestorage.html.erb @@ -0,0 +1,14 @@ +
+
+ +
+
diff --git a/config/routes.rb b/config/routes.rb index 383e497..07e1ffe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -48,7 +48,8 @@ Rails.application.routes.draw do end resource :storage, controller: 'remotestorage', only: [:show] do - resources :rs_auths, only: [:destroy] do + get :apps, to: "rs_auths#index" + resources :rs_auths, only: [:index, :destroy] do member do get :revoke, to: 'rs_auths#destroy' get :launch_app diff --git a/public/img/illustrations/undraw_friends_r511.svg b/public/img/illustrations/undraw_friends_r511.svg new file mode 100644 index 0000000..dc572e3 --- /dev/null +++ b/public/img/illustrations/undraw_friends_r511.svg @@ -0,0 +1 @@ +friends \ No newline at end of file