Merge remote-tracking branch 'upstream/release/4.1' into release/4.2

pull/3127/head
Jan Sandbrink 10 years ago
commit 4e91860852
  1. 4
      app/assets/stylesheets/content/_select2.scss
  2. 2
      app/assets/stylesheets/layout/_top_menu.sass
  3. 2
      app/assets/stylesheets/open_project_global/_variables.sass
  4. 7
      frontend/app/openproject-app.js
  5. 31
      frontend/app/services/timezone-service.js
  6. 2
      frontend/app/ui_components/authoring-directive.js
  7. 4
      frontend/app/work_packages/helpers/work-packages-helper.js
  8. 4
      frontend/tests/integration/mocks/work-package.json
  9. 4
      frontend/tests/integration/mocks/work-packages/819_patch.json
  10. 4
      frontend/tests/integration/mocks/work-packages/820.json
  11. 4
      frontend/tests/integration/mocks/work-packages/821.json
  12. 4
      frontend/tests/integration/mocks/work-packages/822.json
  13. 2
      frontend/tests/integration/mocks/work-packages/823.json
  14. 2
      frontend/tests/integration/mocks/work-packages/824.json
  15. 2
      frontend/tests/integration/mocks/work-packages/825.json
  16. 27
      frontend/tests/unit/tests/services/timezone-service-test.js
  17. 2
      frontend/tests/unit/tests/ui_components/authoring-directive-test.js

