rhodecode-toggle.html
48 lines
| 1.7 KiB
| text/html
|
HtmlLexer
r715 | <link rel="import" href="../../../../../../bower_components/paper-toggle-button/paper-toggle-button.html"> | |||
r727 | <link rel="import" href="../../../../../../bower_components/paper-spinner/paper-spinner.html"> | |||
<link rel="import" href="../../../../../../bower_components/paper-tooltip/paper-tooltip.html"> | ||||
r715 | ||||
<dom-module id="rhodecode-toggle"> | ||||
r727 | ||||
r3171 | <style include="shared-styles"> | |||
.rc-toggle { | ||||
float: left; | ||||
position: relative; | ||||
} | ||||
.rc-toggle paper-spinner { | ||||
position: absolute; | ||||
top: 0; | ||||
left: -30px; | ||||
width: 20px; | ||||
height: 20px; | ||||
} | ||||
</style> | ||||
r727 | ||||
r715 | <template> | |||
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> | ||||
r715 | </template> | |||
r3149 | <script> | |||
Polymer({ | ||||
is: 'rhodecode-toggle', | ||||
properties: { | ||||
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: function(){ | ||||
return !this.noSpinner | ||||
}, | ||||
labelStatus: function(isActive){ | ||||
return this.checked? 'Enabled' : "Disabled" | ||||
} | ||||
}); | ||||
</script> | ||||
</dom-module> | ||||