From d05d0507c9fa7d427ff2a7f1118b108a0b8925d4 Mon Sep 17 00:00:00 2001 From: Jan Suchal Date: Mon, 18 Nov 2024 11:38:24 +0100 Subject: [PATCH] Add blank for upvs boxes --- .../common/blank_results_component.rb | 3 +- app/components/common/icon_component.rb | 3 +- app/lib/sidebar_menu.rb | 2 +- app/views/admin/boxes/index.html.erb | 40 ++++++++++--------- config/locales/sk.yml | 3 ++ 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/app/components/common/blank_results_component.rb b/app/components/common/blank_results_component.rb index 569ab263..dd3465f1 100644 --- a/app/components/common/blank_results_component.rb +++ b/app/components/common/blank_results_component.rb @@ -9,7 +9,8 @@ def before_render filters: "bookmark-slash", rules: "funnel-slash", tags: "tag-slash", - not_found: "magnifying-glass" + not_found: "magnifying-glass", + boxes: "inbox-stack", } @header = t "blank_results.#{@reason}.header" diff --git a/app/components/common/icon_component.rb b/app/components/common/icon_component.rb index b87171bd..2fc479d0 100644 --- a/app/components/common/icon_component.rb +++ b/app/components/common/icon_component.rb @@ -30,7 +30,8 @@ class IconComponent < ViewComponent::Base "magnifying-glass" => "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z", "bookmark-slash" => "m3 3 1.664 1.664M21 21l-1.5-1.5m-5.485-1.242L12 17.25 4.5 21V8.742m.164-4.078a2.15 2.15 0 0 1 1.743-1.342 48.507 48.507 0 0 1 11.186 0c1.1.128 1.907 1.077 1.907 2.185V19.5M4.664 4.664 19.5 19.5", "funnel-slash" => "M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3ZM2 2l20 20", - "tag-slash" => "M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z M6 6h.008v.008H6V6ZM3 21l18-18" + "tag-slash" => "M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z M6 6h.008v.008H6V6ZM3 21l18-18", + "inbox-stack" => "m7.875 14.25 1.214 1.942a2.25 2.25 0 0 0 1.908 1.058h2.006c.776 0 1.497-.4 1.908-1.058l1.214-1.942M2.41 9h4.636a2.25 2.25 0 0 1 1.872 1.002l.164.246a2.25 2.25 0 0 0 1.872 1.002h2.092a2.25 2.25 0 0 0 1.872-1.002l.164-.246A2.25 2.25 0 0 1 16.954 9h4.636M2.41 9a2.25 2.25 0 0 0-.16.832V12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 12V9.832c0-.287-.055-.57-.16-.832M2.41 9a2.25 2.25 0 0 1 .382-.632l3.285-3.832a2.25 2.25 0 0 1 1.708-.786h8.43c.657 0 1.281.287 1.709.786l3.284 3.832c.163.19.291.404.382.632M4.5 20.25h15A2.25 2.25 0 0 0 21.75 18v-2.625c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125V18a2.25 2.25 0 0 0 2.25 2.25Z", }.freeze def initialize(icon, classes: "", stroke_width: 1.5) diff --git a/app/lib/sidebar_menu.rb b/app/lib/sidebar_menu.rb index 365bf319..b089d808 100644 --- a/app/lib/sidebar_menu.rb +++ b/app/lib/sidebar_menu.rb @@ -36,7 +36,7 @@ def admin_menu TW::SidebarMenuDividerComponent.new(name: 'Administrácia'), TW::SidebarMenuItemComponent.new(name: 'Používatelia', url: admin_tenant_users_path(Current.tenant), icon: Icons::UsersComponent.new), TW::SidebarMenuItemComponent.new(name: 'Prístup', url: admin_tenant_tag_groups_path(Current.tenant), icon: Icons::LockClosedComponent.new), - TW::SidebarMenuItemComponent.new(name: 'Schránky', url: admin_tenant_boxes_path(Current.tenant), icon: Icons::RectangleStackComponent.new), + TW::SidebarMenuItemComponent.new(name: 'Schránky', url: admin_tenant_boxes_path(Current.tenant), icon: Common::IconComponent.new("inbox-stack")), TW::SidebarMenuItemComponent.new(name: 'API Prepojenia', url: admin_tenant_api_connections_path(Current.tenant), icon: Icons::RectangleStackComponent.new), TW::SidebarMenuItemComponent.new(name: 'Skupiny', url: admin_tenant_groups_path(Current.tenant), icon: Icons::UserGroupsComponent.new), TW::SidebarMenuItemComponent.new(name: 'Štítky', url: admin_tenant_tags_path(Current.tenant), icon: Icons::TagComponent.new), diff --git a/app/views/admin/boxes/index.html.erb b/app/views/admin/boxes/index.html.erb index 7ed6c8a4..753cf9cc 100644 --- a/app/views/admin/boxes/index.html.erb +++ b/app/views/admin/boxes/index.html.erb @@ -2,30 +2,34 @@
ÚPVS Schránky
- <% if Current.tenant.api_connections.where(type: "Govbox::ApiConnectionWithOboSupport" ).any? %> + <% if Current.tenant.api_connections.where(type: "Govbox::ApiConnectionWithOboSupport").any? %> <%= link_to new_admin_tenant_boxes_upvs_box_path, data: { turbo_frame: "modal" }, class: "px-3.5 py-2.5 bg-blue-600 rounded-md justify-center items-center gap-2.5 flex" do %>

