1+ /*!
2+ * angular-aui
3+ * Version - 0.0.1
4+ * Built - 2014-09-30
5+ 6+ * url - https://github.com/OleksandrBezhan/angular-aui.git
7+ */
8+ 'strict mode' ;
9+
10+ angular . module ( 'angular-aui' , [ 'angular-aui-directives' ] ) ; ; angular . module ( 'angular-aui-directives' , [ ] )
11+ . directive ( 'auiDatePicker' , [ function ( ) {
12+ function link ( scope , element , attrs , ngModelCtrl ) {
13+ AJS . $ ( element ) . datePicker ( {
14+ overrideBrowserDefault : true ,
15+ onSelect : function ( newValue ) {
16+ scope . $apply ( function ( ) {
17+ // model doesn't get updates when `overrideBrowserDefault` = true
18+ ngModelCtrl . $setViewValue ( newValue ) ;
19+ } ) ;
20+ }
21+ } ) ;
22+ }
23+ return {
24+ require : 'ngModel' ,
25+ link : link
26+ } ;
27+ } ] )
28+ . directive ( 'auiInlineDialog' , [ '$compile' , function ( $compile ) {
29+ var dialogContent ;
30+ function link ( scope , element , attrs ) {
31+ var dialog = AJS . InlineDialog ( AJS . $ ( element ) , 1 ,
32+ function ( content , trigger , showPopup ) {
33+ content . html ( dialogContent ) ;
34+ showPopup ( ) ;
35+ return false ;
36+ } , scope . $eval ( attrs . options ) ) ;
37+ scope . $hide = dialog . hide . bind ( dialog ) ;
38+ scope . $refresh = dialog . refresh . bind ( dialog ) ;
39+ scope . $show = dialog . show . bind ( dialog ) ;
40+ }
41+ function controller ( $scope ) {
42+ this . drawContent = function ( html ) {
43+ dialogContent = $compile ( html ) ( $scope ) ;
44+ } ;
45+ }
46+ return {
47+ controller : controller ,
48+ link : link
49+ } ;
50+ } ] )
51+ . directive ( 'auiInlineDialogContent' , [ '$timeout' , function ( $timeout ) {
52+ function link ( scope , element , attrs , inlineDialogCtrl ) {
53+ inlineDialogCtrl . drawContent ( element [ 0 ] . innerHTML ) ;
54+ element . css ( 'display' , 'none' ) ;
55+ }
56+ return {
57+ require : '^auiInlineDialog' ,
58+ link : link
59+ } ;
60+ } ] )
61+ . directive ( 'auiSelect2' , [ function ( ) {
62+ function link ( $scope , element , attrs ) {
63+ AJS . $ ( element ) . auiSelect2 ( ) ;
64+ }
65+ return {
66+ link : link
67+ } ;
68+ } ] ) ;
0 commit comments