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

[#47012] Replace PlaceholderUsers::TableCell by ViewComponent

Dombi Attilab3062220571d
diff --git a/app/cells/placeholder_users/placeholder_user_filter_cell.rb b/app/components/placeholder_users/placeholder_user_filter_component.rb
similarity index 93%
rename from app/cells/placeholder_users/placeholder_user_filter_cell.rb
rename to app/components/placeholder_users/placeholder_user_filter_component.rb
index 9cb7e83df25..4a4a57fce21 100644
--- a/app/cells/placeholder_users/placeholder_user_filter_cell.rb
+++ b/app/components/placeholder_users/placeholder_user_filter_component.rb
@@ -27,8 +27,8 @@
#++
module PlaceholderUsers
- class PlaceholderUserFilterCell < IndividualPrincipalBaseFilterCell
- options :roles, :clear_url, :project
+ class PlaceholderUserFilterComponent < IndividualPrincipalBaseFilterComponent
+ options :roles, :clear_url
class << self
def base_query
diff --git a/app/cells/placeholder_users/row_cell.rb b/app/components/placeholder_users/row_component.rb
similarity index 94%
rename from app/cells/placeholder_users/row_cell.rb
rename to app/components/placeholder_users/row_component.rb
index 956d0bd937b..969bc2d6e08 100644
--- a/app/cells/placeholder_users/row_cell.rb
+++ b/app/components/placeholder_users/row_component.rb
@@ -27,7 +27,7 @@
#++
module PlaceholderUsers
- class RowCell < ::RowCell
+ class RowComponent < ::RowComponent
include AvatarHelper
include UsersHelper
include PlaceholderUsersHelper
@@ -41,6 +41,10 @@ module PlaceholderUsers
link_to h(placeholder_user.name), edit_placeholder_user_path(placeholder_user)
end
+ def created_at
+ format_time placeholder_user.created_at
+ end
+
def button_links
[delete_link].compact
end
diff --git a/app/cells/placeholder_users/table_cell.rb b/app/components/placeholder_users/table_component.rb
similarity index 94%
rename from app/cells/placeholder_users/table_cell.rb
rename to app/components/placeholder_users/table_component.rb
index 3178e6a60bb..cc37b2e3b90 100644
--- a/app/cells/placeholder_users/table_cell.rb
+++ b/app/components/placeholder_users/table_component.rb
@@ -27,8 +27,7 @@
#++
module PlaceholderUsers
- class TableCell < ::TableCell
- options :current_user # adds this option to those of the base class
+ class TableComponent < ::TableComponent
columns :name, :created_at
def initial_sort
diff --git a/app/controllers/placeholder_users_controller.rb b/app/controllers/placeholder_users_controller.rb
index 9e69896a2ac..806bf3e95d0 100644
--- a/app/controllers/placeholder_users_controller.rb
+++ b/app/controllers/placeholder_users_controller.rb
@@ -40,7 +40,7 @@ class PlaceholderUsersController < ApplicationController
before_action :authorize_deletion, only: %i[deletion_info destroy]
def index
- @placeholder_users = PlaceholderUsers::PlaceholderUserFilterCell.query params
+ @placeholder_users = PlaceholderUsers::PlaceholderUserFilterComponent.query params
respond_to do |format|
format.html do
diff --git a/app/views/placeholder_users/index.html.erb b/app/views/placeholder_users/index.html.erb
index 089c8b5b5e8..af5e36bd1e4 100644
--- a/app/views/placeholder_users/index.html.erb
+++ b/app/views/placeholder_users/index.html.erb
@@ -49,9 +49,9 @@ See COPYRIGHT and LICENSE files for more details.
<% if has_ee %>
- <%= rails_cell PlaceholderUsers::PlaceholderUserFilterCell, params %>
+ <%= render PlaceholderUsers::PlaceholderUserFilterComponent.new(params) %>
&nbsp;
- <%= rails_cell PlaceholderUsers::TableCell, @placeholder_users, project: @project, current_user: current_user %>
+ <%= render PlaceholderUsers::TableComponent.new(rows: @placeholder_users) %>
<% else %>
<%= render template: 'common/upsale',
locals: {