This repository was archived by the owner on Oct 5, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-14
lines changed
app/themes/dashboard/ui/app/dashboard Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change 88 return {
99 restrict : 'E' ,
1010 transclude : true ,
11- replace : true ,
11+ replace : false ,
1212 scope : {
1313 boxTitle : '@' ,
14- boxBordered : '@'
14+ boxBordered : '@' ,
15+ collapsed : '@'
1516 } ,
16- link : function ( scope ) {
17- scope . hasBorder = scope . boxBordered !== 'false' && scope . boxBordered !== 'no' ;
17+ link : function ( $ scope, $elem , $attrs ) {
18+ $ scope. hasBorder = $ scope. boxBordered !== 'false' && $ scope. boxBordered !== 'no' ;
1819
19- // TODO: what is the purpose of this watch?
20- scope . $watch ( scope . boxTabs , function ( newVal ) {
21- if ( newVal ) {
22- scope . hasTabs = true ;
23- } else {
24- scope . hasTabs = false ;
25- }
20+ $scope . toggleCollapsed = function ( ) {
21+ $ scope. isCollapsed = ! $scope . isCollapsed ;
22+ } ;
23+
24+ $scope . $watch ( function ( ) { return $attrs . collapsed ; } , function ( newVal ) {
25+ newVal = '' + newVal ;
26+ $scope . isCollapsed = newVal === 'true' || newVal === 'yes' ;
2627 } ) ;
2728 } ,
2829 /* jshint multistr: true */
2930 /* jscs: disable */
30- template : '<div class="box">\
31- <div class="box-header" ng-class="{ \'with-border\': boxBordered }" ng-if="boxTitle">\
31+ template : '<div class="box" ng-init="collapsed = collapsed || false" >\
32+ <div class="box-header" ng-class="{ \'with-border\': boxBordered }" ng-if="boxTitle" ng-click="toggleCollapsed()" >\
3233 <h3 class="box-title">{{ boxTitle }}</h3>\
34+ <div class="box-tools pull-right">\
35+ <button type="button" class="btn btn-box-tool" ng-hide="isCollapsed"><i class="fa fa-minus"></i></button>\
36+ <button type="button" class="btn btn-box-tool" ng-show="isCollapsed"><i class="fa fa-plus"></i></button>\
37+ </div>\
3338 </div>\
34- <div class="box-body" ng-transclude></div>\
39+ <div class="box-body" ng-hide="isCollapsed" ng- transclude></div>\
3540 </div>'
3641 /* jscs: enable */
3742 } ;
You can’t perform that action at this time.
0 commit comments