This repository has been archived by the owner on May 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnitController.js
79 lines (64 loc) · 2.29 KB
/
UnitController.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var UnitController = BaseController.extend({
/**
* Initialize Notes Controller
* @param $scope, current controller scope
*/
init: function ($scope) {
this._super($scope);
},
/**
*@Override
*/
defineListeners: function () {
this._super();
},
_unitChanged: function (newVal) {
var _this = this;
if (newVal === undefined) {
return;
}
this.$scope.Unit = newVal;
// Handle change of unit
setTimeout(function () {
switch (_this.$scope.Unit.TypeId) {
case Enums.UnitTypes.Pdf:
angular.element('#pdf').html(
// here we also change the skin color to alert the user
'<iframe id="pdf1" src="' + _this.$scope.Unit.ResourceUrl + '" width="100%" height="100%" ></iframe> '
);
break;
case Enums.UnitTypes.Word:
angular.element('#pdf').html(
// here we also change the skin color to alert the user
'<iframe id="pdf1" src="' + _this.$scope.Unit.ResourceUrl + '" width="100%" height="100%" ></iframe> '
);
break;
case Enums.UnitTypes.HTML:
angular.element('#html').html(
// here we also change the skin color to alert the user
'<iframe id="html1" src="' + _this.$scope.Unit.ResourceUrl + '" width="100%" height="100%" ></iframe> '
);
break;
case Enums.UnitTypes.TextView:
angular.element('#html').html(
// here we also change the skin color to alert the user
'<div id="html2" style="width:100%; height:100%; overflow: auto;" >' + _this.$scope.Unit.TextContent + '</div> '
);
break;
}
}, 500);
},
/**
*@Override
*/
defineScope: function () {
var _this = this;
this.addWatch('currentunit', this._unitChanged.bind(this));
},
/**
*@Override
*/
destroy: function () {
}
});
UnitController.$inject = ["$scope"];