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
employ the default datepicker for backlogs sprints
ulferts64efc29bc477
diff --git a/frontend/src/app/modules/augmenting/dynamic-scripts/backlogs/editable_inplace.js b/frontend/src/app/modules/augmenting/dynamic-scripts/backlogs/editable_inplace.jsindex 0f7b26e4eca..e2d31f5ef3f 100644--- a/frontend/src/app/modules/augmenting/dynamic-scripts/backlogs/editable_inplace.js+++ b/frontend/src/app/modules/augmenting/dynamic-scripts/backlogs/editable_inplace.js@@ -36,10 +36,12 @@ RB.EditableInplace = (function ($) {getEditor: function () {// Create the model editor container if it does not yet exist- var editor = this.$.children(".editors").first().html('');+ var editor = this.$.children(".editors");if (editor.length === 0) {editor = $("<div class='editors'></div>").appendTo(this.$);+ } else if (!editor.hasClass('permanent')) {+ editor.first().html('');}return editor;},diff --git a/frontend/src/app/modules/augmenting/dynamic-scripts/backlogs/model.js b/frontend/src/app/modules/augmenting/dynamic-scripts/backlogs/model.jsindex 446d12eee38..1a27fa4401b 100644--- a/frontend/src/app/modules/augmenting/dynamic-scripts/backlogs/model.js+++ b/frontend/src/app/modules/augmenting/dynamic-scripts/backlogs/model.js@@ -151,102 +151,71 @@ RB.Model = (function ($) {}});- this.$.find('.editable').each(function (index) {- var field, fieldType, fieldLabel, fieldName, fieldOrder, input, newInput,- typeId, statusId ;-- field = $(this);- fieldId = field.attr('field_id');- fieldName = field.attr('fieldname');- fieldLabel = field.attr('fieldlabel');- fieldOrder = parseInt(field.attr('fieldorder'), 10);- fieldType = field.attr('fieldtype') || 'input';-- if (!fieldLabel) {- fieldLabel = fieldName.replace(/_/ig, " ").replace(/ id$/ig, "");- }+ if (!editor.hasClass('permanent')) {+ this.$.find('.editable').each(function (index) {+ let field, fieldId, fieldType, fieldLabel, fieldName, fieldOrder, input, newInput,+ typeId, statusId;++ field = $(this);+ fieldId = field.attr('field_id');+ fieldName = field.attr('fieldname');+ fieldLabel = field.attr('fieldlabel');+ fieldOrder = parseInt(field.attr('fieldorder'), 10);+ fieldType = field.attr('fieldtype') || 'input';++ if (!fieldLabel) {+ fieldLabel = fieldName.replace(/_/ig, " ").replace(/ id$/ig, "");+ }- if (fieldType === 'select') {- // Special handling for status_id => they are dependent of type_id- if (fieldName === 'status_id') {- typeId = $.trim(self.$.find('.type_id .v').html());- // when creating stories we need to query the select directly- if (typeId == '') {+ if (fieldType === 'select') {+ // Special handling for status_id => they are dependent of type_id+ if (fieldName === 'status_id') {+ typeId = $.trim(self.$.find('.type_id .v').html());+ // when creating stories we need to query the select directly+ if (typeId === '') {typeId = $('#type_id_options').val();- }- statusId = $.trim(self.$.find('.status_id .v').html());- input = self.findFactory(typeId, statusId, fieldName);- }- else if (fieldName === 'type_id'){- input = $('#' + fieldName + '_options').clone(true);- // if the type changes the status dropdown has to be modified- input.change(function(){- typeId = $(this).val();+ }statusId = $.trim(self.$.find('.status_id .v').html());- newInput = self.findFactory(typeId, statusId, 'status_id');- newInput = self.prepareInputFromFactory(newInput,fieldId,'status_id',fieldOrder,maxTabIndex);- newInput = self.replaceStatusForNewType(input, newInput, $(this).parent().find('.status_id').val(), editor);- });- }- else {- input = $('#' + fieldName + '_options').clone(true);+ input = self.findFactory(typeId, statusId, fieldName);+ } else if (fieldName === 'type_id') {+ input = $('#' + fieldName + '_options').clone(true);+ // if the type changes the status dropdown has to be modified+ input.change(function () {+ typeId = $(this).val();+ statusId = $.trim(self.$.find('.status_id .v').html());+ newInput = self.findFactory(typeId, statusId, 'status_id');+ newInput = self.prepareInputFromFactory(newInput, fieldId, 'status_id', fieldOrder, maxTabIndex);+ newInput = self.replaceStatusForNewType(input, newInput, $(this).parent().find('.status_id').val(), editor);+ });+ } else {+ input = $('#' + fieldName + '_options').clone(true);+ }+ } else {+ input = $(document.createElement(fieldType));}- }- else {- input = $(document.createElement(fieldType));- }- input = self.prepareInputFromFactory(input, fieldId, fieldName, fieldOrder, maxTabIndex);-- // Copy the value in the field to the input element- input.val(fieldType === 'select' ? field.children('.v').first().text() : field.text());--- // Add a date picker if field is a date field- if (field.hasClass("date")) {- input.datepicker({- changeMonth: true,- changeYear: true,- dateFormat: 'yy-mm-dd',- firstDay: 1,- showOn: 'button',- onClose: function () {- $(this).focus();- },- selectOtherMonths: true,- showAnim: '',- showButtonPanel: true,- showOtherMonths: true- });+ input = self.prepareInputFromFactory(input, fieldId, fieldName, fieldOrder, maxTabIndex);- // Remove click-bindings from div - since leaving the edit modus removes the input- // and creates a new one- // Open the datepicker when you click on the div (before in edit-mode)- field.unbind("click");- field.click(function(){input.datepicker("show");});+ // Copy the value in the field to the input element+ input.val(fieldType === 'select' ? field.children('.v').first().text() : field.text());- // So that we won't need a datepicker button to re-show it- input.mouseup(function () {- $(this).datepicker("show");+ // Record in the model's root element which input field had the last focus. We will+ // use this information inside RB.Model.refresh() to determine where to return the+ // focus after the element has been refreshed with info from the server.+ input.focus(function () {+ self.$.data('focus', $(this).attr('name'));});- }- // Record in the model's root element which input field had the last focus. We will- // use this information inside RB.Model.refresh() to determine where to return the- // focus after the element has been refreshed with info from the server.- input.focus(function () {- self.$.data('focus', $(this).attr('name'));- });+ input.blur(function () {+ self.$.data('focus', '');+ });- input.blur(function () {- self.$.data('focus', '');+ $("<label />").attr({+ for: input.attr('id'),+ }).text(fieldLabel).appendTo(editor);+ input.appendTo(editor);});-- $("<label />").attr({- for: input.attr('id'),- }).text(fieldLabel).appendTo(editor);- input.appendTo(editor);- });+ }this.displayEditor(editor);this.editorDisplayed(editor);diff --git a/frontend/src/app/modules/backlogs/backlogs-page/styles/master_backlog.sass b/frontend/src/app/modules/backlogs/backlogs-page/styles/master_backlog.sassindex 5cdd75d27dd..333ea94a220 100644--- a/frontend/src/app/modules/backlogs/backlogs-page/styles/master_backlog.sass+++ b/frontend/src/app/modules/backlogs/backlogs-page/styles/master_backlog.sass@@ -293,17 +293,19 @@.velocity, .add_new_storydisplay: none.backlog .sprint.editing- .name.editor- line-height: 1.5rem- margin: 0- min-width: 15em- width: 57%- .start_date.editor, .effective_date.editor+ .editorfont-size: 0.9remline-height: 1.5rem+ height: 30pxmargin: 0padding: 0- width: 75px++ &.name+ min-width: 15em+ width: calc(100% - 2 * 85px - 10px)+ &.start_date, &.effective_date+ width: 85px+.stories .story.editing>*, .editors labeldiff --git a/modules/backlogs/app/views/rb_sprints/_sprint.html.erb b/modules/backlogs/app/views/rb_sprints/_sprint.html.erbindex ae138934545..f82f2fa3964 100644--- a/modules/backlogs/app/views/rb_sprints/_sprint.html.erb+++ b/modules/backlogs/app/views/rb_sprints/_sprint.html.erb@@ -34,13 +34,30 @@ See docs/COPYRIGHT.rdoc for more details.</div><% User.current.allowed_to?(:update_sprints, @project) ? editable = "editable" : editable = "" %>- <div class="effective_date date <%= editable %>" fieldname="effective_date" field_id=<%= sprint.id %>>- <%= sprint.effective_date %>++ <div class="show">+ <div class="effective_date date <%= editable %>" fieldname="effective_date" field_id=<%= sprint.id %>>+ <%= sprint.effective_date %>+ </div>+ <div class="start_date <%= editable %> date" fieldname="start_date" field_id=<%= sprint.id %>>+ <%= sprint.start_date %>+ </div>+ <div class="name <%= editable %>" fieldname="name" field_id="<%= sprint.id %>"><%= sprint.name %></div></div>- <div class="start_date <%= editable %> date" fieldname="start_date" field_id=<%= sprint.id %>>- <%= sprint.start_date %>++ <div class="editors permanent">+ <%= text_field_tag :effective_date,+ sprint.effective_date,+ id: "effective_date_#{sprint.id}",+ class: '-augmented-datepicker effective_date editor' %>+ <%= text_field_tag :start_date,+ sprint.start_date,+ id: "start_date_#{sprint.id}",+ class: '-augmented-datepicker effective_date editor' %>+ <%= text_field_tag :name,+ sprint.name,+ class: 'name editor' %></div>- <div class="name <%= editable %>" fieldname="name" field_id=<%= sprint.id %>><%= sprint.name %></div><div class="meta"><%= render :partial => "shared/model_errors", :object => sprint.errors %>