Skip to content

Commit ffba0f3

Browse files
committed
Add IIFE to app.controller.js
1 parent 23a7e1b commit ffba0f3

File tree

1 file changed

+50
-43
lines changed

1 file changed

+50
-43
lines changed

zeppelin-web/src/app/app.controller.js

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,53 @@
1111
* See the License for the specific language governing permissions and
1212
* limitations under the License.
1313
*/
14-
'use strict';
15-
16-
angular.module('zeppelinWebApp').controller('MainCtrl', function($scope, $rootScope, $window, arrayOrderingSrv) {
17-
$scope.looknfeel = 'default';
18-
19-
var init = function() {
20-
$scope.asIframe = (($window.location.href.indexOf('asIframe') > -1) ? true : false);
21-
};
22-
23-
init();
24-
25-
$rootScope.$on('setIframe', function(event, data) {
26-
if (!event.defaultPrevented) {
27-
$scope.asIframe = data;
28-
event.preventDefault();
29-
}
30-
});
31-
32-
$rootScope.$on('setLookAndFeel', function(event, data) {
33-
if (!event.defaultPrevented && data && data !== '' && data !== $scope.looknfeel) {
34-
$scope.looknfeel = data;
35-
event.preventDefault();
36-
}
37-
});
38-
39-
// Set The lookAndFeel to default on every page
40-
$rootScope.$on('$routeChangeStart', function(event, next, current) {
41-
$rootScope.$broadcast('setLookAndFeel', 'default');
42-
});
43-
44-
$rootScope.noteName = function(note) {
45-
if (!_.isEmpty(note)) {
46-
return arrayOrderingSrv.getNoteName(note);
47-
}
48-
};
49-
50-
BootstrapDialog.defaultOptions.onshown = function() {
51-
angular.element('#' + this.id).find('.btn:last').focus();
52-
};
53-
54-
// Remove BootstrapDialog animation
55-
BootstrapDialog.configDefaultOptions({animate: false});
56-
});
14+
(function() {
15+
'use strict';
16+
17+
angular.module('zeppelinWebApp').controller('MainCtrl', MainCtrl);
18+
19+
MainCtrl.$inject = ['$scope', '$rootScope', '$window', 'arrayOrderingSrv'];
20+
21+
function MainCtrl($scope, $rootScope, $window, arrayOrderingSrv) {
22+
$scope.looknfeel = 'default';
23+
24+
var init = function() {
25+
$scope.asIframe = (($window.location.href.indexOf('asIframe') > -1) ? true : false);
26+
};
27+
28+
init();
29+
30+
$rootScope.$on('setIframe', function(event, data) {
31+
if (!event.defaultPrevented) {
32+
$scope.asIframe = data;
33+
event.preventDefault();
34+
}
35+
});
36+
37+
$rootScope.$on('setLookAndFeel', function(event, data) {
38+
if (!event.defaultPrevented && data && data !== '' && data !== $scope.looknfeel) {
39+
$scope.looknfeel = data;
40+
event.preventDefault();
41+
}
42+
});
43+
44+
// Set The lookAndFeel to default on every page
45+
$rootScope.$on('$routeChangeStart', function(event, next, current) {
46+
$rootScope.$broadcast('setLookAndFeel', 'default');
47+
});
48+
49+
$rootScope.noteName = function(note) {
50+
if (!_.isEmpty(note)) {
51+
return arrayOrderingSrv.getNoteName(note);
52+
}
53+
};
54+
55+
BootstrapDialog.defaultOptions.onshown = function() {
56+
angular.element('#' + this.id).find('.btn:last').focus();
57+
};
58+
59+
// Remove BootstrapDialog animation
60+
BootstrapDialog.configDefaultOptions({animate: false});
61+
}
62+
63+
})();

0 commit comments

Comments
 (0)