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 table

Mir Bhatiae90d8fda2b6c
diff --git a/app/components/op_primer/border_box_table_component.rb b/app/components/op_primer/border_box_table_component.rb
index f0a464c8c6f..b1cb1b9463e 100644
--- a/app/components/op_primer/border_box_table_component.rb
+++ b/app/components/op_primer/border_box_table_component.rb
@@ -32,12 +32,6 @@ module OpPrimer
class BorderBoxTableComponent < TableComponent
include ComponentHelpers
- def before_render
- raise ArgumentError, "BorderBoxTableComponent cannot be #sortable?" if sortable?
-
- super
- end
-
def header_args(_column)
{}
end
diff --git a/modules/meeting/app/components/meetings/index_sub_header_component.html.erb b/modules/meeting/app/components/meetings/index_sub_header_component.html.erb
index 21bd1c3e00c..a27c25c6690 100644
--- a/modules/meeting/app/components/meetings/index_sub_header_component.html.erb
+++ b/modules/meeting/app/components/meetings/index_sub_header_component.html.erb
@@ -7,18 +7,41 @@
render(Meetings::MeetingFilterButtonComponent.new(query: @query, project: @project))
end
- subheader.with_action_button(tag: :a,
- href: dynamic_path,
- scheme: :primary,
- mobile_icon: :plus,
- mobile_label: label_text,
- aria: { label: accessibility_label_text },
- title: accessibility_label_text,
- id: id,
- test_selector: "add-meeting-button") do |button|
- button.with_leading_visual_icon(icon: :plus)
- label_text
- end if render_create_button?
+ # subheader.with_action_button(tag: :a,
+ # href: dynamic_path,
+ # scheme: :primary,
+ # mobile_icon: :plus,
+ # mobile_label: label_text,
+ # aria: { label: accessibility_label_text },
+ # title: accessibility_label_text,
+ # id: id,
+ # test_selector: "add-meeting-button") do |button|
+ # button.with_leading_visual_icon(icon: :plus)
+ # label_text
+ # end if render_create_button?
+
+ if render_create_button?
+ subheader.with_action_component do
+
+ render Primer::Alpha::ActionMenu.new(anchor_align: :end) do |menu|
+ menu.with_show_button(scheme: :primary,
+ test_selector: "op-admin-synchronized-groups--button-new",
+ aria: { label: I18n.t(:button_add) }) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ button.with_trailing_action_icon(icon: :"triangle-down")
+ I18n.t(:label_meeting)
+ end
+
+ menu.with_item(label: I18n.t("meeting.types.structured")) do |item|
+ end
+
+ menu.with_item(label: I18n.t("meeting.types.classic")) do |item|
+ end
+ end
+
+ end
+ end
+
subheader.with_bottom_pane_component(mt: 0) do
render(Meetings::MeetingFiltersComponent.new(query: @query, project: @project))
diff --git a/modules/meeting/app/components/meetings/row_component.rb b/modules/meeting/app/components/meetings/row_component.rb
index b945f6ddf15..bf0495710d3 100644
--- a/modules/meeting/app/components/meetings/row_component.rb
+++ b/modules/meeting/app/components/meetings/row_component.rb
@@ -29,7 +29,15 @@
#++
module Meetings
- class RowComponent < ::RowComponent
+ class RowComponent < ::OpPrimer::BorderBoxRowComponent
+ def column_args(column)
+ if column == :title
+ { style: "grid-column: span 2" }
+ else
+ super
+ end
+ end
+
def project_name
helpers.link_to_project model.project, {}, {}, false
end
@@ -38,14 +46,6 @@ module Meetings
link_to model.title, project_meeting_path(model.project, model)
end
- def type
- if model.is_a?(StructuredMeeting)
- I18n.t("meeting.types.structured")
- else
- I18n.t("meeting.types.classic")
- end
- end
-
def start_time
safe_join([helpers.format_date(model.start_time), helpers.format_time(model.start_time, include_date: false)], " ")
end
@@ -59,5 +59,36 @@ module Meetings
link: :all,
html: { target: "_blank" })
end
+
+ def button_links
+ [
+ action_menu
+ ]
+ end
+
+ def action_menu
+ render(Primer::Alpha::ActionMenu.new) do |menu|
+ menu.with_show_button(icon: "kebab-horizontal", "aria-label": "More", scheme: :invisible)
+
+ menu.with_item(label: I18n.t(:label_meeting_open_this_meeting),
+ href: project_meeting_path(model.project, model),
+ content_arguments: {
+ data: { turbo: false }
+ })
+
+ if delete_allowed?
+ menu.with_item(label: t("label_meeting_index_delete"),
+ scheme: :danger,
+ href: meeting_path(model),
+ form_arguments: {
+ method: :delete, data: { confirm: t("text_are_you_sure"), turbo: "false" }
+ })
+ end
+ end
+ end
+
+ def delete_allowed?
+ User.current.allowed_in_project?(:delete_meetings, model.project)
+ end
end
end
diff --git a/modules/meeting/app/components/meetings/table_component.rb b/modules/meeting/app/components/meetings/table_component.rb
index 4cd2c1b8e0a..0759ad0e5f6 100644
--- a/modules/meeting/app/components/meetings/table_component.rb
+++ b/modules/meeting/app/components/meetings/table_component.rb
@@ -29,38 +29,36 @@
#++
module Meetings
- class TableComponent < ::TableComponent
+ class TableComponent < ::OpPrimer::BorderBoxTableComponent
options :current_project # used to determine if displaying the projects column
- sortable_columns :title, :project_name, :type, :start_time, :duration, :location
+ columns :title, :project_name, :start_time, :duration, :location
- def initial_sort
- %i[start_time asc]
+ def sortable?
+ true
end
- def sortable_columns_correlation
- super.merge(
- project_name: "projects.name",
- type: "meetings.type"
- )
+ def initial_sort
+ %i[start_time asc]
end
- def initialize_sorted_model
- helpers.sort_clear
-
- super
+ def has_actions?
+ true
end
- def paginated?
- true
+ def header_args(column)
+ if column == :title
+ { style: "grid-column: span 2" }
+ else
+ super
+ end
end
def headers
@headers ||= [
[:title, { caption: Meeting.human_attribute_name(:title) }],
current_project.blank? ? [:project_name, { caption: Meeting.human_attribute_name(:project) }] : nil,
- [:type, { caption: Meeting.human_attribute_name(:type) }],
- [:start_time, { caption: Meeting.human_attribute_name(:start_time) }],
+ [:start_time, { caption: I18n.t(:label_meeting_date_and_time) }],
[:duration, { caption: Meeting.human_attribute_name(:duration) }],
[:location, { caption: Meeting.human_attribute_name(:location) }]
].compact
diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.yml
index 184f4e7f2ad..7ff3afe8f64 100644
--- a/modules/meeting/config/locales/en.yml
+++ b/modules/meeting/config/locales/en.yml
@@ -109,8 +109,11 @@ en:
label_meeting_minutes: "Minutes"
label_meeting_close: "Close"
label_meeting_open: "Open"
+ label_meeting_index_delete: "Delete"
+ label_meeting_open_this_meeting: "Open this meeting"
label_meeting_agenda_close: "Close the agenda to begin the Minutes"
label_meeting_date_time: "Date/Time"
+ label_meeting_date_and_time: "Date and time"
label_meeting_diff: "Diff"
label_upcoming_meetings: "Upcoming meetings"
label_past_meetings: "Past meetings"
@@ -128,6 +131,7 @@ en:
label_time_zone: "Time zone"
label_start_date: "Start date"
+
meeting:
attachments:
text: "Attached files are available to all meeting participants. You can also drag and drop these into agenda item notes."
@@ -152,9 +156,9 @@ en:
new_date_time: "New date/time"
label_mail_all_participants: "Send email to all participants"
types:
- classic: "Classic"
+ classic: "Classic (deprecated)"
classic_text: "Organize your meeting in a formattable text agenda and protocol."
- structured: "Dynamic"
+ structured: "One-time"
structured_text: "Organize your meeting as a list of agenda items, optionally linking them to a work package."
structured_text_copy: "Copying a meeting will currently not copy the associated meeting agenda items, just the details"
copied: "Copied from Meeting #%{id}"