Merge branch 'release/4.2' into dev

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

@ -559,10 +559,9 @@ DEPENDENCIES
rubytree (~> 0.8.3) rubytree (~> 0.8.3)
sass (~> 3.4.12) sass (~> 3.4.12)
sass-rails! sass-rails!
selenium-webdriver (~> 2.45.0)
shoulda-context (~> 1.2) shoulda-context (~> 1.2)
shoulda-matchers (~> 2.8) shoulda-matchers (~> 2.8)
selenium-webdriver (~> 2.45.0)
shoulda
simplecov (= 0.8.0.pre) simplecov (= 0.8.0.pre)
sprockets! sprockets!
sprockets-rails! sprockets-rails!

@ -62,7 +62,7 @@
.select2-results .select2-highlighted { .select2-results .select2-highlighted {
border-radius: 5px; border-radius: 5px;
background-color: #24B3E7; background-color: $drop-down-selected-bg-color;
font-weight:bold; font-weight:bold;
} }
.select2-results .select2-result-unselectable { .select2-results .select2-result-unselectable {

@ -216,7 +216,7 @@
padding: 0 padding: 0
.select2-highlighted .select2-highlighted
background: $header-item-bg-hover-color !important background: $primary-color !important
border-radius: 0 !important border-radius: 0 !important
font-weight: bold !important font-weight: bold !important
color: $header-drop-down-item-font-hover-color 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-unselected-font-color: $main-menu-font-color !default
$drop-down-selected-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 $action-menu-bg-color: #FFFFFF

@ -203,7 +203,12 @@ openprojectApp
$httpProvider.interceptors.push(function($q) { $httpProvider.interceptors.push(function($q) {
return { return {
'request': function(config) { '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; config.url = window.appBasePath + config.url;
} }

@ -33,8 +33,8 @@ module.exports = function(ConfigurationService, I18n) {
moment.locale(I18n.locale); moment.locale(I18n.locale);
}, },
parseDate: function(date, format) { parseDatetime: function(datetime, format) {
var d = moment.utc(date, format); var d = moment.utc(datetime, format);
if (ConfigurationService.isTimezoneSet()) { if (ConfigurationService.isTimezoneSet()) {
d.local(); d.local();
@ -44,18 +44,27 @@ module.exports = function(ConfigurationService, I18n) {
return d; return d;
}, },
parseDate: function(date, format) {
return moment(date, format);
},
parseISODate: function(date) { parseISODate: function(date) {
return TimezoneService.parseDate(date, 'YYYY-MM-DD'); return TimezoneService.parseDate(date, 'YYYY-MM-DD');
}, },
formattedDate: function(date) { formattedDate: function(date) {
var format = ConfigurationService.dateFormatPresent() ? ConfigurationService.dateFormat() : 'L'; var d = TimezoneService.parseDate(date);
return TimezoneService.parseDate(date).format(format); return d.format(TimezoneService.getDateFormat());
},
formattedTime: function(datetimeString) {
return TimezoneService.parseDatetime(datetimeString).format(TimezoneService.getTimeFormat());
}, },
formattedTime: function(date) { formattedDatetime: function(datetimeString) {
var format = ConfigurationService.timeFormatPresent() ? ConfigurationService.timeFormat() : 'LT'; var d = TimezoneService.parseDatetime(datetimeString);
return TimezoneService.parseDate(date).format(format); return d.format(TimezoneService.getDateFormat()) + ' ' +
d.format(TimezoneService.getTimeFormat());
}, },
formattedISODate: function(date) { formattedISODate: function(date) {
@ -70,6 +79,14 @@ module.exports = function(ConfigurationService, I18n) {
var format = dateFormat || (ConfigurationService.dateFormatPresent() ? var format = dateFormat || (ConfigurationService.dateFormatPresent() ?
ConfigurationService.dateFormat() : 'L'); ConfigurationService.dateFormat() : 'L');
return moment(date, [format]).isValid(); 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) { link: function(scope, element, attrs) {
moment.locale(I18n.locale); moment.locale(I18n.locale);
var createdOn = TimezoneService.parseDate(scope.createdOn); var createdOn = TimezoneService.parseDatetime(scope.createdOn);
var timeago = createdOn.fromNow(); var timeago = createdOn.fromNow();
var time = createdOn.format('LLL'); var time = createdOn.format('LLL');

@ -141,9 +141,7 @@ module.exports =function(TimezoneService, currencyFilter, CustomFieldHelper) {
case 'datetime': case 'datetime':
var dateTime; var dateTime;
if (value) { if (value) {
dateTime = TimezoneService.formattedDate(value) + dateTime = TimezoneService.formattedDatetime(value);
' ' +
TimezoneService.formattedTime(value);
} }
return dateTime || ''; return dateTime || '';
case 'date': 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." "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", "priority": "Normal",
"startDate": "2014-02-28T00:00:00+00:00", "startDate": "2014-02-28",
"dueDate": "2014-04-28T00:00:00+00:00", "dueDate": "2014-04-28",
"estimatedTime": { "estimatedTime": {
"units": "hours", "units": "hours",
"value": null "value": null

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

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

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

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

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

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

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

@ -31,6 +31,7 @@
describe('TimezoneService', function() { describe('TimezoneService', function() {
var TIME = '2013-02-08T09:30:26'; var TIME = '2013-02-08T09:30:26';
var DATE = '2013-02-08';
var TimezoneService; var TimezoneService;
var ConfigurationService; var ConfigurationService;
var isTimezoneSetStub; var isTimezoneSetStub;
@ -42,15 +43,15 @@ describe('TimezoneService', function() {
TimezoneService = _TimezoneService_; TimezoneService = _TimezoneService_;
ConfigurationService = _ConfigurationService_; ConfigurationService = _ConfigurationService_;
isTimezoneSetStub = sinon.stub(ConfigurationService, "isTimezoneSet"); isTimezoneSetStub = sinon.stub(ConfigurationService, 'isTimezoneSet');
timezoneStub = sinon.stub(ConfigurationService, "timezone"); timezoneStub = sinon.stub(ConfigurationService, 'timezone');
})); }));
describe('#parseDate', function() { describe('#parseDatetime', function() {
it('is UTC', function() { it('is UTC', function() {
var time = TimezoneService.parseDate(TIME); var time = TimezoneService.parseDatetime(TIME);
expect(time.zone()).to.equal(0); 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() { describe('Non-UTC timezone', function() {
@ -61,12 +62,24 @@ describe('TimezoneService', function() {
isTimezoneSetStub.returns(true); isTimezoneSetStub.returns(true);
timezoneStub.returns(timezone); timezoneStub.returns(timezone);
date = TimezoneService.parseDate(TIME); date = TimezoneService.parseDatetime(TIME);
}); });
it('is ' + timezone, function() { 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) { beforeEach(module('openproject.templates', function($provide) {
timezoneService = {}; timezoneService = {};
timezoneService.parseDate = sinon.stub().returns(createdOn); timezoneService.parseDatetime = sinon.stub().returns(createdOn);
$provide.constant('TimezoneService', timezoneService); $provide.constant('TimezoneService', timezoneService);
})); }));

Loading…
Cancel
Save