@ -62,7 +62,7 @@
.select2-results .select2-highlighted {
border-radius: 5px;
background-color: #24B3E7;
background-color: $drop-down-selected-bg-color;
font-weight:bold;
}
.select2-results .select2-result-unselectable {
@ -172,7 +172,7 @@ $se2-width: 100%;
}
&.select2-dropdown-open {
.select2-choice {
background-color: $se2-theme-selectable-color;
}

@ -216,7 +216,7 @@
padding: 0
.select2-highlighted
background: $header-item-bg-hover-color !important
background: $primary-color !important
border-radius: 0 !important
font-weight: bold !important
color: $header-drop-down-item-font-hover-color

@ -165,7 +165,7 @@ $my-page-edit-box-border-color: $primary-color-dark !default
$drop-down-unselected-font-color: $main-menu-font-color !default
$drop-down-selected-font-color: $main-menu-font-color !default
$drop-down-selected-bg-color: #24B3E7 !default
$drop-down-selected-bg-color: $primary-color !default
$action-menu-bg-color: #FFFFFF

@ -203,7 +203,12 @@ openprojectApp
$httpProvider.interceptors.push(function($q) {
return {
'request': function(config) {
if (!config.url.match('(^/templates|\\.html$)')) {
// OpenProject can run in a subpath e.g. https://mydomain/open_project.
// We append the path found as the base-tag value to all http requests
// to the server except:
// * when the path is already appended
// * when we are getting a template
if (!config.url.match('(^/templates|\\.html$|^' + window.appBasePath + ')')) {
config.url = window.appBasePath + config.url;
}

@ -33,8 +33,8 @@ module.exports = function(ConfigurationService, I18n) {
moment.locale(I18n.locale);
},
parseDate: function(date, format) {
var d = moment.utc(date, format);
parseDatetime: function(datetime, format) {
var d = moment.utc(datetime, format);
if (ConfigurationService.isTimezoneSet()) {
d.local();
@ -44,18 +44,27 @@ module.exports = function(ConfigurationService, I18n) {
return d;
},
parseDate: function(date, format) {
return moment(date, format);
},
parseISODate: function(date) {
return TimezoneService.parseDate(date, 'YYYY-MM-DD');
},
formattedDate: function(date) {
var format = ConfigurationService.dateFormatPresent() ? ConfigurationService.dateFormat() : 'L';
return TimezoneService.parseDate(date).format(format);
var d = TimezoneService.parseDate(date);
return d.format(TimezoneService.getDateFormat());
},
formattedTime: function(datetimeString) {
return TimezoneService.parseDatetime(datetimeString).format(TimezoneService.getTimeFormat());
},
formattedTime: function(date) {
var format = ConfigurationService.timeFormatPresent() ? ConfigurationService.timeFormat() : 'LT';
return TimezoneService.parseDate(date).format(format);
formattedDatetime: function(datetimeString) {
var d = TimezoneService.parseDatetime(datetimeString);
return d.format(TimezoneService.getDateFormat()) + ' ' +
d.format(TimezoneService.getTimeFormat());
},
formattedISODate: function(date) {
@ -66,6 +75,14 @@ module.exports = function(ConfigurationService, I18n) {
var format = dateFormat || (ConfigurationService.dateFormatPresent() ?
ConfigurationService.dateFormat() : 'L');
return moment(date, [format]).isValid();
},
getDateFormat: function() {
return ConfigurationService.dateFormatPresent() ? ConfigurationService.dateFormat() : 'L';
},
getTimeFormat: function() {
return ConfigurationService.timeFormatPresent() ? ConfigurationService.timeFormat() : 'LT';
}
};

@ -36,7 +36,7 @@ module.exports = function(I18n, PathHelper, TimezoneService) {
link: function(scope, element, attrs) {
moment.locale(I18n.locale);
var createdOn = TimezoneService.parseDate(scope.createdOn);
var createdOn = TimezoneService.parseDatetime(scope.createdOn);
var timeago = createdOn.fromNow();
var time = createdOn.format('LLL');

@ -141,9 +141,7 @@ module.exports =function(TimezoneService, currencyFilter, CustomFieldHelper) {
case 'datetime':
var dateTime;
if (value) {
dateTime = TimezoneService.formattedDate(value) +
' ' +
TimezoneService.formattedTime(value);
dateTime = TimezoneService.formattedDatetime(value);
}
return dateTime || '';
case 'date':

@ -86,8 +86,8 @@
"raw": "Sapiente terra dolores tempore debitis stultus. Adeo aduro repellendus. Vereor vulgivagus maxime ulciscor barba deleniti cognomen ustulo. Hic tubineus sumptus argumentum animi arcesso. Voluntarius dolore et. Apostolus vobis ultra delego acervus averto vitae."
},
"priority": "Normal",
"startDate": "2014-02-28T00:00:00+00:00",
"dueDate": "2014-04-28T00:00:00+00:00",
"startDate": "2014-02-28",
"dueDate": "2014-04-28",
"estimatedTime": {
"units": "hours",
"value": null

@ -107,8 +107,8 @@
"status": "specified",
"isClosed": false,
"priority": "Normal",
"startDate": "2014-10-23T00:00:00+00:00",
"dueDate": "2014-12-27T00:00:00+00:00",
"startDate": "2014-10-23",
"dueDate": "2014-12-27",
"estimatedTime": "PT0S",
"spentTime": "PT0S",
"percentageDone": 0,

@ -93,8 +93,8 @@
"raw": "#54\n2"
},
"priority": "Normal",
"startDate": "2014-10-23T00:00:00+00:00",
"dueDate": "2014-12-27T00:00:00+00:00",
"startDate": "2014-10-23",
"dueDate": "2014-12-27",
"estimatedTime": "PT0S",
"spentTime": "PT0S",
"percentageDone": 0,

@ -103,8 +103,8 @@
"raw": "#54\n2"
},
"priority": "Normal",
"startDate": "2014-10-23T00:00:00+00:00",
"dueDate": "2014-12-27T00:00:00+00:00",
"startDate": "2014-10-23",
"dueDate": "2014-12-27",
"estimatedTime": "PT0S",
"spentTime": "PT0S",
"percentageDone": 0,

@ -105,8 +105,8 @@
"description": "",
"rawDescription": "",
"priority": "Normal",
"startDate": "2014-10-23T00:00:00+00:00",
"dueDate": "2014-12-27T00:00:00+00:00",
"startDate": "2014-10-23",
"dueDate": "2014-12-27",
"estimatedTime": "PT0S",
"spentTime": "PT12H",
"percentageDone": 0,

@ -109,7 +109,7 @@
},
"priority": "Normal",
"startDate": null,
"dueDate": "2014-12-27T00:00:00+00:00",
"dueDate": "2014-12-27",
"estimatedTime": "PT0S",
"spentTime": "PT0S",
"percentageDone": 0,

@ -108,7 +108,7 @@
"raw": "#54"
},
"priority": "Normal",
"startDate": "2014-10-23T00:00:00+00:00",
"startDate": "2014-10-23",
"dueDate": null,
"estimatedTime": "PT0S",
"spentTime": "PT0S",

@ -112,7 +112,7 @@
"raw": "#54"
},
"priority": "Normal",
"startDate": "2014-10-23T00:00:00+00:00",
"startDate": "2014-10-23",
"dueDate": null,
"estimatedTime": "PT0S",
"spentTime": "PT0S",

@ -31,6 +31,7 @@
describe('TimezoneService', function() {
var TIME = '2013-02-08T09:30:26';
var DATE = '2013-02-08';
var TimezoneService;
var ConfigurationService;
var isTimezoneSetStub;
@ -42,15 +43,15 @@ describe('TimezoneService', function() {
TimezoneService = _TimezoneService_;
ConfigurationService = _ConfigurationService_;
isTimezoneSetStub = sinon.stub(ConfigurationService, "isTimezoneSet");
timezoneStub = sinon.stub(ConfigurationService, "timezone");
isTimezoneSetStub = sinon.stub(ConfigurationService, 'isTimezoneSet');
timezoneStub = sinon.stub(ConfigurationService, 'timezone');
}));
describe('#parseDate', function() {
describe('#parseDatetime', function() {
it('is UTC', function() {
var time = TimezoneService.parseDate(TIME);
var time = TimezoneService.parseDatetime(TIME);
expect(time.zone()).to.equal(0);
expect(time.format("HH:mm")).to.eq("09:30");
expect(time.format('HH:mm')).to.eq('09:30');
});
describe('Non-UTC timezone', function() {
@ -61,12 +62,24 @@ describe('TimezoneService', function() {
isTimezoneSetStub.returns(true);
timezoneStub.returns(timezone);
date = TimezoneService.parseDate(TIME);
date = TimezoneService.parseDatetime(TIME);
});
it('is ' + timezone, function() {
expect(date.format("HH:mm")).to.eq("01:30");
expect(date.format('HH:mm')).to.eq('01:30');
});
});
});
describe('#parseDate', function() {
it('has local time zone', function() {
var time = TimezoneService.parseDate(DATE);
expect(time.zone()).to.equal(time.clone().local().zone());
});
it('has no time information', function() {
var time = TimezoneService.parseDate(DATE);
expect(time.format('HH:mm')).to.eq('00:00');
});
});
});

@ -37,7 +37,7 @@ describe('authoring Directive', function() {
beforeEach(module('openproject.templates', function($provide) {
timezoneService = {};
timezoneService.parseDate = sinon.stub().returns(createdOn);
timezoneService.parseDatetime = sinon.stub().returns(createdOn);
$provide.constant('TimezoneService', timezoneService);
}));

Loading…
Cancel
Save