"use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } (function () { "use strict"; /** * NewsComponentCtrl News component controller * Allows to construct a news card. Requires that the newsContainerComponent * is present. */ var NewsComponentCtrl = /*#__PURE__*/function () { /** * constructor News component constructor * @param {Object} constant JSON object with reusable static constants * @param {Object} NewCompModal Oject that allows modal creations * @param {Object} $document Angular wrapper for the the window.document object * @param {Object} $translate */ function NewsComponentCtrl(constant, NewCompModal, $document, $translate) { _classCallCheck(this, NewsComponentCtrl); this.imgPath = constant.imgPath; this.newCompModal = NewCompModal; this.$document = $document; this.$translate = $translate; this.isCalendarVisible = false; } /** * openDialog Open the news dialog on click event */ _createClass(NewsComponentCtrl, [{ key: "openDialog", value: function openDialog() { var _self = this, bodyRef = angular.element(this.$document[0].body); this.newCompModal.show("NewsDialogController", "transversalModule/template/news_dialog_view.html", { parent: angular.element(bodyRef), disableClose: true, targetEvent: null, escapeToClose: false, controllerAs: "$ctrl", locals: { "newsData": _self.newsData, "newsDate": _self.newsDate, "getDateLabel": _self.newsContainer.getDateLabel, "imgPath": _self.imgPath, "isCalendarVisible": _self.isCalendarVisible, "$translate": _self.$translate }, bindToController: true }).then(function (response) {})["catch"](function () {}); } }]); return NewsComponentCtrl; }(); // Component definition var newsComponent = { require: { newsContainer: "^newsContainerComponent" }, bindings: { newsData: "<", newsDate: "<" }, controller: NewsComponentCtrl, templateUrl: "transversalModule/template/news_component_view.html" }; /** * NewsDialogCtrl News dialog controller */ var NewsDialogCtrl = /*#__PURE__*/function () { /** * constructor News dialog constructor * @param {Object} $mdDialog Service that allows the control of * dialogs * @param {Object} newsData Object with news data * (title, body, etc...) * @param {String} newsDate String representation of a date * @param {Function} getDateLabel Auxiliar function that allows a better * representation of the date * @param {String} imgPath Images path * @param {Boolean} isCalendarVisible Flag to turn on or off the visibility of * the calendar icon */ function NewsDialogCtrl($mdDialog, newsData, newsDate, getDateLabel, imgPath, isCalendarVisible) { _classCallCheck(this, NewsDialogCtrl); this.$mdDialog = $mdDialog; this.newsData = newsData; this.getDateLabel = getDateLabel; this.newsDate = newsDate; this.imgPath = imgPath; this.isCalendarVisible = isCalendarVisible; } /** * close Function handler that allows to close the dialog, by using the * $mdDialog service */ _createClass(NewsDialogCtrl, [{ key: "close", value: function close() { this.$mdDialog.cancel(); } }]); return NewsDialogCtrl; }(); angular.module("newsmodule.news", []).component("newsComponent", newsComponent).controller("NewsDialogController", NewsDialogCtrl); }).call();