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

Replace datepicker with a basic one in backlogs

Oliver Güntherf351d01add2e
diff --git a/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/model.js b/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/model.js
index e812cee5d54..a51d0730604 100644
--- a/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/model.js
+++ b/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/model.js
@@ -385,6 +385,11 @@ RB.Model = (function ($) {
} else {
this.open();
}
+
+ window.OpenProject.getPluginContext().then((pluginContext) => {
+ pluginContext.bootstrap(this.$[0]);
+ });
+
this.refreshed();
},
diff --git a/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/sprint.js b/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/sprint.js
index 672b00789fb..a2128169b8e 100644
--- a/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/sprint.js
+++ b/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/sprint.js
@@ -61,14 +61,7 @@ RB.Sprint = (function ($) {
saveDirectives: function () {
const wrapper = this.$;
const editor = wrapper.find('.editor');
- const inputs = editor.map((i, el) => {
- if (el.matches('op-single-date-picker')) {
- return Array.from(el.querySelectorAll('input'));
- }
-
- return el;
- });
- const data = inputs.serialize() + "&_method=put";
+ const data = editor.serialize() + "&_method=put";
const url = RB.urlFor('update_sprint', { id: this.getID() });
return {
diff --git a/modules/backlogs/app/views/rb_sprints/_sprint.html.erb b/modules/backlogs/app/views/rb_sprints/_sprint.html.erb
index 2c485741ae1..3ab6e0f673c 100644
--- a/modules/backlogs/app/views/rb_sprints/_sprint.html.erb
+++ b/modules/backlogs/app/views/rb_sprints/_sprint.html.erb
@@ -47,17 +47,17 @@ See COPYRIGHT and LICENSE files for more details.
<% if User.current.allowed_to?(:update_sprints, @project) %>
<div class="editors permanent">
- <%= angular_component_tag "op-single-date-picker",
- class: "effective_date editor",
+ <%= angular_component_tag "op-basic-single-date-picker",
inputs: {
value: sprint.effective_date,
+ inputClassNames: 'effective_date editor',
id: "effective_date_#{sprint.id}",
name: :effective_date
} %>
- <%= angular_component_tag "op-single-date-picker",
- class: "start_date editor",
+ <%= angular_component_tag "op-basic-single-date-picker",
inputs: {
value: sprint.start_date,
+ inputClassNames: 'start_date editor',
id: "start_date_#{sprint.id}",
name: :start_date
} %>
diff --git a/modules/backlogs/spec/support/pages/backlogs.rb b/modules/backlogs/spec/support/pages/backlogs.rb
index a0270fba3f1..3e97b4627ca 100644
--- a/modules/backlogs/spec/support/pages/backlogs.rb
+++ b/modules/backlogs/spec/support/pages/backlogs.rb
@@ -75,18 +75,18 @@ module Pages
end
def alter_attributes_in_edit_backlog_mode(backlog, attributes)
- attributes.each do |key, value|
- case key
- when :name
- within_backlog(backlog) do
+ within_backlog(backlog) do
+ attributes.each do |key, value|
+ case key
+ when :name
find('input[name=name]').set value
+ when :start_date
+ find('input[name=start_date]').set value
+ when :effective_date
+ find('input[name=effective_date]').set value
+ else
+ raise NotImplementedError
end
- when :start_date
- ::Components::Datepicker.update_field("#start_date_#{backlog.id}", value)
- when :effective_date
- ::Components::Datepicker.update_field("#effective_date_#{backlog.id}", value)
- else
- raise NotImplementedError
end
end
end