Last active
July 20, 2016 06:31
-
-
Save adriatic/c25ba39975e423c90205214dc1c07055 to your computer and use it in GitHub Desktop.
Upload: templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="./templates.css"></require> | |
<div id="example"> | |
<div class="demo-section k-content"> | |
<ak-upload k-multiple.bind="true" k-async.bind="asyncUpload"> | |
<ak-template> | |
<span class='k-progress'></span> | |
<div class='file-wrapper'> | |
<span class='file-icon ${addExtensionClass(files[0].extension)}'></span> | |
<h4 class='file-heading file-name-heading'>Name: ${name}</h4> | |
<h4 class='file-heading file-size-heading'>Size: ${size} bytes</h4> | |
<button type='button' class='k-upload-action'></button> | |
</div> | |
</ak-template> | |
<input name="files" type="file"/> | |
</ak-upload> | |
</div> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Templates { | |
asyncUpload = { | |
saveUrl: 'http://demos.telerik.com/kendo-ui/upload/save', | |
removeUrl: 'http://demos.telerik.com/kendo-ui/upload/remove', | |
autoUpload: false | |
}; | |
addExtensionClass(extension) { | |
switch (extension) { | |
case '.jpg': | |
case '.img': | |
case '.png': | |
case '.gif': | |
return 'img-file'; | |
case '.doc': | |
case '.docx': | |
return 'doc-file'; | |
case '.xls': | |
case '.xlsx': | |
return 'xls-file'; | |
case '.pdf': | |
return 'pdf-file'; | |
case '.zip': | |
case '.rar': | |
return 'zip-file'; | |
default: | |
return 'default-file'; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia KendoUI bridge</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.common.min.css"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.rtl.min.css"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.default.min.css"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.1.226/styles/kendo.mobile.all.min.css"> | |
<script src="https://kendo.cdn.telerik.com/2016.1.226/js/jszip.min.js"></script> | |
</head> | |
<body aurelia-app="main"> | |
<h1>Loading...</h1> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script> | |
<script src="https://rawgit.com/aurelia-ui-toolkits/aurelia-kendoui-bundles/0.3.5/config2.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function configure(aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging() | |
.plugin('aurelia-kendoui-bridge', kendo => kendo.pro()); | |
aurelia.start().then(a => a.setRoot()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.file-icon { | |
display: inline-block; | |
float: left; | |
width: 48px; | |
height: 48px; | |
margin-left: 10px; | |
margin-top: 13.5px; | |
} | |
.img-file { background-image: url(http://demos.telerik.com/kendo-ui/content/web/upload/jpg.png) } | |
.doc-file { background-image: url(http://demos.telerik.com/kendo-ui/content/web/upload/doc.png) } | |
.pdf-file { background-image: url(http://demos.telerik.com/kendo-ui/content/web/upload/pdf.png) } | |
.xls-file { background-image: url(http://demos.telerik.com/kendo-ui/content/web/upload/xls.png) } | |
.zip-file { background-image: url(http://demos.telerik.com/kendo-ui/content/web/upload/zip.png) } | |
.default-file { background-image: url(http://demos.telerik.com/kendo-ui/content/web/upload/default.png) } | |
#example .file-heading { | |
font-family: Arial; | |
font-size: 1.1em; | |
display: inline-block; | |
float: left; | |
width: 60%; | |
margin: 0 0 0 20px; | |
height: 25px; | |
-ms-text-overflow: ellipsis; | |
-o-text-overflow: ellipsis; | |
text-overflow: ellipsis; | |
overflow:hidden; | |
white-space:nowrap; | |
} | |
.file-name-heading { | |
font-weight: bold; | |
margin-top: 20px; | |
} | |
.file-size-heading { | |
font-weight: normal; | |
font-style: italic; | |
} | |
li.k-file .file-wrapper .k-upload-action { | |
position: absolute; | |
top: 0; | |
right: 0; | |
} | |
li.k-file div.file-wrapper { | |
position: relative; | |
height: 75px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment