Sha256: f30eb2e57919c296d853828442ca8f298b8b6414df47c0699e82dc455d5964b1
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
angular.module('EssayApp.directives').directive("buttonset", ['$timeout', ($timeout) -> restrict: 'A' scope: true require: "?ngModel" link: (scope, element, attrs) -> promise = null init = (element) -> promise = $timeout (-> try if angular.isDefined(element.data("uiButtonset")) element.buttonset("refresh") element.find("input").trigger("change") else element.buttonset({items: "input[type=radio]:not(.ui-helper-hidden-accessible)"}) catch error console.log error return ), 0, false fn = () -> element.find("input[disabled]").length scope.$watch attrs['buttonset'], () -> $timeout.cancel(promise) if promise? init(element) scope.$watch fn, (new_value, old_value) -> if new_value > 0 && element.find("input[disabled]:checked").length > 0 $timeout (-> element.find('input:not([disabled])')[0].click() ), 0, false if new_value > 0 || old_value > 0 element.find("input").trigger("change") # init(element) ])
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
translation_cms-0.1.5 | app/assets/javascripts/app/directives/buttonset.js.coffee |