Merge pull request #4230 from oliverguenther/feature/inline-edit-duration
Add duration fieldpull/4203/merge
commit
19434b7dca
@ -0,0 +1,6 @@ |
||||
<input type="number" |
||||
wp-edit-field-requirements="vm.field.schema" |
||||
ng-model="vm.workPackage[vm.fieldName]" |
||||
duration-value |
||||
ng-blur="vm.deactivate()" |
||||
focus> |
@ -0,0 +1,34 @@ |
||||
// -- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License version 3.
|
||||
//
|
||||
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||
// Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
// Copyright (C) 2010-2013 the ChiliProject Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// See doc/COPYRIGHT.rdoc for more details.
|
||||
// ++
|
||||
|
||||
import {Field} from "./wp-edit-field.module"; |
||||
import {WorkPackageEditFieldService} from "./wp-edit-field.service"; |
||||
|
||||
export class DurationField extends Field { |
||||
public template:string = '/components/wp-edit/wp-edit-field/wp-edit-duration-field.directive.html' |
||||
} |
@ -0,0 +1,46 @@ |
||||
//-- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License version 3.
|
||||
//
|
||||
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||
// Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
// Copyright (C) 2010-2013 the ChiliProject Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// See doc/COPYRIGHT.rdoc for more details.
|
||||
//++
|
||||
|
||||
module.exports = function($filter, TimezoneService) { |
||||
return { |
||||
restrict:'A', |
||||
require: 'ngModel', |
||||
link: function(scope, element, attrs, ngModelController) { |
||||
ngModelController.$parsers.push(function(value) { |
||||
if (value) { |
||||
var minutes = Number(moment.duration(value, 'hours').asMinutes().toFixed(2)); |
||||
return moment.duration(minutes, 'minutes'); |
||||
} |
||||
}); |
||||
|
||||
ngModelController.$formatters.push(function(value) { |
||||
return TimezoneService.formattedDuration(value); |
||||
}); |
||||
} |
||||
}; |
||||
}; |
Loading…
Reference in new issue