Source: widgets/guide/nextdayasset.js

  1. define('application/widgets/guide/nextdayasset', [
  2. 'rofl/widgets/button',
  3. 'rofl/widgets/label',
  4. 'application/widgets/pointerfocusableasset'
  5. ], function (
  6. Button,
  7. Label,
  8. PointerFocusableButton
  9. ) {
  10. 'use strict';
  11. return PointerFocusableButton.extend({
  12. /**
  13. * Initialises the button.
  14. *
  15. * @param {string} [id] - The id. Optional.
  16. */
  17. init: function init (id) {
  18. init.base.call(this, id);
  19. this.addClass('next-day-button');
  20. this._buildNextAsset();
  21. },
  22. /**
  23. * Returns string of date.
  24. *
  25. * @returns {string} - Date in string form.
  26. */
  27. getText: function () {
  28. if (this._dateLabel) {
  29. return this._dateLabel.getText();
  30. }
  31. },
  32. /**
  33. * Sets buttons date label.
  34. *
  35. * @param {string} date - Next date string.
  36. */
  37. setDate: function (date) {
  38. var dateLabel = this._dateLabel = new Label({ text: date, classNames: ['date-label'] });
  39. this._assetbutton.appendChildWidget(dateLabel);
  40. },
  41. /**
  42. * Builds next asset button.
  43. *
  44. * @private
  45. */
  46. _buildNextAsset: function () {
  47. var assetButton = this._assetbutton = new Button(),
  48. icon = new Label({ text: '', classNames: ['icon', 'icon-chevron-right'] });
  49. assetButton.addClass('assetbutton');
  50. assetButton.appendChildWidget(icon);
  51. this.appendChildWidget(assetButton);
  52. }
  53. });
  54. });