diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-07-07 19:29:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-07 19:29:43 +0200 |
commit | 2a1a3957b65e847d51c4c735acf033f7df29cba6 (patch) | |
tree | e53ac77b3dfa0d425b9ea8084420988a4d7054b7 /apps/files_sharing/js/sharedfilelist.js | |
parent | f5ed01617045a816977688a6c9e549fdf2dab509 (diff) | |
parent | beae00a5e5457c41994e54c7f0563245d9ccf5ce (diff) | |
download | nextcloud-server-2a1a3957b65e847d51c4c735acf033f7df29cba6.tar.gz nextcloud-server-2a1a3957b65e847d51c4c735acf033f7df29cba6.zip |
Merge pull request #333 from nextcloud/sync-master
Sync master
Diffstat (limited to 'apps/files_sharing/js/sharedfilelist.js')
-rw-r--r-- | apps/files_sharing/js/sharedfilelist.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js index da0f957ed99..dccd6027b02 100644 --- a/apps/files_sharing/js/sharedfilelist.js +++ b/apps/files_sharing/js/sharedfilelist.js @@ -79,6 +79,42 @@ var permission = parseInt($tr.attr('data-permissions')) | OC.PERMISSION_DELETE; $tr.attr('data-permissions', permission); } + + // add row with expiration date for link only shares - influenced by _createRow of filelist + if (this._linksOnly) { + var expirationTimestamp = 0; + if(fileData.shares[0].expiration !== null) { + expirationTimestamp = moment(fileData.shares[0].expiration).valueOf(); + } + $tr.attr('data-expiration', expirationTimestamp); + + // date column (1000 milliseconds to seconds, 60 seconds, 60 minutes, 24 hours) + // difference in days multiplied by 5 - brightest shade for expiry dates in more than 32 days (160/5) + var modifiedColor = Math.round((expirationTimestamp - (new Date()).getTime()) / 1000 / 60 / 60 / 24 * 5); + // ensure that the brightest color is still readable + if (modifiedColor >= 160) { + modifiedColor = 160; + } + + if (expirationTimestamp > 0) { + formatted = OC.Util.formatDate(expirationTimestamp); + text = OC.Util.relativeModifiedDate(expirationTimestamp); + } else { + formatted = t('files_sharing', 'No expiration date set'); + text = ''; + modifiedColor = 160; + } + td = $('<td></td>').attr({"class": "date"}); + td.append($('<span></span>').attr({ + "class": "modified", + "title": formatted, + "style": 'color:rgb(' + modifiedColor + ',' + modifiedColor + ',' + modifiedColor + ')' + }).text(text) + .tooltip({placement: 'top'}) + ); + + $tr.append(td); + } return $tr; }, @@ -98,6 +134,11 @@ // root has special permissions this.$el.find('#emptycontent').toggleClass('hidden', !this.isEmpty); this.$el.find('#filestable thead th').toggleClass('hidden', this.isEmpty); + + // hide expiration date header for non link only shares + if (!this._linksOnly) { + this.$el.find('th.column-expiration').addClass('hidden'); + } } else { OCA.Files.FileList.prototype.updateEmptyContent.apply(this, arguments); @@ -249,6 +290,7 @@ type: share.share_type, target: share.share_with, stime: share.stime * 1000, + expiration: share.expiration, }; if (self._sharedWithUser) { file.shareOwner = share.displayname_owner; |