Skip to content

Commit

Permalink
Fix export and version comparison
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
  • Loading branch information
skjnldsv committed Nov 29, 2016
1 parent 8bfa606 commit 4b05574
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion js/components/addressBook/addressBook_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@ angular.module('contactsApp')

ctrl.showUrl = false;
/* globals oc_config */

function compareVersion(version1, version2) {
for(var i = 0; i < Math.max(version1.length, version2.length); i++) {
a = version1[i] || 0;
b = version2[i] || 0;
if(Number(a) < Number(b)) {
return true
}
if(version1[i] !== version2[i]) {
return false
}
}
return false;
}
/* eslint-disable camelcase */
ctrl.canExport = oc_config.version.split('.') >= [9, 0, 2, 0];
ctrl.canExport = compareVersion([9, 0, 2, 0], oc_config.version.split('.'));
/* eslint-enable camelcase */

ctrl.toggleShowUrl = function() {
Expand Down

0 comments on commit 4b05574

Please sign in to comment.