diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-07-15 12:06:13 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-08-07 01:22:42 +0200 |
commit | 9854e71d2c83bd5f74a4798be1547e75112d5a41 (patch) | |
tree | 39a4104d2056c5af09f498f83560d0691c4e6f2e /apps/files/js/mainfileinfodetailview.js | |
parent | 43888bb9bf46928acfe79084377b96133609ef6c (diff) | |
download | nextcloud-server-9854e71d2c83bd5f74a4798be1547e75112d5a41.tar.gz nextcloud-server-9854e71d2c83bd5f74a4798be1547e75112d5a41.zip |
Basic work for right sidebar
Adds right sidebar with registrable panels (still WIP)
Diffstat (limited to 'apps/files/js/mainfileinfodetailview.js')
-rw-r--r-- | apps/files/js/mainfileinfodetailview.js | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js new file mode 100644 index 00000000000..3f3705c2586 --- /dev/null +++ b/apps/files/js/mainfileinfodetailview.js @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2015 + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + +(function() { + var TEMPLATE = + '<div class="thumbnail"></div>' + + '<ul class="detailList">' + + ' <li>Name: {{name}}</li>' + + ' <li>Path: {{path}}</li>' + + '</ul>'; + + /** + * @class OCA.Files.MainFileInfoDetailView + * @classdesc + * + * Displays main details about a file + * + */ + var MainFileInfoDetailView = function() { + this.initialize(); + }; + /** + * @memberof OCA.Files + */ + MainFileInfoDetailView.prototype = _.extend({}, OCA.Files.DetailFileInfoView.prototype, + /** @lends OCA.Files.MainFileInfoDetailView.prototype */ { + _template: null, + + /** + * Initialize the details view + */ + initialize: function() { + this.$el = $('<div class="mainFileInfoView"></div>'); + }, + + /** + * Renders this details view + * + * @abstract + */ + render: function() { + this.$el.empty(); + + if (!this._template) { + this._template = Handlebars.compile(TEMPLATE); + } + + if (this._fileInfo) { + this.$el.append(this._template(this._fileInfo)); + var $iconDiv = this.$el.find('.thumbnail'); + // FIXME: use proper way, this is only for demo purposes + FileList.lazyLoadPreview({ + path: this._fileInfo.path + '/' + this._fileInfo.name, + mime: this._fileInfo.mimetype, + etag: this._fileInfo.etag, + callback: function(url) { + $iconDiv.css('background-image', 'url("' + url + '")'); + } + }); + } else { + // TODO: render placeholder text? + } + } + }); + + OCA.Files.MainFileInfoDetailView = MainFileInfoDetailView; +})(); + |