learning_detailed.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /* ------------------------------------------------------------------------------
  2. *
  3. * # Learning page kit
  4. *
  5. * Demo JS code for learning html page kit - detailed view
  6. *
  7. * ---------------------------------------------------------------------------- */
  8. // Setup module
  9. // ------------------------------
  10. var LearningCourseDetailed = function() {
  11. //
  12. // Setup module components
  13. //
  14. // CKEditor
  15. var _componentCKEditor = function() {
  16. if (typeof CKEDITOR == 'undefined') {
  17. console.warn('Warning - ckeditor.js is not loaded.');
  18. return;
  19. }
  20. // Initialize
  21. CKEDITOR.replace('add-comment', {
  22. height: 200,
  23. removeButtons: 'Subscript,Superscript',
  24. toolbarGroups: [
  25. { name: 'styles' },
  26. { name: 'editing', groups: [ 'find', 'selection' ] },
  27. { name: 'basicstyles', groups: [ 'basicstyles' ] },
  28. { name: 'paragraph', groups: [ 'list', 'blocks', 'align' ] },
  29. { name: 'links' },
  30. { name: 'insert' },
  31. { name: 'colors' },
  32. { name: 'tools' },
  33. { name: 'others' },
  34. { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }
  35. ]
  36. });
  37. };
  38. // Schedule
  39. var _componentFullCalendar = function() {
  40. if (!$().fullCalendar) {
  41. console.warn('Warning - fullcalendar.min.js is not loaded.');
  42. return;
  43. }
  44. // Add events
  45. var eventColors = [
  46. {
  47. title: 'Data management',
  48. start: '2014-11-02',
  49. color: '#EF5350'
  50. },
  51. {
  52. title: 'Web development',
  53. start: '2014-11-02',
  54. end: '2014-11-04',
  55. color: '#26A69A'
  56. },
  57. {
  58. title: 'UX design camp',
  59. start: '2014-11-05',
  60. end: '2014-11-07',
  61. color: '#5C6BC0'
  62. },
  63. {
  64. id: 999,
  65. title: 'Business development',
  66. start: '2014-11-09',
  67. color: '#26A69A'
  68. },
  69. {
  70. id: 999,
  71. title: 'Business development',
  72. start: '2014-11-16',
  73. end: '2014-11-18',
  74. color: '#26A69A'
  75. },
  76. {
  77. title: 'Marketing strategy',
  78. start: '2014-11-19',
  79. end: '2014-11-22',
  80. color: '#66BB6A'
  81. },
  82. {
  83. title: 'Web development',
  84. start: '2014-11-12T10:30:00',
  85. end: '2014-11-12T12:30:00',
  86. color: '#EC407A'
  87. },
  88. {
  89. title: 'LESS language',
  90. start: '2014-11-12T12:00:00',
  91. color: '#EC407A'
  92. },
  93. {
  94. title: 'SASS language',
  95. start: '2014-11-12T14:30:00',
  96. color: '#EC407A'
  97. },
  98. {
  99. title: 'PHP language',
  100. start: '2014-11-12T17:30:00',
  101. color: '#EC407A'
  102. },
  103. {
  104. title: 'Python language',
  105. start: '2014-11-12T20:00:00',
  106. color: '#EC407A'
  107. },
  108. {
  109. title: 'Operations',
  110. start: '2014-11-24',
  111. end: '2014-11-26',
  112. color: '#795548'
  113. },
  114. {
  115. title: 'Finances',
  116. start: '2014-11-27',
  117. end: '2014-11-29',
  118. color: '#FF7043'
  119. }
  120. ];
  121. // Container
  122. var $element = $('.schedule');
  123. // Initialize with options
  124. $element.fullCalendar({
  125. header: {
  126. left: 'prev,next today',
  127. center: 'title',
  128. right: 'month,agendaWeek,agendaDay'
  129. },
  130. defaultDate: '2014-11-12',
  131. editable: true,
  132. events: eventColors
  133. });
  134. // Render if inside hidden element
  135. $('a[href="#course-schedule"]').on('shown.bs.tab', function (e) {
  136. $element.fullCalendar('render');
  137. // $(window).trigger('resize');
  138. });
  139. };
  140. //
  141. // Return objects assigned to module
  142. //
  143. return {
  144. init: function() {
  145. _componentCKEditor();
  146. _componentFullCalendar();
  147. }
  148. }
  149. }();
  150. // Initialize module
  151. // ------------------------------
  152. document.addEventListener('DOMContentLoaded', function() {
  153. LearningCourseDetailed.init();
  154. });