mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
270 lines
9.5 KiB
HTML
270 lines
9.5 KiB
HTML
<link rel="import" href="../../../bower_components/polymer/polymer.html">
|
||
<link rel="import" href="../../../bower_components/iron-flex-layout/iron-flex-layout.html">
|
||
<link rel="import" href="../../../bower_components/iron-ajax/iron-ajax.html">
|
||
<link rel="import" href="../../../bower_components/iron-list/iron-list.html">
|
||
<link rel="import" href="../../../bower_components/paper-styles/color.html">
|
||
<link rel="import" href="../../../bower_components/paper-styles/typography.html">
|
||
<link rel="import" href="../../../bower_components/paper-icon-button/paper-icon-button.html">
|
||
<link rel="import" href="../../../bower_components/iron-icon/iron-icon.html">
|
||
<link rel="import" href="../../../bower_components/paper-badge/paper-badge.html">
|
||
<link rel="import" href="../../../bower_components/paper-item/paper-item.html">
|
||
<link rel="import" href="../../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
|
||
<link rel="import" href="../../../bower_components/iron-signals/iron-signals.html">
|
||
|
||
<style>
|
||
.pad {
|
||
@apply(--layout-flex);
|
||
@apply(--layout-vertical);
|
||
padding: 0 16px;
|
||
}
|
||
|
||
.dim {
|
||
color: gray;
|
||
}
|
||
|
||
paper-badge {
|
||
-webkit-transition: all 0.1s;
|
||
transition: all 0.1s;
|
||
opacity: 1;
|
||
margin-top: 5px;
|
||
}
|
||
paper-badge[label="0"] {
|
||
opacity: 0;
|
||
}
|
||
|
||
paper-item {
|
||
white-space: nowrap;
|
||
cursor: pointer;
|
||
position: relative;
|
||
}
|
||
paper-item:hover::after {
|
||
content: "-";
|
||
width: 16px;
|
||
height: 16px;
|
||
display: block;
|
||
border-radius: 50% 50%;
|
||
background-color: var(--google-red-300);
|
||
margin-left: 10px;
|
||
line-height: 16px;
|
||
text-align: center;
|
||
color: white;
|
||
font-weight: bold;
|
||
text-decoration: none;
|
||
position: absolute;
|
||
right: 15px;
|
||
top: calc(50% - 8px);
|
||
}
|
||
|
||
ul { list-style-type: none; overflow: hidden; margin:10px}
|
||
ul li div.text{ float:left; text-align: left;height: 55px }
|
||
ul li div.folder-container{ float:left; width: 70px;text-align: left ;height: 55px}
|
||
ul li:hover { background: #eeeeee; height: 55px}
|
||
.file{
|
||
width: 52px;
|
||
height: 52px;
|
||
}
|
||
.folder {
|
||
height: 52px;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.primary {
|
||
font-size: 16px;
|
||
line-height: 20px;
|
||
font-family: sans-serif;
|
||
}
|
||
.secondary {
|
||
font-size: 12px;
|
||
line-height: 20px;
|
||
color: gray;
|
||
font-family: sans-serif;
|
||
}
|
||
|
||
.pull-right{
|
||
float: right;
|
||
}
|
||
|
||
.iron-list ul{
|
||
padding: 0px;
|
||
}
|
||
|
||
.breadcrumb {
|
||
font-family: sans-serif;
|
||
font-size: 12px;
|
||
padding-left: 11px;
|
||
height: 28px;
|
||
width: auto;
|
||
}
|
||
|
||
.folder-breadcrumb-img{
|
||
float: left;
|
||
text-align: left;
|
||
height: 15px;
|
||
padding: 0px 10px 0px 0px;
|
||
}
|
||
|
||
.folder-breadcrumb-text{
|
||
float: left;
|
||
text-align: left;
|
||
height: 25px;
|
||
padding: 0px 10px 0px 0px;
|
||
}
|
||
|
||
.folder-breadcrumb-container{
|
||
float: left;
|
||
}
|
||
|
||
paper-dropdown-menu.custom {
|
||
overflow: visible;
|
||
--paper-input-container-label: {
|
||
color: white;
|
||
background-color: var(--paper-pink-500);
|
||
font-style: italic;
|
||
text-align: center;
|
||
font-weight: bold;
|
||
};
|
||
--paper-input-container-input: {
|
||
color: var(--paper-indigo-500);
|
||
font-style: normal;
|
||
font-family: serif;
|
||
text-transform: uppercase;
|
||
}
|
||
/* no underline */
|
||
--paper-input-container-underline: {
|
||
display: none;
|
||
};
|
||
}
|
||
|
||
</style>
|
||
|
||
|
||
<dom-module id="alfresco-file-list">
|
||
<template>
|
||
<div class="breadcrumb">
|
||
<template is="dom-repeat" items="{{breadcrumbs}}">
|
||
<div class="folder-breadcrumb-container">
|
||
<img class="folder-breadcrumb-img" src="img/folder.svg">
|
||
|
||
<div class="folder-breadcrumb-text">[[item]]</div>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
|
||
<!-- Main List for the items -->
|
||
<iron-list id="itemsList" items="{{data}}" selected-items="{{selectedItems}}" selection-enabled>
|
||
<template>
|
||
<div>
|
||
<ul tabindex$="[[tabIndex]]" aria-label$="Select/Deselect [[item.name]]" class$="[[_computedClass(selected)]]">
|
||
<li>
|
||
<div class="folder-container" on-click="goToFolder">
|
||
<template is="dom-if" if="{{item.isFolder}}">
|
||
<img class="folder" src="img/folder.svg">
|
||
</template>
|
||
<template is="dom-if" if="{{!item.isFolder}}">
|
||
<img class="file" src="{{thumbBaseUrl()}}{{item.contentUrl}}">
|
||
</template>
|
||
</div>
|
||
<div class="text">
|
||
<div class="pad">
|
||
<div class="primary">
|
||
[[item.displayName]]
|
||
</div>
|
||
<div class="secondary dim">
|
||
[[item.node.description]]
|
||
</div>
|
||
<div class="secondary dim">
|
||
Modified [[item.modifiedOn]] by [[item.modifiedBy]]
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div lass="dropdowm menu">
|
||
<paper-dropdown-menu class="custom pull-right" label="Actions" no-label-float>
|
||
<paper-listbox class="dropdown-content">
|
||
<paper-item>Download as Zip</paper-item>
|
||
<paper-item>View Details</paper-item>
|
||
<paper-item>Edit Properties</paper-item>
|
||
<paper-item>Copy To...</paper-item>
|
||
<paper-item>Move To...</paper-item>
|
||
</paper-listbox>
|
||
</paper-dropdown-menu>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
<div class="border"></div>
|
||
</div>
|
||
</template>
|
||
</iron-list>
|
||
|
||
</template>
|
||
|
||
<script>
|
||
HTMLImports.whenReady(function() {
|
||
Polymer({
|
||
is: "alfresco-file-list",
|
||
|
||
host: 'http://192.168.99.100:8080',
|
||
|
||
baseUrl: function(){
|
||
return this.host + '/alfresco/service/slingshot/doclib/doclist/all/site/';
|
||
},
|
||
|
||
properties: {
|
||
showSelection: {
|
||
type: Boolean,
|
||
value: true,
|
||
observer: '_showSelectionChanged'
|
||
}
|
||
},
|
||
|
||
goToFolder: function (event) {
|
||
this.container = event.model.item.location.container;
|
||
var path = event.model.item.location.path !== '/' ? (event.model.item.location.path + '/' ) : '/';
|
||
var relativePath = this.container + path + event.model.item.fileName;
|
||
var slug = event.model.item.location.site + '/' + relativePath;
|
||
this.breadcrumbs = relativePath.split('/');
|
||
console.log('event.model.item.location.path' + event.model.item.location.path);
|
||
console.log('event.model.item.fileName' + event.model.item.fileName);
|
||
console.log('event.model.item.location.site' + event.model.item.location.site);
|
||
|
||
console.log('relativePath' + relativePath);
|
||
console.log('this.breadcrumbs' + this.breadcrumbs);
|
||
this.fetchFolderFolder(slug);
|
||
},
|
||
|
||
ready: function() {
|
||
this.breadcrumbs = ['documentLibrary'];
|
||
var initialFolder = 'swsdp/documentLibrary';
|
||
this.fetchFolderFolder(initialFolder);
|
||
var self = this;
|
||
if(document.querySelector("#alfresco-app")) {
|
||
document.querySelector("#alfresco-app").uploadedSignal = function (e, detail, sender) {
|
||
self.fetchFolderFolder(initialFolder);
|
||
};
|
||
}
|
||
},
|
||
|
||
fetchFolderFolder: function(slug) {
|
||
function error () {
|
||
console.log("error");
|
||
}
|
||
var xhr = new XMLHttpRequest();
|
||
xhr.addEventListener("load", (XMLHttpRequestProgressEvent)=>{
|
||
this.data =JSON.parse(XMLHttpRequestProgressEvent.currentTarget.response).items;
|
||
});
|
||
|
||
xhr.addEventListener("error", error);
|
||
|
||
xhr.open("GET", (this.baseUrl() + slug));
|
||
xhr.withCredentials = true;
|
||
xhr.setRequestHeader("Authorization", 'Basic ' + btoa('admin:admin'));
|
||
xhr.send();
|
||
},
|
||
|
||
thumbBaseUrl: function () {
|
||
return this.host + '/share/proxy/alfresco/';
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
</dom-module>
|