Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

primerize session table

Behrokh Satarnejad53865592f571
diff --git a/app/components/users/sessions/row_component.rb b/app/components/users/sessions/row_component.rb
index cabe1f0ce2d..09975f60a3e 100644
--- a/app/components/users/sessions/row_component.rb
+++ b/app/components/users/sessions/row_component.rb
@@ -30,7 +30,7 @@
module Users
module Sessions
- class RowComponent < ::RowComponent
+ class RowComponent < ::OpPrimer::BorderBoxRowComponent
property :firstname, :lastname
delegate :current_session, to: :table
@@ -47,9 +47,7 @@ module Users
end
def is_current # rubocop:disable Naming/PredicateName
- if current?
- helpers.op_icon "icon-yes"
- end
+ helpers.op_icon("icon-yes") if current?
end
def device
@@ -74,22 +72,47 @@ module Users
end
end
+ def actions
+ action_menu
+ end
+
+ private
+
def button_links
- [delete_link].compact
+ [action_menu]
end
- def delete_link
+ def action_menu
+ render(Primer::Alpha::ActionMenu.new(anchor_align: :end)) do |menu|
+ menu.with_show_button(
+ icon: "kebab-horizontal",
+ "aria-label": t(:label_more),
+ scheme: :invisible,
+
+ data: { "test-selector": "more-button" }
+ )
+ delete_action(menu)
+ end
+ end
+
+ def delete_action(menu)
return if current?
- link_to(
- helpers.op_icon("icon icon-delete"),
- { controller: "/my/sessions", action: "destroy", id: session },
- class: "button--link",
- role: :button,
- method: :delete,
- data: { confirm: I18n.t(:text_are_you_sure), disable_with: I18n.t(:label_loading) },
- title: I18n.t(:button_delete)
- )
+ menu.with_item(
+ label: I18n.t(:button_delete),
+ scheme: :danger,
+ href: url_for({ controller: "/my/sessions", action: "destroy", id: session }),
+ tag: :button,
+ form_arguments: { method: :delete },
+ content_arguments: {
+ data: {
+ confirm: I18n.t(:text_are_you_sure),
+ disable_with: I18n.t(:label_loading)
+ }
+ }
+ ) do |item|
+ item.with_leading_visual_icon(icon: :trash)
+ end
end
end
end
diff --git a/app/components/users/sessions/table_component.rb b/app/components/users/sessions/table_component.rb
index f0adacc435d..39246572414 100644
--- a/app/components/users/sessions/table_component.rb
+++ b/app/components/users/sessions/table_component.rb
@@ -27,14 +27,21 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
-
module Users
module Sessions
- class TableComponent < ::TableComponent
+ class TableComponent < ::OpPrimer::BorderBoxTableComponent
columns :is_current, :browser, :device, :updated_at
sortable_columns :updated_at
options :current_session
+ mobile_columns :is_current, :browser, :device, :updated_at
+
+ def mobile_title
+ t("users.sessions.title")
+ end
+ def has_actions?
+ true
+ end
def initial_sort
%i[updated_at desc]
end