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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Rewrite meeting as grid
Oliver Güntherf1775c7dd5de
diff --git a/app/components/op_primer/component_helpers.rb b/app/components/op_primer/component_helpers.rbindex 4114cd81590..4e12424aabe 100644--- a/app/components/op_primer/component_helpers.rb+++ b/app/components/op_primer/component_helpers.rb@@ -32,8 +32,8 @@ module OpPrimerrender(OpPrimer::FlexLayoutComponent.new(**), &)end- def grid_layout(**, &)- render(OpPrimer::GridLayoutComponent.new(**), &)+ def grid_layout(css_class, **, &)+ render(OpPrimer::GridLayoutComponent.new(css_class, **), &)enddef box_collection(**, &)diff --git a/app/components/op_primer/grid_layout_component.html.erb b/app/components/op_primer/grid_layout_component.html.erbindex a09cceda618..00c04d97610 100644--- a/app/components/op_primer/grid_layout_component.html.erb+++ b/app/components/op_primer/grid_layout_component.html.erb@@ -26,8 +26,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See COPYRIGHT and LICENSE files for more details.++#%>-<% if areas.any? %>+<% if @system_arguments[:tag] %>+ <%= render Primer::BaseComponent.new(**@system_arguments) do %>+ <% areas.each do |row| %>+ <%= row %>+ <% end %>+ <% end %>+<% else %><% areas.each do |row| %><%= row %><% end %>+<% end %>diff --git a/app/components/op_primer/grid_layout_component.rb b/app/components/op_primer/grid_layout_component.rbindex 10769f7eaea..cf127a5b298 100644--- a/app/components/op_primer/grid_layout_component.rb+++ b/app/components/op_primer/grid_layout_component.rb@@ -28,17 +28,31 @@module OpPrimerclass GridLayoutComponent < Primer::Component- def initialize(**)+ attr_reader :css_class++ def initialize(css_class, **args)super- @system_arguments = deny_tag_argument(**) || {}+ @css_class = css_class+ @system_arguments = args+ @system_arguments[:classes] = class_names(+ @system_arguments[:classes],+ css_class+ )end- renders_many :areas, lambda { |area_name, component = ::Primer::BaseComponent, **system_arguments, &block|- system_arguments[:style] ||= ''- system_arguments[:style] = join_style_arguments(system_arguments[:style], "grid-area: #{area_name}")+ renders_many :areas, lambda { |area_name, component = ::Primer::BaseComponent, **sysargs, &block|+ styles = [+ "grid-area: #{area_name}",+ sysargs[:justify_self] ? "justify-self: #{sysargs[:justify_self]}" : nil,+ ]+ sysargs[:style] = join_style_arguments(sysargs[:style], *styles)+ sysargs[:classes] = class_names(+ sysargs[:classes],+ "#{css_class}--#{area_name}"+ )- render(component.new(**system_arguments), &block)+ render(component.new(**sysargs), &block)}endenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex b8b13c08407..e1b2daa56c0 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1305,6 +1305,9 @@ en:x_days:one: "1 day"other: "%{count} days"+ x_min_abbreviated:+ one: "1 min"+ other: "%{count} mins"x_minutes:one: "1 minute"other: "%{count} minutes"diff --git a/frontend/src/global_styles/openproject.sass b/frontend/src/global_styles/openproject.sassindex 76b8accdc37..cb19b44297a 100644--- a/frontend/src/global_styles/openproject.sass+++ b/frontend/src/global_styles/openproject.sass@@ -16,3 +16,6 @@// SPOT styles@import "../app/spot/styles/sass/common"@import "../app/spot/styles/sass/components"++// Module specific Styles+@import "../../../modules/meeting/app/components/_index.sass"diff --git a/modules/meeting/app/components/_index.sass b/modules/meeting/app/components/_index.sassnew file mode 100644index 00000000000..6765a36a8a5--- /dev/null+++ b/modules/meeting/app/components/_index.sass@@ -0,0 +1 @@+@import "./meeting_agenda_items/item_component/show_component.sass"diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erbindex 296773aa5a2..c486fe7125d 100644--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb@@ -1,98 +1,75 @@<%=- flex_layout do |flex|- flex.with_row do- flex_layout(justify_content: :space_between, align_items: :flex_start) do |flex1|- flex1.with_column(flex: 1) do- flex_layout(align_items: :flex_start) do |flex2|- flex2.with_column(mx: 1, pt: 2) do- if drag_and_drop_enabled?- render(Primer::OpenProject::DragHandle.new(classes: 'handle'))- end- end- flex2.with_column(flex: 1, mt: 2, pl: drag_and_drop_enabled? ? 0 : 3) do- if @meeting_agenda_item.visible_work_package?- flex_layout(align_items: :center) do |flex3|- flex3.with_column(mr: 2) do- render(Primer::Beta::Link.new(href: work_package_path(@meeting_agenda_item.work_package), underline: false,- font_size: :normal, font_weight: :bold, target: "_blank")) do- render(Primer::Beta::Truncate.new) do |component|- component.with_item(max_width: 300, expandable: true) do- @meeting_agenda_item.work_package.subject- end- end- end- end- flex3.with_column(mr: 2) do- render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do- "#{@meeting_agenda_item.work_package.type.name} ##{@meeting_agenda_item.work_package.id}"- end- end- flex3.with_column(mr: 2) do- render(Primer::Beta::Label.new(font_weight: :bold)) do- @meeting_agenda_item.work_package.status.name- end- end- flex3.with_column do- render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do- "#{@meeting_agenda_item.duration_in_minutes || 0} min"- end- end- end- elsif @meeting_agenda_item.linked_work_package?- flex_layout(align_items: :center) do |flex3|- flex3.with_column(mr: 2) do- render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do- I18n.t(:label_agenda_item_undisclosed_wp, id: @meeting_agenda_item.work_package_id)- end- end- flex3.with_column do- render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do- "#{@meeting_agenda_item.duration_in_minutes || 0} min"- end- end- end- else- flex_layout(align_items: :center) do |flex3|- flex3.with_column(mr: 2) do- render(Primer::Beta::Text.new(font_size: :normal, font_weight: :bold, test_selector: 'op-meeting-agenda-title')) do- render(Primer::Beta::Truncate.new) do |component|- component.with_item(max_width: 300, expandable: true) { @meeting_agenda_item.title }- end- end- end- flex3.with_column do- render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do- "#{@meeting_agenda_item.duration_in_minutes || 0} min"- end- end+ grid_layout('op-meeting-agenda-item', tag: :div) do |grid|+ if drag_and_drop_enabled?+ grid.with_area(:drag_handle, tag: :div) do+ render(Primer::OpenProject::DragHandle.new(classes: 'handle'))+ end+ end++ if @meeting_agenda_item.duration_in_minutes.present? && @meeting_agenda_item.duration_in_minutes > 0+ grid.with_area(:duration, tag: :div, mr: 1) do+ render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do+ I18n.t('datetime.distance_in_words.x_min_abbreviated', count: @meeting_agenda_item.duration_in_minutes)+ end+ end+ end++ grid.with_area(:content, tag: :div) do+ if @meeting_agenda_item.visible_work_package?+ flex_layout(align_items: :center) do |flex|+ flex.with_column(mr: 2) do+ render(Primer::Beta::Link.new(href: work_package_path(@meeting_agenda_item.work_package), underline: false,+ font_size: :normal, font_weight: :bold, target: "_blank")) do+ render(Primer::Beta::Truncate.new) do |component|+ component.with_item(max_width: 300, expandable: true) do+ @meeting_agenda_item.work_package.subjectendendendend- end- flex1.with_column do- flex_layout(align_items: :center, mt: edit_enabled? ? 1 : 2) do |flex2|- flex2.with_column(mr: 2) do- title = I18n.t(:label_added_time_by,- author: @meeting_agenda_item.author.name,- age: helpers.distance_of_time_in_words(Time.zone.now, @meeting_agenda_item.created_at))- render(Users::AvatarComponent.new(user: @meeting_agenda_item.author, size: 'mini', title:))+ flex.with_column(mr: 2, classes: 'hidden-for-mobile') do+ render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do+ "#{@meeting_agenda_item.work_package.type.name} ##{@meeting_agenda_item.work_package.id}"end- flex2.with_column do- render(Primer::Alpha::ActionMenu.new) do |menu|- menu.with_show_button(icon: "kebab-horizontal", 'aria-label': t("label_agenda_item_actions"), scheme: :invisible, test_selector: 'op-meeting-agenda-actions')- edit_action_item(menu)- move_actions(menu)- delete_action_item(menu)- end if edit_enabled?+ end+ flex.with_column(mr: 2, classes: 'hidden-for-mobile') do+ render(Primer::Beta::Label.new(font_weight: :bold)) do+ @meeting_agenda_item.work_package.status.nameendendend+ elsif @meeting_agenda_item.linked_work_package?+ render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do+ I18n.t(:label_agenda_item_undisclosed_wp, id: @meeting_agenda_item.work_package_id)+ end+ else+ render(Primer::Beta::Text.new(font_size: :normal, font_weight: :bold, test_selector: 'op-meeting-agenda-title')) do+ render(Primer::Beta::Truncate.new) do |component|+ component.with_item(max_width: 300, expandable: true) { @meeting_agenda_item.title }+ end+ endendend- flex.with_row(mt: edit_enabled? ? 1 : 2, pl: 4) do++ grid.with_area(:author, tag: :div) do+ title = I18n.t(:label_added_time_by,+ author: @meeting_agenda_item.author.name,+ age: helpers.distance_of_time_in_words(Time.zone.now, @meeting_agenda_item.created_at))+ render(Users::AvatarComponent.new(user: @meeting_agenda_item.author, size: 'mini', title:))+ end++ grid.with_area(:actions, tag: :div, justify_self: :end) do+ render(Primer::Alpha::ActionMenu.new) do |menu|+ menu.with_show_button(icon: "kebab-horizontal", 'aria-label': t("label_agenda_item_actions"), scheme: :invisible, test_selector: 'op-meeting-agenda-actions')+ edit_action_item(menu)+ move_actions(menu)+ delete_action_item(menu)+ end if edit_enabled?+ end++ grid.with_area(:notes, tag: :div) doif @meeting_agenda_item.notes.present?- render(Primer::Box.new(color: :subtle)) do+ render(Primer::Box.new(color: :subtle, mt: 1)) do::OpenProject::TextFormatting::Renderer.format_text(@meeting_agenda_item.notes)endenddiff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sass b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sassnew file mode 100644index 00000000000..68cebccaf53--- /dev/null+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sass@@ -0,0 +1,17 @@+.op-meeting-agenda-item+ display: grid+ grid-template-columns: 20px max-content 1fr max-content 50px+ grid-template-areas: "drag_handle duration content author actions" ". notes notes notes notes"++ &--drag_handle,+ &--duration,+ &--content,+ &--author+ align-self: center++ &--actions+ justify-self: end++ @media screen and (max-width: $breakpoint-lg)+ grid-template-columns: 20px auto 1fr 50px+ grid-template-areas: "drag_handle content content actions" ". duration author author" ". notes notes notes"