##// END OF EJS Templates
js: use ES6 classes for polymer 2.x
js: use ES6 classes for polymer 2.x

File last commit:

r3172:d37fc984 default
r3172:d37fc984 default
Show More
rhodecode-toggle.html
61 lines | 1.9 KiB | text/html | HtmlLexer
js: use ES6 classes for polymer 2.x
r3172 <link rel="import"
href="../../../../../../bower_components/paper-toggle-button/paper-toggle-button.html">
components: completed rhodecode-toggle for notification settings
r727 <link rel="import" href="../../../../../../bower_components/paper-spinner/paper-spinner.html">
<link rel="import" href="../../../../../../bower_components/paper-tooltip/paper-tooltip.html">
rhodecode-toggle: stub for new UI element
r715
<dom-module id="rhodecode-toggle">
components: completed rhodecode-toggle for notification settings
r727
frontend: use webpack instead of vulcanize
r3171 <style include="shared-styles">
.rc-toggle {
float: left;
position: relative;
}
js: use ES6 classes for polymer 2.x
r3172
frontend: use webpack instead of vulcanize
r3171 .rc-toggle paper-spinner {
position: absolute;
top: 0;
left: -30px;
width: 20px;
height: 20px;
}
</style>
components: completed rhodecode-toggle for notification settings
r727
rhodecode-toggle: stub for new UI element
r715 <template>
components: completed rhodecode-toggle for notification settings
r727 <div class="rc-toggle">
<paper-toggle-button checked={{checked}}>[[labelStatus(checked)]]</paper-toggle-button>
<paper-tooltip>[[tooltipText]]</paper-tooltip>
<template is="dom-if" if="[[shouldShow(noSpinner)]]">
<paper-spinner active=[[active]]></paper-spinner>
</template>
</div>
rhodecode-toggle: stub for new UI element
r715 </template>
polymer: prepare for 3.x migration
r3149 <script>
js: use ES6 classes for polymer 2.x
r3172
class RhodecodeToggle extends Polymer.Element {
static get is() {
return 'rhodecode-toggle';
}
static get properties() {
return {
noSpinner: {type: Boolean, value: false, reflectToAttribute: true},
tooltipText: {type: String, value: "Click to toggle", reflectToAttribute: true},
checked: {type: Boolean, value: false, reflectToAttribute: true},
active: {type: Boolean, value: false, reflectToAttribute: true, notify: true}
}
}
shouldShow() {
polymer: prepare for 3.x migration
r3149 return !this.noSpinner
}
js: use ES6 classes for polymer 2.x
r3172
labelStatus(isActive) {
return this.checked ? 'Enabled' : "Disabled"
}
}
customElements.define(RhodecodeToggle.is, RhodecodeToggle);
polymer: prepare for 3.x migration
r3149 </script>
</dom-module>