Pripojiť novú schránku

<% end %> <% end %>
- <% @boxes.where(type: "Upvs::Box").each do |box| %> -
-
-
- <%= render Common::BoxLabelComponent.new(box, "items-start justify-start gap-0" ) %> + <% if @boxes.where(type: "Upvs::Box").any? %> + <% @boxes.where(type: "Upvs::Box").each do |box| %> +
+
+
+ <%= render Common::BoxLabelComponent.new(box, "items-start justify-start gap-0") %> +
+
+ <%= box.name %>, URI: <%= box.uri %> +
-
- <%= box.name %>, URI: <%= box.uri %> +
+ <%= link_to edit_polymorphic_path([:admin, box.tenant, :boxes, box]), data: { turbo_frame: "modal" } do %> + <%= render Common::EditButtonComponent.new %> + <% end %>
-
- <%= link_to edit_polymorphic_path([:admin, box.tenant, :boxes, box]), data: { turbo_frame: "modal" } do %> - <%= render Common::EditButtonComponent.new %> - <% end %> -
-
<% end %> + <% else %> + <%= render Common::BlankResultsComponent.new(:boxes) %> + <% end %>
@@ -33,7 +37,7 @@
FS Schránky
- <% if Current.tenant.api_connections.where(type: "Fs::ApiConnection" ).any? %> + <% if Current.tenant.api_connections.where(type: "Fs::ApiConnection").any? %> <%= link_to new_admin_tenant_boxes_fs_box_path, data: { turbo_frame: "modal" }, class: "px-3.5 py-2.5 bg-blue-600 rounded-md justify-center items-center gap-2.5 flex" do %>

Pripojiť novú schránku

<% end %> @@ -43,9 +47,9 @@
<% @boxes.where(type: "Fs::Box").each do |box| %>
-
+
- <%= render Common::BoxLabelComponent.new(box, "items-start justify-start gap-0" ) %> + <%= render Common::BoxLabelComponent.new(box, "items-start justify-start gap-0") %>
<%= box.name %>, DIČ: <%= box.settings_dic %> @@ -60,7 +64,7 @@ <% end %>
<% else %> - <%= render Common::BlankResultsComponent.new(:empty) %> + <%= render Common::BlankResultsComponent.new(:boxes) %> <% end %>
<% end %> diff --git a/config/locales/sk.yml b/config/locales/sk.yml index bfe0ce0f..a4ea6b47 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -332,6 +332,9 @@ sk: rules: header: "Žiadne pravidlá" description: 'Zatiaľ nie sú vytvorené žiadne pravidlá.' + boxes: + header: "Žiadne schránky" + description: 'Zatiaľ nie sú vytvorené žiadne schránky.' not_found: header: "Žiadne správy" description: "Zvolenému vyhľadávaniu nevyhovuje žiadna správa, skúste vybrať iný štítok alebo zmeniť vyhľadávací výraz." \ No newline at end of file