Last active
July 20, 2016 06:34
-
-
Save adriatic/dbc27765015c120bee18cab55dafe90e to your computer and use it in GitHub Desktop.
Tabstrip: Api
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> | |
<div id="example"> | |
<div class="box wide"> | |
<div class="box-col"> | |
<h4>Select</h4> | |
<ul class="options"> | |
<li> | |
<input type="text" value.bind="tabIndex" class="k-textbox"/> | |
<button ak-button click.delegate="selectTab()">Select</button> | |
</li> | |
</ul> | |
<h4>Enable / Disable</h4> | |
<ul class="options"> | |
<li> | |
<button ak-button click.delegate="toggleTab()">Enable/Disable Selected</button> | |
</li> | |
</ul> | |
</div> | |
<div class="box-col"> | |
<h4>Add / Remove</h4> | |
<ul class="options"> | |
<li> | |
<button ak-button click.delegate="removeItem()">Remove Selected</button> | |
</li> | |
<li> | |
<input type="text" value.bind="appendText" class="k-textbox"/> | |
<button ak-button click.delegate="appendItem()">Append</button> | |
</li> | |
</ul> | |
</div> | |
<div class="box-col"> | |
<h4> </h4> | |
<ul class="options"> | |
<li> | |
<input type="text" value.bind="beforeText" id="beforeText" class="k-textbox"/> | |
<button ak-button click.delegate="beforeItem()">Insert Before</button> | |
</li> | |
<li> | |
<input type="text" value.bind="afterText" class="k-textbox"/> | |
<button ak-button click.delegate="afterItem()">Insert After</button> | |
</li> | |
</ul> | |
</div> | |
</div> | |
<div class="demo-section k-content"> | |
<div id="tabstrip" ak-tabstrip="k-widget.two-way: tabStrip"> | |
<ul> | |
<li class="k-state-active"> | |
Baseball | |
</li> | |
<li> | |
Golf | |
</li> | |
<li> | |
Swimming | |
</li> | |
</ul> | |
<div> | |
<p>Baseball is a bat-and-ball sport played between two teams of nine players each. The aim is to score runs by hitting a thrown ball with a bat and touching a series of four bases arranged at the corners of a ninety-foot diamond. Players on the batting team take turns hitting against the pitcher of the fielding team, which tries to stop them from scoring runs by getting hitters out in any of several ways. A player on the batting team can stop at any of the bases and later advance via a teammate's hit or other means. The teams switch between batting and fielding whenever the fielding team records three outs. One turn at bat for each team constitutes an inning and nine innings make up a professional game. The team with the most runs at the end of the game wins.</p> | |
</div> | |
<div> | |
<p>Golf is a precision club and ball sport, in which competing players (or golfers) use many types of clubs to hit balls into a series of holes on a golf course using the fewest number of strokes. It is one of the few ball games that does not require a standardized playing area. Instead, the game is played on golf courses, each of which features a unique design, although courses typically consist of either nine or 18 holes. Golf is defined, in the rules of golf, as playing a ball with a club from the teeing ground into the hole by a stroke or successive strokes in accordance with the Rules.</p> | |
</div> | |
<div> | |
<p>Swimming has been recorded since prehistoric times; the earliest recording of swimming dates back to Stone Age paintings from around 7,000 years ago. Written references date from 2000 BC. Some of the earliest references to swimming include the Gilgamesh, the Iliad, the Odyssey, the Bible, Beowulf, and other sagas. In 1578, Nikolaus Wynmann, a German professor of languages, wrote the first swimming book, The Swimmer or A Dialogue on the Art of Swimming. Competitive swimming in Europe started around 1800, mostly using breaststroke.</p> | |
</div> | |
</div> | |
</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 API { | |
beforeText = 'Item'; | |
afterText = 'Item'; | |
appendText = 'Item'; | |
tabIndex = '0'; | |
getItem(index) { | |
return this.tabStrip.tabGroup.children('li').eq(index); | |
} | |
selectTab() { | |
this.tabStrip.select(this.getItem(this.tabIndex)); | |
} | |
toggleTab() { | |
let tab = this.tabStrip.select(); | |
this.tabStrip.enable(tab, tab.hasClass('k-state-disabled')); | |
} | |
removeItem() { | |
let tab = this.tabStrip.select(); | |
let otherTab = tab.next(); | |
otherTab = otherTab.length ? otherTab : tab.prev(); | |
this.tabStrip.remove(tab); | |
this.tabStrip.select(otherTab); | |
} | |
appendItem() { | |
this.tabStrip.append({ | |
text: this.appendText, | |
content: '<br>' | |
}); | |
} | |
beforeItem() { | |
this.tabStrip.insertBefore({ | |
text: this.beforeText, | |
content: '<br>' | |
}, this.tabStrip.select()); | |
} | |
afterItem() { | |
this.tabStrip.insertAfter({ | |
text: this.afterText, | |
content: '<br>' | |
}, this.tabStrip.select()); | |
} | |
} |
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()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment