ode-ngjs-front 1.4.11 → 1.4.12-develop-integration.202506191529
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.
- package/dist/668.js +21 -0
- package/dist/668.js.map +1 -0
- package/dist/669.js +2 -0
- package/dist/669.js.map +1 -0
- package/dist/ode-ngjs-front.js +4 -4
- package/dist/ode-ngjs-front.js.map +1 -1
- package/dist/ts/directives/business/portal/portal.directive.d.ts.map +1 -1
- package/dist/ts/modules/widgets.module.d.ts +3 -1
- package/dist/ts/modules/widgets.module.d.ts.map +1 -1
- package/dist/ts/services/theme-helper.service.d.ts.map +1 -1
- package/dist/ts/widgets/cantine-widget/cantine-widget.widget.d.ts.map +1 -1
- package/dist/ts/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.d.ts +2 -0
- package/dist/ts/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.d.ts.map +1 -0
- package/dist/ts/widgets/screen-time-widget/screen-time-widget.widget.d.ts +19 -0
- package/dist/ts/widgets/screen-time-widget/screen-time-widget.widget.d.ts.map +1 -0
- package/dist/version.txt +1 -1
- package/dist/widgets/agenda-widget/agenda-widget.widget.js +1 -1
- package/dist/widgets/agenda-widget/agenda-widget.widget.js.map +1 -1
- package/dist/widgets/bookmark-widget/bookmark-widget.widget.js +1 -1
- package/dist/widgets/bookmark-widget/bookmark-widget.widget.js.map +1 -1
- package/dist/widgets/briefme-widget/briefme-widget.widget.js +1 -1
- package/dist/widgets/briefme-widget/briefme-widget.widget.js.map +1 -1
- package/dist/widgets/calendar-widget/calendar-widget.widget.js +1 -1
- package/dist/widgets/calendar-widget/calendar-widget.widget.js.map +1 -1
- package/dist/widgets/cantine-widget/cantine-widget.widget.js +1 -1
- package/dist/widgets/cantine-widget/cantine-widget.widget.js.map +1 -1
- package/dist/widgets/carnet-de-bord/carnet-de-bord.widget.js +1 -1
- package/dist/widgets/carnet-de-bord/carnet-de-bord.widget.js.map +1 -1
- package/dist/widgets/cursus-widget/cursus-widget.widget.js +1 -1
- package/dist/widgets/cursus-widget/cursus-widget.widget.js.map +1 -1
- package/dist/widgets/dicodelazone-widget/dicodelazone-widget.widget.js +1 -1
- package/dist/widgets/dicodelazone-widget/dicodelazone-widget.widget.js.map +1 -1
- package/dist/widgets/edumalin-widget/edumalin-widget.widget.js +1 -1
- package/dist/widgets/edumalin-widget/edumalin-widget.widget.js.map +1 -1
- package/dist/widgets/last-infos-widget/last-infos-widget.widget.js +1 -1
- package/dist/widgets/last-infos-widget/last-infos-widget.widget.js.map +1 -1
- package/dist/widgets/maxicours-widget/maxicours-widget.widget.js +1 -1
- package/dist/widgets/maxicours-widget/maxicours-widget.widget.js.map +1 -1
- package/dist/widgets/mediacentre-widget/mediacentre-widget.widget.js +1 -1
- package/dist/widgets/mediacentre-widget/mediacentre-widget.widget.js.map +1 -1
- package/dist/widgets/my-apps/my-apps.widget.js +1 -1
- package/dist/widgets/my-apps/my-apps.widget.js.map +1 -1
- package/dist/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.js +2 -0
- package/dist/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.js.map +1 -0
- package/dist/widgets/qwant-widget/qwant-widget.widget.js +1 -1
- package/dist/widgets/qwant-widget/qwant-widget.widget.js.map +1 -1
- package/dist/widgets/record-me/record-me.widget.js +1 -1
- package/dist/widgets/record-me/record-me.widget.js.map +1 -1
- package/dist/widgets/rss-widget/rss-widget.widget.js +1 -1
- package/dist/widgets/rss-widget/rss-widget.widget.js.map +1 -1
- package/dist/widgets/school-widget/school-widget.widget.js +1 -1
- package/dist/widgets/school-widget/school-widget.widget.js.map +1 -1
- package/dist/widgets/screen-time-widget/screen-time-widget.widget.js +2 -0
- package/dist/widgets/screen-time-widget/screen-time-widget.widget.js.map +1 -0
- package/dist/widgets/universalis-widget/universalis-widget.widget.js +1 -1
- package/dist/widgets/universalis-widget/universalis-widget.widget.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[536],{5541:(t,e,o)=>{o.d(e,{Z:()=>i});const i='<div class="widget-maxicours"> <div class="widget-header"> <div class="subtitle"><i18n>maxicours-widget.widget.title</i18n></div> <div class="widget-options"> <div class="widget-handle"><i class="fas fa-grip-vertical"></i></div> </div> </div> <div class="widget-body m-3" ng-if="!ctrl.showWidget()" dnd-nodrag> <p> <a data-maxicours-href href="[[ctrl.controllerData.connectorEndpoint]]" target="_blank" rel="noopener" i18n-title="maxicours-widget"> <i class="ic-maxicours"></i> </a> </p> </div> <div class="widget-body p-4" ng-if="ctrl.showWidget()" dnd-nodrag> <i class="ic-maxicours" ng-if="ctrl.controllerData.id < 0"></i> <p ng-if="ctrl.controllerData.id >= 0"> <a data-maxicours-href href="[[ctrl.controllerData.connectorEndpoint]]" target="_blank" rel="noopener" i18n-title="maxicours-widget" ng-if="ctrl.controllerData.id >= 0"> <i class="ic-maxicours"></i> </a> </p> <div ng-if="ctrl.loads"> <div class="widget-empty-message" translate content="loading"></div> </div> <div class="widget-empty-message" ng-if="!ctrl.loads && (!ctrl.controllerData.id || ctrl.controllerData.id < 0)"> <i18n>maxicours-widget.widget.inactive.user</i18n> <form class="mt-3" data-maxicours-action method="get"> <button class="btn btn-primary" ng-click="ctrl.initAuthProcess()" formtarget="_blank" rel="noopener" translate content="maxicours-widget.widget.connect"></button> </form> </div> <div ng-if="!ctrl.loads && ctrl.controllerData.id >= 0"> <div> <i18n>maxicours-widget.widget.my.points</i18n> : <span>[[ ctrl.controllerData.userInfo.activityScore ]]</span> </div> <div> <div ng-if="ctrl.controllerData.userInfo.hasSessionOfTheDay" class="mt-4"> <h4><a ng-href="[[ctrl.controllerData.userInfo.sessionOfTheDayUrl]]" target="_blank" rel="noopener"><i18n>maxicours-widget.widget.daily.session</i18n></a></h4> <ul ng-if="ctrl.controllerData.userInfo.hasSessionOfTheDay === \'true\'"> <li class="activity row border-top py-3 mx-1 align-items-center" ng-repeat="activity in ctrl.controllerData.userInfo.sessionOfTheDayActivities"> <div class="col-auto"> <img class="picto" ng-src="[[activity.picto]]"> </div> <div class="col-auto"> <strong>[[activity.title]]</strong> <p class="mb-0">[[activity.label]]</p> </div> </li> </ul> </div> <div ng-if="ctrl.controllerData.userInfo.newPersonnalCourses.length > 0"> <h4><i18n>maxicours-widget.widget.my.courses<i18n></i18n></i18n></h4> <ul> <li ng-repeat="course in ctrl.controllerData.userInfo.newPersonnalCourses"> <b> <a ng-href="[[course.url]]" target="_blank" rel="noopener">[[course.label]] ([[course.date]])</a> </b> </li> <li ng-repeat="course in ctrl.controllerData.userInfo.currentPersonnalCourses"> <a ng-href="[[course.url]]" target="_blank" rel="noopener">[[course.label]] ([[course.date]])</a> </li> </ul> </div> </div> </div> </div> </div>'},3132:function(t,e,o){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.odeModuleName=void 0;var r=i(o(4202)),n=o(9419),a=i(o(3336)),s=function(){function t(){this.controllerData={},this.loads=!1}return Object.defineProperty(t.prototype,"version",{get:function(){return(0,n.conf)().Platform.deploymentTag},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"me",{get:function(){return(0,n.session)().user},enumerable:!1,configurable:!0}),t.prototype.showWidget=function(){return"ELEVE"===this.me.type},t.prototype.loading=function(t){this.loads=t,this.apply&&this.apply()},t.prototype.authProcess=function(t){var e=this;this.getUserStatus().then(
|
|
1
|
+
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[536],{5541:(t,e,o)=>{o.d(e,{Z:()=>i});const i='<div class="widget-maxicours"> <div class="widget-header"> <div class="subtitle"><i18n>maxicours-widget.widget.title</i18n></div> <div class="widget-options"> <div class="widget-handle"><i class="fas fa-grip-vertical"></i></div> </div> </div> <div class="widget-body m-3" ng-if="!ctrl.showWidget()" dnd-nodrag> <p> <a data-maxicours-href href="[[ctrl.controllerData.connectorEndpoint]]" target="_blank" rel="noopener" i18n-title="maxicours-widget"> <i class="ic-maxicours"></i> </a> </p> </div> <div class="widget-body p-4" ng-if="ctrl.showWidget()" dnd-nodrag> <i class="ic-maxicours" ng-if="ctrl.controllerData.id < 0"></i> <p ng-if="ctrl.controllerData.id >= 0"> <a data-maxicours-href href="[[ctrl.controllerData.connectorEndpoint]]" target="_blank" rel="noopener" i18n-title="maxicours-widget" ng-if="ctrl.controllerData.id >= 0"> <i class="ic-maxicours"></i> </a> </p> <div ng-if="ctrl.loads"> <div class="widget-empty-message" translate content="loading"></div> </div> <div class="widget-empty-message" ng-if="!ctrl.loads && (!ctrl.controllerData.id || ctrl.controllerData.id < 0)"> <i18n>maxicours-widget.widget.inactive.user</i18n> <form class="mt-3" data-maxicours-action method="get"> <button class="btn btn-primary" ng-click="ctrl.initAuthProcess()" formtarget="_blank" rel="noopener" translate content="maxicours-widget.widget.connect"></button> </form> </div> <div ng-if="!ctrl.loads && ctrl.controllerData.id >= 0"> <div> <i18n>maxicours-widget.widget.my.points</i18n> : <span>[[ ctrl.controllerData.userInfo.activityScore ]]</span> </div> <div> <div ng-if="ctrl.controllerData.userInfo.hasSessionOfTheDay" class="mt-4"> <h4><a ng-href="[[ctrl.controllerData.userInfo.sessionOfTheDayUrl]]" target="_blank" rel="noopener"><i18n>maxicours-widget.widget.daily.session</i18n></a></h4> <ul ng-if="ctrl.controllerData.userInfo.hasSessionOfTheDay === \'true\'"> <li class="activity row border-top py-3 mx-1 align-items-center" ng-repeat="activity in ctrl.controllerData.userInfo.sessionOfTheDayActivities"> <div class="col-auto"> <img class="picto" ng-src="[[activity.picto]]"> </div> <div class="col-auto"> <strong>[[activity.title]]</strong> <p class="mb-0">[[activity.label]]</p> </div> </li> </ul> </div> <div ng-if="ctrl.controllerData.userInfo.newPersonnalCourses.length > 0"> <h4><i18n>maxicours-widget.widget.my.courses<i18n></i18n></i18n></h4> <ul> <li ng-repeat="course in ctrl.controllerData.userInfo.newPersonnalCourses"> <b> <a ng-href="[[course.url]]" target="_blank" rel="noopener">[[course.label]] ([[course.date]])</a> </b> </li> <li ng-repeat="course in ctrl.controllerData.userInfo.currentPersonnalCourses"> <a ng-href="[[course.url]]" target="_blank" rel="noopener">[[course.label]] ([[course.date]])</a> </li> </ul> </div> </div> </div> </div> </div>'},3132:function(t,e,o){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.odeModuleName=void 0;var r=i(o(4202)),n=o(9419),a=i(o(3336)),s=function(){function t(){this.controllerData={},this.loads=!1}return Object.defineProperty(t.prototype,"version",{get:function(){return(0,n.conf)().Platform.deploymentTag},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"me",{get:function(){return(0,n.session)().user},enumerable:!1,configurable:!0}),t.prototype.showWidget=function(){return"ELEVE"===this.me.type},t.prototype.loading=function(t){this.loads=t,this.apply&&this.apply()},t.prototype.authProcess=function(t){var e=this;this.getUserStatus().then(function(){return e.getUserInfo(t)})},t.prototype.initAuthProcess=function(){var t=this,e=5;this.loading(!0);var o=function(){t.controllerData.id<0&&e-- >0?(t.authProcess(),setTimeout(o,2e3)):t.loading(!1)};setTimeout(o,2e3)},t.prototype.getConf=function(){var t=this;return(0,n.http)().get("/maxicours/conf",{queryParams:{_:this.version}}).then(function(e){if(200!==(0,n.http)().latestResponse.status)throw"Cannot get maxicours widget configuration.";Object.assign(t.controllerData,e),t.controllerData.connectorEndpoint&&((0,a.default)("[data-maxicours-action]").attr("action",t.controllerData.connectorEndpoint),(0,a.default)("[data-maxicours-href]").attr("href",t.controllerData.connectorEndpoint))}).catch(function(){console.log("HTTP error on /maxicours/conf. aide-aux-devoirs widget will not load.")})},t.prototype.getUserStatus=function(){var t=this;return(0,n.http)().get("/maxicours/getUserStatus",{queryParams:{_:this.version}}).then(function(e){if(200!==(0,n.http)().latestResponse.status)throw"Cannot get maxicours user status.";var o=a.default.parseXML(e),i=(0,a.default)(o);t.controllerData.id=i.find("mxcId").text(),t.apply&&t.apply()}).catch(function(){console.log("HTTP error on /maxicours/getUserStatus. aide-aux-devoirs widget will not load.")})},t.prototype.getUserInfo=function(t){var e=this;if(void 0===this.controllerData.id||"string"==typeof this.controllerData.id&&0===this.controllerData.id.trim().length||this.controllerData.id<0)return"function"==typeof t&&t(),Promise.resolve();(0,n.http)().get("/maxicours/getUserInfo/"+this.controllerData.id).then(function(t){if(200!==(0,n.http)().latestResponse.status)throw"Cannot get maxicours user info.";try{var o=a.default.parseXML(t),i=(0,a.default)(o),r=function(t,e,o){return(o?t.find(o).find(e):t.find(e)).text()},s=function(t){return(0,a.default)(t).children().toArray().map(function(t){for(var e={},o=(0,a.default)(t).children(),i=0;i<o.length;i++)e[o[i].nodeName]=o[i].textContent;return e})};e.controllerData.userInfo={hasAnActiveAccount:r(i,"hasAnActiveAccount"),activityScore:r(i,"activityScore"),hasSessionOfTheDay:r(i,"hasSessionOfTheDay"),sessionOfTheDayUrl:r(i,"sessionOfTheDayUrl"),sessionOfTheDayActivities:s(i.find("sessionOfTheDayActivities")),hasPersonnalCourses:r(i,"hasPersonnalCourses"),newPersonnalCourses:s(i.find("newPersonnalCourses")),currentPersonnalCourses:s(i.find("currentPersonnalCourses"))},e.apply&&e.apply()}catch(t){console.log("Cannot parse maxicours user info.")}}).finally(function(){"function"==typeof t&&t()})},t}(),c=function(){function t(){this.restrict="E",this.template=o(5541).Z,this.controller=[s],this.controllerAs="ctrl",this.require=["odeMaxicoursWidget"]}return t.prototype.link=function(t,e,o,i){var r=i?i[0]:null;r&&(r.apply=function(){t.$apply()},r.getConf().then(function(){return r.authProcess(function(){r.loading(!1),r.apply&&r.apply()})}))},t}();(0,n.notif)().onLangReady().promise.then(function(t){(0,n.conf)().Platform.idiom.addKeys(o(841))}),e.odeModuleName="odeMaxicoursWidgetModule",r.default.module(e.odeModuleName,[]).directive("odeMaxicoursWidget",function(){return new c})},841:t=>{t.exports=JSON.parse('{"maxicours-widget":"Aide aux devoirs","maxicours-widget.widget.title":"Aide aux devoirs","maxicours-widget.widget.inactive.user":"Vous n\'êtes pas authentifié sur le service.","maxicours-widget.widget.connect":"Activer mon compte","maxicours-widget.widget.refresh":"Rafraîchir les informations","maxicours-widget.widget.my.points":"Mes points","maxicours-widget.widget.points":"pts","maxicours-widget.widget.daily.session":"Ma séance du jour","maxicours-widget.widget.my.courses":"Mes parcours à réaliser"}')}}]);
|
|
2
2
|
//# sourceMappingURL=maxicours-widget.widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgets/maxicours-widget/maxicours-widget.widget.js","mappings":"gIAGA,QAFW,6tF,mLCDX,iBAEA,UACA,aAGA,0BAGI,KAAAA,eAaI,CAAC,EACL,KAAAC,OAAgB,CAkIpB,QAhII,sBAAY,sBAAO,C,IAAnB,WACI,OAAO,IAAAC,QAAOC,SAASC,aAC3B,E,gCACA,sBAAY,iBAAE,C,IAAd,WACI,OAAO,IAAAC,WAAUC,IACrB,E,gCAEA,YAAAC,WAAA,WACI,MAAwB,UAAjBC,KAAKC,GAAGC,IACnB,EAEA,YAAAC,QAAA,SAAQC,GACJJ,KAAKP,MAAQW,EACbJ,KAAKK,OAASL,KAAKK,OACvB,EAEA,YAAAC,YAAA,SAAYC,GAAZ,WACIP,KAAKQ,gBAAgBC,MAAM,WAAM,SAAKC,YAAYH,EAAjB,GACrC,EAEA,YAAAI,gBAAA,sBAEQC,EAAY,EAChBZ,KAAKG,SAAQ,GACb,IAAMU,EAAkB,WAChB,EAAKrB,eAAesB,GAAK,GAAKF,KAAc,GAC5C,EAAKN,cACLS,WAAWF,EANL,MAQN,EAAKV,SAAQ,EAErB,EACAY,WAAWF,EAXG,IAYlB,EAEA,YAAAG,QAAA,sBACI,OAAO,IAAAC,QAAOC,IAAI,kBAAmB,CAAEC,YAAa,CAAE,EAAKnB,KAAKoB,WAC/DX,MAAM,SAAAY,GACH,GAAqC,OAAjC,IAAAJ,QAAOK,eAAeC,OACtB,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widget/maxicours-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/maxicours-widget/maxicours-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \"<div class=\\\"widget-maxicours\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"><i18n>maxicours-widget.widget.title</i18n></div> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\"><i class=\\\"fas fa-grip-vertical\\\"></i></div> </div> </div> <div class=\\\"widget-body m-3\\\" ng-if=\\\"!ctrl.showWidget()\\\" dnd-nodrag> <p> <a data-maxicours-href href=\\\"[[ctrl.controllerData.connectorEndpoint]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" i18n-title=\\\"maxicours-widget\\\"> <i class=\\\"ic-maxicours\\\"></i> </a> </p> </div> <div class=\\\"widget-body p-4\\\" ng-if=\\\"ctrl.showWidget()\\\" dnd-nodrag> <i class=\\\"ic-maxicours\\\" ng-if=\\\"ctrl.controllerData.id < 0\\\"></i> <p ng-if=\\\"ctrl.controllerData.id >= 0\\\"> <a data-maxicours-href href=\\\"[[ctrl.controllerData.connectorEndpoint]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" i18n-title=\\\"maxicours-widget\\\" ng-if=\\\"ctrl.controllerData.id >= 0\\\"> <i class=\\\"ic-maxicours\\\"></i> </a> </p> <div ng-if=\\\"ctrl.loads\\\"> <div class=\\\"widget-empty-message\\\" translate content=\\\"loading\\\"></div> </div> <div class=\\\"widget-empty-message\\\" ng-if=\\\"!ctrl.loads && (!ctrl.controllerData.id || ctrl.controllerData.id < 0)\\\"> <i18n>maxicours-widget.widget.inactive.user</i18n> <form class=\\\"mt-3\\\" data-maxicours-action method=\\\"get\\\"> <button class=\\\"btn btn-primary\\\" ng-click=\\\"ctrl.initAuthProcess()\\\" formtarget=\\\"_blank\\\" rel=\\\"noopener\\\" translate content=\\\"maxicours-widget.widget.connect\\\"></button> </form> </div> <div ng-if=\\\"!ctrl.loads && ctrl.controllerData.id >= 0\\\"> <div> <i18n>maxicours-widget.widget.my.points</i18n> : <span>[[ ctrl.controllerData.userInfo.activityScore ]]</span> </div> <div> <div ng-if=\\\"ctrl.controllerData.userInfo.hasSessionOfTheDay\\\" class=\\\"mt-4\\\"> <h4><a ng-href=\\\"[[ctrl.controllerData.userInfo.sessionOfTheDayUrl]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\"><i18n>maxicours-widget.widget.daily.session</i18n></a></h4> <ul ng-if=\\\"ctrl.controllerData.userInfo.hasSessionOfTheDay === 'true'\\\"> <li class=\\\"activity row border-top py-3 mx-1 align-items-center\\\" ng-repeat=\\\"activity in ctrl.controllerData.userInfo.sessionOfTheDayActivities\\\"> <div class=\\\"col-auto\\\"> <img class=\\\"picto\\\" ng-src=\\\"[[activity.picto]]\\\"> </div> <div class=\\\"col-auto\\\"> <strong>[[activity.title]]</strong> <p class=\\\"mb-0\\\">[[activity.label]]</p> </div> </li> </ul> </div> <div ng-if=\\\"ctrl.controllerData.userInfo.newPersonnalCourses.length > 0\\\"> <h4><i18n>maxicours-widget.widget.my.courses<i18n></i18n></i18n></h4> <ul> <li ng-repeat=\\\"course in ctrl.controllerData.userInfo.newPersonnalCourses\\\"> <b> <a ng-href=\\\"[[course.url]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">[[course.label]] ([[course.date]])</a> </b> </li> <li ng-repeat=\\\"course in ctrl.controllerData.userInfo.currentPersonnalCourses\\\"> <a ng-href=\\\"[[course.url]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">[[course.label]] ([[course.date]])</a> </li> </ul> </div> </div> </div> </div> </div>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { IUserInfo } from \"ode-ts-client\";\nimport { conf, notif, session, http } from \"../../utils\";\nimport $ from \"jquery\"; // FIXME : remove jQuery dependency \n\n/* Controller for the directive */\nclass Controller implements IController {\n // Shortcut for refreshing the view.\n public apply?: () => void;\n controllerData:{\n id?:any;\n connectorEndpoint?:string;\n userInfo?:{\n hasAnActiveAccount: string;\n activityScore: string;\n hasSessionOfTheDay: string;\n sessionOfTheDayUrl: string;\n sessionOfTheDayActivities: Array<any|string>;\n hasPersonnalCourses: string;\n newPersonnalCourses: Array<any|string>;\n currentPersonnalCourses: Array<any|string>;\n };\n } = {};\n loads:boolean = false;\n\n private get version(): string {\n return conf().Platform.deploymentTag;\n }\n private get me(): IUserInfo {\n return session().user;\n }\n\n showWidget() {\n return this.me.type === 'ELEVE';\n }\n\n loading(mode:boolean) {\n this.loads = mode;\n this.apply && this.apply();\n }\n\n authProcess(hook?: any) {\n this.getUserStatus().then( () => this.getUserInfo(hook) );\n }\n\n initAuthProcess() {\n const delay = 2000;\n let countdown = 5;\n this.loading(true);\n const timeoutFunction = () => {\n if (this.controllerData.id < 0 && countdown-- > 0) {\n this.authProcess();\n setTimeout(timeoutFunction, delay);\n } else {\n this.loading(false);\n }\n }\n setTimeout(timeoutFunction, delay);\n }\n\n getConf() {\n return http().get('/maxicours/conf', { queryParams: { \"_\": this.version } })\n .then( data => {\n if( http().latestResponse.status !== 200 ) {\n throw \"Cannot get maxicours widget configuration.\";\n }\n Object.assign( this.controllerData, data );\n if( this.controllerData.connectorEndpoint ) {\n $(\"[data-maxicours-action]\").attr(\"action\", this.controllerData.connectorEndpoint );\n $(\"[data-maxicours-href]\").attr(\"href\", this.controllerData.connectorEndpoint );\n }\n })\n .catch( () => {\n console.log('HTTP error on /maxicours/conf. aide-aux-devoirs widget will not load.');\n });\n }\n\n getUserStatus() {\n return http().get<string>('/maxicours/getUserStatus', { queryParams: { \"_\": this.version } })\n .then( xml => {\n if( http().latestResponse.status !== 200 ) {\n throw \"Cannot get maxicours user status.\";\n }\n const xmlDocument = $.parseXML(xml);\n const $xml = $(xmlDocument);\n\n this.controllerData.id = $xml.find(\"mxcId\").text()\n this.apply && this.apply();\n })\n .catch( () => {\n console.log('HTTP error on /maxicours/getUserStatus. aide-aux-devoirs widget will not load.');\n });\n }\n\n getUserInfo(hook?:any) {\n if (typeof this.controllerData.id === \"undefined\"\n || (typeof this.controllerData.id === \"string\" && this.controllerData.id.trim().length === 0)\n || this.controllerData.id < 0) {\n if (typeof hook === 'function')\n hook();\n return Promise.resolve();\n }\n\n http().get<string>('/maxicours/getUserInfo/' + this.controllerData.id)\n .then( xml => {\n if( http().latestResponse.status !== 200 ) {\n throw \"Cannot get maxicours user info.\";\n }\n try {\n const xmlDocument = $.parseXML(xml);\n const $xml = $(xmlDocument);\n\n let getText = function (xml:JQuery<XMLDocument>, tagName:string, parent?:string) {\n const tags = parent ? xml.find(parent).find(tagName) : xml.find(tagName)\n return tags.text()\n }\n let getContent = function (xml:JQuery<XMLDocument>, tagName:string, parent?:string) {\n const tags = parent ? xml.find(parent).find(tagName) : xml.find(tagName)\n return tags.contents()\n }\n let jsonifyArray = function(arrayTag:JQuery<HTMLElement>) {\n return $(arrayTag).children().toArray().map( item => {\n let serialized:any = {};\n const children = $(item).children();\n for (let i = 0; i < children.length; i++) {\n serialized[children[i].nodeName] = children[i].textContent;\n }\n return serialized;\n });\n }\n\n this.controllerData.userInfo = {\n hasAnActiveAccount: getText($xml, \"hasAnActiveAccount\"),\n activityScore: getText($xml, \"activityScore\"),\n hasSessionOfTheDay: getText($xml, \"hasSessionOfTheDay\"),\n sessionOfTheDayUrl: getText($xml, \"sessionOfTheDayUrl\"),\n sessionOfTheDayActivities: jsonifyArray($xml.find(\"sessionOfTheDayActivities\")),\n hasPersonnalCourses: getText($xml, \"hasPersonnalCourses\"),\n newPersonnalCourses: jsonifyArray($xml.find(\"newPersonnalCourses\")),\n currentPersonnalCourses: jsonifyArray($xml.find(\"currentPersonnalCourses\"))\n }\n\n this.apply && this.apply();\n } catch (e) {\n console.log(\"Cannot parse maxicours user info.\");\n }\n })\n .finally( () => {\n if (typeof hook === 'function')\n hook();\n });\n }\n\n}\n\n/* Directive */\nclass Directive implements IDirective<IScope, JQLite, IAttributes, IController[]> {\n restrict = 'E';\n template = require('./maxicours-widget.widget.html').default;\n controller = [Controller];\n controllerAs = 'ctrl';\n require = ['odeMaxicoursWidget'];\n\n link(scope: IScope, elem: JQLite, attrs: IAttributes, controllers?: IController[]): void {\n const ctrl: Controller | null = controllers ? controllers[0] as Controller : null;\n if (!ctrl) return;\n\n ctrl.apply = () => {\n scope.$apply();\n };\n\n ctrl.getConf()\n .then( () => ctrl.authProcess( () => {\n ctrl.loading( false );\n ctrl.apply && ctrl.apply();\n }));\n }\n}\n\n/** The maxicours-widget widget. */\nfunction DirectiveFactory() {\n return new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then(lang => {\n switch (lang) {\n default: conf().Platform.idiom.addKeys(require('./i18n/fr.json')); break;\n }\n});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odeMaxicoursWidgetModule\";\nangular.module(odeModuleName, []).directive(\"odeMaxicoursWidget\", DirectiveFactory);\n"],"names":["controllerData","loads","conf","Platform","deploymentTag","session","user","showWidget","this","me","type","loading","mode","apply","authProcess","hook","getUserStatus","then","getUserInfo","initAuthProcess","countdown","timeoutFunction","id","setTimeout","getConf","http","get","queryParams","version","data","latestResponse","status","Object","assign","connectorEndpoint","attr","catch","console","log","xml","xmlDocument","parseXML","$xml","find","text","trim","length","Promise","resolve","getText","tagName","parent","jsonifyArray","arrayTag","children","toArray","map","item","serialized","i","nodeName","textContent","userInfo","hasAnActiveAccount","activityScore","hasSessionOfTheDay","sessionOfTheDayUrl","sessionOfTheDayActivities","hasPersonnalCourses","newPersonnalCourses","currentPersonnalCourses","e","finally","restrict","template","controller","Controller","controllerAs","require","link","scope","elem","attrs","controllers","ctrl","$apply","notif","onLangReady","promise","lang","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"widgets/maxicours-widget/maxicours-widget.widget.js","mappings":"gIAGA,QAFW,6t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B,wBAAyBlB,EAAaV,EAAKC,KAAK,6BAGpD,EAAK9B,OAAS,EAAKA,O,CACrB,MAAO0D,GACLlC,QAAQC,IAAI,oC,CAEpB,GACCkC,QAAS,WACc,mBAATzD,GACPA,GACR,EACJ,EAEJ,EAnJA,GAsJA,0BACI,KAAA0D,SAAW,IACX,KAAAC,SAAW,UACX,KAAAC,WAAa,CAACC,GACd,KAAAC,aAAe,OACf,KAAAC,QAAU,CAAC,qBAgBf,QAdI,YAAAC,KAAA,SAAKC,EAAeC,EAAcC,EAAoBC,GAClD,IAAMC,EAA0BD,EAAcA,EAAY,GAAmB,KACxEC,IAELA,EAAKvE,MAAQ,WACTmE,EAAMK,QACV,EAEAD,EAAK5D,UACJP,KAAM,WAAM,OAAAmE,EAAKtE,YAAa,WAC3BsE,EAAKzE,SAAS,GACdyE,EAAKvE,OAASuE,EAAKvE,OACvB,EAHa,GAIjB,EACJ,EArBA,IA6BA,IAAAyE,SAAQC,cAAcC,QAAQvE,KAAK,SAAAwE,IAElB,IAAAvF,QAAOC,SAASuF,MAAMC,QAAQ,EAAQ,KAEvD,GAIa,EAAAC,cAAgB,2BAC7B,UAAQC,OAAO,EAAAD,cAAe,IAAIE,UAAU,qBAd5C,WACI,OAAO,IAAIC,CACf,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/maxicours-widget/maxicours-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/maxicours-widget/maxicours-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \"<div class=\\\"widget-maxicours\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"><i18n>maxicours-widget.widget.title</i18n></div> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\"><i class=\\\"fas fa-grip-vertical\\\"></i></div> </div> </div> <div class=\\\"widget-body m-3\\\" ng-if=\\\"!ctrl.showWidget()\\\" dnd-nodrag> <p> <a data-maxicours-href href=\\\"[[ctrl.controllerData.connectorEndpoint]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" i18n-title=\\\"maxicours-widget\\\"> <i class=\\\"ic-maxicours\\\"></i> </a> </p> </div> <div class=\\\"widget-body p-4\\\" ng-if=\\\"ctrl.showWidget()\\\" dnd-nodrag> <i class=\\\"ic-maxicours\\\" ng-if=\\\"ctrl.controllerData.id < 0\\\"></i> <p ng-if=\\\"ctrl.controllerData.id >= 0\\\"> <a data-maxicours-href href=\\\"[[ctrl.controllerData.connectorEndpoint]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" i18n-title=\\\"maxicours-widget\\\" ng-if=\\\"ctrl.controllerData.id >= 0\\\"> <i class=\\\"ic-maxicours\\\"></i> </a> </p> <div ng-if=\\\"ctrl.loads\\\"> <div class=\\\"widget-empty-message\\\" translate content=\\\"loading\\\"></div> </div> <div class=\\\"widget-empty-message\\\" ng-if=\\\"!ctrl.loads && (!ctrl.controllerData.id || ctrl.controllerData.id < 0)\\\"> <i18n>maxicours-widget.widget.inactive.user</i18n> <form class=\\\"mt-3\\\" data-maxicours-action method=\\\"get\\\"> <button class=\\\"btn btn-primary\\\" ng-click=\\\"ctrl.initAuthProcess()\\\" formtarget=\\\"_blank\\\" rel=\\\"noopener\\\" translate content=\\\"maxicours-widget.widget.connect\\\"></button> </form> </div> <div ng-if=\\\"!ctrl.loads && ctrl.controllerData.id >= 0\\\"> <div> <i18n>maxicours-widget.widget.my.points</i18n> : <span>[[ ctrl.controllerData.userInfo.activityScore ]]</span> </div> <div> <div ng-if=\\\"ctrl.controllerData.userInfo.hasSessionOfTheDay\\\" class=\\\"mt-4\\\"> <h4><a ng-href=\\\"[[ctrl.controllerData.userInfo.sessionOfTheDayUrl]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\"><i18n>maxicours-widget.widget.daily.session</i18n></a></h4> <ul ng-if=\\\"ctrl.controllerData.userInfo.hasSessionOfTheDay === 'true'\\\"> <li class=\\\"activity row border-top py-3 mx-1 align-items-center\\\" ng-repeat=\\\"activity in ctrl.controllerData.userInfo.sessionOfTheDayActivities\\\"> <div class=\\\"col-auto\\\"> <img class=\\\"picto\\\" ng-src=\\\"[[activity.picto]]\\\"> </div> <div class=\\\"col-auto\\\"> <strong>[[activity.title]]</strong> <p class=\\\"mb-0\\\">[[activity.label]]</p> </div> </li> </ul> </div> <div ng-if=\\\"ctrl.controllerData.userInfo.newPersonnalCourses.length > 0\\\"> <h4><i18n>maxicours-widget.widget.my.courses<i18n></i18n></i18n></h4> <ul> <li ng-repeat=\\\"course in ctrl.controllerData.userInfo.newPersonnalCourses\\\"> <b> <a ng-href=\\\"[[course.url]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">[[course.label]] ([[course.date]])</a> </b> </li> <li ng-repeat=\\\"course in ctrl.controllerData.userInfo.currentPersonnalCourses\\\"> <a ng-href=\\\"[[course.url]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\">[[course.label]] ([[course.date]])</a> </li> </ul> </div> </div> </div> </div> </div>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { IUserInfo } from \"ode-ts-client\";\nimport { conf, notif, session, http } from \"../../utils\";\nimport $ from \"jquery\"; // FIXME : remove jQuery dependency \n\n/* Controller for the directive */\nclass Controller implements IController {\n // Shortcut for refreshing the view.\n public apply?: () => void;\n controllerData:{\n id?:any;\n connectorEndpoint?:string;\n userInfo?:{\n hasAnActiveAccount: string;\n activityScore: string;\n hasSessionOfTheDay: string;\n sessionOfTheDayUrl: string;\n sessionOfTheDayActivities: Array<any|string>;\n hasPersonnalCourses: string;\n newPersonnalCourses: Array<any|string>;\n currentPersonnalCourses: Array<any|string>;\n };\n } = {};\n loads:boolean = false;\n\n private get version(): string {\n return conf().Platform.deploymentTag;\n }\n private get me(): IUserInfo {\n return session().user;\n }\n\n showWidget() {\n return this.me.type === 'ELEVE';\n }\n\n loading(mode:boolean) {\n this.loads = mode;\n this.apply && this.apply();\n }\n\n authProcess(hook?: any) {\n this.getUserStatus().then( () => this.getUserInfo(hook) );\n }\n\n initAuthProcess() {\n const delay = 2000;\n let countdown = 5;\n this.loading(true);\n const timeoutFunction = () => {\n if (this.controllerData.id < 0 && countdown-- > 0) {\n this.authProcess();\n setTimeout(timeoutFunction, delay);\n } else {\n this.loading(false);\n }\n }\n setTimeout(timeoutFunction, delay);\n }\n\n getConf() {\n return http().get('/maxicours/conf', { queryParams: { \"_\": this.version } })\n .then( data => {\n if( http().latestResponse.status !== 200 ) {\n throw \"Cannot get maxicours widget configuration.\";\n }\n Object.assign( this.controllerData, data );\n if( this.controllerData.connectorEndpoint ) {\n $(\"[data-maxicours-action]\").attr(\"action\", this.controllerData.connectorEndpoint );\n $(\"[data-maxicours-href]\").attr(\"href\", this.controllerData.connectorEndpoint );\n }\n })\n .catch( () => {\n console.log('HTTP error on /maxicours/conf. aide-aux-devoirs widget will not load.');\n });\n }\n\n getUserStatus() {\n return http().get<string>('/maxicours/getUserStatus', { queryParams: { \"_\": this.version } })\n .then( xml => {\n if( http().latestResponse.status !== 200 ) {\n throw \"Cannot get maxicours user status.\";\n }\n const xmlDocument = $.parseXML(xml);\n const $xml = $(xmlDocument);\n\n this.controllerData.id = $xml.find(\"mxcId\").text()\n this.apply && this.apply();\n })\n .catch( () => {\n console.log('HTTP error on /maxicours/getUserStatus. aide-aux-devoirs widget will not load.');\n });\n }\n\n getUserInfo(hook?:any) {\n if (typeof this.controllerData.id === \"undefined\"\n || (typeof this.controllerData.id === \"string\" && this.controllerData.id.trim().length === 0)\n || this.controllerData.id < 0) {\n if (typeof hook === 'function')\n hook();\n return Promise.resolve();\n }\n\n http().get<string>('/maxicours/getUserInfo/' + this.controllerData.id)\n .then( xml => {\n if( http().latestResponse.status !== 200 ) {\n throw \"Cannot get maxicours user info.\";\n }\n try {\n const xmlDocument = $.parseXML(xml);\n const $xml = $(xmlDocument);\n\n let getText = function (xml:JQuery<XMLDocument>, tagName:string, parent?:string) {\n const tags = parent ? xml.find(parent).find(tagName) : xml.find(tagName)\n return tags.text()\n }\n let getContent = function (xml:JQuery<XMLDocument>, tagName:string, parent?:string) {\n const tags = parent ? xml.find(parent).find(tagName) : xml.find(tagName)\n return tags.contents()\n }\n let jsonifyArray = function(arrayTag:JQuery<HTMLElement>) {\n return $(arrayTag).children().toArray().map( item => {\n let serialized:any = {};\n const children = $(item).children();\n for (let i = 0; i < children.length; i++) {\n serialized[children[i].nodeName] = children[i].textContent;\n }\n return serialized;\n });\n }\n\n this.controllerData.userInfo = {\n hasAnActiveAccount: getText($xml, \"hasAnActiveAccount\"),\n activityScore: getText($xml, \"activityScore\"),\n hasSessionOfTheDay: getText($xml, \"hasSessionOfTheDay\"),\n sessionOfTheDayUrl: getText($xml, \"sessionOfTheDayUrl\"),\n sessionOfTheDayActivities: jsonifyArray($xml.find(\"sessionOfTheDayActivities\")),\n hasPersonnalCourses: getText($xml, \"hasPersonnalCourses\"),\n newPersonnalCourses: jsonifyArray($xml.find(\"newPersonnalCourses\")),\n currentPersonnalCourses: jsonifyArray($xml.find(\"currentPersonnalCourses\"))\n }\n\n this.apply && this.apply();\n } catch (e) {\n console.log(\"Cannot parse maxicours user info.\");\n }\n })\n .finally( () => {\n if (typeof hook === 'function')\n hook();\n });\n }\n\n}\n\n/* Directive */\nclass Directive implements IDirective<IScope, JQLite, IAttributes, IController[]> {\n restrict = 'E';\n template = require('./maxicours-widget.widget.html').default;\n controller = [Controller];\n controllerAs = 'ctrl';\n require = ['odeMaxicoursWidget'];\n\n link(scope: IScope, elem: JQLite, attrs: IAttributes, controllers?: IController[]): void {\n const ctrl: Controller | null = controllers ? controllers[0] as Controller : null;\n if (!ctrl) return;\n\n ctrl.apply = () => {\n scope.$apply();\n };\n\n ctrl.getConf()\n .then( () => ctrl.authProcess( () => {\n ctrl.loading( false );\n ctrl.apply && ctrl.apply();\n }));\n }\n}\n\n/** The maxicours-widget widget. */\nfunction DirectiveFactory() {\n return new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then(lang => {\n switch (lang) {\n default: conf().Platform.idiom.addKeys(require('./i18n/fr.json')); break;\n }\n});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odeMaxicoursWidgetModule\";\nangular.module(odeModuleName, []).directive(\"odeMaxicoursWidget\", DirectiveFactory);\n"],"names":["controllerData","loads","conf","Platform","deploymentTag","session","user","showWidget","this","me","type","loading","mode","apply","authProcess","hook","getUserStatus","then","getUserInfo","initAuthProcess","countdown","timeoutFunction","id","setTimeout","getConf","http","get","queryParams","version","data","latestResponse","status","Object","assign","connectorEndpoint","attr","catch","console","log","xml","xmlDocument","parseXML","$xml","find","text","trim","length","Promise","resolve","getText","tagName","parent","jsonifyArray","arrayTag","children","toArray","map","item","serialized","i","nodeName","textContent","userInfo","hasAnActiveAccount","activityScore","hasSessionOfTheDay","sessionOfTheDayUrl","sessionOfTheDayActivities","hasPersonnalCourses","newPersonnalCourses","currentPersonnalCourses","e","finally","restrict","template","controller","Controller","controllerAs","require","link","scope","elem","attrs","controllers","ctrl","$apply","notif","onLangReady","promise","lang","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[820],{1058:(e,t,i)=>{i.d(t,{Z:()=>n});const n='<style>.widget-mediacentre .widget-body{max-height:300px;overflow:auto}.widget-mediacentre .widget-body .empty{display:flex;align-items:center;justify-content:center;padding:8px;font-style:italic}.widget-mediacentre .widget-body .resource-list{display:flex;flex-wrap:wrap}.widget-mediacentre .widget-body .resource-list-item{position:relative;width:25%;height:150px}.widget-mediacentre .widget-body .resource-list-item a{display:flex;flex-direction:column;align-items:center;justify-content:center;transition:background-color .8s cubic-bezier(.25,.46,.45,.94);position:relative;margin:1px;padding:0 8px;color:unset;text-decoration:none;background:#fafafa;height:99%;width:auto}.widget-mediacentre .widget-body .resource-list-item a:hover{background-color:#fff;color:#ff8d2e;cursor:pointer}.widget-mediacentre .widget-body .resource-list-item .picture{height:80%;display:flex;align-items:center;justify-content:center}.widget-mediacentre .widget-body .resource-list-item .picture img{max-height:100%;max-width:100%}.widget-mediacentre .widget-body .resource-list-item .title{height:20%;max-width:90%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.widget-mediacentre #universalis-container .widget-body{padding:10px 0}.widget-mediacentre #universalis-container .widget-empty-message{display:flex;align-items:center;justify-content:space-between;padding:12px}.widget-mediacentre #universalis-container .widget-empty-message:first-child,.widget-mediacentre #universalis-container form{max-height:40px}.widget-mediacentre #universalis-container .widget-empty-message form *,.widget-mediacentre #universalis-container .widget-empty-message:first-child *{max-height:inherit}.widget-mediacentre #universalis-container img{width:auto}.widget-mediacentre #universalis-container form{width:90%}.widget-mediacentre #universalis-container form .input-group input#inputUniversalisQ{height:30px}.widget-mediacentre #universalis-container form .input-group button{padding:0 8px}</style> <div class="widget-mediacentre"> <div class="widget-header"> <div class="subtitle"> <a class="seemore" href="/mediacentre" i18n-title="mediacentre.widget.more" dnd-nodrag ng-click="trackEvent($event, {detail:{\'open\':\'more\'} })"> <i18n>mediacentre.widget.title</i18n> <span class="seemore-text"><i18n>mediacentre.widget.more</i18n></span> </a> </div> <div class="widget-options"> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <ul class="resource-list" ng-if="ctrl.resources.length > 0"> <li class="resource-list-item" ng-repeat="resource in ctrl.resources" title="[[resource.title]]"> <a ng-href="[[resource.link]]" target="_blank"> <div class="picture"><img skin-src="[[resource.image]]" alt="[[resource.title]]"/></div> <div class="title">[[resource.title]]</div> </a> </li> </ul> <div class="empty" ng-if="ctrl.resources.length <= 0"> <i18n>mediacentre.widget.empty</i18n> </div> </div> <div class="widget-footer border-top border-ghost" ng-if="ctrl.hasUniversalis"> <div id="universalis-container"> <div class="widget-body"> <div class="widget-empty-message"> <div class="row row-cols-1 align-items-center"> <div class="mb-3"> <a href="http://www.universalis-edu.com" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':\'universalis\'} })"> <img src="/assets/widgets/mediacentre-widget/universalis.png" width="75" alt="Universalis"> </a> </div> </div> <form method="GET" action="https://www.universalis-edu.com/nomade/precherche/" target="_blank" autocomplete="off"> <div class="row row-cols-1 align-items-center"> <label class="sr-only" for="inputUniversalisQ" translate content="{{ctrl.selectedSchool.UAI == null ? \'mediacentre.widget.universalis.no.uai\' : \'mediacentre.widget.universalis.search\'}}"></label> <div class="input-group mb-2"> <input type="text" id="inputUniversalisQ" class="form-control" name="q" maxlen gth="255" i18n-placeholder="{{ctrl.selectedSchool.UAI == null ? \'mediacentre.widget.universalis.no.uai\' : \'mediacentre.widget.universalis.search\'}}" ng-disabled="ctrl.selectedSchool.UAI == null"/> <input type="hidden" name="r" value="www"/> <input type="hidden" name="uai" value="{{ctrl.selectedSchool.UAI}}"/> <button class="btn btn-outline-secondary" ng-class="{\'disabled\': ctrl.selectedSchool.UAI == null}" aria-labelledby="inputUniversalisQ" ng-click="trackEvent($event, {detail:{\'search\':\'launch\'} })"> <i class="ic-search"></i> </button> </div> </div> </form> </div> </div> </div> </div> </div>'},5116:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var o=s(i(4202)),a=i(9419),c=i(5262),l=function(){function e(){var e=this;this.resources=[],this.limitResources=4,this.hasUniversalis=!1,this.initResources=function(){return n(e,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.initResourcesFavorites()];case 1:return e.sent(),[4,this.initSignetFavorites()];case 2:return e.sent(),[4,this.hasUniversalisResource()];case 3:return e.sent(),this.resources.length>this.limitResources&&(this.resources=this.resources.slice(0,this.limitResources)),[2]}}))}))},this.fetchFavorites=function(t){return n(e,void 0,void 0,(function(){var e,i,n;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,(0,a.http)().get(t)];case 1:return"ok"===(e=r.sent()).status&&e&&e.data&&e.data.length>0&&(i=e.data,this.resources=this.resources.concat(i)),[3,3];case 2:throw n=r.sent(),console.warn("[widget.mediacentre] Failed to fetch favorites : ",n),n;case 3:return[2]}}))}))},this.initResourcesFavorites=function(){return n(e,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.fetchFavorites("/mediacentre/favorites")];case 1:return t.sent(),[3,3];case 2:throw e=t.sent(),console.warn("[widget.mediacentre] Failed to initResourcesFavorites : ",e),e;case 3:return[2]}}))}))},this.initSignetFavorites=function(){return n(e,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.fetchFavorites("/mediacentre/signets/favorites")];case 1:return t.sent(),[3,3];case 2:throw e=t.sent(),console.warn("[widget.mediacentre] Failed to initSignetFavorites : ",e),e;case 3:return[2]}}))}))},this.hasUniversalisResource=function(){return n(e,void 0,void 0,(function(){var e,t;return r(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,(0,a.http)().get("/mediacentre/resource/universalis")];case 1:return e=i.sent(),this.hasUniversalis=!!e,[3,3];case 2:throw t=i.sent(),console.warn("[widget.mediacentre] Failed to check exitence of universalis resource: ",t),t;case 3:return[2]}}))}))}}return Object.defineProperty(e.prototype,"description",{get:function(){return(0,a.session)().description},enumerable:!1,configurable:!0}),e.prototype.initializeUniversalis=function(){var e,t;return n(this,void 0,void 0,(function(){var i,n=this;return r(this,(function(r){switch(r.label){case 0:return this.hasUniversalis?(this._userPref=null===(e=c.WidgetFrameworkFactory.instance().list.find((function(e){return e.platformConf.name===c.WIDGET_NAME.MEDIACENTRE})))||void 0===e?void 0:e.userPref,[4,(0,a.notif)().onSessionReady().promise]):[2];case 1:return r.sent(),i=0,(null===(t=this._userPref)||void 0===t?void 0:t.schoolId)&&o.default.isArray(this.description.schools)&&(i=this.description.schools.findIndex((function(e){var t;return e.id===(null===(t=n._userPref)||void 0===t?void 0:t.schoolId)})),i<0&&(i=0)),this.setSelectedSchool(i),[2]}}))}))},e.prototype.setSelectedSchool=function(e){return 0<=e&&e<this.description.schools.length&&this.selectedSchool!==this.description.schools[e]&&(this.selectedSchool=this.description.schools[e],!0)},e}(),d=function(){function e(e){this.$compile=e,this.restrict="E",this.template=i(1058).Z,this.scope={},this.bindToController=!0,this.controller=[l],this.controllerAs="ctrl",this.require=["odeMediacentreWidget"]}return e.prototype.link=function(e,t,i,s){return n(this,void 0,void 0,(function(){var t;return r(this,(function(i){switch(i.label){case 0:return(t=s?s[0]:null)?[4,t.initResources()]:[2];case 1:return i.sent(),[4,t.initializeUniversalis()];case 2:return i.sent(),e.$apply(),e.trackEvent=function(e,t){var i;void 0===t.bubbles&&(t.bubbles=!0);var n=null;t&&"more"===(null===(i=t.detail)||void 0===i?void 0:i.open)&&(n=new CustomEvent(a.TrackedActionFromWidget.mediacentre,t)),n&&e.currentTarget&&e.currentTarget.dispatchEvent(n)},[2]}}))}))},e}();function u(e){return new d(e)}u.$inject=["$compile"],(0,a.notif)().onLangReady().promise.then((function(e){(0,a.conf)().Platform.idiom.addKeys(i(3948))})),t.odeModuleName="odeMediacentreWidgetModule",o.default.module(t.odeModuleName,[]).directive("odeMediacentreWidget",u)},3948:e=>{e.exports=JSON.parse('{"mediacentre-widget":"Mes favoris Médiacentre","mediacentre.widget.title":"Mes favoris Médiacentre","mediacentre.widget.more":"voir plus","mediacentre.widget.empty":"Aucune ressource favorite","mediacentre.widget.universalis.no.uai":"UAI non renseigné","mediacentre.widget.universalis.search":"Rechercher dans Universalis"}')}}]);
|
|
1
|
+
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[820],{1058:(e,t,i)=>{i.d(t,{Z:()=>n});const n='<style>.widget-mediacentre .widget-body{max-height:300px;overflow:auto}.widget-mediacentre .widget-body .empty{display:flex;align-items:center;justify-content:center;padding:8px;font-style:italic}.widget-mediacentre .widget-body .resource-list{display:flex;flex-wrap:wrap}.widget-mediacentre .widget-body .resource-list-item{position:relative;width:25%;height:150px}.widget-mediacentre .widget-body .resource-list-item a{display:flex;flex-direction:column;align-items:center;justify-content:center;transition:background-color .8s cubic-bezier(.25,.46,.45,.94);position:relative;margin:1px;padding:0 8px;color:unset;text-decoration:none;background:#fafafa;height:99%;width:auto}.widget-mediacentre .widget-body .resource-list-item a:hover{background-color:#fff;color:#ff8d2e;cursor:pointer}.widget-mediacentre .widget-body .resource-list-item .picture{height:80%;display:flex;align-items:center;justify-content:center}.widget-mediacentre .widget-body .resource-list-item .picture img{max-height:100%;max-width:100%}.widget-mediacentre .widget-body .resource-list-item .title{height:20%;max-width:90%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.widget-mediacentre #universalis-container .widget-body{padding:10px 0}.widget-mediacentre #universalis-container .widget-empty-message{display:flex;align-items:center;justify-content:space-between;padding:12px}.widget-mediacentre #universalis-container .widget-empty-message:first-child,.widget-mediacentre #universalis-container form{max-height:40px}.widget-mediacentre #universalis-container .widget-empty-message form *,.widget-mediacentre #universalis-container .widget-empty-message:first-child *{max-height:inherit}.widget-mediacentre #universalis-container img{width:auto}.widget-mediacentre #universalis-container form{width:90%}.widget-mediacentre #universalis-container form .input-group input#inputUniversalisQ{height:30px}.widget-mediacentre #universalis-container form .input-group button{padding:0 8px}</style> <div class="widget-mediacentre"> <div class="widget-header"> <div class="subtitle"> <a class="seemore" href="/mediacentre" i18n-title="mediacentre.widget.more" dnd-nodrag ng-click="trackEvent($event, {detail:{\'open\':\'more\'} })"> <i18n>mediacentre.widget.title</i18n> <span class="seemore-text"><i18n>mediacentre.widget.more</i18n></span> </a> </div> <div class="widget-options"> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <ul class="resource-list" ng-if="ctrl.resources.length > 0"> <li class="resource-list-item" ng-repeat="resource in ctrl.resources" title="[[resource.title]]"> <a ng-href="[[resource.link]]" target="_blank"> <div class="picture"><img skin-src="[[resource.image]]" alt="[[resource.title]]"/></div> <div class="title">[[resource.title]]</div> </a> </li> </ul> <div class="empty" ng-if="ctrl.resources.length <= 0"> <i18n>mediacentre.widget.empty</i18n> </div> </div> <div class="widget-footer border-top border-ghost" ng-if="ctrl.hasUniversalis"> <div id="universalis-container"> <div class="widget-body"> <div class="widget-empty-message"> <div class="row row-cols-1 align-items-center"> <div class="mb-3"> <a href="http://www.universalis-edu.com" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':\'universalis\'} })"> <img src="/assets/widgets/mediacentre-widget/universalis.png" width="75" alt="Universalis"> </a> </div> </div> <form method="GET" action="https://www.universalis-edu.com/nomade/precherche/" target="_blank" autocomplete="off"> <div class="row row-cols-1 align-items-center"> <label class="sr-only" for="inputUniversalisQ" translate content="{{ctrl.selectedSchool.UAI == null ? \'mediacentre.widget.universalis.no.uai\' : \'mediacentre.widget.universalis.search\'}}"></label> <div class="input-group mb-2"> <input type="text" id="inputUniversalisQ" class="form-control" name="q" maxlen gth="255" i18n-placeholder="{{ctrl.selectedSchool.UAI == null ? \'mediacentre.widget.universalis.no.uai\' : \'mediacentre.widget.universalis.search\'}}" ng-disabled="ctrl.selectedSchool.UAI == null"/> <input type="hidden" name="r" value="www"/> <input type="hidden" name="uai" value="{{ctrl.selectedSchool.UAI}}"/> <button class="btn btn-outline-secondary" ng-class="{\'disabled\': ctrl.selectedSchool.UAI == null}" aria-labelledby="inputUniversalisQ" ng-click="trackEvent($event, {detail:{\'search\':\'launch\'} })"> <i class="ic-search"></i> </button> </div> </div> </form> </div> </div> </div> </div> </div>'},5116:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}c((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var i,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var o=s(i(4202)),a=i(9419),c=i(5262),l=function(){function e(){var e=this;this.resources=[],this.limitResources=4,this.hasUniversalis=!1,this.initResources=function(){return n(e,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,this.initResourcesFavorites()];case 1:return e.sent(),[4,this.initSignetFavorites()];case 2:return e.sent(),[4,this.hasUniversalisResource()];case 3:return e.sent(),this.resources.length>this.limitResources&&(this.resources=this.resources.slice(0,this.limitResources)),[2]}})})},this.fetchFavorites=function(t){return n(e,void 0,void 0,function(){var e,i,n;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,(0,a.http)().get(t)];case 1:return"ok"===(e=r.sent()).status&&e&&e.data&&e.data.length>0&&(i=e.data,this.resources=this.resources.concat(i)),[3,3];case 2:throw n=r.sent(),console.warn("[widget.mediacentre] Failed to fetch favorites : ",n),n;case 3:return[2]}})})},this.initResourcesFavorites=function(){return n(e,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.fetchFavorites("/mediacentre/favorites")];case 1:return t.sent(),[3,3];case 2:throw e=t.sent(),console.warn("[widget.mediacentre] Failed to initResourcesFavorites : ",e),e;case 3:return[2]}})})},this.initSignetFavorites=function(){return n(e,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.fetchFavorites("/mediacentre/signets/favorites")];case 1:return t.sent(),[3,3];case 2:throw e=t.sent(),console.warn("[widget.mediacentre] Failed to initSignetFavorites : ",e),e;case 3:return[2]}})})},this.hasUniversalisResource=function(){return n(e,void 0,void 0,function(){var e,t;return r(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,(0,a.http)().get("/mediacentre/resource/universalis")];case 1:return e=i.sent(),this.hasUniversalis=!!e,[3,3];case 2:throw t=i.sent(),console.warn("[widget.mediacentre] Failed to check exitence of universalis resource: ",t),t;case 3:return[2]}})})}}return Object.defineProperty(e.prototype,"description",{get:function(){return(0,a.session)().description},enumerable:!1,configurable:!0}),e.prototype.initializeUniversalis=function(){var e,t;return n(this,void 0,void 0,function(){var i,n=this;return r(this,function(r){switch(r.label){case 0:return this.hasUniversalis?(this._userPref=null===(e=c.WidgetFrameworkFactory.instance().list.find(function(e){return e.platformConf.name===c.WIDGET_NAME.MEDIACENTRE}))||void 0===e?void 0:e.userPref,[4,(0,a.notif)().onSessionReady().promise]):[2];case 1:return r.sent(),i=0,(null===(t=this._userPref)||void 0===t?void 0:t.schoolId)&&o.default.isArray(this.description.schools)&&(i=this.description.schools.findIndex(function(e){var t;return e.id===(null===(t=n._userPref)||void 0===t?void 0:t.schoolId)}),i<0&&(i=0)),this.setSelectedSchool(i),[2]}})})},e.prototype.setSelectedSchool=function(e){return 0<=e&&e<this.description.schools.length&&this.selectedSchool!==this.description.schools[e]&&(this.selectedSchool=this.description.schools[e],!0)},e}(),d=function(){function e(e){this.$compile=e,this.restrict="E",this.template=i(1058).Z,this.scope={},this.bindToController=!0,this.controller=[l],this.controllerAs="ctrl",this.require=["odeMediacentreWidget"]}return e.prototype.link=function(e,t,i,s){return n(this,void 0,void 0,function(){var t;return r(this,function(i){switch(i.label){case 0:return(t=s?s[0]:null)?[4,t.initResources()]:[2];case 1:return i.sent(),[4,t.initializeUniversalis()];case 2:return i.sent(),e.$apply(),e.trackEvent=function(e,t){var i;void 0===t.bubbles&&(t.bubbles=!0);var n=null;t&&"more"===(null===(i=t.detail)||void 0===i?void 0:i.open)&&(n=new CustomEvent(a.TrackedActionFromWidget.mediacentre,t)),n&&e.currentTarget&&e.currentTarget.dispatchEvent(n)},[2]}})})},e}();function u(e){return new d(e)}u.$inject=["$compile"],(0,a.notif)().onLangReady().promise.then(function(e){(0,a.conf)().Platform.idiom.addKeys(i(3948))}),t.odeModuleName="odeMediacentreWidgetModule",o.default.module(t.odeModuleName,[]).directive("odeMediacentreWidget",u)},3948:e=>{e.exports=JSON.parse('{"mediacentre-widget":"Mes favoris Médiacentre","mediacentre.widget.title":"Mes favoris Médiacentre","mediacentre.widget.more":"voir plus","mediacentre.widget.empty":"Aucune ressource favorite","mediacentre.widget.universalis.no.uai":"UAI non renseigné","mediacentre.widget.universalis.search":"Rechercher dans Universalis"}')}}]);
|
|
2
2
|
//# sourceMappingURL=mediacentre-widget.widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgets/mediacentre-widget/mediacentre-widget.widget.js","mappings":"gIAGA,QAFW,+9I,8iDCDX,iBACA,UACA,UAqCA,qCACY,KAAAA,UAAwB,GACxB,KAAAC,eAAyB,EAC1B,KAAAC,gBAA0B,EAE1B,KAAAC,cAAgB,gD,kDACnB,SAAMC,KAAKC,0B,OACX,OADA,SACA,GAAMD,KAAKE,uB,OACX,OADA,SACA,GAAMF,KAAKG,0B,cAAX,SACIH,KAAKJ,UAAUQ,OAASJ,KAAKH,iBAAgBG,KAAKJ,UAA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IAAIE,UAAW,uBAAwBZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/mediacentre-widget/mediacentre-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/mediacentre-widget/mediacentre-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \"<style>.widget-mediacentre .widget-body{max-height:300px;overflow:auto}.widget-mediacentre .widget-body .empty{display:flex;align-items:center;justify-content:center;padding:8px;font-style:italic}.widget-mediacentre .widget-body .resource-list{display:flex;flex-wrap:wrap}.widget-mediacentre .widget-body .resource-list-item{position:relative;width:25%;height:150px}.widget-mediacentre .widget-body .resource-list-item a{display:flex;flex-direction:column;align-items:center;justify-content:center;transition:background-color .8s cubic-bezier(.25,.46,.45,.94);position:relative;margin:1px;padding:0 8px;color:unset;text-decoration:none;background:#fafafa;height:99%;width:auto}.widget-mediacentre .widget-body .resource-list-item a:hover{background-color:#fff;color:#ff8d2e;cursor:pointer}.widget-mediacentre .widget-body .resource-list-item .picture{height:80%;display:flex;align-items:center;justify-content:center}.widget-mediacentre .widget-body .resource-list-item .picture img{max-height:100%;max-width:100%}.widget-mediacentre .widget-body .resource-list-item .title{height:20%;max-width:90%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.widget-mediacentre #universalis-container .widget-body{padding:10px 0}.widget-mediacentre #universalis-container .widget-empty-message{display:flex;align-items:center;justify-content:space-between;padding:12px}.widget-mediacentre #universalis-container .widget-empty-message:first-child,.widget-mediacentre #universalis-container form{max-height:40px}.widget-mediacentre #universalis-container .widget-empty-message form *,.widget-mediacentre #universalis-container .widget-empty-message:first-child *{max-height:inherit}.widget-mediacentre #universalis-container img{width:auto}.widget-mediacentre #universalis-container form{width:90%}.widget-mediacentre #universalis-container form .input-group input#inputUniversalisQ{height:30px}.widget-mediacentre #universalis-container form .input-group button{padding:0 8px}</style> <div class=\\\"widget-mediacentre\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"> <a class=\\\"seemore\\\" href=\\\"/mediacentre\\\" i18n-title=\\\"mediacentre.widget.more\\\" dnd-nodrag ng-click=\\\"trackEvent($event, {detail:{'open':'more'} })\\\"> <i18n>mediacentre.widget.title</i18n> <span class=\\\"seemore-text\\\"><i18n>mediacentre.widget.more</i18n></span> </a> </div> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\" title=\\\"Déplacer le widget\\\"><i class=\\\"fas fa-grip-vertical\\\" aria-hidden=\\\"true\\\"></i></div> </div> </div> <div class=\\\"widget-body\\\" dnd-nodrag> <ul class=\\\"resource-list\\\" ng-if=\\\"ctrl.resources.length > 0\\\"> <li class=\\\"resource-list-item\\\" ng-repeat=\\\"resource in ctrl.resources\\\" title=\\\"[[resource.title]]\\\"> <a ng-href=\\\"[[resource.link]]\\\" target=\\\"_blank\\\"> <div class=\\\"picture\\\"><img skin-src=\\\"[[resource.image]]\\\" alt=\\\"[[resource.title]]\\\"/></div> <div class=\\\"title\\\">[[resource.title]]</div> </a> </li> </ul> <div class=\\\"empty\\\" ng-if=\\\"ctrl.resources.length <= 0\\\"> <i18n>mediacentre.widget.empty</i18n> </div> </div> <div class=\\\"widget-footer border-top border-ghost\\\" ng-if=\\\"ctrl.hasUniversalis\\\"> <div id=\\\"universalis-container\\\"> <div class=\\\"widget-body\\\"> <div class=\\\"widget-empty-message\\\"> <div class=\\\"row row-cols-1 align-items-center\\\"> <div class=\\\"mb-3\\\"> <a href=\\\"http://www.universalis-edu.com\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'universalis'} })\\\"> <img src=\\\"/assets/widgets/mediacentre-widget/universalis.png\\\" width=\\\"75\\\" alt=\\\"Universalis\\\"> </a> </div> </div> <form method=\\\"GET\\\" action=\\\"https://www.universalis-edu.com/nomade/precherche/\\\" target=\\\"_blank\\\" autocomplete=\\\"off\\\"> <div class=\\\"row row-cols-1 align-items-center\\\"> <label class=\\\"sr-only\\\" for=\\\"inputUniversalisQ\\\" translate content=\\\"{{ctrl.selectedSchool.UAI == null ? 'mediacentre.widget.universalis.no.uai' : 'mediacentre.widget.universalis.search'}}\\\"></label> <div class=\\\"input-group mb-2\\\"> <input type=\\\"text\\\" id=\\\"inputUniversalisQ\\\" class=\\\"form-control\\\" name=\\\"q\\\" maxlen gth=\\\"255\\\" i18n-placeholder=\\\"{{ctrl.selectedSchool.UAI == null ? 'mediacentre.widget.universalis.no.uai' : 'mediacentre.widget.universalis.search'}}\\\" ng-disabled=\\\"ctrl.selectedSchool.UAI == null\\\"/> <input type=\\\"hidden\\\" name=\\\"r\\\" value=\\\"www\\\"/> <input type=\\\"hidden\\\" name=\\\"uai\\\" value=\\\"{{ctrl.selectedSchool.UAI}}\\\"/> <button class=\\\"btn btn-outline-secondary\\\" ng-class=\\\"{'disabled': ctrl.selectedSchool.UAI == null}\\\" aria-labelledby=\\\"inputUniversalisQ\\\" ng-click=\\\"trackEvent($event, {detail:{'search':'launch'} })\\\"> <i class=\\\"ic-search\\\"></i> </button> </div> </div> </form> </div> </div> </div> </div> </div>\";\n// Exports\nexport default code;","import angular, {IAttributes, ICompileService, IController, IDirective} from \"angular\";\nimport {conf, notif, TrackedScope, TrackedAction, TrackedActionFromWidget, http, session} from \"../../utils\";\nimport {IUserDescription, School, WIDGET_NAME, WidgetFrameworkFactory, WidgetUserPref} from \"ode-ts-client\";\n\ntype Resource = {\n authors: string[];\n date: number;\n description: string;\n disciplines: string[];\n displayTitle: string;\n document_types: string[];\n editors: string[];\n hash: number;\n id: string;\n favorite?: boolean;\n image: string;\n levels: string[];\n link: string;\n plain_text: string[];\n source: string;\n title: string;\n action: object;\n structure_name: string;\n structure_uai: string;\n display_structure_name?: boolean;\n _id?: string;\n\n user?: string;\n favoriteId?: string;\n}\n\ntype Response = {\n data: Resource[];\n event: string;\n state: string;\n status: string;\n}\n\n/* Controller for the directive */\nclass Controller implements IController {\n private resources: Resource[] = [];\n private limitResources: number = 4; // limit of resources to display\n public hasUniversalis: boolean = false;\n\n public initResources = async(): Promise<void> => {\n await this.initResourcesFavorites();\n await this.initSignetFavorites();\n await this.hasUniversalisResource();\n if (this.resources.length > this.limitResources) this.resources = this.resources.slice(0, this.limitResources);\n }\n\n private fetchFavorites = async (apiUrl: string): Promise<void> => {\n try {\n let response: Response = await http().get<Response>(apiUrl);\n if (response.status === \"ok\" && response && response.data && response.data.length > 0) {\n let favoriteResources: Resource[] = response.data as Resource[];\n this.resources = this.resources.concat(favoriteResources);\n }\n } catch (e) {\n console.warn(`[widget.mediacentre] Failed to fetch favorites : `, e);\n throw e;\n }\n }\n\n private initResourcesFavorites = async(): Promise<void> => {\n try {\n await this.fetchFavorites('/mediacentre/favorites');\n } catch (e) {\n console.warn(\"[widget.mediacentre] Failed to initResourcesFavorites : \", e);\n throw e;\n }\n }\n\n private initSignetFavorites = async(): Promise<void> => {\n try {\n await this.fetchFavorites('/mediacentre/signets/favorites');\n } catch (e) {\n console.warn(\"[widget.mediacentre] Failed to initSignetFavorites : \", e);\n throw e;\n }\n }\n\n private hasUniversalisResource = async(): Promise<void> => {\n try {\n let universalisResource: Resource = await http().get<Resource>('/mediacentre/resource/universalis');\n this.hasUniversalis = !!universalisResource;\n } catch (e) {\n console.warn(\"[widget.mediacentre] Failed to check exitence of universalis resource: \", e);\n throw e;\n }\n }\n\n\n // Universalis\n\n private _userPref?:WidgetUserPref;\n private selectedSchool?:School;\n\n protected get description():IUserDescription {\n return session().description;\n }\n\n public async initializeUniversalis() {\n if (!this.hasUniversalis) return;\n\n this._userPref = WidgetFrameworkFactory.instance().list.find( w => w.platformConf.name===WIDGET_NAME.MEDIACENTRE)?.userPref;\n await notif().onSessionReady().promise;\n\n let defaultIndex = 0;\n if( this._userPref?.schoolId && angular.isArray(this.description.schools) ) {\n defaultIndex = this.description.schools.findIndex( school => school.id===this._userPref?.schoolId );\n if( defaultIndex < 0 ) {\n defaultIndex = 0;\n }\n }\n this.setSelectedSchool( defaultIndex );\n }\n\n private setSelectedSchool( idx:number ):boolean {\n if( 0 <= idx && idx < this.description.schools.length && this.selectedSchool !== this.description.schools[idx]) {\n this.selectedSchool = this.description.schools[idx];\n return true;\n }\n return false;\n }\n}\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n template = require('./mediacentre-widget.widget.html').default;\n scope = {};\n bindToController = true;\n controller = [Controller];\n controllerAs = 'ctrl';\n require = ['odeMediacentreWidget'];\n\n async link (scope:TrackedScope, elem:JQLite, attrs:IAttributes, controllers?:IController[]): Promise<void> {\n const ctrl: Controller|null = controllers ? controllers[0] as Controller : null;\n if (!ctrl) return;\n\n await ctrl.initResources(); // Init Mediacentre resources\n await ctrl.initializeUniversalis(); // Init Universalis search bar\n scope.$apply();\n\n // Give an opportunity to track some events from outside of this widget.\n scope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>): void => {\n // Allow events to bubble up.\n if (typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n let event = null;\n if (p && p.detail?.open === 'more') {\n event = new CustomEvent( TrackedActionFromWidget.mediacentre, p );\n }\n if (event && e.currentTarget) {\n e.currentTarget.dispatchEvent(event);\n }\n }\n }\n\n constructor (private $compile: ICompileService) { }\n}\n\n/** The mediacentre widget. */\nfunction DirectiveFactory($compile:ICompileService) {\n return new Directive($compile);\n}\nDirectiveFactory.$inject = [\"$compile\"];\n\n// Preload translations\nnotif().onLangReady().promise.then((lang: any): void => {\n switch (lang) {\n default:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n }\n});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odeMediacentreWidgetModule\";\nangular.module( odeModuleName, []).directive( \"odeMediacentreWidget\", DirectiveFactory );\n"],"names":["resources","limitResources","hasUniversalis","initResources","this","initResourcesFavorites","initSignetFavorites","hasUniversalisResource","length","slice","fetchFavorites","apiUrl","http","get","response","status","data","favoriteResources","concat","console","warn","universalisResource","session","description","initializeUniversalis","_userPref","WidgetFrameworkFactory","instance","list","find","w","platformConf","name","WIDGET_NAME","MEDIACENTRE","userPref","notif","onSessionReady","promise","defaultIndex","schoolId","isArray","schools","findIndex","school","id","setSelectedSchool","idx","selectedSchool","$compile","restrict","template","scope","bindToController","controller","Controller","controllerAs","require","link","elem","attrs","controllers","ctrl","$apply","trackEvent","e","p","bubbles","event","detail","open","CustomEvent","TrackedActionFromWidget","mediacentre","currentTarget","dispatchEvent","DirectiveFactory","Directive","$inject","onLangReady","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"widgets/mediacentre-widget/mediacentre-widget.widget.js","mappings":"gIAGA,QAFW,+9I,0iDCDX,iBACA,UACA,UAqCA,qCACY,KAAAA,UAAwB,GACxB,KAAAC,eAAyB,EAC1B,KAAAC,gBAA0B,EAE1B,KAAAC,cAAgB,+C,iDACnB,SAAMC,KAAKC,0B,OACX,OADA,SACA,GAAMD,KAAKE,uB,OACX,OADA,SACA,GAAMF,KAAKG,0B,cAAX,SACIH,KAAKJ,UAAUQ,OAASJ,KAAKH,iBAAgBG,KAAKJ,UAAYI,KAAKJ,UAAUS,MAAM,EAAGL,KAAKH,iB,UAG3F,KAAAS,eAAiB,SAAOC,GAAc,oC,2DAEb,O,sBAAA,IAAM,IAAAC,QAAOC,IAAcF,I,aAC3B,QADrBG,EAAqB,UACZC,QAAoBD,GAAYA,EAASE,MAAQF,EAASE,KAAKR,OAAS,IAC7ES,EAAgCH,EAASE,KAC7CZ,KAAKJ,UAAYI,KAAKJ,UAAUkB,OAAOD,I,aAI3C,M,WADAE,QAAQC,KAAK,oDAAqD,GAC5D,E,uBAIN,KAAAf,uBAAyB,+C,uDAEzB,O,sBAAA,GAAMD,KAAKM,eAAe,2B,cAA1B,S,aAGA,M,WADAS,QAAQC,KAAK,2DAA4D,GACnE,E,uBAIN,KAAAd,oBAAsB,+C,uDAEtB,O,sBAAA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AC,QAAU,CAAC,uBAyBuC,CACtD,OAxBU,YAAAC,KAAN,SAAYN,EAAoBO,EAAaC,EAAmBC,G,8FAE5D,OADMC,EAAwBD,EAAcA,EAAY,GAAmB,MAG3E,GAAMC,EAAK3D,iBAFA,I,OAGX,OADA,SACA,GAAM2D,EAAKtC,yB,cAAX,SACA4B,EAAMW,SAGNX,EAAMY,WAAa,SAACC,EAASC,G,WAEA,IAAdA,EAAEC,UAAyBD,EAAEC,SAAU,GAElD,IAAIC,EAAQ,KACRF,GAAwB,UAAX,QAAR,EAAAA,EAAEG,cAAM,eAAEC,QACfF,EAAQ,IAAIG,YAAa,EAAAC,wBAAwBC,YAAaP,IAE9DE,GAASH,EAAES,eACXT,EAAES,cAAcC,cAAcP,EAEtC,E,UAIR,EAjCA,GAoCA,SAASQ,EAAiB3B,GACtB,OAAO,IAAI4B,EAAU5B,EACzB,CACA2B,EAAiBE,QAAU,CAAC,aAG5B,IAAA1C,SAAQ2C,cAAczC,QAAQ0C,KAAK,SAACC,IAEnB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAExD,GAIa,EAAAC,cAAgB,6BAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,uBAAwBZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/mediacentre-widget/mediacentre-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/mediacentre-widget/mediacentre-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \"<style>.widget-mediacentre .widget-body{max-height:300px;overflow:auto}.widget-mediacentre .widget-body .empty{display:flex;align-items:center;justify-content:center;padding:8px;font-style:italic}.widget-mediacentre .widget-body .resource-list{display:flex;flex-wrap:wrap}.widget-mediacentre .widget-body .resource-list-item{position:relative;width:25%;height:150px}.widget-mediacentre .widget-body .resource-list-item a{display:flex;flex-direction:column;align-items:center;justify-content:center;transition:background-color .8s cubic-bezier(.25,.46,.45,.94);position:relative;margin:1px;padding:0 8px;color:unset;text-decoration:none;background:#fafafa;height:99%;width:auto}.widget-mediacentre .widget-body .resource-list-item a:hover{background-color:#fff;color:#ff8d2e;cursor:pointer}.widget-mediacentre .widget-body .resource-list-item .picture{height:80%;display:flex;align-items:center;justify-content:center}.widget-mediacentre .widget-body .resource-list-item .picture img{max-height:100%;max-width:100%}.widget-mediacentre .widget-body .resource-list-item .title{height:20%;max-width:90%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.widget-mediacentre #universalis-container .widget-body{padding:10px 0}.widget-mediacentre #universalis-container .widget-empty-message{display:flex;align-items:center;justify-content:space-between;padding:12px}.widget-mediacentre #universalis-container .widget-empty-message:first-child,.widget-mediacentre #universalis-container form{max-height:40px}.widget-mediacentre #universalis-container .widget-empty-message form *,.widget-mediacentre #universalis-container .widget-empty-message:first-child *{max-height:inherit}.widget-mediacentre #universalis-container img{width:auto}.widget-mediacentre #universalis-container form{width:90%}.widget-mediacentre #universalis-container form .input-group input#inputUniversalisQ{height:30px}.widget-mediacentre #universalis-container form .input-group button{padding:0 8px}</style> <div class=\\\"widget-mediacentre\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"> <a class=\\\"seemore\\\" href=\\\"/mediacentre\\\" i18n-title=\\\"mediacentre.widget.more\\\" dnd-nodrag ng-click=\\\"trackEvent($event, {detail:{'open':'more'} })\\\"> <i18n>mediacentre.widget.title</i18n> <span class=\\\"seemore-text\\\"><i18n>mediacentre.widget.more</i18n></span> </a> </div> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\" title=\\\"Déplacer le widget\\\"><i class=\\\"fas fa-grip-vertical\\\" aria-hidden=\\\"true\\\"></i></div> </div> </div> <div class=\\\"widget-body\\\" dnd-nodrag> <ul class=\\\"resource-list\\\" ng-if=\\\"ctrl.resources.length > 0\\\"> <li class=\\\"resource-list-item\\\" ng-repeat=\\\"resource in ctrl.resources\\\" title=\\\"[[resource.title]]\\\"> <a ng-href=\\\"[[resource.link]]\\\" target=\\\"_blank\\\"> <div class=\\\"picture\\\"><img skin-src=\\\"[[resource.image]]\\\" alt=\\\"[[resource.title]]\\\"/></div> <div class=\\\"title\\\">[[resource.title]]</div> </a> </li> </ul> <div class=\\\"empty\\\" ng-if=\\\"ctrl.resources.length <= 0\\\"> <i18n>mediacentre.widget.empty</i18n> </div> </div> <div class=\\\"widget-footer border-top border-ghost\\\" ng-if=\\\"ctrl.hasUniversalis\\\"> <div id=\\\"universalis-container\\\"> <div class=\\\"widget-body\\\"> <div class=\\\"widget-empty-message\\\"> <div class=\\\"row row-cols-1 align-items-center\\\"> <div class=\\\"mb-3\\\"> <a href=\\\"http://www.universalis-edu.com\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'universalis'} })\\\"> <img src=\\\"/assets/widgets/mediacentre-widget/universalis.png\\\" width=\\\"75\\\" alt=\\\"Universalis\\\"> </a> </div> </div> <form method=\\\"GET\\\" action=\\\"https://www.universalis-edu.com/nomade/precherche/\\\" target=\\\"_blank\\\" autocomplete=\\\"off\\\"> <div class=\\\"row row-cols-1 align-items-center\\\"> <label class=\\\"sr-only\\\" for=\\\"inputUniversalisQ\\\" translate content=\\\"{{ctrl.selectedSchool.UAI == null ? 'mediacentre.widget.universalis.no.uai' : 'mediacentre.widget.universalis.search'}}\\\"></label> <div class=\\\"input-group mb-2\\\"> <input type=\\\"text\\\" id=\\\"inputUniversalisQ\\\" class=\\\"form-control\\\" name=\\\"q\\\" maxlen gth=\\\"255\\\" i18n-placeholder=\\\"{{ctrl.selectedSchool.UAI == null ? 'mediacentre.widget.universalis.no.uai' : 'mediacentre.widget.universalis.search'}}\\\" ng-disabled=\\\"ctrl.selectedSchool.UAI == null\\\"/> <input type=\\\"hidden\\\" name=\\\"r\\\" value=\\\"www\\\"/> <input type=\\\"hidden\\\" name=\\\"uai\\\" value=\\\"{{ctrl.selectedSchool.UAI}}\\\"/> <button class=\\\"btn btn-outline-secondary\\\" ng-class=\\\"{'disabled': ctrl.selectedSchool.UAI == null}\\\" aria-labelledby=\\\"inputUniversalisQ\\\" ng-click=\\\"trackEvent($event, {detail:{'search':'launch'} })\\\"> <i class=\\\"ic-search\\\"></i> </button> </div> </div> </form> </div> </div> </div> </div> </div>\";\n// Exports\nexport default code;","import angular, {IAttributes, ICompileService, IController, IDirective} from \"angular\";\nimport {conf, notif, TrackedScope, TrackedAction, TrackedActionFromWidget, http, session} from \"../../utils\";\nimport {IUserDescription, School, WIDGET_NAME, WidgetFrameworkFactory, WidgetUserPref} from \"ode-ts-client\";\n\ntype Resource = {\n authors: string[];\n date: number;\n description: string;\n disciplines: string[];\n displayTitle: string;\n document_types: string[];\n editors: string[];\n hash: number;\n id: string;\n favorite?: boolean;\n image: string;\n levels: string[];\n link: string;\n plain_text: string[];\n source: string;\n title: string;\n action: object;\n structure_name: string;\n structure_uai: string;\n display_structure_name?: boolean;\n _id?: string;\n\n user?: string;\n favoriteId?: string;\n}\n\ntype Response = {\n data: Resource[];\n event: string;\n state: string;\n status: string;\n}\n\n/* Controller for the directive */\nclass Controller implements IController {\n private resources: Resource[] = [];\n private limitResources: number = 4; // limit of resources to display\n public hasUniversalis: boolean = false;\n\n public initResources = async(): Promise<void> => {\n await this.initResourcesFavorites();\n await this.initSignetFavorites();\n await this.hasUniversalisResource();\n if (this.resources.length > this.limitResources) this.resources = this.resources.slice(0, this.limitResources);\n }\n\n private fetchFavorites = async (apiUrl: string): Promise<void> => {\n try {\n let response: Response = await http().get<Response>(apiUrl);\n if (response.status === \"ok\" && response && response.data && response.data.length > 0) {\n let favoriteResources: Resource[] = response.data as Resource[];\n this.resources = this.resources.concat(favoriteResources);\n }\n } catch (e) {\n console.warn(`[widget.mediacentre] Failed to fetch favorites : `, e);\n throw e;\n }\n }\n\n private initResourcesFavorites = async(): Promise<void> => {\n try {\n await this.fetchFavorites('/mediacentre/favorites');\n } catch (e) {\n console.warn(\"[widget.mediacentre] Failed to initResourcesFavorites : \", e);\n throw e;\n }\n }\n\n private initSignetFavorites = async(): Promise<void> => {\n try {\n await this.fetchFavorites('/mediacentre/signets/favorites');\n } catch (e) {\n console.warn(\"[widget.mediacentre] Failed to initSignetFavorites : \", e);\n throw e;\n }\n }\n\n private hasUniversalisResource = async(): Promise<void> => {\n try {\n let universalisResource: Resource = await http().get<Resource>('/mediacentre/resource/universalis');\n this.hasUniversalis = !!universalisResource;\n } catch (e) {\n console.warn(\"[widget.mediacentre] Failed to check exitence of universalis resource: \", e);\n throw e;\n }\n }\n\n\n // Universalis\n\n private _userPref?:WidgetUserPref;\n private selectedSchool?:School;\n\n protected get description():IUserDescription {\n return session().description;\n }\n\n public async initializeUniversalis() {\n if (!this.hasUniversalis) return;\n\n this._userPref = WidgetFrameworkFactory.instance().list.find( w => w.platformConf.name===WIDGET_NAME.MEDIACENTRE)?.userPref;\n await notif().onSessionReady().promise;\n\n let defaultIndex = 0;\n if( this._userPref?.schoolId && angular.isArray(this.description.schools) ) {\n defaultIndex = this.description.schools.findIndex( school => school.id===this._userPref?.schoolId );\n if( defaultIndex < 0 ) {\n defaultIndex = 0;\n }\n }\n this.setSelectedSchool( defaultIndex );\n }\n\n private setSelectedSchool( idx:number ):boolean {\n if( 0 <= idx && idx < this.description.schools.length && this.selectedSchool !== this.description.schools[idx]) {\n this.selectedSchool = this.description.schools[idx];\n return true;\n }\n return false;\n }\n}\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n template = require('./mediacentre-widget.widget.html').default;\n scope = {};\n bindToController = true;\n controller = [Controller];\n controllerAs = 'ctrl';\n require = ['odeMediacentreWidget'];\n\n async link (scope:TrackedScope, elem:JQLite, attrs:IAttributes, controllers?:IController[]): Promise<void> {\n const ctrl: Controller|null = controllers ? controllers[0] as Controller : null;\n if (!ctrl) return;\n\n await ctrl.initResources(); // Init Mediacentre resources\n await ctrl.initializeUniversalis(); // Init Universalis search bar\n scope.$apply();\n\n // Give an opportunity to track some events from outside of this widget.\n scope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>): void => {\n // Allow events to bubble up.\n if (typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n let event = null;\n if (p && p.detail?.open === 'more') {\n event = new CustomEvent( TrackedActionFromWidget.mediacentre, p );\n }\n if (event && e.currentTarget) {\n e.currentTarget.dispatchEvent(event);\n }\n }\n }\n\n constructor (private $compile: ICompileService) { }\n}\n\n/** The mediacentre widget. */\nfunction DirectiveFactory($compile:ICompileService) {\n return new Directive($compile);\n}\nDirectiveFactory.$inject = [\"$compile\"];\n\n// Preload translations\nnotif().onLangReady().promise.then((lang: any): void => {\n switch (lang) {\n default:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n }\n});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odeMediacentreWidgetModule\";\nangular.module( odeModuleName, []).directive( \"odeMediacentreWidget\", DirectiveFactory );\n"],"names":["resources","limitResources","hasUniversalis","initResources","this","initResourcesFavorites","initSignetFavorites","hasUniversalisResource","length","slice","fetchFavorites","apiUrl","http","get","response","status","data","favoriteResources","concat","console","warn","universalisResource","session","description","initializeUniversalis","_userPref","WidgetFrameworkFactory","instance","list","find","w","platformConf","name","WIDGET_NAME","MEDIACENTRE","userPref","notif","onSessionReady","promise","defaultIndex","schoolId","isArray","schools","findIndex","school","id","setSelectedSchool","idx","selectedSchool","$compile","restrict","template","scope","bindToController","controller","Controller","controllerAs","require","link","elem","attrs","controllers","ctrl","$apply","trackEvent","e","p","bubbles","event","detail","open","CustomEvent","TrackedActionFromWidget","mediacentre","currentTarget","dispatchEvent","DirectiveFactory","Directive","$inject","onLangReady","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[649],{5052:(e,t,i)=>{i.d(t,{Z:()=>n});const n='<div class="widget-applications"> <div class="widget-header"> <div class="subtitle"><i18n>my-apps.widget.title</i18n></div> <div class="widget-options"> <div class="widget-handle"><i class="fas fa-grip-vertical"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message link" ng-if="ctrl.apps.length===0"> <a href="/welcome" ng-click="trackEvent($event, {detail:{\'open\':\'more\'} })"> <i18n>my-apps.widget.more</i18n> </a> </div> <ul class="icon-grid" ng-if="ctrl.apps.length>0"> <li class="icon-grid-item" ng-repeat="app in ctrl.apps"> <a connector-lightbox-trigger="app" ng-href="[[app.address]]" ng-click="trackEvent($event, {detail:{\'open\':\'app\', \'app\':app} })" aria-label="[[app.displayName]]" target="[[app.target]]" rel="noopener" i18n-title="[[app.displayName]]" ng-switch="app.icon.indexOf(\'/\')"> <i ng-class="ctrl.getIconClass(app)" ng-switch-when="-1"></i> <img skin-src="[[app.icon]]" ng-switch-default alt="[[app.displayName]]"/> </a> </li> </ul> </div> <div class="widget-footer border-top border-ghost" ng-if="ctrl.apps.length!==0"> <div class="widget-footer-action"> <a class="link" href="/welcome" ng-click="trackEvent($event, {detail:{\'open\':\'more\'} })"> <i18n>my-apps.widget.options</i18n> </a> </div> </div> </div>'},1204:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var o=n(i(4202)),a=i(9419),p=function(){function e(e){this.themeSvc=e,this.apps=[]}return e.prototype.redirect=function(e){window.location.href=e},e.prototype.getIconClass=function(e){var t=this.themeSvc.getIconCode(e);return"ic-app-".concat(t," color-app-").concat(t)},e}(),s=function(){function e(){this.restrict="E",this.template=i(5052).Z,this.controller=["odeThemeHelperService",p],this.controllerAs="ctrl",this.require=["odeMyApps"]}return e.prototype.link=function(e,t,i,n){var o=n?n[0]:null;o&&((0,a.notif)().onSessionReady().promise.then(
|
|
1
|
+
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[649],{5052:(e,t,i)=>{i.d(t,{Z:()=>n});const n='<div class="widget-applications"> <div class="widget-header"> <div class="subtitle"><i18n>my-apps.widget.title</i18n></div> <div class="widget-options"> <div class="widget-handle"><i class="fas fa-grip-vertical"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message link" ng-if="ctrl.apps.length===0"> <a href="/welcome" ng-click="trackEvent($event, {detail:{\'open\':\'more\'} })"> <i18n>my-apps.widget.more</i18n> </a> </div> <ul class="icon-grid" ng-if="ctrl.apps.length>0"> <li class="icon-grid-item" ng-repeat="app in ctrl.apps"> <a connector-lightbox-trigger="app" ng-href="[[app.address]]" ng-click="trackEvent($event, {detail:{\'open\':\'app\', \'app\':app} })" aria-label="[[app.displayName]]" target="[[app.target]]" rel="noopener" i18n-title="[[app.displayName]]" ng-switch="app.icon.indexOf(\'/\')"> <i ng-class="ctrl.getIconClass(app)" ng-switch-when="-1"></i> <img skin-src="[[app.icon]]" ng-switch-default alt="[[app.displayName]]"/> </a> </li> </ul> </div> <div class="widget-footer border-top border-ghost" ng-if="ctrl.apps.length!==0"> <div class="widget-footer-action"> <a class="link" href="/welcome" ng-click="trackEvent($event, {detail:{\'open\':\'more\'} })"> <i18n>my-apps.widget.options</i18n> </a> </div> </div> </div>'},1204:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var o=n(i(4202)),a=i(9419),p=function(){function e(e){this.themeSvc=e,this.apps=[]}return e.prototype.redirect=function(e){window.location.href=e},e.prototype.getIconClass=function(e){var t=this.themeSvc.getIconCode(e);return"ic-app-".concat(t," color-app-").concat(t)},e}(),s=function(){function e(){this.restrict="E",this.template=i(5052).Z,this.controller=["odeThemeHelperService",p],this.controllerAs="ctrl",this.require=["odeMyApps"]}return e.prototype.link=function(e,t,i,n){var o=n?n[0]:null;o&&((0,a.notif)().onSessionReady().promise.then(function(){o.apps=(0,a.conf)().User.bookmarkedApps,e.$apply()}),e.trackEvent=function(e,t){var i,n;void 0===t.bubbles&&(t.bubbles=!0);var o=null;(t&&"app"===(null===(i=t.detail)||void 0===i?void 0:i.open)||t&&"more"===(null===(n=t.detail)||void 0===n?void 0:n.open))&&(o=new CustomEvent(a.TrackedActionFromWidget.myApps,t)),o&&e.currentTarget&&e.currentTarget.dispatchEvent(o)})},e}();(0,a.notif)().onLangReady().promise.then(function(e){(0,a.conf)().Platform.idiom.addKeys(i(4865))}),t.odeModuleName="odeMyAppsModule",o.default.module(t.odeModuleName,[]).directive("odeMyApps",function(){return new s})},4865:e=>{e.exports=JSON.parse('{"my-apps.widget.title":"Mes applis","my-apps.widget.options":"Plus","my-apps.widget.more":"Sélectionner vos applications favorites"}')}}]);
|
|
2
2
|
//# sourceMappingURL=my-apps.widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgets/my-apps/my-apps.widget.js","mappings":"gIAGA,QAFW,uwC,mLCDX,iBAEA,UAIA,aACI,WACKA,GAAA,KAAAA,SAAAA,EAGR,KAAAC,KAAiB,EADd,CAUJ,OARC,YAAAC,SAAA,SAAUC,GACTC,OAAOC,SAASC,KAAOH,CACxB,EAEA,YAAAI,aAAA,SAAaC,GACZ,IAAMC,EAAUC,KAAKV,SAASW,YAAYH,GAC1C,MAAO,iBAAUC,EAAO,sBAAcA,EACvC,EACD,EAdA,GAiBA,0BACI,KAAAG,SAAW,IACd,KAAAC,SAAW,UACX,KAAAC,WAAa,CAAC,wBAAyBC,GACvC,KAAAC,aAAe,OACZ,KAAAC,QAAU,CAAC,YA2Bf,QAzBI,YAAAC,KAAA,SAAKC,EAAoBC,EAAaC,EAAmBC,GACrD,IAAMC,EAAuBD,EAAcA,EAAY,GAAmB,KAC1EC,KAEN,IAAAC,SAAQC,iBAAiBC,QAAQC,
|
|
1
|
+
{"version":3,"file":"widgets/my-apps/my-apps.widget.js","mappings":"gIAGA,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/widgets/my-apps/my-apps.widget.ts"],"sourcesContent":["// Module\nvar code = \"<div class=\\\"widget-applications\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"><i18n>my-apps.widget.title</i18n></div> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\"><i class=\\\"fas fa-grip-vertical\\\"></i></div> </div> </div> <div class=\\\"widget-body\\\" dnd-nodrag> <div class=\\\"widget-empty-message link\\\" ng-if=\\\"ctrl.apps.length===0\\\"> <a href=\\\"/welcome\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'more'} })\\\"> <i18n>my-apps.widget.more</i18n> </a> </div> <ul class=\\\"icon-grid\\\" ng-if=\\\"ctrl.apps.length>0\\\"> <li class=\\\"icon-grid-item\\\" ng-repeat=\\\"app in ctrl.apps\\\"> <a connector-lightbox-trigger=\\\"app\\\" ng-href=\\\"[[app.address]]\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'app', 'app':app} })\\\" aria-label=\\\"[[app.displayName]]\\\" target=\\\"[[app.target]]\\\" rel=\\\"noopener\\\" i18n-title=\\\"[[app.displayName]]\\\" ng-switch=\\\"app.icon.indexOf('/')\\\"> <i ng-class=\\\"ctrl.getIconClass(app)\\\" ng-switch-when=\\\"-1\\\"></i> <img skin-src=\\\"[[app.icon]]\\\" ng-switch-default alt=\\\"[[app.displayName]]\\\"/> </a> </li> </ul> </div> <div class=\\\"widget-footer border-top border-ghost\\\" ng-if=\\\"ctrl.apps.length!==0\\\"> <div class=\\\"widget-footer-action\\\"> <a class=\\\"link\\\" href=\\\"/welcome\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'more'} })\\\"> <i18n>my-apps.widget.options</i18n> </a> </div> </div> </div>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective } from \"angular\";\nimport { IWebApp } from \"ode-ts-client\";\nimport { conf, notif, TrackedScope, TrackedAction, TrackedActionFromWidget } from \"../../utils\";\nimport { ThemeHelperService } from \"../../services\";\n\n/* Controller for the directive */\nclass Controller implements IController {\n constructor(\n\t\tpublic themeSvc: ThemeHelperService\n\t\t) {\n }\n\tapps:IWebApp[] = [];\n\tredirect( path:string ) {\n\t\twindow.location.href = path;\n\t};\n\n\tgetIconClass(app:IWebApp) {\n\t\tconst appCode = this.themeSvc.getIconCode(app);\n\t\treturn `ic-app-${appCode} color-app-${appCode}`;\n\t}\n}\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./my-apps.widget.html').default;\n\tcontroller = [\"odeThemeHelperService\", Controller];\n\tcontrollerAs = 'ctrl';\n require = ['odeMyApps'];\n\n link(scope:TrackedScope, elem:JQLite, attrs:IAttributes, controllers?:IController[]): void {\n const ctrl:Controller|null = controllers ? controllers[0] as Controller : null;\n\t\tif( ! ctrl ) return;\n\n\t\tnotif().onSessionReady().promise.then( () => {\n\t\t\tctrl.apps = conf().User.bookmarkedApps;\n\t\t\tscope.$apply();\n\t\t});\n\n\t\t// Give an opportunity to track some events from outside of this widget.\n\t\tscope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>) => {\n\t\t\t// Allow events to bubble up.\n\t\t\tif(typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n\t\t\tlet event = null;\n\t\t\tif( p && p.detail?.open==='app' ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.myApps, p );\n\t\t\t} else if( p && p.detail?.open==='more' ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.myApps, p );\n\t\t\t}\n\t\t\tif( event && e.currentTarget ) {\n\t\t\t\te.currentTarget.dispatchEvent(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** The my-apps widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odeMyAppsModule\";\nangular.module( odeModuleName, []).directive( \"odeMyApps\", DirectiveFactory );\n"],"names":["themeSvc","apps","redirect","path","window","location","href","getIconClass","app","appCode","this","getIconCode","restrict","template","controller","Controller","controllerAs","require","link","scope","elem","attrs","controllers","ctrl","notif","onSessionReady","promise","then","conf","User","bookmarkedApps","$apply","trackEvent","e","p","bubbles","event","detail","open","CustomEvent","TrackedActionFromWidget","myApps","currentTarget","dispatchEvent","onLangReady","lang","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[443],{7601:(t,e,r)=>{r.d(e,{Z:()=>i});const i='<style>.ptit-observatoire-widget-container{box-sizing:border-box;background:#358284;padding:10px;border-radius:6px;overflow:hidden}.ptit-observatoire-widget-content{display:flex;flex-direction:column;gap:10px;box-sizing:border-box;width:100%;height:100%;background-color:#fff;border-radius:3px;padding:10px}.ptit-observatoire-widget-form{width:100%;display:flex;flex-direction:column;gap:10px}.ptit-observatoire-widget-select{background-color:#fff;padding:15px;border:1px solid #c1c1ca;color:#c1c1ca;border-radius:10px}.ptit-observatoire-submit-button{display:flex;align-items:center;gap:10px;background-color:#173a37;color:#fff;border:none;padding:10px 15px;border-radius:30px}.ptit-observatoire-plus-icon{display:flex;align-items:center;justify-content:center;line-height:100%;text-align:center;background-color:#2c6262;border-radius:50%;width:30px;height:30px}.ptit-observatoire-modal-form{display:flex;flex-direction:column;gap:15px}.ptit-observatoire-modal-form-legend{text-transform:uppercase;color:#7caaac;font-weight:700}.ptit-observatoire-modal-form-textarea{width:100%}.ptit-observatoire-modal-options-container{display:flex;flex-wrap:wrap;gap:5px}</style> <div class="ptit-observatoire-widget-container"> <div class="ptit-observatoire-widget-content"> <p> <i18n>ptitObservatoire.title</i18n> </p> <div class="widget-body" dnd-nodrag> <form class="ptit-observatoire-widget-form" ng-submit="ctrl.startObservation()"> <select class="ptit-observatoire-widget-select" name="student" ng-model="ctrl.formData.student_id"> <option value="" selected="selected"> </option> <option ng-repeat="student in ctrl.studentsList" value="{{student.id}}"> {{student.fullName}} </option> </select> <button type="submit" class="ptit-observatoire-submit-button"> <span class="ptit-observatoire-plus-icon">+</span> <span> <i18n>ptitObservatoire.newObservation</i18n> </span> </button> </form> </div> </div> <ode-modal visible="ctrl.showLightbox" on-close="ctrl.showLightbox=false" size="lg" dnd-nodrag> <ode-modal-title> <h2> <i18n>ptitObservatoire.modal.title</i18n> </h2> </ode-modal-title> <ode-modal-body> <form class="ptit-observatoire-modal-form" ng-submit="ctrl.handleObservationSubmit(); ctrl.showLightbox=false"> <fieldset> <legend class="ptit-observatoire-modal-form-legend"> <i18n>ptitObservatoire.modal.observation</i18n> </legend> <textarea class="ptit-observatoire-modal-form-textarea" name="content" ng-model="ctrl.formData[\'content\']" i18n-placeholder="ptitObservatoire.modal.textarea.placeholder"></textarea> </fieldset> <fieldset> <legend class="ptit-observatoire-modal-form-legend"> <i18n>ptitObservatoire.modal.evaluation</i18n> </legend> <label for="strengths"> <input type="radio" id="strength" name="assessment_type" ng-model="ctrl.formData[\'assessment_type\']" ng-value="\'strength\'"/> <i18n>ptitObservatoire.modal.evaluation.strength</i18n> </label> <label for="neutral"> <input type="radio" id="neutral" name="assessment_type" ng-model="ctrl.formData[\'assessment_type\']" ng-value="\'neutral\'"/> <i18n>ptitObservatoire.modal.evaluation.neutral</i18n> </label> <label for="difficulties"> <input type="radio" id="difficulties" name="assessment_type" ng-model="ctrl.formData[\'assessment_type\']" ng-value="\'difficulties\'"/> <i18n>ptitObservatoire.modal.evaluation.difficulties</i18n> </label> </fieldset> <fieldset> <legend class="ptit-observatoire-modal-form-legend"> <i18n>ptitObservatoire.modal.categories</i18n> </legend> <div class="ptit-observatoire-modal-options-container"> <label ng-repeat="category in ctrl.observationCategories"> <input type="radio" name="{{category.name}}" ng-model="ctrl.formData[\'category_id\']" ng-value="category.id"/> {{ category.name }} </label> </div> </fieldset> <fieldset> <legend class="ptit-observatoire-modal-form-legend"> <i18n>ptitObservatoire.modal.options</i18n> </legend> <label> <input type="checkbox" ng-model="ctrl.formData[\'private\']"/> <i18n>ptitObservatoire.modal.options.private</i18n> </label> </fieldset> <button type="submit" class="ptit-observatoire-submit-button"> <i18n>ptitObservatoire.modal.save</i18n> </button> </form> </ode-modal-body> </ode-modal> </div>'},5883:function(t,e,r){var i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))(function(o,n){function a(t){try{l(i.next(t))}catch(t){n(t)}}function s(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,s)}l((i=i.apply(t,e||[])).next())})},n=this&&this.__generator||function(t,e){var r,i,o,n,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(n){return function(s){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(o=2&n[0]?i.return:n[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,n[1])).done)return o;switch(i=0,o&&(n=[2&n[0],o.value]),n[0]){case 0:case 1:o=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,i=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a.label=n[1];break}if(6===n[0]&&a.label<o[1]){a.label=o[1],o=n;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(n);break}o[2]&&a.ops.pop(),a.trys.pop();continue}n=e.call(t,a)}catch(t){n=[6,t],i=0}finally{r=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.odeModuleName=void 0;var s=a(r(4202)),l=r(9419),d=r(6731),c=function(){function t(){this.formData={},this.observationCategories=[],this.studentsList=[],this.showLightbox=!1}return t.prototype.startObservation=function(){this.formData.student_id&&(this.showLightbox=!0)},t.prototype.handleObservationSubmit=function(){return o(this,void 0,void 0,function(){var t;return n(this,function(e){switch(e.label){case 0:return t={data:{type:"observations",attributes:i(i({},this.formData),{teacher_id:1,date:(new Date).toISOString().substring(0,10)})}},[4,this.saveObservation(t)];case 1:return e.sent(),[2]}})})},t.prototype.saveObservation=function(t){return o(this,void 0,void 0,function(){var e;return n(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,(0,l.http)().postJson("/appregistry/ptitObservatoire/observations",t)];case 1:return r.sent(),d.notify.success("ptitObservatoire.notify.save.success"),[3,3];case 2:return e=r.sent(),console.error("Error saving observation:",e),d.notify.error("ptitObservatoire.notify.save.error"),[3,3];case 3:return[2]}})})},t}(),u=function(){function t(){this.restrict="E",this.template=r(7601).Z,this.scope={},this.bindToController=!0,this.controller=[c],this.controllerAs="ctrl",this.require=["odePtitObservatoireWidget"]}return t.prototype.link=function(t,e,r,i){return o(this,void 0,void 0,function(){var e,r;return n(this,function(o){switch(o.label){case 0:return(e=i?i[0]:null)?[4,Promise.all([this.getObservationCategories(),this.getStudentsList()])]:[2];case 1:return r=o.sent(),e.observationCategories=r[0],e.studentsList=r[1],t.$applyAsync(),[2]}})})},t.prototype.getStudentsList=function(){return o(this,void 0,void 0,function(){var t;return n(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,(0,l.http)().get("/appregistry/ptitObservatoire/students")];case 1:return[2,e.sent().map(function(t){return{id:t.id,fullName:t.attributes.full_name}})];case 2:return t=e.sent(),console.error("Error fetching students:",t),[2,[]];case 3:return[2]}})})},t.prototype.getObservationCategories=function(){return o(this,void 0,void 0,function(){var t;return n(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,(0,l.http)().get("/appregistry/ptitObservatoire/observations/categories")];case 1:return[2,e.sent().map(function(t){return{id:t.id,name:t.attributes.name}})];case 2:return t=e.sent(),console.error("Error fetching categories:",t),[2,[]];case 3:return[2]}})})},t}();(0,l.notif)().onLangReady().promise.then(function(t){(0,l.conf)().Platform.idiom.addKeys(r(5512))}),e.odeModuleName="odePtitObservatoireWidgetModule",s.default.module(e.odeModuleName,[]).directive("odePtitObservatoireWidget",function(){return new u})},5512:t=>{t.exports=JSON.parse('{"ptitObservatoire.title":"Centraliser mes observations","ptitObservatoire.newObservation":"Nouvelle observation","ptitObservatoire.selectStudent":"Sélectionner un élève","ptitObservatoire.modal.title":"Saisie de l\'Observation","ptitObservatoire.modal.observation":"Observation","ptitObservatoire.modal.evaluation":"Évaluation","ptitObservatoire.modal.evaluation.strength":"Forces","ptitObservatoire.modal.evaluation.neutral":"Neutre","ptitObservatoire.modal.evaluation.difficulties":"Difficultés","ptitObservatoire.modal.categories":"Catégories","ptitObservatoire.modal.options":"Options","ptitObservatoire.modal.options.private":"Observation privée","ptitObservatoire.modal.save":"Enregistrer l\'observation","ptitObservatoire.notify.save.success":"Observation enregistrée avec succès","ptitObservatoire.notify.save.error":"Une erreur est survenue lors de l\'enregistrement de l\'observation","ptitObservatoire.modal.textarea.placeholder":"Je suis bienveillant et factuel : J\'écris ce que j\'ai vu et entendu"}')}}]);
|
|
2
|
+
//# sourceMappingURL=ptit-observatoire-widget.widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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SAAUF,EAAQ/B,WAAWkC,UAFzB,I,OAML,O,WADAzB,QAAQC,MAAM,2BAA4B,GACnC,CAAC,EAAD,I,uBAIH,YAAAgB,yBAAN,W,8FAEc,O,sBAAA,IAAM,IAAArB,QAAOwB,IAAI,0D,OAC7B,MAAO,CAAP,EADY,SACDC,IAAI,SAACK,GAA2D,OAC1EH,GAAIG,EAASH,GACbI,KAAMD,EAASnC,WAAWoC,KAFgD,I,OAM3E,O,WADA3B,QAAQC,MAAM,6BAA8B,GACrC,CAAC,EAAD,I,uBAGV,EArDA,IA6DA,IAAA2B,SACEC,cACAC,QAAQC,KAAK,SAACC,IAGZ,IAAAC,QAAOC,SAASC,MAAMC,QAAQ,EAAQ,MAGzC,GAIY,EAAAC,cAAgB,kCAC7B,UACEC,OAAO,EAAAD,cAAe,IACtBE,UAAU,4BApBZ,WACC,OAAO,IAAIC,CACZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/ptit-observatoire-widget/ptit-observatoire-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \"<style>.ptit-observatoire-widget-container{box-sizing:border-box;background:#358284;padding:10px;border-radius:6px;overflow:hidden}.ptit-observatoire-widget-content{display:flex;flex-direction:column;gap:10px;box-sizing:border-box;width:100%;height:100%;background-color:#fff;border-radius:3px;padding:10px}.ptit-observatoire-widget-form{width:100%;display:flex;flex-direction:column;gap:10px}.ptit-observatoire-widget-select{background-color:#fff;padding:15px;border:1px solid #c1c1ca;color:#c1c1ca;border-radius:10px}.ptit-observatoire-submit-button{display:flex;align-items:center;gap:10px;background-color:#173a37;color:#fff;border:none;padding:10px 15px;border-radius:30px}.ptit-observatoire-plus-icon{display:flex;align-items:center;justify-content:center;line-height:100%;text-align:center;background-color:#2c6262;border-radius:50%;width:30px;height:30px}.ptit-observatoire-modal-form{display:flex;flex-direction:column;gap:15px}.ptit-observatoire-modal-form-legend{text-transform:uppercase;color:#7caaac;font-weight:700}.ptit-observatoire-modal-form-textarea{width:100%}.ptit-observatoire-modal-options-container{display:flex;flex-wrap:wrap;gap:5px}</style> <div class=\\\"ptit-observatoire-widget-container\\\"> <div class=\\\"ptit-observatoire-widget-content\\\"> <p> <i18n>ptitObservatoire.title</i18n> </p> <div class=\\\"widget-body\\\" dnd-nodrag> <form class=\\\"ptit-observatoire-widget-form\\\" ng-submit=\\\"ctrl.startObservation()\\\"> <select class=\\\"ptit-observatoire-widget-select\\\" name=\\\"student\\\" ng-model=\\\"ctrl.formData.student_id\\\"> <option value=\\\"\\\" selected=\\\"selected\\\"> </option> <option ng-repeat=\\\"student in ctrl.studentsList\\\" value=\\\"{{student.id}}\\\"> {{student.fullName}} </option> </select> <button type=\\\"submit\\\" class=\\\"ptit-observatoire-submit-button\\\"> <span class=\\\"ptit-observatoire-plus-icon\\\">+</span> <span> <i18n>ptitObservatoire.newObservation</i18n> </span> </button> </form> </div> </div> <ode-modal visible=\\\"ctrl.showLightbox\\\" on-close=\\\"ctrl.showLightbox=false\\\" size=\\\"lg\\\" dnd-nodrag> <ode-modal-title> <h2> <i18n>ptitObservatoire.modal.title</i18n> </h2> </ode-modal-title> <ode-modal-body> <form class=\\\"ptit-observatoire-modal-form\\\" ng-submit=\\\"ctrl.handleObservationSubmit(); ctrl.showLightbox=false\\\"> <fieldset> <legend class=\\\"ptit-observatoire-modal-form-legend\\\"> <i18n>ptitObservatoire.modal.observation</i18n> </legend> <textarea class=\\\"ptit-observatoire-modal-form-textarea\\\" name=\\\"content\\\" ng-model=\\\"ctrl.formData['content']\\\" i18n-placeholder=\\\"ptitObservatoire.modal.textarea.placeholder\\\"></textarea> </fieldset> <fieldset> <legend class=\\\"ptit-observatoire-modal-form-legend\\\"> <i18n>ptitObservatoire.modal.evaluation</i18n> </legend> <label for=\\\"strengths\\\"> <input type=\\\"radio\\\" id=\\\"strength\\\" name=\\\"assessment_type\\\" ng-model=\\\"ctrl.formData['assessment_type']\\\" ng-value=\\\"'strength'\\\"/> <i18n>ptitObservatoire.modal.evaluation.strength</i18n> </label> <label for=\\\"neutral\\\"> <input type=\\\"radio\\\" id=\\\"neutral\\\" name=\\\"assessment_type\\\" ng-model=\\\"ctrl.formData['assessment_type']\\\" ng-value=\\\"'neutral'\\\"/> <i18n>ptitObservatoire.modal.evaluation.neutral</i18n> </label> <label for=\\\"difficulties\\\"> <input type=\\\"radio\\\" id=\\\"difficulties\\\" name=\\\"assessment_type\\\" ng-model=\\\"ctrl.formData['assessment_type']\\\" ng-value=\\\"'difficulties'\\\"/> <i18n>ptitObservatoire.modal.evaluation.difficulties</i18n> </label> </fieldset> <fieldset> <legend class=\\\"ptit-observatoire-modal-form-legend\\\"> <i18n>ptitObservatoire.modal.categories</i18n> </legend> <div class=\\\"ptit-observatoire-modal-options-container\\\"> <label ng-repeat=\\\"category in ctrl.observationCategories\\\"> <input type=\\\"radio\\\" name=\\\"{{category.name}}\\\" ng-model=\\\"ctrl.formData['category_id']\\\" ng-value=\\\"category.id\\\"/> {{ category.name }} </label> </div> </fieldset> <fieldset> <legend class=\\\"ptit-observatoire-modal-form-legend\\\"> <i18n>ptitObservatoire.modal.options</i18n> </legend> <label> <input type=\\\"checkbox\\\" ng-model=\\\"ctrl.formData['private']\\\"/> <i18n>ptitObservatoire.modal.options.private</i18n> </label> </fieldset> <button type=\\\"submit\\\" class=\\\"ptit-observatoire-submit-button\\\"> <i18n>ptitObservatoire.modal.save</i18n> </button> </form> </ode-modal-body> </ode-modal> </div>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { conf, http, notif } from \"../../utils\";\nimport { notify } from \"../../services\";\n\ninterface Student {\n\tid: number,\n\tfullName: string\n}\n\ninterface ObservationCategory {\n\tid: number,\n\tname: string\n}\n\n/* Controller for the directive */\nclass Controller implements IController {\n\tformData: { [key: string]: string } = {};\n\tpublic observationCategories: ObservationCategory[] = [];\n\tpublic studentsList: Student[] = [];\n\tpublic showLightbox = false;\n\n\n\tstartObservation() {\n\t\tif (this.formData.student_id) {\n\t\t\tthis.showLightbox = true;\n\t\t}\n\t}\n\n\tasync handleObservationSubmit() {\n\t\tconst body = {\n\t\t\tdata: {\n\t\t\t\ttype: \"observations\",\n\t\t\t\tattributes: {\n\t\t\t\t\t...this.formData,\n\t\t\t\t\t\"teacher_id\": 1, // TODO: change when respone updated from ptit observatoire\n\t\t\t\t\t\"date\": new Date().toISOString().substring(0, 10),\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait this.saveObservation(body)\n\t}\n\n\tasync saveObservation(body: any): Promise<void> {\n\t\ttry {\n\t\t\tawait http().postJson(\"/appregistry/ptitObservatoire/observations\", body)\n\t\t\tnotify.success(\"ptitObservatoire.notify.save.success\")\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error saving observation:\", error);\n\t\t\tnotify.error(\"ptitObservatoire.notify.save.error\")\n\t\t}\n\t}\n}\n\n/* Directive */\nclass Directive implements IDirective<IScope, JQLite, IAttributes, IController[]> {\n\trestrict = 'E';\n\ttemplate = require('./ptit-observatoire-widget.widget.html').default;\n\tscope = {};\n\tbindToController = true;\n\tcontroller = [Controller];\n\tcontrollerAs = 'ctrl';\n\trequire = ['odePtitObservatoireWidget'];\n\n\tasync link(scope: IScope, elem: JQLite, attrs: IAttributes, controllers?: IController[]) {\n\t\tconst ctrl: Controller | null = controllers\n\t\t\t? (controllers[0] as Controller)\n\t\t\t: null;\n\t\tif (!ctrl) {\n\t\t\treturn;\n\t\t}\n\n\t\t[ctrl.observationCategories, ctrl.studentsList] = await Promise.all([\n\t\t\tthis.getObservationCategories(),\n\t\t\tthis.getStudentsList(),\n\t\t]);\n\n\t\tscope.$applyAsync();\n\t}\n\n\tasync getStudentsList(): Promise<Student[]> {\n\t\ttry {\n\t\t\tconst res = await http().get(\"/appregistry/ptitObservatoire/students\");\n\n\t\t\treturn res.map((\n\t\t\t\tstudent: { id: number, attributes: { full_name: string } }\n\t\t\t) => ({\n\t\t\t\tid: student.id,\n\t\t\t\tfullName: student.attributes.full_name\n\t\t\t}));\n\t\t} catch (e) {\n\t\t\tconsole.error(\"Error fetching students:\", e);\n\t\t\treturn [];\n\t\t}\n\t}\n\n\tasync getObservationCategories(): Promise<ObservationCategory[]> {\n\t\ttry {\n\t\t\tconst res = await http().get(\"/appregistry/ptitObservatoire/observations/categories\");\n\t\t\treturn res.map((category: { id: number; attributes: { name: string } }) => ({\n\t\t\t\tid: category.id,\n\t\t\t\tname: category.attributes.name,\n\t\t\t}));\n\t\t} catch (e) {\n\t\t\tconsole.error(\"Error fetching categories:\", e);\n\t\t\treturn [];\n\t\t}\n\t}\n}\n\n/** The P'tit observatoire widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif()\n\t.onLangReady()\n\t.promise.then((lang) => {\n\t\tswitch (lang) {\n\t\t\tdefault:\n\t\t\t\tconf().Platform.idiom.addKeys(require(\"./i18n/fr.json\"));\n\t\t\t\tbreak;\n\t\t}\n\t});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odePtitObservatoireWidgetModule\";\nangular\n\t.module(odeModuleName, [])\n\t.directive(\"odePtitObservatoireWidget\", DirectiveFactory);\n"],"names":["formData","observationCategories","studentsList","showLightbox","startObservation","this","student_id","handleObservationSubmit","body","data","type","attributes","Date","toISOString","substring","saveObservation","http","postJson","notify","success","console","error","restrict","template","scope","bindToController","controller","Controller","controllerAs","require","link","elem","attrs","controllers","ctrl","Promise","all","getObservationCategories","getStudentsList","$applyAsync","get","map","student","id","fullName","full_name","category","name","notif","onLangReady","promise","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[165],{8265:(t,e,n)=>{n.d(e,{Z:()=>a});const a=' <style>.widget-qwant .widget-header{border:0}.widget-qwant .widget-body img{margin:auto}</style> <div class="widget-qwant"> <div class="widget-header"> <div class="widget-options"> <div class="widget-handle"><i class="fas fa-grip-vertical"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message"> <div class="row row-cols-1 align-items-center"> <div class="mb-12"> <a href="https://www.qwant.com" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':\'qwant\'} })"> <img src="/assets/widgets/qwant/logo-qwant.svg" width="77" height="75" alt="Qwant"> </a> </div> </div> <form method="GET" target="_blank" action="https://www.qwant.com" autocomplete="off"> <div class="row row-cols-1 align-items-center"> <label class="sr-only" for="inputQwantQ" translate content="search"></label> <div class="input-group mb-2"> <input type="text" id="inputQwantQ" class="form-control" name="q" maxlength="255" i18n-placeholder="search"/> <input type="hidden" name="l" value="fr"/> <button class="btn btn-outline-secondary" aria-labelledby="inputQwantQ" ng-click="trackEvent($event, {detail:{\'search\':\'launch\'} })"> <i class="ic-search"></i> </button> </div> </div> </form> </div> </div> </div>'},3399:function(t,e,n){var a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.odeModuleName=void 0;var i=a(n(4202)),o=n(9419),d=function(){function t(){this.restrict="E",this.template=n(8265).Z}return t.prototype.link=function(t){t.trackEvent=function(t,e){var n,a;void 0===e.bubbles&&(e.bubbles=!0);var i=null;!e||"qwant"!==(null===(n=e.detail)||void 0===n?void 0:n.open)&&"string"!=typeof(null===(a=e.detail)||void 0===a?void 0:a.search)||(i=new CustomEvent(o.TrackedActionFromWidget.qwant,e)),i&&t.currentTarget&&t.currentTarget.dispatchEvent(i)}},t}();(0,o.notif)().onLangReady().promise.then(
|
|
1
|
+
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[165],{8265:(t,e,n)=>{n.d(e,{Z:()=>a});const a=' <style>.widget-qwant .widget-header{border:0}.widget-qwant .widget-body img{margin:auto}</style> <div class="widget-qwant"> <div class="widget-header"> <div class="widget-options"> <div class="widget-handle"><i class="fas fa-grip-vertical"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message"> <div class="row row-cols-1 align-items-center"> <div class="mb-12"> <a href="https://www.qwant.com" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':\'qwant\'} })"> <img src="/assets/widgets/qwant/logo-qwant.svg" width="77" height="75" alt="Qwant"> </a> </div> </div> <form method="GET" target="_blank" action="https://www.qwant.com" autocomplete="off"> <div class="row row-cols-1 align-items-center"> <label class="sr-only" for="inputQwantQ" translate content="search"></label> <div class="input-group mb-2"> <input type="text" id="inputQwantQ" class="form-control" name="q" maxlength="255" i18n-placeholder="search"/> <input type="hidden" name="l" value="fr"/> <button class="btn btn-outline-secondary" aria-labelledby="inputQwantQ" ng-click="trackEvent($event, {detail:{\'search\':\'launch\'} })"> <i class="ic-search"></i> </button> </div> </div> </form> </div> </div> </div>'},3399:function(t,e,n){var a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.odeModuleName=void 0;var i=a(n(4202)),o=n(9419),d=function(){function t(){this.restrict="E",this.template=n(8265).Z}return t.prototype.link=function(t){t.trackEvent=function(t,e){var n,a;void 0===e.bubbles&&(e.bubbles=!0);var i=null;!e||"qwant"!==(null===(n=e.detail)||void 0===n?void 0:n.open)&&"string"!=typeof(null===(a=e.detail)||void 0===a?void 0:a.search)||(i=new CustomEvent(o.TrackedActionFromWidget.qwant,e)),i&&t.currentTarget&&t.currentTarget.dispatchEvent(i)}},t}();(0,o.notif)().onLangReady().promise.then(function(t){(0,o.conf)().Platform.idiom.addKeys(n(2467))}),e.odeModuleName="odeQwantModule",i.default.module(e.odeModuleName,[]).directive("odeQwant",function(){return new d})},2467:t=>{t.exports=JSON.parse('{"qwant-widget.widget.title":"Qwant","qwant-junior":"QwantJunior","qwant":"Qwant"}')}}]);
|
|
2
2
|
//# sourceMappingURL=qwant-widget.widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgets/qwant-widget/qwant-widget.widget.js","mappings":"gIAGA,QAFW,guC,mLCDX,iBACA,UAGA,0BACI,KAAAA,SAAW,IACd,KAAAC,SAAW,SAiBZ,QAfC,YAAAC,KAAA,SAAKC,GAEJA,EAAMC,WAAa,SAACC,EAASC,G,aAEJ,IAAdA,EAAEC,UAAyBD,EAAEC,SAAU,GAEjD,IAAIC,EAAQ,MACRF,GAAuB,WAAT,QAAR,EAAAA,EAAEG,cAAM,eAAEC,OAA4C,iBAAX,QAAR,EAAAJ,EAAEG,cAAM,eAAEE,UACtDH,EAAQ,IAAII,YAAa,EAAAC,wBAAwBC,MAAOR,IAErDE,GAASH,EAAEU,eACdV,EAAEU,cAAcC,cAAcR,EAEhC,CACD,EACD,EAnBA,IA2BA,IAAAS,SAAQC,cAAcC,QAAQC,
|
|
1
|
+
{"version":3,"file":"widgets/qwant-widget/qwant-widget.widget.js","mappings":"gIAGA,QAFW,guC,mLCDX,iBACA,UAGA,0BACI,KAAAA,SAAW,IACd,KAAAC,SAAW,SAiBZ,QAfC,YAAAC,KAAA,SAAKC,GAEJA,EAAMC,WAAa,SAACC,EAASC,G,aAEJ,IAAdA,EAAEC,UAAyBD,EAAEC,SAAU,GAEjD,IAAIC,EAAQ,MACRF,GAAuB,WAAT,QAAR,EAAAA,EAAEG,cAAM,eAAEC,OAA4C,iBAAX,QAAR,EAAAJ,EAAEG,cAAM,eAAEE,UACtDH,EAAQ,IAAII,YAAa,EAAAC,wBAAwBC,MAAOR,IAErDE,GAASH,EAAEU,eACdV,EAAEU,cAAcC,cAAcR,EAEhC,CACD,EACD,EAnBA,IA2BA,IAAAS,SAAQC,cAAcC,QAAQC,KAAM,SAAAC,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,GAIa,EAAAC,cAAgB,iBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,WAd9C,WACC,OAAO,IAAIC,CACZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/qwant-widget/qwant-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/qwant-widget/qwant-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \" <style>.widget-qwant .widget-header{border:0}.widget-qwant .widget-body img{margin:auto}</style> <div class=\\\"widget-qwant\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\"><i class=\\\"fas fa-grip-vertical\\\"></i></div> </div> </div> <div class=\\\"widget-body\\\" dnd-nodrag> <div class=\\\"widget-empty-message\\\"> <div class=\\\"row row-cols-1 align-items-center\\\"> <div class=\\\"mb-12\\\"> <a href=\\\"https://www.qwant.com\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" ng-click=\\\"trackEvent($event, {detail:{'open':'qwant'} })\\\"> <img src=\\\"/assets/widgets/qwant/logo-qwant.svg\\\" width=\\\"77\\\" height=\\\"75\\\" alt=\\\"Qwant\\\"> </a> </div> </div> <form method=\\\"GET\\\" target=\\\"_blank\\\" action=\\\"https://www.qwant.com\\\" autocomplete=\\\"off\\\"> <div class=\\\"row row-cols-1 align-items-center\\\"> <label class=\\\"sr-only\\\" for=\\\"inputQwantQ\\\" translate content=\\\"search\\\"></label> <div class=\\\"input-group mb-2\\\"> <input type=\\\"text\\\" id=\\\"inputQwantQ\\\" class=\\\"form-control\\\" name=\\\"q\\\" maxlength=\\\"255\\\" i18n-placeholder=\\\"search\\\"/> <input type=\\\"hidden\\\" name=\\\"l\\\" value=\\\"fr\\\"/> <button class=\\\"btn btn-outline-secondary\\\" aria-labelledby=\\\"inputQwantQ\\\" ng-click=\\\"trackEvent($event, {detail:{'search':'launch'} })\\\"> <i class=\\\"ic-search\\\"></i> </button> </div> </div> </form> </div> </div> </div>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { conf, notif, TrackedAction, TrackedScope, TrackedActionFromWidget } from \"../../utils\";\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./qwant-widget.widget.html').default;\n\n\tlink(scope:TrackedScope) {\n\t\t// Give an opportunity to track some events from outside of this widget.\n\t\tscope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>) => {\n\t\t\t// Allow events to bubble up.\n\t\t\tif(typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n\t\t\tlet event = null;\n\t\t\tif( p && (p.detail?.open==='qwant' || typeof p.detail?.search==='string') ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.qwant, p );\n\t\t\t}\n\t\t\tif( event && e.currentTarget ) {\n\t\t\t\te.currentTarget.dispatchEvent(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** The qwant widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odeQwantModule\";\nangular.module( odeModuleName, []).directive( \"odeQwant\", DirectiveFactory );\n"],"names":["restrict","template","link","scope","trackEvent","e","p","bubbles","event","detail","open","search","CustomEvent","TrackedActionFromWidget","qwant","currentTarget","dispatchEvent","notif","onLangReady","promise","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[932],{7072:(e,d,i)=>{i.d(d,{Z:()=>t});const t=' <div class="widget-record"> <div class="widget-header"> <div class="subtitle"><i18n>record-me.widget.title</i18n></div> <div class="widget-options"> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body flex-wrap justify-content-center" ode-recorder dnd-nodrag></div> </div> '},1317:function(e,d,i){var t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0}),d.odeModuleName=void 0;var o=t(i(4202)),r=i(9419),s=function(){this.restrict="E",this.template=i(7072).Z};(0,r.notif)().onLangReady().promise.then(
|
|
1
|
+
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[932],{7072:(e,d,i)=>{i.d(d,{Z:()=>t});const t=' <div class="widget-record"> <div class="widget-header"> <div class="subtitle"><i18n>record-me.widget.title</i18n></div> <div class="widget-options"> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body flex-wrap justify-content-center" ode-recorder dnd-nodrag></div> </div> '},1317:function(e,d,i){var t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0}),d.odeModuleName=void 0;var o=t(i(4202)),r=i(9419),s=function(){this.restrict="E",this.template=i(7072).Z};(0,r.notif)().onLangReady().promise.then(function(e){(0,r.conf)().Platform.idiom.addKeys(i(6299))}),d.odeModuleName="odeRecordMeModule",o.default.module(d.odeModuleName,[]).directive("odeRecordMe",function(){return new s})},6299:e=>{e.exports=JSON.parse('{"record-me.widget.title":"Le studio"}')}}]);
|
|
2
2
|
//# sourceMappingURL=record-me.widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgets/record-me/record-me.widget.js","mappings":"gIAGA,QAFW,0X,mLCDX,iBACA,UAGA,aACI,KAAAA,SAAW,IACd,KAAAC,SAAW,SACZ,GAQA,IAAAC,SAAQC,cAAcC,QAAQC,
|
|
1
|
+
{"version":3,"file":"widgets/record-me/record-me.widget.js","mappings":"gIAGA,QAFW,0X,mLCDX,iBACA,UAGA,aACI,KAAAA,SAAW,IACd,KAAAC,SAAW,SACZ,GAQA,IAAAC,SAAQC,cAAcC,QAAQC,KAAM,SAAAC,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,GAIa,EAAAC,cAAgB,oBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,cAd9C,WACC,OAAO,IAAIC,CACZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/record-me/record-me.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/record-me/record-me.widget.ts"],"sourcesContent":["// Module\nvar code = \" <div class=\\\"widget-record\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"><i18n>record-me.widget.title</i18n></div> <div class=\\\"widget-options\\\"> <div class=\\\"widget-handle\\\" title=\\\"Déplacer le widget\\\"><i class=\\\"fas fa-grip-vertical\\\" aria-hidden=\\\"true\\\"></i></div> </div> </div> <div class=\\\"widget-body flex-wrap justify-content-center\\\" ode-recorder dnd-nodrag></div> </div> \";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { conf, notif } from \"../../utils\";\n\n/* Directive */\nclass Directive implements IDirective<IScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./record-me.widget.html').default;\n}\n\n/** The my-apps widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odeRecordMeModule\";\nangular.module( odeModuleName, []).directive( \"odeRecordMe\", DirectiveFactory );\n"],"names":["restrict","template","notif","onLangReady","promise","then","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[390],{4643:(e,t,i)=>{i.d(t,{Z:()=>n});const n=' <div class="widget-rss"> <div class="widget-header"> <div class="subtitle"><i18n>rss-widget.widget.title</i18n></div> <div class="widget-options"> <div class="tools"> <a href="#" class="tool tool-option" i18n-title="rss-widget.widget.channel.config" ng-if="ctrl.canAddFeed" ng-click="ctrl.display.edition = true"> <i class="fas fa-cog"></i> </a> </div> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message link" ng-click="ctrl.display.edition = true" ng-if="ctrl.channel===undefined || ctrl.channel.feeds.length === 0"> <i18n>rss-widget.widget.empty.info</i18n> </div> <div class="widget-empty-message link" ng-if="ctrl.channel && ctrl.channel.feeds.length > 0 && ctrl.feeds.length === 0"> <i18n>rss-widget.widget.channel.feed.no.result</i18n> </div> <div class="rss-feed" ng-if="ctrl.feeds !== undefined" ng-repeat="feed in ctrl.feeds track by $index"> <div class="feed-title" ng-click="ctrl.showOrHideFeed($index)">[[feed.title]]</div> <ul class="list" ng-show="ctrl.display.selectedFeed === [[$index]]"> <li class="item link" ng-repeat="item in feed.Items track by $index"> <a href="[[item.link]]" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':item.link} })"> <div class="title">[[item.title]]</div> <div class="meta">[[ctrl.formatDate(item.pubDate)]]</div> <div class="meta" ng-bind-html="item.description"></div> </a> </li> </ul> </div> </div> </div> <ode-modal visible="ctrl.display.edition" on-close="ctrl.display.edition = false" dnd-nodrag> <ode-modal-title> <i18n ng-if="!ctrl.display.feedEdition">rss-widget.widget.channel.feed.list</i18n> <i18n ng-if="ctrl.display.feedEdition">rss-widget.widget.channel.feed.edit</i18n> </ode-modal-title> <ode-modal-body> <div ng-if="!ctrl.display.feedEdition"> <p ng-if="ctrl.channel.feeds.length === 0"><i18n>rss-widget.widget.channel.undefined</i18n></p> <table class="table table-hover" ng-if="ctrl.channel.feeds.length > 0"> <thead> <tr class="bg-secondary text-light"> <th><i18n>rss-widget.widget.channel.feed.title</i18n></th> <th><i18n>rss-widget.widget.channel.feed.show</i18n></th> <th></th> </tr> </thead> <tbody> <tr class="c-pointer" ng-repeat="feed in ctrl.channel.feeds track by $index" ng-class="{ \'table-active\' : ctrl.display.feedEdition && $index === ctrl.selectedFeedIndex }"> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].title]]</td> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].show]]</td> <td ng-click="ctrl.removeFeed($index)"> <button type="button" class="btn-close" aria-label="Close"></button> </td> </tr> </tbody> </table> </div> <form autocomplete="off" id="formFeedEdition" ng-if="ctrl.display.feedEdition"> <div class="form-group row"> <label for="inputFeedTitle" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.title</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.title.placeholder" id="inputFeedTitle" class="form-control" ng-model="ctrl.selectedFeed.title"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedUrl" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.url</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.url.placeholder" id="inputFeedUrl" class="form-control" ng-model="ctrl.selectedFeed.link"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedShow" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.show</i18n></label> <div class="col-sm-8"> <select id="inputFeedShow" class="form-control" ng-options="n for n in ctrl.showValues" ng-model="ctrl.selectedFeed.show"></select> </div> </div> </form> </ode-modal-body> <ode-modal-footer> <div ng-if="!ctrl.display.feedEdition && ctrl.canAddFeed"> <button class="btn btn-primary" ng-click="ctrl.openFeedEdition()" translate content="rss-widget.widget.channel.feed.add"></button> </div> <div ng-if="ctrl.display.feedEdition"> <button form="formFeedEdition" type="reset" class="btn btn-light" ng-click="ctrl.closeFeedEdition()"> <i18n>rss-widget.widget.channel.feed.cancel</i18n> </button> <button form="formFeedEdition" type="submit" class="btn btn-primary" ng-click="ctrl.saveFeed()"> <i18n>rss-widget.widget.channel.feed.save</i18n> </button> </div> </ode-modal-footer> </ode-modal>'},7377:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var d=n(i(4202)),l=i(9419),s=function(){function e(){this.channel=void 0,this.feeds=[],this.totalFeeds=10,this.defaultShow=3,this.showValues=[1,2,3,4,5,6,7,8,9,10],this.display={edition:!1,feedEdition:!1,selectedFeed:0}}return e.prototype.initFeeds=function(){var e=this;return void 0===this.channel?(0,l.http)().get("/rss/channels").then(
|
|
1
|
+
"use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[390],{4643:(e,t,i)=>{i.d(t,{Z:()=>n});const n=' <div class="widget-rss"> <div class="widget-header"> <div class="subtitle"><i18n>rss-widget.widget.title</i18n></div> <div class="widget-options"> <div class="tools"> <a href="#" class="tool tool-option" i18n-title="rss-widget.widget.channel.config" ng-if="ctrl.canAddFeed" ng-click="ctrl.display.edition = true"> <i class="fas fa-cog"></i> </a> </div> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message link" ng-click="ctrl.display.edition = true" ng-if="ctrl.channel===undefined || ctrl.channel.feeds.length === 0"> <i18n>rss-widget.widget.empty.info</i18n> </div> <div class="widget-empty-message link" ng-if="ctrl.channel && ctrl.channel.feeds.length > 0 && ctrl.feeds.length === 0"> <i18n>rss-widget.widget.channel.feed.no.result</i18n> </div> <div class="rss-feed" ng-if="ctrl.feeds !== undefined" ng-repeat="feed in ctrl.feeds track by $index"> <div class="feed-title" ng-click="ctrl.showOrHideFeed($index)">[[feed.title]]</div> <ul class="list" ng-show="ctrl.display.selectedFeed === [[$index]]"> <li class="item link" ng-repeat="item in feed.Items track by $index"> <a href="[[item.link]]" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':item.link} })"> <div class="title">[[item.title]]</div> <div class="meta">[[ctrl.formatDate(item.pubDate)]]</div> <div class="meta" ng-bind-html="item.description"></div> </a> </li> </ul> </div> </div> </div> <ode-modal visible="ctrl.display.edition" on-close="ctrl.display.edition = false" dnd-nodrag> <ode-modal-title> <i18n ng-if="!ctrl.display.feedEdition">rss-widget.widget.channel.feed.list</i18n> <i18n ng-if="ctrl.display.feedEdition">rss-widget.widget.channel.feed.edit</i18n> </ode-modal-title> <ode-modal-body> <div ng-if="!ctrl.display.feedEdition"> <p ng-if="ctrl.channel.feeds.length === 0"><i18n>rss-widget.widget.channel.undefined</i18n></p> <table class="table table-hover" ng-if="ctrl.channel.feeds.length > 0"> <thead> <tr class="bg-secondary text-light"> <th><i18n>rss-widget.widget.channel.feed.title</i18n></th> <th><i18n>rss-widget.widget.channel.feed.show</i18n></th> <th></th> </tr> </thead> <tbody> <tr class="c-pointer" ng-repeat="feed in ctrl.channel.feeds track by $index" ng-class="{ \'table-active\' : ctrl.display.feedEdition && $index === ctrl.selectedFeedIndex }"> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].title]]</td> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].show]]</td> <td ng-click="ctrl.removeFeed($index)"> <button type="button" class="btn-close" aria-label="Close"></button> </td> </tr> </tbody> </table> </div> <form autocomplete="off" id="formFeedEdition" ng-if="ctrl.display.feedEdition"> <div class="form-group row"> <label for="inputFeedTitle" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.title</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.title.placeholder" id="inputFeedTitle" class="form-control" ng-model="ctrl.selectedFeed.title"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedUrl" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.url</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.url.placeholder" id="inputFeedUrl" class="form-control" ng-model="ctrl.selectedFeed.link"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedShow" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.show</i18n></label> <div class="col-sm-8"> <select id="inputFeedShow" class="form-control" ng-options="n for n in ctrl.showValues" ng-model="ctrl.selectedFeed.show"></select> </div> </div> </form> </ode-modal-body> <ode-modal-footer> <div ng-if="!ctrl.display.feedEdition && ctrl.canAddFeed"> <button class="btn btn-primary" ng-click="ctrl.openFeedEdition()" translate content="rss-widget.widget.channel.feed.add"></button> </div> <div ng-if="ctrl.display.feedEdition"> <button form="formFeedEdition" type="reset" class="btn btn-light" ng-click="ctrl.closeFeedEdition()"> <i18n>rss-widget.widget.channel.feed.cancel</i18n> </button> <button form="formFeedEdition" type="submit" class="btn btn-primary" ng-click="ctrl.saveFeed()"> <i18n>rss-widget.widget.channel.feed.save</i18n> </button> </div> </ode-modal-footer> </ode-modal>'},7377:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var d=n(i(4202)),l=i(9419),s=function(){function e(){this.channel=void 0,this.feeds=[],this.totalFeeds=10,this.defaultShow=3,this.showValues=[1,2,3,4,5,6,7,8,9,10],this.display={edition:!1,feedEdition:!1,selectedFeed:0}}return e.prototype.initFeeds=function(){var e=this;return void 0===this.channel?(0,l.http)().get("/rss/channels").then(function(t){return t&&t.length>0?e.channel=t[0]:e.channel={feeds:[]},e.loadFeeds(0)}).catch(function(t){console.warn("[widget.rss] failed to initFeeds: ",t),e.channel={feeds:[]}}):this.loadFeeds(0)},e.prototype.loadFeeds=function(e){var t=this;return this.feeds=[],Promise.all(this.channel.feeds.map(function(i){var n=i.title;return null!==i.link&&""!==i.link?(0,l.http)().get("/rss/feed/items?url="+encodeURIComponent(i.link)+"&force="+e).then(function(e){"object"!=typeof e||e.title||(e.title=n),200===e.status&&t.feeds.length<t.totalFeeds&&(void 0!==e.Items&&null!=i.show&&e.Items.length>i.show&&(e.Items=e.Items.slice(0,i.show)),t.feeds.push(e))}).catch(function(e){console.warn("[widget.rss] failed to loadFeeds: ",e)}):Promise.resolve()})).then(function(e){})},Object.defineProperty(e.prototype,"canAddFeed",{get:function(){var e=$(window).width();return this.channel&&this.channel.feeds.length<this.totalFeeds&&("number"!=typeof e||e>=992)},enumerable:!1,configurable:!0}),e.prototype.openFeedEdition=function(e){"number"==typeof e&&e>=0&&e<this.totalFeeds?(this.selectedFeed=d.default.copy(this.channel.feeds[e]),this.selectedFeedIndex=e):(this.selectedFeed={title:"",link:"",show:3},this.selectedFeedIndex=-1),this.display.feedEdition=!0},e.prototype.closeFeedEdition=function(){this.display.feedEdition=!1,this.selectedFeed=void 0,this.selectedFeedIndex=void 0},e.prototype.removeFeed=function(e){"number"==typeof e&&e>=0&&e<this.totalFeeds&&(this.channel.feeds.splice(e,1),this.saveChannel())},e.prototype.validFeed=function(e){return e&&e.title&&""!==e.title.trim()&&e.link&&""!==e.link.trim()},e.prototype.saveFeed=function(){"number"==typeof this.selectedFeedIndex&&this.validFeed(this.selectedFeed)&&this.selectedFeed&&(this.selectedFeedIndex>=0&&this.selectedFeedIndex<this.totalFeeds?this.channel.feeds[this.selectedFeedIndex]=this.selectedFeed:this.channel.feeds.push(this.selectedFeed),this.saveChannel()),this.closeFeedEdition()},e.prototype.saveChannel=function(){this.channel._id?this.editChannel():this.createChannel()},e.prototype.createChannel=function(){var e=this;this.channel?(0,l.http)().postJson("/rss/channel",this.channel).then(function(t){e.channel._id=t._id,e.loadFeeds(0)}):console.log("createChannel : channel is undefined")},e.prototype.editChannel=function(){var e=this;this.channel&&this.channel._id?(0,l.http)().putJson("/rss/channel/"+this.channel._id,{feeds:this.channel.feeds}).then(function(t){e.loadFeeds(0)}):console.log("editChannel : channel is undefined")},e.prototype.showOrHideFeed=function(e){this.display.selectedFeed===e?this.display.selectedFeed=void 0:this.display.selectedFeed=e},e.prototype.formatDate=function(e){return("number"==typeof e?l.L10n.unix(e):l.L10n.moment(e,void 0,"en")).locale("fr").format("dddd DD MMMM YYYY HH:mm")},e}(),o=function(){function e(){this.restrict="E",this.template=i(4643).Z,this.controller=[s],this.controllerAs="ctrl",this.require=["odeRssWidget"]}return e.prototype.link=function(e,t,i,n){var d=n?n[0]:null;d&&(d.initFeeds().then(function(){e.$apply()}),e.trackEvent=function(e,t){var i;void 0===t.bubbles&&(t.bubbles=!0);var n=null;t&&"string"==typeof(null===(i=t.detail)||void 0===i?void 0:i.open)&&(n=new CustomEvent(l.TrackedActionFromWidget.rss,t)),n&&e.currentTarget&&e.currentTarget.dispatchEvent(n)})},e}();(0,l.notif)().onLangReady().promise.then(function(e){(0,l.conf)().Platform.idiom.addKeys(i(2546))}),t.odeModuleName="odeRssWidgetModule",d.default.module(t.odeModuleName,[]).directive("odeRssWidget",function(){return new o})},2546:e=>{e.exports=JSON.parse('{"rss-widget.widget.title":"RSS","rss-widget.widget.channel.config":"Configurer","rss-widget.widget.channel.feed.add":"Ajouter un flux","rss-widget.widget.channel.feed.cancel":"Retour","rss-widget.widget.channel.feed.edit":"Edition d\'un flux","rss-widget.widget.channel.feed.list":"Liste des flux","rss-widget.widget.channel.feed.no.result":"Aucun résultat","rss-widget.widget.channel.feed.read.more":"Voir plus","rss-widget.widget.channel.feed.remove":"Supprimer le flux","rss-widget.widget.channel.feed.save":"Enregistrer","rss-widget.widget.channel.feed.show":"Nombre d\'articles à afficher","rss-widget.widget.channel.feed.title":"Titre","rss-widget.widget.channel.feed.update":"Actualiser","rss-widget.widget.channel.feed.url":"Adresse du flux","rss-widget.widget.channel.refresh":"Rafraîchir","rss-widget.widget.channel.undefined":"Aucun flux configuré","rss-widget.widget.channel.feed.title.placeholder":"Saisissez le titre du nouveau flux RSS","rss-widget.widget.channel.feed.url.placeholder":"Saisissez l\'Url du nouveau flux RSS","rss-widget.widget.empty.info":"Ajoutez un flux RSS pour voir vos derniers articles"}')}}]);
|
|
2
2
|
//# sourceMappingURL=rss-widget.widget.js.map
|