BreadcrumbView.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. 'use strict';
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2017
  5. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. */
  7. define(['jquery', '../../lib/@waca/core-client/js/core-client/ui/core/View', 'text!./templates/BreadcrumbView.html'], function ($, BaseView, Template) {
  8. var View = null;
  9. View = BaseView.extend({
  10. templateString: Template,
  11. items: null,
  12. events: {
  13. 'click .breadcrumbView a': 'tapItem'
  14. },
  15. init: function init(options) {
  16. View.inherited('init', this, arguments);
  17. this.items = options.items;
  18. },
  19. render: function render() {
  20. this.$el.empty();
  21. var sHtml = this.dotTemplate({
  22. items: this.items
  23. });
  24. this.$el.append(sHtml);
  25. },
  26. tapItem: function tapItem(event) {
  27. this._fireAction(event.currentTarget, event);
  28. },
  29. _fireAction: function _fireAction(element, event) {
  30. var id = $(element).data('id');
  31. var item = this.items[id];
  32. var info = {
  33. breadcrumbId: item.id,
  34. breadcrumbName: item.name,
  35. breadcrumbData: item.data
  36. };
  37. this.trigger('action:breadcrumb', { 'data': info, 'payload': event });
  38. }
  39. });
  40. return View;
  41. });
  42. //# sourceMappingURL=BreadcrumbView.js.map