Skip to content

Instantly share code, notes, and snippets.

@sylvain-hamel
Forked from gist-master/app.html
Created November 4, 2016 20:50
Show Gist options
  • Save sylvain-hamel/a20374f622fdd89dd41cf34b1d2fe74d to your computer and use it in GitHub Desktop.
Save sylvain-hamel/a20374f622fdd89dd41cf34b1d2fe74d to your computer and use it in GitHub Desktop.
Menu: context menu
<template>
<require from="./context-menu.css!css"></require>
<require from="aurelia-kendoui-bridge/listview/listview"></require>
<require from="aurelia-kendoui-bridge/dropdownlist/dropdownlist"></require>
<require from="aurelia-kendoui-bridge/contextmenu/contextmenu"></require>
<require from="aurelia-kendoui-bridge/common/template"></require>
<div id="example">
<div class="demo-section k-content wide">
<ak-list-view k-data-source.bind="dataSource" id="listview-context-menu">
<ak-template>
<div class="product">
<img src="http://demos.telerik.com/kendo-ui/content/shared/images/employees/${FromID}.png" alt="${From}" />
<h3>${Title}</h3>
<p class="date">${Date}</p>
<p>${From}</p>
</div>
</ak-template>
</ak-list-view>
</div>
<ul id="menu"
ak-contextmenu="k-orientation.two-way: vertical; k-target: #listview-context-menu; k-filter: .product; k-animation.bind: animation"
ak-contextmenu.ref="contextVM">
<li repeat.for="i of items">
${i}
<ul>
<li repeat.for="j of ['a', 'b', 'c']">${j}
</li>
</ul>
</li>
</ul>
</div>
</template>
export class ContextMenu {
orientation = 'horizontal';
dataSource = new kendo.data.DataSource({
data: [{
MailID: 1,
FromID: 1,
From: 'Ivo Nedkov',
Date: '2/22/2009',
Title: 'RE: New version of Telerik Trainer'
}, {
MailID: 2,
FromID: 2,
From: 'Jytte Petersen',
Date: '2/22/2009',
Title: 'RE: New version of Telerik Trainer'
}],
pageSize: 5
});
count = 3;
items = [1, 2, 3];
constructor(){
setInterval(()=>{
this.items.push(++this.count);
setTimeout(()=>{
this.contextVM.recreate();
});
}, 5000);
}
}
#listview-context-menu {
padding: 0;
margin-bottom: -1px;
min-height: 300px;
}
.product {
position: relative;
height: 62px;
margin: 0;
padding: 0;
border-bottom: 1px solid rgba(128,128,128,.3);
}
.product img {
width: 40px;
height: 40px;
border-radius: 40px;
margin: 10px;
border: 1px solid #000;
float: left;
}
.product h3 {
margin: 0;
padding: 15px 5px 1px 0;
overflow: hidden;
line-height: 1em;
font-size: 1.1em;
font-weight: bold;
}
.product p {
font-size: .9em;
}
.product .date {
float: right;
margin: -8px 15px 0 0;
}
.k-listview:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
@media screen and (max-width: 620px) {
.product h3 {
max-width: 100px;
white-space: nowrap;
text-overflow: ellipsis;
height: 15px;
}
}
<!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.2.714/styles/kendo.common.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.2.714/styles/kendo.rtl.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.2.714/styles/kendo.default.min.css">
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.2.714/styles/kendo.mobile.all.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.4.0/bluebird.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.2.1/chroma.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2016.2.714/js/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2016.2.714/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2016.2.714/js/kendo.all.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/1.0.0-beta.1.0.6/config2.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-kendoui-bridge');
aurelia.start().then(a => a.setRoot());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment