Source: models/production/menu.js

  1. define('application/models/production/menu', [
  2. 'rofl/models/api/abstract',
  3. 'rofl/lib/l10n',
  4. 'application/managers/feature',
  5. 'antie/runtimecontext'
  6. ], function (
  7. Abstract,
  8. L10N,
  9. FeatureManager,
  10. RuntimeContext
  11. ) {
  12. 'use strict';
  13. var l10n = L10N.getInstance();
  14. return Abstract.extend({
  15. /**
  16. * Checks if model has local data.
  17. *
  18. * @returns {boolean} - True or false if local data exists or not.
  19. */
  20. hasLocalData: function () {
  21. return true;
  22. },
  23. /**
  24. * Return local data.
  25. *
  26. * @returns {Array} - Array of object with menu data.
  27. */
  28. getLocalData: function () {
  29. var menu = {
  30. middle: [
  31. {
  32. '_id': 6,
  33. '_label': l10n.get('menu.search'),
  34. '_icon': 'icon-search-v2',
  35. 'route': 'search',
  36. args: {keepHistory: false}
  37. },
  38. {
  39. '_id': 7,
  40. '_label': l10n.get('menu.home'),
  41. '_icon': 'icon-home',
  42. 'route': 'home',
  43. args: {keepHistory: false}
  44. },
  45. {
  46. '_id': 1,
  47. '_label': l10n.get('menu.channellist'),
  48. '_icon': 'icon-now-on-tv',
  49. 'route': 'channellist',
  50. args: {keepHistory: false}
  51. },
  52. {
  53. '_id': 2,
  54. '_label': l10n.get('menu.guide'),
  55. '_icon': 'icon-guide',
  56. 'route': 'guide',
  57. args: {keepHistory: false}
  58. }
  59. ]
  60. };
  61. if (FeatureManager.getInstance().isRecordingEnabled()
  62. && RuntimeContext.getCurrentApplication().getUser().canRecord()) {
  63. menu.middle.push({
  64. '_id': 3,
  65. '_label': l10n.get('menu.recordings'),
  66. '_icon': 'icon-my-recordings',
  67. 'route': 'recordings',
  68. args: {keepHistory: false}
  69. });
  70. }
  71. if (FeatureManager.getInstance().isMoviesEnabled()) {
  72. menu.middle.push({
  73. '_id': 5,
  74. '_label': l10n.get('menu.movies'),
  75. '_icon': 'icon-movies',
  76. 'route': 'movies',
  77. args: {keepHistory: false}
  78. });
  79. }
  80. if (FeatureManager.getInstance().isSeriesEnabled()) {
  81. menu.middle.push({
  82. '_id': 6,
  83. '_label': l10n.get('menu.series'),
  84. '_icon': 'icon-series',
  85. 'route': 'series',
  86. args: {keepHistory: false}
  87. });
  88. }
  89. if (FeatureManager.getInstance().isSportsEnabled()) {
  90. menu.middle.push({
  91. '_id': 7,
  92. '_label': l10n.get('menu.sports'),
  93. '_icon': 'icon-sport',
  94. 'route': 'sports',
  95. args: {keepHistory: false}
  96. });
  97. }
  98. menu.middle.push({
  99. '_id': 8,
  100. '_label': l10n.get('menu.settings'),
  101. '_icon': 'icon-settings',
  102. 'route': 'settings',
  103. args: {keepHistory: false}
  104. },
  105. {
  106. '_id': 9,
  107. '_label': l10n.get('menu.exit'),
  108. '_icon': 'icon-remove',
  109. 'route': 'exit',
  110. args: {keepHistory: false}
  111. });
  112. return menu;
  113. },
  114. /**
  115. * Transforms api data to application data.
  116. *
  117. * @param {Object} data - Data object.
  118. * @returns {Object} Application data.
  119. */
  120. transformFrom: function (data) {
  121. if (data.menu) {
  122. this.modelProperty = data.menu;
  123. }
  124. return this;
  125. }
  126. });
  127. });