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

adapt to changed Dialog implementation of Primer

ulferts31d51519d06c
diff --git a/app/components/projects/configure_view_modal_component.html.erb b/app/components/projects/configure_view_modal_component.html.erb
index 55b1e30db12..c3103e08833 100644
--- a/app/components/projects/configure_view_modal_component.html.erb
+++ b/app/components/projects/configure_view_modal_component.html.erb
@@ -1,6 +1,10 @@
<%= render(Primer::Alpha::Dialog.new(title: t(:'queries.configure_view.heading'),
size: :large,
- id: MODAL_ID)) do |d| %>
+ id: MODAL_ID,
+ # Hack to give the draggable autcompleter (ng-select) bound to the dialog
+ # enough height to display all options.
+ # This is necessary as long as ng-select does not support popovers.
+ style: "min-height: 430px")) do |d| %>
<% d.with_header(variant: :large, mb: 3) %>
<%= render(Primer::Alpha::Dialog::Body.new) do %>
diff --git a/app/models/queries/projects/selects/custom_field.rb b/app/models/queries/projects/selects/custom_field.rb
index e0077aa1495..65655e4305d 100644
--- a/app/models/queries/projects/selects/custom_field.rb
+++ b/app/models/queries/projects/selects/custom_field.rb
@@ -51,11 +51,9 @@ class Queries::Projects::Selects::CustomField < Queries::Selects::Base
end
def custom_field
- @custom_field ||= begin
- ProjectCustomField
- .visible
- .find_by_id(self.class.key.match(attribute)[1])
- end
+ @custom_field ||= ProjectCustomField
+ .visible
+ .find_by(id: self.class.key.match(attribute)[1])
end
def scope
diff --git a/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.html b/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.html
index 6f44e10547d..f1eca7df63d 100644
--- a/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.html
+++ b/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.html
@@ -1,6 +1,6 @@
<div class="op-draggable-autocomplete">
<div class="FormControl-spacingWrapper mb-3">
- <div class="FormControl width-full">
+ <div class="FormControl width-full" id="op-draggable-autocomplete-container">
<label class="FormControl-label"
[textContent]="inputLabel"
[attr.for]="id">
@@ -18,6 +18,7 @@
[clearSearchOnAdd]="true"
[closeOnSelect]="true"
[searchFn]="searchFunction"
+ [appendTo]="'#op-draggable-autocomplete-container'"
(open)="opened()"
(change)="select($event)"
></ng-select>
diff --git a/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.sass b/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.sass
index 0a504582695..a3a3b7c5556 100644
--- a/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.sass
+++ b/frontend/src/app/shared/components/autocompleter/draggable-autocomplete/draggable-autocomplete.component.sass
@@ -21,3 +21,10 @@
color: #999
padding-left: 5px
cursor: pointer
+
+// Hack to allow the ng-select dropdown bound to this id to be positioned correctly.
+// The ng-select needs to be bound to the id because the component is currently used in a modal.
+// At least in the case of the Primer Dialog, that modal is a popover. Without binding, the dropdown
+// would be positioned behind the Dialog.
+#op-draggable-autocomplete-container
+ position: relative
diff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rb
index 13ee7dacd00..692992b495f 100644
--- a/spec/support/pages/projects/index.rb
+++ b/spec/support/pages/projects/index.rb
@@ -277,7 +277,7 @@ module Pages
query: column
end
- within 'modal-dialog' do
+ within 'dialog' do
click_on 'Apply'
end
end