Added directive element for the new checkboxes

This commit is contained in:
Torkel Ödegaard 2014-09-24 19:10:00 +02:00
parent 4c59ec815e
commit 4997068a0d
2 changed files with 11 additions and 14 deletions

View File

@ -20,13 +20,18 @@ function (angular, kbn) {
angular
.module('grafana.directives')
.directive('tip', function($compile) {
.directive('editorOptBool', function($compile) {
return {
restrict: 'E',
link: function(scope, elem, attrs) {
var _t = '<i class="grafana-tip icon-'+(attrs.icon||'question-sign')+'" bs-tooltip="\''+
kbn.addslashes(elem.text())+'\'"></i>';
elem.replaceWith($compile(angular.element(_t))(scope));
var template = '<div class="editor-option text-center">' +
' <label for="' + attrs.name + '" class="small">' +
attrs.text + '</label>' +
'<input id="' + attrs.name + '" type="checkbox" ' +
' ng-model="' + attrs.model + '"' +
' ng-checked="' + attrs.model + '"></input>' +
' <label for="' + attrs.name + '" class="cr1"></label>';
elem.replaceWith($compile(angular.element(template))(scope));
}
};
});

View File

@ -16,16 +16,8 @@
<div class="modal-body">
<div class="editor-row">
<div class="editor-option text-center">
<label for="currentTime" class="small">Current time range</label>
<input id="currentTime" type="checkbox" ng-model="forCurrent" ng-checked="forCurrent"></input>
<label for="currentTime" class="cr1"></label>
</div>
<div class="editor-option text-center">
<label for="toPanel" class="small">To fullscreen panel</label>
<input id="toPanel" type="checkbox" ng-model="toPanel" ng-checked="toPanel"></input>
<label for="toPanel" class="cr1"></label>
</div>
<editor-opt-bool name="currentTime" text="Current time range" model="forCurrent"></editor-opt-bool>
<editor-opt-bool name="toPanel" text="To this panel only" model="toPanel"></editor-opt-bool>
</div>
<div class="editor-row" style="margin-top: 20px;">