Skip to content

Instantly share code, notes, and snippets.

@gist-master
Forked from adriatic/app.html
Last active April 21, 2017 09:05
Show Gist options
  • Save gist-master/46eda80ba7db36d5795c8a72792227ef to your computer and use it in GitHub Desktop.
Save gist-master/46eda80ba7db36d5795c8a72792227ef to your computer and use it in GitHub Desktop.
Notification: templates
<template>
<require from="./templates.css!css"></require>
<require from="aurelia-kendoui-bridge/notification/notification"></require>
<require from="aurelia-kendoui-bridge/notification/notification-template"></require>
<require from="aurelia-kendoui-bridge/button/button"></require>
<div id="example">
<ak-notification id="notification"
k-widget.bind="notification"
k-position.bind="{pinned: true, top: 30, right: 30}"
k-auto-hide-after.bind="0"
k-stacking="down">
<ak-notification-template type="info">
<div class="new-mail">
<img src="http://demos.telerik.com/kendo-ui/content/web/notification/envelope.png" />
<h3>${title}</h3>
<p>${message}</p>
</div>
</ak-notification-template>
<ak-notification-template type="error">
<div class="wrong-pass">
<img src="http://demos.telerik.com/kendo-ui/content/web/notification/error-icon.png" />
<h3>${title}</h3>
<p>${message}</p>
</div>
</ak-notification-template>
<ak-notification-template type="success">
<div class="upload-success">
<img src="http://demos.telerik.com/kendo-ui/content/web/notification/success-icon.png" />
<h3>${message}</h3>
</div>
</ak-notification-template>
</ak-notification>
<div class="demo-section k-content" style="text-align: center;">
<h4>Show notification:</h4>
<p>
<button click.delegate="showEmailNotification()" ak-button>Email</button><br />
<button click.delegate="showErrorNotification()" ak-button>Error</button><br />
<button click.delegate="showSuccessNotification()" ak-button>Upload Success</button>
</p>
<h4>Hide notification:</h4>
<p>
<button click.delegate="hideAllNotifications()" ak-button>Hide All Notifications</button>
</p>
</div>
</div>
</template>
export class Templates {
showEmailNotification() {
this.notification.show({
title: 'New E-mail',
message: 'You have 1 new mail message!'
}, 'info');
}
showErrorNotification() {
this.notification.show({
title: 'Wrong Password',
message: 'Please enter your password again.'
}, 'error');
}
showSuccessNotification() {
this.notification.show({
message: 'Upload Successful'
}, 'success');
}
hideAllNotifications() {
this.notification.hide();
}
}
<!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());
}
.demo-section p {
margin: 3px 0 20px;
line-height: 50px;
}
.demo-section .k-button {
width: 250px;
}
.k-notification {
border: 0;
}
/* Info template */
.k-notification-info.k-group {
background: rgba(0%,0%,0%,.7);
color: #fff;
}
.new-mail {
width: 300px;
height: 100px;
}
.new-mail h3 {
font-size: 1em;
padding: 32px 10px 5px;
}
.new-mail img {
float: left;
margin: 30px 15px 30px 30px;
}
/* Error template */
.k-notification-error.k-group {
background: rgba(100%,0%,0%,.7);
color: #ffffff;
}
.wrong-pass {
width: 300px;
height: 100px;
}
.wrong-pass h3 {
font-size: 1em;
padding: 32px 10px 5px;
}
.wrong-pass img {
float: left;
margin: 30px 15px 30px 30px;
}
/* Success template */
.k-notification-upload-success.k-group {
background: rgba(0%,60%,0%,.7);
color: #fff;
}
.upload-success {
width: 240px;
height: 100px;
padding: 0 30px;
line-height: 100px;
}
.upload-success>h3 {
font-size: 1.6em;
font-weight: normal;
display: inline;
vertical-align: middle;
}
.upload-success>img {
display: inline;
vertical-align: middle;
margin-right: 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment