@oat-sa/tao-core-ui 1.57.0 → 1.58.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/dist/actionbar.js +386 -395
  2. package/dist/adder.js +21 -19
  3. package/dist/animable/absorbable/absorbable.js +204 -213
  4. package/dist/animable/absorbable/css/absorb.css +1 -0
  5. package/dist/animable/absorbable/css/absorb.css.map +1 -1
  6. package/dist/animable/pulsable/pulsable.js +168 -177
  7. package/dist/autocomplete/css/autocomplete.css +1 -0
  8. package/dist/autocomplete/css/autocomplete.css.map +1 -1
  9. package/dist/autocomplete.js +68 -66
  10. package/dist/badge/badge.js +188 -197
  11. package/dist/badge/css/badge.css +1 -0
  12. package/dist/badge/css/badge.css.map +1 -1
  13. package/dist/breadcrumbs.js +275 -284
  14. package/dist/btngrouper.js +5 -5
  15. package/dist/bulkActionPopup.js +490 -495
  16. package/dist/button.js +283 -291
  17. package/dist/cascadingComboBox.js +249 -258
  18. package/dist/ckeditor/ckConfigurator.js +42 -20
  19. package/dist/ckeditor/dtdHandler.js +11 -9
  20. package/dist/class/selector.js +441 -450
  21. package/dist/component/resizable.js +1 -1
  22. package/dist/component/windowed.js +285 -294
  23. package/dist/component.js +419 -428
  24. package/dist/contextualPopup.js +417 -426
  25. package/dist/dashboard.js +300 -309
  26. package/dist/datalist.js +753 -762
  27. package/dist/datatable/filterStrategy/multiple.js +1 -1
  28. package/dist/datatable/filterStrategy/single.js +1 -1
  29. package/dist/datatable.js +1527 -1550
  30. package/dist/dateRange/dateRange.js +393 -402
  31. package/dist/datetime/picker.js +665 -672
  32. package/dist/deleter.js +368 -377
  33. package/dist/destination/selector.js +286 -295
  34. package/dist/dialog/alert.js +3 -3
  35. package/dist/dialog/confirm.js +1 -1
  36. package/dist/dialog/confirmDelete.js +216 -225
  37. package/dist/dialog.js +650 -654
  38. package/dist/disabler.js +8 -8
  39. package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +166 -175
  40. package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +518 -527
  41. package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +380 -389
  42. package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +539 -548
  43. package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +369 -378
  44. package/dist/documentViewer/providers/pdfViewer.js +184 -193
  45. package/dist/documentViewer.js +292 -301
  46. package/dist/dropdown.js +383 -392
  47. package/dist/durationer.js +5 -5
  48. package/dist/dynamicComponent.js +597 -598
  49. package/dist/feedback.js +356 -362
  50. package/dist/figure/FigureStateActive.js +117 -108
  51. package/dist/filesender.js +2 -2
  52. package/dist/filter.js +230 -239
  53. package/dist/form/dropdownForm.js +355 -357
  54. package/dist/form/form.js +919 -690
  55. package/dist/form/simpleForm.js +1 -1
  56. package/dist/form/validator/renderer.js +233 -235
  57. package/dist/form/validator/validator.js +257 -189
  58. package/dist/form/widget/definitions.js +1 -1
  59. package/dist/form/widget/providers/checkBox.js +254 -259
  60. package/dist/form/widget/providers/comboBox.js +187 -192
  61. package/dist/form/widget/providers/default.js +8 -9
  62. package/dist/form/widget/providers/hidden.js +170 -179
  63. package/dist/form/widget/providers/hiddenBox.js +262 -267
  64. package/dist/form/widget/providers/radioBox.js +216 -225
  65. package/dist/form/widget/providers/textArea.js +187 -196
  66. package/dist/form/widget/providers/textBox.js +2 -3
  67. package/dist/form/widget/widget.js +473 -475
  68. package/dist/formValidator/formValidator.js +1 -1
  69. package/dist/formValidator/highlighters/message.js +1 -1
  70. package/dist/generis/form/form.js +314 -323
  71. package/dist/generis/validator/validator.js +209 -218
  72. package/dist/generis/widget/checkBox/checkBox.js +218 -227
  73. package/dist/generis/widget/comboBox/comboBox.js +179 -188
  74. package/dist/generis/widget/hiddenBox/hiddenBox.js +220 -229
  75. package/dist/generis/widget/textBox/textBox.js +169 -178
  76. package/dist/generis/widget/widget.js +246 -255
  77. package/dist/groupedComboBox.js +222 -231
  78. package/dist/groupvalidator.js +2 -2
  79. package/dist/highlighter.js +967 -958
  80. package/dist/image/ImgStateActive/helper.js +7 -5
  81. package/dist/image/ImgStateActive/initHelper.js +49 -43
  82. package/dist/image/ImgStateActive/initMediaEditor.js +24 -20
  83. package/dist/image/ImgStateActive/mediaSizer.js +14 -12
  84. package/dist/image/ImgStateActive.js +72 -70
  85. package/dist/incrementer.js +6 -6
  86. package/dist/inplacer.js +6 -6
  87. package/dist/itemButtonList/css/item-button-list.css +1 -0
  88. package/dist/itemButtonList/css/item-button-list.css.map +1 -1
  89. package/dist/itemButtonList.js +439 -435
  90. package/dist/keyNavigation/navigableDomElement.js +51 -38
  91. package/dist/keyNavigation/navigator.js +85 -70
  92. package/dist/listbox.js +460 -469
  93. package/dist/liststyler.js +8 -8
  94. package/dist/loadingButton/loadingButton.js +209 -218
  95. package/dist/lock.js +476 -485
  96. package/dist/login/login.js +475 -484
  97. package/dist/maths/calculator/basicCalculator.js +235 -244
  98. package/dist/maths/calculator/calculatorComponent.js +3 -3
  99. package/dist/maths/calculator/core/board.js +772 -781
  100. package/dist/maths/calculator/core/expression.js +476 -485
  101. package/dist/maths/calculator/core/labels.js +228 -237
  102. package/dist/maths/calculator/core/tokenizer.js +1 -1
  103. package/dist/maths/calculator/core/tokens.js +163 -170
  104. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +244 -253
  105. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +279 -288
  106. package/dist/maths/calculator/scientificCalculator.js +327 -336
  107. package/dist/mediaEditor/mediaEditorComponent.js +238 -245
  108. package/dist/mediaEditor/plugins/mediaAlignment/helper.js +7 -7
  109. package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +229 -235
  110. package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +580 -589
  111. package/dist/mediaplayer/players/html5.js +666 -675
  112. package/dist/mediaplayer/players/youtube.js +419 -424
  113. package/dist/mediaplayer/support.js +11 -10
  114. package/dist/mediaplayer/utils/reminder.js +14 -13
  115. package/dist/mediaplayer/utils/timeObserver.js +10 -11
  116. package/dist/mediaplayer/youtubeManager.js +164 -145
  117. package/dist/mediaplayer.js +1565 -1520
  118. package/dist/mediasizer.js +669 -678
  119. package/dist/modal.js +10 -17
  120. package/dist/pageSizeSelector.js +219 -228
  121. package/dist/pagination/providers/pages.js +280 -289
  122. package/dist/pagination/providers/simple.js +192 -201
  123. package/dist/previewer.js +30 -30
  124. package/dist/progressbar.js +4 -4
  125. package/dist/report.js +347 -356
  126. package/dist/resource/filters.js +271 -280
  127. package/dist/resource/list.js +1264 -1273
  128. package/dist/resource/selector.js +865 -874
  129. package/dist/resource/tree.js +1483 -1492
  130. package/dist/resourcemgr/fileBrowser.js +564 -569
  131. package/dist/resourcemgr/filePreview.js +16 -16
  132. package/dist/resourcemgr/fileSelector.js +515 -524
  133. package/dist/resourcemgr/util/updatePermissions.js +2 -2
  134. package/dist/resourcemgr.js +306 -315
  135. package/dist/searchModal/advancedSearch.js +796 -767
  136. package/dist/searchModal.js +597 -549
  137. package/dist/switch/switch.js +298 -307
  138. package/dist/tabs.js +598 -575
  139. package/dist/taskQueue/status.js +312 -321
  140. package/dist/taskQueue/table.js +375 -384
  141. package/dist/taskQueue/taskQueueModel.js +488 -472
  142. package/dist/taskQueueButton/taskable.js +264 -273
  143. package/dist/taskQueueButton/treeButton.js +189 -198
  144. package/dist/themeLoader.js +24 -23
  145. package/dist/themes.js +1 -1
  146. package/dist/toggler.js +3 -3
  147. package/dist/tooltip.js +295 -304
  148. package/dist/transformer.js +2 -2
  149. package/dist/tristateCheckboxGroup.js +311 -320
  150. package/dist/uploader.js +687 -696
  151. package/dist/validator/Report.js +1 -1
  152. package/dist/validator/Validator.js +3 -3
  153. package/dist/validator/validators.js +9 -9
  154. package/dist/validator.js +240 -230
  155. package/dist/waitForMedia.js +1 -1
  156. package/package.json +3 -3
  157. package/scss/ckeditor/skins/tao/scss/inc/_menu.scss +51 -27
  158. package/scss/ckeditor/skins/tao/scss/inc/_panel.scss +16 -5
  159. package/scss/ckeditor/skins/tao/scss/inc/_richcombo.scss +0 -2
  160. package/scss/ckeditor/skins/tao/scss/inc/_toolbar.scss +15 -3
  161. package/src/animable/absorbable/css/absorb.css +1 -0
  162. package/src/animable/absorbable/css/absorb.css.map +1 -1
  163. package/src/autocomplete/css/autocomplete.css +1 -0
  164. package/src/autocomplete/css/autocomplete.css.map +1 -1
  165. package/src/badge/css/badge.css +1 -0
  166. package/src/badge/css/badge.css.map +1 -1
  167. package/src/ckeditor/ckConfigurator.js +24 -1
  168. package/src/itemButtonList/css/item-button-list.css +1 -0
  169. package/src/itemButtonList/css/item-button-list.css.map +1 -1
  170. package/scss/.DS_Store +0 -0
  171. package/src/.DS_Store +0 -0
@@ -1,483 +1,474 @@
1
1
  define(['jquery', 'lodash', 'handlebars', 'i18n', 'lib/dompurify/purify', 'css!ui/contextualPopup/css/contextualPopup.css'], function ($$1, _, Handlebars, __, DOMPurify, contextualPopup_css) { 'use strict';
2
2
 
3
- $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
- _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
- Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
6
- __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
7
- DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
8
-
3
+ $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
+ _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
+ Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
6
+ __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
7
+ DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
8
+
9
+ function _typeof(obj) {
10
+ "@babel/helpers - typeof";
11
+
12
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
13
+ return typeof obj;
14
+ } : function (obj) {
15
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
16
+ }, _typeof(obj);
17
+ }
18
+
19
+ function Helpers0 (hb) {
20
+ //register a i18n helper
21
+ hb.registerHelper('__', function (key) {
22
+ return __(key);
23
+ });
9
24
  /**
10
- * This program is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU General Public License
12
- * as published by the Free Software Foundation; under version 2
13
- * of the License (non-upgradable).
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program; if not, write to the Free Software
22
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
- *
24
- * Copyright (c) 2013-2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
25
+ * Register dompurify helper
25
26
  *
27
+ * https://github.com/cure53/DOMPurify
28
+ * with config SAFE_FOR_TEMPLATES: true
29
+ * to make output safe for template systems
30
+ */
31
+
32
+ hb.registerHelper('dompurify', function (context) {
33
+ return DOMPurify.sanitize(context);
34
+ });
35
+ /**
36
+ * Register join helper
26
37
  *
38
+ * Example :
39
+ * var values = {a:v1, b:v2, c:v3};
40
+ * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
41
+ * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
27
42
  */
28
- function Helpers0 (hb) {
29
- //register a i18n helper
30
- hb.registerHelper('__', function (key) {
31
- return __(key);
32
- });
33
- /**
34
- * Register dompurify helper
35
- *
36
- * https://github.com/cure53/DOMPurify
37
- * with config SAFE_FOR_TEMPLATES: true
38
- * to make output safe for template systems
39
- */
40
43
 
41
- hb.registerHelper('dompurify', function (context) {
42
- return DOMPurify.sanitize(context);
43
- });
44
- /**
45
- * Register join helper
46
- *
47
- * Example :
48
- * var values = {a:v1, b:v2, c:v3};
49
- * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
50
- * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
51
- */
44
+ hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
45
+ var fragments = [];
46
+ keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
47
+ fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
48
+ wrapper = typeof wrapper === 'string' ? wrapper : '"';
52
49
 
53
- hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
54
- var fragments = [];
55
- keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
56
- fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
57
- wrapper = typeof wrapper === 'string' ? wrapper : '"';
58
-
59
- _.forIn(arr, function (value, key) {
60
- var fragment = '';
61
-
62
- if (value !== null || value !== undefined) {
63
- if (typeof value === 'boolean') {
64
- value = value ? 'true' : 'false';
65
- } else if (typeof value === 'object') {
66
- value = _.values(value).join(' ');
67
- }
68
- } else {
69
- value = '';
70
- }
50
+ _.forIn(arr, function (value, key) {
51
+ var fragment = '';
71
52
 
72
- if (keyValueGlue !== undefined) {
73
- fragment += key + keyValueGlue;
53
+ if (value !== null || value !== undefined) {
54
+ if (typeof value === 'boolean') {
55
+ value = value ? 'true' : 'false';
56
+ } else if (_typeof(value) === 'object') {
57
+ value = _.values(value).join(' ');
74
58
  }
59
+ } else {
60
+ value = '';
61
+ }
75
62
 
76
- fragment += wrapper + value + wrapper;
77
- fragments.push(fragment);
78
- });
79
-
80
- return fragments.join(fragmentGlue);
81
- }); //register a classic "for loop" helper
82
- //it also adds a local variable "i" as the index in each iteration loop
83
-
84
- hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
85
- var ret = '';
86
- startIndex = parseInt(startIndex);
87
- stopIndex = parseInt(stopIndex);
88
- increment = parseInt(increment);
89
-
90
- for (var i = startIndex; i < stopIndex; i += increment) {
91
- ret += options.fn(_.extend({}, this, {
92
- i: i
93
- }));
63
+ if (keyValueGlue !== undefined) {
64
+ fragment += key + keyValueGlue;
94
65
  }
95
66
 
96
- return ret;
67
+ fragment += wrapper + value + wrapper;
68
+ fragments.push(fragment);
97
69
  });
98
- hb.registerHelper('equal', function (var1, var2, options) {
99
- if (var1 == var2) {
100
- return options.fn(this);
101
- } else {
102
- return options.inverse(this);
103
- }
104
- }); // register a "get property" helper
105
- // it gets the named property from the provided context
106
70
 
107
- hb.registerHelper('property', function (name, context) {
108
- return context[name] || '';
109
- }); // register an 'includes' helper
110
- // it checks if value is in array
71
+ return fragments.join(fragmentGlue);
72
+ }); //register a classic "for loop" helper
73
+ //it also adds a local variable "i" as the index in each iteration loop
111
74
 
112
- hb.registerHelper('includes', function (haystack, needle, options) {
113
- if (_.contains(haystack, needle)) {
114
- return options.fn(this);
115
- }
116
- });
117
- }
75
+ hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
76
+ var ret = '';
77
+ startIndex = parseInt(startIndex);
78
+ stopIndex = parseInt(stopIndex);
79
+ increment = parseInt(increment);
118
80
 
119
- if (!Helpers0.__initialized) {
120
- Helpers0(Handlebars);
121
- Helpers0.__initialized = true;
122
- }
123
- var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
124
- this.compilerInfo = [4,'>= 1.0.0'];
125
- helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
126
- var buffer = "", stack1, helper, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, self=this, functionType="function";
127
-
128
- function program1(depth0,data) {
129
-
130
- var buffer = "", stack1;
131
- buffer += "\n ";
132
- stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.controls)),stack1 == null || stack1 === false ? stack1 : stack1.done), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
133
- if(stack1 || stack1 === 0) { buffer += stack1; }
134
- buffer += "\n ";
135
- stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.controls)),stack1 == null || stack1 === false ? stack1 : stack1.cancel), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
136
- if(stack1 || stack1 === 0) { buffer += stack1; }
137
- buffer += "\n ";
138
- return buffer;
81
+ for (var i = startIndex; i < stopIndex; i += increment) {
82
+ ret += options.fn(_.extend({}, this, {
83
+ i: i
84
+ }));
139
85
  }
140
- function program2(depth0,data) {
141
-
142
-
143
- return "<button class=\"btn btn-info small done\">done</button>";
86
+
87
+ return ret;
88
+ });
89
+ hb.registerHelper('equal', function (var1, var2, options) {
90
+ if (var1 == var2) {
91
+ return options.fn(this);
92
+ } else {
93
+ return options.inverse(this);
144
94
  }
95
+ }); // register a "get property" helper
96
+ // it gets the named property from the provided context
97
+
98
+ hb.registerHelper('property', function (name, context) {
99
+ return context[name] || '';
100
+ }); // register an 'includes' helper
101
+ // it checks if value is in array
145
102
 
146
- function program4(depth0,data) {
147
-
148
- var buffer = "", helper, options;
149
- buffer += "<a href=\"#\" class=\"btn cancel\" title=\""
150
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "cancel", options) : helperMissing.call(depth0, "__", "cancel", options)))
151
- + "\">cancel</a>";
152
- return buffer;
103
+ hb.registerHelper('includes', function (haystack, needle, options) {
104
+ if (_.contains(haystack, needle)) {
105
+ return options.fn(this);
153
106
  }
107
+ });
108
+ }
109
+
110
+ if (!Helpers0.__initialized) {
111
+ Helpers0(Handlebars);
112
+ Helpers0.__initialized = true;
113
+ }
114
+ var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
115
+ this.compilerInfo = [4,'>= 1.0.0'];
116
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
117
+ var buffer = "", stack1, helper, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, self=this, functionType="function";
118
+
119
+ function program1(depth0,data) {
120
+
121
+ var buffer = "", stack1;
122
+ buffer += "\n ";
123
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.controls)),stack1 == null || stack1 === false ? stack1 : stack1.done), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
124
+ if(stack1 || stack1 === 0) { buffer += stack1; }
125
+ buffer += "\n ";
126
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 && depth0.controls)),stack1 == null || stack1 === false ? stack1 : stack1.cancel), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
127
+ if(stack1 || stack1 === 0) { buffer += stack1; }
128
+ buffer += "\n ";
129
+ return buffer;
130
+ }
131
+ function program2(depth0,data) {
132
+
133
+
134
+ return "<button class=\"btn btn-info small done\">done</button>";
135
+ }
154
136
 
155
- buffer += "<div class=\"contextual-popup\" style=\"top:"
156
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.popup)),stack1 == null || stack1 === false ? stack1 : stack1.top)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
157
- + "px; left:"
158
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.popup)),stack1 == null || stack1 === false ? stack1 : stack1.left)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
159
- + "px\">\n <div class=\"arrow\" style=\"left:"
160
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.arrow)),stack1 == null || stack1 === false ? stack1 : stack1.left)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
161
- + "px\"></div>\n <div class=\"arrow-cover\" style=\"left:"
162
- + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.arrow)),stack1 == null || stack1 === false ? stack1 : stack1.leftCover)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
163
- + "px\"></div>\n <div class=\"popup-content\">";
164
- if (helper = helpers.content) { stack1 = helper.call(depth0, {hash:{},data:data}); }
165
- else { helper = (depth0 && depth0.content); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
166
- if(stack1 || stack1 === 0) { buffer += stack1; }
167
- buffer += "</div>\n <div class=\"footer\">\n ";
168
- stack1 = helpers['if'].call(depth0, (depth0 && depth0.controls), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
169
- if(stack1 || stack1 === 0) { buffer += stack1; }
170
- buffer += "\n </div>\n</div>";
171
- return buffer;
172
- });
173
- function popupTpl(data, options, asString) {
174
- var html = Template(data, options);
175
- return (asString || true) ? html : $(html);
137
+ function program4(depth0,data) {
138
+
139
+ var buffer = "", helper, options;
140
+ buffer += "<a href=\"#\" class=\"btn cancel\" title=\""
141
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "cancel", options) : helperMissing.call(depth0, "__", "cancel", options)))
142
+ + "\">cancel</a>";
143
+ return buffer;
176
144
  }
177
145
 
178
- /*
179
- * This program is free software; you can redistribute it and/or
180
- * modify it under the terms of the GNU General Public License
181
- * as published by the Free Software Foundation; under version 2
182
- * of the License (non-upgradable).
183
- *
184
- * This program is distributed in the hope that it will be useful,
185
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
186
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
187
- * GNU General Public License for more details.
188
- *
189
- * You should have received a copy of the GNU General Public License
190
- * along with this program; if not, write to the Free Software
191
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
192
- *
193
- * Copyright (c) 2015 (original work) Open Assessment Technologies SA ;
194
- *
146
+ buffer += "<div class=\"contextual-popup\" style=\"top:"
147
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.popup)),stack1 == null || stack1 === false ? stack1 : stack1.top)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
148
+ + "px; left:"
149
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.popup)),stack1 == null || stack1 === false ? stack1 : stack1.left)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
150
+ + "px\">\n <div class=\"arrow\" style=\"left:"
151
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.arrow)),stack1 == null || stack1 === false ? stack1 : stack1.left)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
152
+ + "px\"></div>\n <div class=\"arrow-cover\" style=\"left:"
153
+ + escapeExpression(((stack1 = ((stack1 = (depth0 && depth0.arrow)),stack1 == null || stack1 === false ? stack1 : stack1.leftCover)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
154
+ + "px\"></div>\n <div class=\"popup-content\">";
155
+ if (helper = helpers.content) { stack1 = helper.call(depth0, {hash:{},data:data}); }
156
+ else { helper = (depth0 && depth0.content); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
157
+ if(stack1 || stack1 === 0) { buffer += stack1; }
158
+ buffer += "</div>\n <div class=\"footer\">\n ";
159
+ stack1 = helpers['if'].call(depth0, (depth0 && depth0.controls), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
160
+ if(stack1 || stack1 === 0) { buffer += stack1; }
161
+ buffer += "\n </div>\n</div>";
162
+ return buffer;
163
+ });
164
+ function popupTpl(data, options, asString) {
165
+ var html = Template(data, options);
166
+ return (asString || true) ? html : $(html);
167
+ }
168
+
169
+ /*
170
+ * This program is free software; you can redistribute it and/or
171
+ * modify it under the terms of the GNU General Public License
172
+ * as published by the Free Software Foundation; under version 2
173
+ * of the License (non-upgradable).
174
+ *
175
+ * This program is distributed in the hope that it will be useful,
176
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
177
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
178
+ * GNU General Public License for more details.
179
+ *
180
+ * You should have received a copy of the GNU General Public License
181
+ * along with this program; if not, write to the Free Software
182
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
183
+ *
184
+ * Copyright (c) 2015 (original work) Open Assessment Technologies SA ;
185
+ *
186
+ */
187
+ var _ns = '.contextual-popup';
188
+ var _defaults = {
189
+ controls: false,
190
+ style: {},
191
+ position: 'bottom',
192
+ callbacks: {}
193
+ };
194
+ /**
195
+ * Create an element selector reltive to the $anchor and contained in the $container
196
+ *
197
+ * @param {JQuery} $anchor
198
+ * @param {JQuery} $container
199
+ * @param {Object} options
200
+ * @param {JQuery|String} [options.content] - the inital content of the popup
201
+ * @param {Boolean} [options.controls] - add cancel/done button
202
+ * @param {Function} [options.callbacks.beforeDone] - Triggered when a dialog is about to close. If returned <i>false</i>, the dialog will not close.
203
+ * @param {Function} [options.callbacks.beforeCancel] - Triggered when a dialog is about to close. If returned <i>false</i>, the dialog will not close.
204
+ * @param {Function} [options.callbacks.beforeDestroy] - Triggered when a dialog is about to destroy.
205
+ * @returns {Object} the new selector instance
206
+ */
207
+
208
+ function create($anchor, $container, options) {
209
+ var destroyed = false;
210
+ options = _.defaults(options, _defaults);
211
+ $anchor.data('contextual-popup-options', options); //anchor must be positioned in css
212
+
213
+ var positions = _computePosition($anchor, $container);
214
+
215
+ var $element = $$1(popupTpl({
216
+ popup: positions.popup,
217
+ arrow: positions.arrow,
218
+ controls: options.controls
219
+ })); //only one
220
+
221
+ $anchor.find('.contextual-popup').remove(); //attach the popup
222
+
223
+ $element.addClass(options.position);
224
+ $element.css('width', options.style.popupWidth);
225
+ $anchor.append($element);
226
+ $element.off(_ns).on('click' + _ns, '.done', function () {
227
+ if (runCallback('beforeDone')) {
228
+ _done($element);
229
+ }
230
+ }).on('click' + _ns, '.cancel', function () {
231
+ if (runCallback('beforeCancel')) {
232
+ _cancel($element);
233
+ }
234
+ });
235
+
236
+ if (options.content) {
237
+ setContent(options.content);
238
+ }
239
+ /**
240
+ * Set the popup content
241
+ * @param {JQuery|String} content
242
+ * @returns {undefined}
195
243
  */
196
- var _ns = '.contextual-popup';
197
- var _defaults = {
198
- controls: false,
199
- style: {},
200
- position: 'bottom',
201
- callbacks: {}
202
- };
244
+
245
+
246
+ function setContent(content) {
247
+ if (content instanceof $$1 || _.isString(content)) {
248
+ $element.find('.popup-content').empty().append(content);
249
+ }
250
+ }
203
251
  /**
204
- * Create an element selector reltive to the $anchor and contained in the $container
205
- *
206
- * @param {JQuery} $anchor
207
- * @param {JQuery} $container
208
- * @param {Object} options
209
- * @param {JQuery|String} [options.content] - the inital content of the popup
210
- * @param {Boolean} [options.controls] - add cancel/done button
211
- * @param {Function} [options.callbacks.beforeDone] - Triggered when a dialog is about to close. If returned <i>false</i>, the dialog will not close.
212
- * @param {Function} [options.callbacks.beforeCancel] - Triggered when a dialog is about to close. If returned <i>false</i>, the dialog will not close.
213
- * @param {Function} [options.callbacks.beforeDestroy] - Triggered when a dialog is about to destroy.
214
- * @returns {Object} the new selector instance
252
+ * Run callback function before action. If returned <i>false</i>, action will not be executed.
253
+ * @param {string} name - callback name
254
+ * @returns {boolean}
215
255
  */
216
256
 
217
- function create($anchor, $container, options) {
218
- var destroyed = false;
219
- options = _.defaults(options, _defaults);
220
- $anchor.data('contextual-popup-options', options); //anchor must be positioned in css
221
257
 
222
- var positions = _computePosition($anchor, $container);
258
+ function runCallback(name) {
259
+ var result = true;
223
260
 
224
- var $element = $$1(popupTpl({
225
- popup: positions.popup,
226
- arrow: positions.arrow,
227
- controls: options.controls
228
- })); //only one
261
+ if (options.callbacks[name] && _.isFunction(options.callbacks[name])) {
262
+ result = options.callbacks[name]();
263
+ }
229
264
 
230
- $anchor.find('.contextual-popup').remove(); //attach the popup
265
+ return result;
266
+ }
231
267
 
232
- $element.addClass(options.position);
233
- $element.css('width', options.style.popupWidth);
234
- $anchor.append($element);
235
- $element.off(_ns).on('click' + _ns, '.done', function () {
236
- if (runCallback('beforeDone')) {
237
- _done($element);
238
- }
239
- }).on('click' + _ns, '.cancel', function () {
240
- if (runCallback('beforeCancel')) {
241
- _cancel($element);
242
- }
243
- });
268
+ var popup = {
269
+ /**
270
+ * Get the popup JQuery container
271
+ *
272
+ * @returns {jQuery}
273
+ */
274
+ getPopup: function getPopup() {
275
+ return $element;
276
+ },
277
+ setContent: setContent,
244
278
 
245
- if (options.content) {
246
- setContent(options.content);
247
- }
248
279
  /**
249
- * Set the popup content
250
- * @param {JQuery|String} content
280
+ * Recalculates the position of the popup relative to the anchor
281
+ * Useful after any changes in layout
282
+ *
251
283
  * @returns {undefined}
252
284
  */
285
+ reposition: function reposition() {
286
+ var pos = _computePosition($anchor, $container);
253
287
 
288
+ $element.css({
289
+ top: pos.popup.top,
290
+ left: pos.popup.left
291
+ });
292
+ $element.children('.arrow').css('left', pos.arrow.left);
293
+ $element.children('.arrow-cover').css('left', pos.arrow.leftCover);
294
+ },
254
295
 
255
- function setContent(content) {
256
- if (content instanceof $$1 || _.isString(content)) {
257
- $element.find('.popup-content').empty().append(content);
258
- }
259
- }
260
296
  /**
261
- * Run callback function before action. If returned <i>false</i>, action will not be executed.
262
- * @param {string} name - callback name
263
- * @returns {boolean}
297
+ * Manually triggers "done"
298
+ *
299
+ * @returns {undefined}
264
300
  */
301
+ done: function done() {
302
+ _done($element);
303
+ },
265
304
 
305
+ /**
306
+ * Manually triggers "cancel"
307
+ *
308
+ * @returns {undefined}
309
+ */
310
+ cancel: function cancel() {
311
+ _cancel($element);
312
+ },
266
313
 
267
- function runCallback(name) {
268
- var result = true;
269
-
270
- if (options.callbacks[name] && _.isFunction(options.callbacks[name])) {
271
- result = options.callbacks[name]();
272
- }
314
+ /**
315
+ * Manually triggers "hide"
316
+ *
317
+ * @returns {undefined}
318
+ */
319
+ hide: function hide() {
320
+ _hide($element);
321
+ },
273
322
 
274
- return result;
275
- }
323
+ /**
324
+ * Manually triggers "show"
325
+ *
326
+ * @fires show.contextual-popup
327
+ * @returns {undefined}
328
+ */
329
+ show: function show() {
330
+ $element.show();
331
+ $element.trigger('show' + _ns);
332
+ },
276
333
 
277
- var popup = {
278
- /**
279
- * Get the popup JQuery container
280
- *
281
- * @returns {jQuery}
282
- */
283
- getPopup: function getPopup() {
284
- return $element;
285
- },
286
- setContent: setContent,
287
-
288
- /**
289
- * Recalculates the position of the popup relative to the anchor
290
- * Useful after any changes in layout
291
- *
292
- * @returns {undefined}
293
- */
294
- reposition: function reposition() {
295
- var pos = _computePosition($anchor, $container);
296
-
297
- $element.css({
298
- top: pos.popup.top,
299
- left: pos.popup.left
300
- });
301
- $element.children('.arrow').css('left', pos.arrow.left);
302
- $element.children('.arrow-cover').css('left', pos.arrow.leftCover);
303
- },
304
-
305
- /**
306
- * Manually triggers "done"
307
- *
308
- * @returns {undefined}
309
- */
310
- done: function done() {
311
- _done($element);
312
- },
313
-
314
- /**
315
- * Manually triggers "cancel"
316
- *
317
- * @returns {undefined}
318
- */
319
- cancel: function cancel() {
320
- _cancel($element);
321
- },
322
-
323
- /**
324
- * Manually triggers "hide"
325
- *
326
- * @returns {undefined}
327
- */
328
- hide: function hide() {
329
- _hide($element);
330
- },
331
-
332
- /**
333
- * Manually triggers "show"
334
- *
335
- * @fires show.contextual-popup
336
- * @returns {undefined}
337
- */
338
- show: function show() {
339
- $element.show();
340
- $element.trigger('show' + _ns);
341
- },
342
-
343
- /**
344
- * Manually triggers "destroy"
345
- *
346
- * @fires destroy.contextual-popup
347
- * @returns {undefined}
348
- */
349
- destroy: function destroy() {
350
- if (!destroyed) {
351
- runCallback('beforeDestroy');
352
- destroyed = true;
353
- $element.remove();
354
- $element.trigger('destroy' + _ns);
355
- }
356
- },
357
-
358
- /**
359
- * Tells if the popup is currently hidden or visible
360
- * @returns {boolean}
361
- */
362
- isVisible: function () {
363
- return $element.is(':visible');
334
+ /**
335
+ * Manually triggers "destroy"
336
+ *
337
+ * @fires destroy.contextual-popup
338
+ * @returns {undefined}
339
+ */
340
+ destroy: function destroy() {
341
+ if (!destroyed) {
342
+ runCallback('beforeDestroy');
343
+ destroyed = true;
344
+ $element.remove();
345
+ $element.trigger('destroy' + _ns);
364
346
  }
365
- }; //need to reposition the popup after this has been attached to the dom
366
-
367
- popup.reposition();
368
- return popup;
369
- }
370
- /**
371
- * Hide
372
- *
373
- * @fires hide.contextual-popup
374
- * @param {JQuery} $element
375
- */
376
-
377
-
378
- function _hide($element) {
379
- $element.hide();
380
- $element.trigger('hide' + _ns);
381
- }
382
- /**
383
- * Callback when the "done" button is clicked
384
- *
385
- * @fires done.contextual-popup
386
- * @param {JQuery} $element
387
- */
347
+ },
388
348
 
349
+ /**
350
+ * Tells if the popup is currently hidden or visible
351
+ * @returns {boolean}
352
+ */
353
+ isVisible: function isVisible() {
354
+ return $element.is(':visible');
355
+ }
356
+ }; //need to reposition the popup after this has been attached to the dom
357
+
358
+ popup.reposition();
359
+ return popup;
360
+ }
361
+ /**
362
+ * Hide
363
+ *
364
+ * @fires hide.contextual-popup
365
+ * @param {JQuery} $element
366
+ */
367
+
368
+
369
+ function _hide($element) {
370
+ $element.hide();
371
+ $element.trigger('hide' + _ns);
372
+ }
373
+ /**
374
+ * Callback when the "done" button is clicked
375
+ *
376
+ * @fires done.contextual-popup
377
+ * @param {JQuery} $element
378
+ */
379
+
380
+
381
+ function _done($element) {
382
+ _hide($element);
383
+
384
+ $element.trigger('done' + _ns);
385
+ }
386
+ /**
387
+ * Callback when the "cancel" button is clicked
388
+ *
389
+ * @fires cancel.contextual-popup
390
+ * @param {JQuery} $element
391
+ */
392
+
393
+
394
+ function _cancel($element) {
395
+ _hide($element);
396
+
397
+ $element.trigger('cancel' + _ns);
398
+ }
399
+
400
+ var _styleDefaults = {
401
+ popupWidth: 500,
402
+ arrowWidth: 6,
403
+ marginTop: 15,
404
+ marginLeft: 15
405
+ };
406
+ /**
407
+ * Calculate the position of the popup and arrow relative to the anchor and container elements
408
+ *
409
+ * @param {JQuery} $anchor
410
+ * @param {JQuery} $container
411
+ * @returns {Object} - Object containing the positioning data
412
+ */
413
+
414
+ function _computePosition($anchor, $container) {
415
+ var $contextualPopup = $anchor.children('.contextual-popup');
416
+ var options = $anchor.data('contextual-popup-options');
417
+
418
+ var styleOpts = _.defaults(options.style || {}, _styleDefaults);
419
+
420
+ var popupWidth = styleOpts.popupWidth;
421
+ var popupHeight = $contextualPopup.outerHeight();
422
+ var arrowWidth = styleOpts.arrowWidth;
423
+ var marginTop = styleOpts.marginTop;
424
+ var marginLeft = styleOpts.marginLeft;
425
+ var _anchor = {
426
+ top: $anchor.offset().top,
427
+ left: $anchor.offset().left,
428
+ w: $anchor.innerWidth(),
429
+ h: $anchor.innerHeight()
430
+ };
431
+ var _container = {
432
+ top: $container.offset().top,
433
+ left: $container.offset().left,
434
+ w: $container.innerWidth()
435
+ };
436
+ var _popup = {
437
+ top: _anchor.h + marginTop,
438
+ left: -popupWidth / 2 + _anchor.w / 2,
439
+ w: popupWidth
440
+ };
389
441
 
390
- function _done($element) {
391
- _hide($element);
442
+ switch (options.position) {
443
+ case 'top':
444
+ _popup.top = -marginTop - popupHeight;
445
+ $contextualPopup.removeClass('bottom').addClass('top');
446
+ break;
392
447
 
393
- $element.trigger('done' + _ns);
448
+ case 'bottom':
449
+ _popup.top = _anchor.h + marginTop;
450
+ $contextualPopup.removeClass('top').addClass('bottom');
451
+ break;
394
452
  }
395
- /**
396
- * Callback when the "cancel" button is clicked
397
- *
398
- * @fires cancel.contextual-popup
399
- * @param {JQuery} $element
400
- */
401
453
 
454
+ var offset = _anchor.left - _container.left; //do we have enough space on the left ?
402
455
 
403
- function _cancel($element) {
404
- _hide($element);
405
-
406
- $element.trigger('cancel' + _ns);
456
+ if (offset + marginLeft + _anchor.w / 2 < _popup.w / 2) {
457
+ _popup.left = -offset + marginLeft;
458
+ } else if (_container.w - (offset + _anchor.w / 2 + marginLeft) < _popup.w / 2) {
459
+ _popup.left = -offset + _container.w - marginLeft - _popup.w;
407
460
  }
408
461
 
409
- var _styleDefaults = {
410
- popupWidth: 500,
411
- arrowWidth: 6,
412
- marginTop: 15,
413
- marginLeft: 15
462
+ var _arrow = {
463
+ left: -_popup.left + _anchor.w / 2 - arrowWidth,
464
+ leftCover: -_popup.left + _anchor.w / 2 - arrowWidth - 6
414
465
  };
415
- /**
416
- * Calculate the position of the popup and arrow relative to the anchor and container elements
417
- *
418
- * @param {JQuery} $anchor
419
- * @param {JQuery} $container
420
- * @returns {Object} - Object containing the positioning data
421
- */
422
-
423
- function _computePosition($anchor, $container) {
424
- var $contextualPopup = $anchor.children('.contextual-popup');
425
- var options = $anchor.data('contextual-popup-options');
426
-
427
- var styleOpts = _.defaults(options.style || {}, _styleDefaults);
428
-
429
- var popupWidth = styleOpts.popupWidth;
430
- var popupHeight = $contextualPopup.outerHeight();
431
- var arrowWidth = styleOpts.arrowWidth;
432
- var marginTop = styleOpts.marginTop;
433
- var marginLeft = styleOpts.marginLeft;
434
- var _anchor = {
435
- top: $anchor.offset().top,
436
- left: $anchor.offset().left,
437
- w: $anchor.innerWidth(),
438
- h: $anchor.innerHeight()
439
- };
440
- var _container = {
441
- top: $container.offset().top,
442
- left: $container.offset().left,
443
- w: $container.innerWidth()
444
- };
445
- var _popup = {
446
- top: _anchor.h + marginTop,
447
- left: -popupWidth / 2 + _anchor.w / 2,
448
- w: popupWidth
449
- };
450
-
451
- switch (options.position) {
452
- case 'top':
453
- _popup.top = -marginTop - popupHeight;
454
- $contextualPopup.removeClass('bottom').addClass('top');
455
- break;
456
-
457
- case 'bottom':
458
- _popup.top = _anchor.h + marginTop;
459
- $contextualPopup.removeClass('top').addClass('bottom');
460
- break;
461
- }
462
-
463
- var offset = _anchor.left - _container.left; //do we have enough space on the left ?
464
-
465
- if (offset + marginLeft + _anchor.w / 2 < _popup.w / 2) {
466
- _popup.left = -offset + marginLeft;
467
- } else if (_container.w - (offset + _anchor.w / 2 + marginLeft) < _popup.w / 2) {
468
- _popup.left = -offset + _container.w - marginLeft - _popup.w;
469
- }
470
-
471
- var _arrow = {
472
- left: -_popup.left + _anchor.w / 2 - arrowWidth,
473
- leftCover: -_popup.left + _anchor.w / 2 - arrowWidth - 6
474
- };
475
- return {
476
- popup: _popup,
477
- arrow: _arrow
478
- };
479
- }
466
+ return {
467
+ popup: _popup,
468
+ arrow: _arrow
469
+ };
470
+ }
480
471
 
481
- return create;
472
+ return create;
482
473
 
483
474
  });