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

Start on mobile layout for Datepicker

Henriette Dargef84c92ca7a98
diff --git a/app/components/_index.sass b/app/components/_index.sass
index 23c9000d86f..85b20dad25c 100644
--- a/app/components/_index.sass
+++ b/app/components/_index.sass
@@ -6,6 +6,7 @@
@import "work_packages/activities_tab/journals/item_component/details"
@import "work_packages/activities_tab/journals/item_component/add_reactions"
@import "work_packages/activities_tab/journals/item_component/reactions"
+@import "work_packages/date_picker/banner_component"
@import "work_packages/date_picker/dialog_content_component"
@import "shares/modal_body_component"
@import "work_packages/reminder/modal_body_component"
diff --git a/app/components/work_packages/date_picker/banner_component.html.erb b/app/components/work_packages/date_picker/banner_component.html.erb
index 24583d5eeea..6f7bde11671 100644
--- a/app/components/work_packages/date_picker/banner_component.html.erb
+++ b/app/components/work_packages/date_picker/banner_component.html.erb
@@ -1,10 +1,15 @@
<%=
- render(Primer::Alpha::Banner.new(scheme:,
- full: true,
- icon: :info,
- description:,
- classes: "rounded-top-2")) do |banner|
+ render(Primer::Alpha::Banner.new(description:,
+ classes: "wp-datepicker--banner_desktop rounded-top-2",
+ **banner_options)) do |banner|
banner.with_action_button(tag: :a, href: link, target: "_blank") { I18n.t("work_packages.datepicker_modal.show_relations") }
title
end
%>
+<%=
+ render(Primer::Alpha::Banner.new(description: mobile_description,
+ classes: "wp-datepicker--banner_mobile rounded-top-2",
+ **banner_options)) do
+ mobile_title
+ end
+%>
diff --git a/app/components/work_packages/date_picker/banner_component.rb b/app/components/work_packages/date_picker/banner_component.rb
index 7a1d2f70626..a2305a4e14a 100644
--- a/app/components/work_packages/date_picker/banner_component.rb
+++ b/app/components/work_packages/date_picker/banner_component.rb
@@ -70,6 +70,14 @@ module WorkPackages
end
end
+ def mobile_title
+ if @manually_scheduled
+ I18n.t("work_packages.datepicker_modal.banner.title.manual_mobile")
+ else
+ I18n.t("work_packages.datepicker_modal.banner.title.automatic_mobile")
+ end
+ end
+
def description
if @manually_scheduled
if children.any?
@@ -87,6 +95,18 @@ module WorkPackages
button_name: I18n.t("work_packages.datepicker_modal.show_relations"))
end
+ def mobile_description
+ text = if @manually_scheduled
+ I18n.t("work_packages.datepicker_modal.banner.description.manual_mobile")
+ else
+ I18n.t("work_packages.datepicker_modal.banner.description.automatic_mobile")
+ end
+
+ "#{text} #{render(Primer::Beta::Link.new(tag: :a, href: link, target: '_blank')) do
+ I18n.t('work_packages.datepicker_modal.show_relations')
+ end}".html_safe
+ end
+
def overlapping_predecessor?
predecessor_work_packages.any? { |wp| wp.due_date.after?(@work_package.start_date) }
end
@@ -117,6 +137,14 @@ module WorkPackages
.flatten
.uniq
end
+
+ def banner_options
+ {
+ scheme:,
+ full: true,
+ icon: :info
+ }
+ end
end
end
end
diff --git a/app/components/work_packages/date_picker/banner_component.sass b/app/components/work_packages/date_picker/banner_component.sass
new file mode 100644
index 00000000000..0c4e19bb178
--- /dev/null
+++ b/app/components/work_packages/date_picker/banner_component.sass
@@ -0,0 +1,9 @@
+.wp-datepicker--banner
+
+ @media screen and (min-width: $breakpoint-sm)
+ &_mobile
+ display: none
+
+ @media screen and (max-width: $breakpoint-sm)
+ &_desktop
+ display: none
diff --git a/app/components/work_packages/date_picker/dialog_content_component.html.erb b/app/components/work_packages/date_picker/dialog_content_component.html.erb
index f4583acfd89..0016c0b5973 100644
--- a/app/components/work_packages/date_picker/dialog_content_component.html.erb
+++ b/app/components/work_packages/date_picker/dialog_content_component.html.erb
@@ -21,7 +21,7 @@
) do |f|
flex_layout do |body|
body.with_row(mb: 3) do
- flex_layout(align_items: :flex_end, justify_content: :space_between) do |first_row|
+ flex_layout(classes: "wp-datepicker-dialog--form-block", align_items: :flex_end, justify_content: :space_between) do |first_row|
first_row.with_column do
concat(render(Primer::Alpha::FormControl.new(label: I18n.t("work_packages.datepicker_modal.mode.title"))) do |component|
component.with_input do
@@ -73,7 +73,7 @@
end
if schedulable?
- body.with_row(mb: 3) do
+ body.with_row(mb: 3, classes: "FormControl-horizontalGroup--sm-vertical") do
render(WorkPackages::DatePicker::Form.new(f,
work_package:,
focused_field:,
diff --git a/app/components/work_packages/date_picker/dialog_content_component.sass b/app/components/work_packages/date_picker/dialog_content_component.sass
index 8b01723f059..be5418390cc 100644
--- a/app/components/work_packages/date_picker/dialog_content_component.sass
+++ b/app/components/work_packages/date_picker/dialog_content_component.sass
@@ -1,4 +1,13 @@
-.wp-datepicker-dialog--content
- // We set a fixed height for this dialog zo avoid that it jumps around when the tabs are switched or errors shown
- min-height: 525px
- min-width: 600px
+.wp-datepicker-dialog
+
+ @media screen and (min-width: $breakpoint-sm)
+ &--content
+ // We set a fixed height for this dialog zo avoid that it jumps around when the tabs are switched or errors shown
+ min-height: 525px
+ min-width: 600px
+
+ @media screen and (max-width: $breakpoint-sm)
+ &--form-block
+ flex-direction: column !important
+ align-items: flex-start !important
+ row-gap: 1rem
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 9c46d343666..e46a80aa5d6 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -705,13 +705,17 @@ en:
datepicker_modal:
banner:
description:
+ automatic_mobile: "Start date derived."
click_on_show_relations_to_open_gantt: 'Click on "%{button_name}" for Gantt overview.'
+ manual_mobile: "Ignoring relations."
manual_gap_between_predecessors: "There is a gap between this and all predecessors."
manual_overlap_with_predecessors: "Overlaps with at least one predecessor."
manual_with_children: "This has child work package but their start dates are ignored."
title:
+ automatic_mobile: "Automatically scheduled."
automatic_with_children: "The dates are determined by child work packages."
automatic_with_predecessor: "The start date is set by a predecessor."
+ manual_mobile: "Manually scheduled."
manually_scheduled: "Manually scheduled. Dates not affected by relations."
blankslate:
title: "No predecessors"