mumuki-laboratory 9.0.6 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mumuki_laboratory/application/discussions.js +10 -10
  3. data/app/assets/javascripts/mumuki_laboratory/application/gamification.js +3 -3
  4. data/app/assets/javascripts/mumuki_laboratory/application/kids.js +11 -7
  5. data/app/assets/javascripts/mumuki_laboratory/application/kindergarten.js +3 -3
  6. data/app/assets/javascripts/mumuki_laboratory/application/messages.js +3 -3
  7. data/app/assets/javascripts/mumuki_laboratory/application/mu-modal-carrousel.js +4 -4
  8. data/app/assets/javascripts/mumuki_laboratory/application/multiple-files.js +12 -6
  9. data/app/assets/javascripts/mumuki_laboratory/application/multiple-scenarios.js +1 -1
  10. data/app/assets/javascripts/mumuki_laboratory/application/primary.js +4 -4
  11. data/app/assets/javascripts/mumuki_laboratory/application/profile.js +0 -6
  12. data/app/assets/javascripts/mumuki_laboratory/application/progress.js +1 -1
  13. data/app/assets/javascripts/mumuki_laboratory/application/speech-bubble-renderer.js +1 -1
  14. data/app/assets/javascripts/mumuki_laboratory/application/submission.js +4 -3
  15. data/app/assets/javascripts/mumuki_laboratory/application/toast.js +3 -0
  16. data/app/assets/javascripts/mumuki_laboratory/application/tooltip.js +1 -1
  17. data/app/assets/javascripts/mumuki_laboratory/application/upload.js +2 -2
  18. data/app/assets/stylesheets/mumuki_laboratory/application.scss +0 -1
  19. data/app/assets/stylesheets/mumuki_laboratory/application/_errors.scss +1 -1
  20. data/app/assets/stylesheets/mumuki_laboratory/application/_layout.scss +1 -27
  21. data/app/assets/stylesheets/mumuki_laboratory/application/_modules.scss +0 -2
  22. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_activity.scss +7 -5
  23. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_avatar.scss +5 -0
  24. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_breadcrumb.scss +6 -30
  25. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_datepicker.scss +0 -4
  26. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_discussion.scss +38 -60
  27. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_editor.scss +16 -18
  28. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_exercise_assignment.scss +2 -11
  29. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_exercise_results.scss +1 -7
  30. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_faqs.scss +3 -3
  31. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_flash.scss +7 -46
  32. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids.scss +19 -5
  33. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kids_results.scss +18 -23
  34. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_kindergarten.scss +1 -9
  35. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_overlap.scss +1 -1
  36. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_progress_bar.scss +5 -5
  37. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_timer.scss +1 -3
  38. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_menu.scss +13 -6
  39. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_profile.scss +0 -2
  40. data/app/controllers/application_controller.rb +4 -2
  41. data/app/controllers/discussions_messages_controller.rb +3 -1
  42. data/app/controllers/exam_authorization_requests_controller.rb +1 -5
  43. data/app/controllers/users_controller.rb +4 -0
  44. data/app/helpers/application_helper.rb +5 -5
  45. data/app/helpers/assignment_result_helper.rb +3 -2
  46. data/app/helpers/assistance_box_helper.rb +1 -1
  47. data/app/helpers/concerns/with_student_path_navigation.rb +8 -3
  48. data/app/helpers/concerns/with_student_path_navigation/continue_navigation.rb +1 -1
  49. data/app/helpers/concerns/with_student_path_navigation/finish_navigation.rb +1 -1
  50. data/app/helpers/concerns/with_student_path_navigation/next_parent_navigation.rb +7 -0
  51. data/app/helpers/concerns/with_student_path_navigation/revisit_navigation.rb +1 -1
  52. data/app/helpers/discussions_helper.rb +61 -24
  53. data/app/helpers/editor_tabs_helper.rb +10 -6
  54. data/app/helpers/email_helper.rb +2 -2
  55. data/app/helpers/exercise_input_helper.rb +2 -3
  56. data/app/helpers/links_helper.rb +12 -9
  57. data/app/helpers/menu_bar_helper.rb +1 -1
  58. data/app/helpers/messages_helper.rb +1 -1
  59. data/app/helpers/overlapped_buttons_helper.rb +22 -12
  60. data/app/helpers/profile_helper.rb +3 -3
  61. data/app/helpers/toast_helper.rb +27 -0
  62. data/app/helpers/user_activity_helper.rb +1 -1
  63. data/app/helpers/user_menu_helper.rb +4 -0
  64. data/app/views/book/show.html.erb +2 -2
  65. data/app/views/certificates/verify.html.erb +1 -1
  66. data/app/views/chapters/show.html.erb +2 -2
  67. data/app/views/discussions/_message.html.erb +31 -6
  68. data/app/views/discussions/_new_message.html.erb +4 -4
  69. data/app/views/discussions/index.html.erb +8 -10
  70. data/app/views/discussions/new.html.erb +1 -1
  71. data/app/views/discussions/show.html.erb +20 -12
  72. data/app/views/exam_authorization_requests/_approved.html.erb +1 -0
  73. data/app/views/exam_authorization_requests/_pending.html.erb +4 -0
  74. data/app/views/exam_authorization_requests/_rejected.html.erb +1 -0
  75. data/app/views/exam_registrations/show.html.erb +11 -12
  76. data/app/views/exercise_solutions/_assistant_rules_box.html.erb +1 -1
  77. data/app/views/exercise_solutions/_contextualization_results_body.html.erb +1 -1
  78. data/app/views/exercise_solutions/_contextualization_results_container.html.erb +1 -1
  79. data/app/views/exercise_solutions/_kids_results_button.html.erb +2 -2
  80. data/app/views/exercise_solutions/_results.html.erb +1 -1
  81. data/app/views/exercises/_exercise_assignment.html.erb +2 -2
  82. data/app/views/exercises/_exercise_skipped.html.erb +1 -1
  83. data/app/views/exercises/_read_only.html.erb +108 -105
  84. data/app/views/exercises/show.html.erb +7 -7
  85. data/app/views/guides/_guide.html.erb +1 -1
  86. data/app/views/guides/_guide_container.html.erb +4 -4
  87. data/app/views/invitations/_invitation_form.html.erb +5 -4
  88. data/app/views/layouts/_authoring.html.erb +1 -1
  89. data/app/views/layouts/_discussions.html.erb +7 -7
  90. data/app/views/layouts/_kids.html.erb +7 -7
  91. data/app/views/layouts/_kindergarten.html.erb +10 -6
  92. data/app/views/layouts/_main.html.erb +6 -10
  93. data/app/views/layouts/_organizations_listing.html.erb +2 -2
  94. data/app/views/layouts/_progress_bar.html.erb +2 -0
  95. data/app/views/layouts/_submission_result_error.html.erb +1 -1
  96. data/app/views/layouts/_test_results.html.erb +2 -2
  97. data/app/views/layouts/_timer.html.erb +1 -1
  98. data/app/views/layouts/_user_menu.html.erb +4 -3
  99. data/app/views/layouts/application.html.erb +39 -42
  100. data/app/views/layouts/exercise_inputs/editors/_code.html.erb +4 -4
  101. data/app/views/layouts/exercise_inputs/editors/_free_form.html.erb +1 -1
  102. data/app/views/layouts/exercise_inputs/editors/_multiple_choice.html.erb +7 -9
  103. data/app/views/layouts/exercise_inputs/editors/_multiple_files.html.erb +10 -10
  104. data/app/views/layouts/exercise_inputs/editors/_single_choice.html.erb +6 -8
  105. data/app/views/layouts/exercise_inputs/editors/_text.html.erb +2 -3
  106. data/app/views/layouts/exercise_inputs/editors/_upload.html.erb +5 -5
  107. data/app/views/layouts/exercise_inputs/forms/_form.html.erb +1 -1
  108. data/app/views/layouts/exercise_inputs/forms/_interactive_form.html.erb +2 -2
  109. data/app/views/layouts/exercise_inputs/forms/_kids_form.html.erb +1 -1
  110. data/app/views/layouts/exercise_inputs/forms/_playground_form.html.erb +2 -2
  111. data/app/views/layouts/exercise_inputs/forms/_problem_form.html.erb +13 -9
  112. data/app/views/layouts/exercise_inputs/layouts/_input_primary.html.erb +2 -2
  113. data/app/views/layouts/exercise_inputs/layouts/_input_right.html.erb +2 -2
  114. data/app/views/layouts/exercise_inputs/read_only_editors/_code.html.erb +1 -1
  115. data/app/views/layouts/exercise_inputs/read_only_editors/_free_form.html.erb +1 -1
  116. data/app/views/layouts/exercise_inputs/read_only_editors/_multiple_choice.html.erb +4 -4
  117. data/app/views/layouts/exercise_inputs/read_only_editors/_multiple_files.html.erb +2 -2
  118. data/app/views/layouts/exercise_inputs/read_only_editors/_single_choice.html.erb +4 -4
  119. data/app/views/layouts/exercise_inputs/read_only_editors/_text.erb +1 -1
  120. data/app/views/layouts/modals/_avatar_picker.html.erb +2 -5
  121. data/app/views/layouts/modals/_guide_corollary.html.erb +4 -8
  122. data/app/views/layouts/modals/_kids_context.html.erb +7 -5
  123. data/app/views/layouts/modals/_kids_results.html.erb +2 -2
  124. data/app/views/layouts/modals/_kids_results_aborted.html.erb +2 -2
  125. data/app/views/layouts/modals/_kindergarten_context.html.erb +3 -3
  126. data/app/views/layouts/modals/_kindergarten_results.html.erb +3 -3
  127. data/app/views/layouts/modals/_kindergarten_results_aborted.html.erb +2 -2
  128. data/app/views/layouts/modals/_level_up.html.erb +2 -5
  129. data/app/views/layouts/modals/_new_message.html.erb +5 -5
  130. data/app/views/notifications/_dropdown.html.erb +3 -3
  131. data/app/views/notifications/_exam_authorization_request.html.erb +1 -1
  132. data/app/views/users/_activity_indicator.html.erb +14 -14
  133. data/app/views/users/_edit_user_form.html.erb +6 -6
  134. data/app/views/users/_profile_fields.html.erb +6 -6
  135. data/app/views/users/_user_form.html.erb +2 -2
  136. data/app/views/users/activity.html.erb +29 -29
  137. data/app/views/users/certificates.html.erb +26 -24
  138. data/app/views/users/discussions.html.erb +23 -21
  139. data/app/views/users/exam_authorizations.html.erb +42 -0
  140. data/app/views/users/messages.html.erb +22 -20
  141. data/app/views/users/show.html.erb +5 -3
  142. data/app/views/users/terms.html.erb +4 -2
  143. data/config/routes.rb +2 -1
  144. data/lib/mumuki/laboratory.rb +1 -1
  145. data/lib/mumuki/laboratory/locales/en.yml +17 -2
  146. data/lib/mumuki/laboratory/locales/es-CL.yml +17 -2
  147. data/lib/mumuki/laboratory/locales/es.yml +17 -2
  148. data/lib/mumuki/laboratory/locales/pt.yml +17 -3
  149. data/lib/mumuki/laboratory/version.rb +1 -1
  150. data/spec/capybara_helper.rb +1 -0
  151. data/spec/controllers/discussions_messages_controller_spec.rb +64 -2
  152. data/spec/controllers/exam_authorization_requests_controller_spec.rb +1 -18
  153. data/spec/controllers/users_controller_spec.rb +1 -0
  154. data/spec/dummy/db/schema.rb +4 -0
  155. data/spec/features/discussion_flow_spec.rb +20 -2
  156. data/spec/features/exercise_flow_spec.rb +1 -1
  157. data/spec/features/guide_reset_spec.rb +1 -1
  158. data/spec/features/notifications_flow_spec.rb +2 -3
  159. data/spec/features/terms_flow_spec.rb +1 -2
  160. data/spec/helpers/breadcrumbs_helper_spec.rb +2 -2
  161. data/spec/helpers/with_navigation_spec.rb +51 -13
  162. data/spec/javascripts/editors-spec.js +3 -3
  163. data/spec/javascripts/kids-button-spec.js +2 -2
  164. data/spec/javascripts/upload-spec.js +8 -8
  165. metadata +125 -122
  166. data/app/assets/stylesheets/mumuki_laboratory/application/hovers.scss +0 -12
  167. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_checkboxes.scss +0 -34
  168. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_guide_corollary.scss +0 -9
  169. data/app/views/exam_authorization_requests/show.html.erb +0 -17
@@ -15,7 +15,8 @@ module AssignmentResultHelper
15
15
 
16
16
  def render_community_link
17
17
  if community_link?
18
- link_to fa_icon('facebook-f', type: :brand, text: I18n.t(:ask_community), class: 'fa-fw'), community_link, target: '_blank'
18
+ link_to fa_icon('facebook-f', type: :brand, text: I18n.t(:ask_community), class: 'fa-fw'),
19
+ community_link, target: '_blank', class: 'dropdown-item'
19
20
  end
20
21
  end
21
22
 
@@ -25,7 +26,7 @@ module AssignmentResultHelper
25
26
  fa_icon(:bug, text: t(:notify_problem_with_exercise), class: 'fa-fw'),
26
27
  subject: t(:problem_with_exercise, title: @exercise.name),
27
28
  body: assignment_help_email_body(assignment),
28
- class: 'warning'
29
+ class: 'dropdown-item'
29
30
  end
30
31
  end
31
32
 
@@ -1,6 +1,6 @@
1
1
  module AssistanceBoxHelper
2
2
  def assistance_box(assignment)
3
- %Q{<div class="mu-tips-box">
3
+ %Q{<div class="mu-tips-box mb-3">
4
4
  #{Mumukit::Assistant::Narrator.random.compose_explanation_html assignment.tips}
5
5
  </div>}.html_safe
6
6
  end
@@ -1,8 +1,7 @@
1
1
  module WithStudentPathNavigation
2
2
  def next_button(navigable)
3
3
  return unless navigable
4
- ContinueNavigation.new(self).button(navigable) || RevisitNavigation.new(self).button(navigable) || FinishNavigation.new(self).button(navigable)
5
- #TODO Refactor this
4
+ navigation_flows.lazy.map { |it| it.new(self).button(navigable) }.find(&:present?)
6
5
  end
7
6
 
8
7
  def next_lesson_button(guide)
@@ -14,6 +13,12 @@ module WithStudentPathNavigation
14
13
  end
15
14
 
16
15
  def close_modal_button
17
- %Q{<button class="btn btn-success btn-block mu-close-modal">#{t :keep_learning}</button>}.html_safe
16
+ %Q{<button class="btn btn-complementary w-100 mu-close-modal">#{t :keep_learning}</button>}.html_safe
17
+ end
18
+
19
+ private
20
+
21
+ def navigation_flows
22
+ [ContinueNavigation, RevisitNavigation, NextParentNavigation, FinishNavigation]
18
23
  end
19
24
  end
@@ -13,7 +13,7 @@ module WithStudentPathNavigation
13
13
  end
14
14
 
15
15
  def clazz
16
- 'btn btn-success btn-block'
16
+ 'btn btn-complementary w-100'
17
17
  end
18
18
 
19
19
  def sibling_for(navigable)
@@ -6,7 +6,7 @@ module WithStudentPathNavigation
6
6
  end
7
7
 
8
8
  def clazz
9
- 'btn btn-success btn-block'
9
+ 'btn btn-complementary w-100'
10
10
  end
11
11
  end
12
12
  end
@@ -0,0 +1,7 @@
1
+ module WithStudentPathNavigation
2
+ class NextParentNavigation < ContinueNavigation
3
+ def sibling_for(navigable)
4
+ super(navigable.navigable_parent)
5
+ end
6
+ end
7
+ end
@@ -13,7 +13,7 @@ module WithStudentPathNavigation
13
13
  end
14
14
 
15
15
  def clazz
16
- 'btn btn-warning btn-block'
16
+ 'btn btn-warning w-100'
17
17
  end
18
18
 
19
19
  def sibling_for(navigable)
@@ -1,6 +1,6 @@
1
1
  module DiscussionsHelper
2
2
  def read_discussions_link(item)
3
- discussions_link others_discussions_icon(t(:solve_your_doubts)), item_discussions_path(item, default_discussions_params)
3
+ discussions_link others_discussions_icon(t(:solve_your_doubts)), item_discussions_path(item, default_discussions_params), class: 'dropdown-item'
4
4
  end
5
5
 
6
6
  def kids_read_discussions_link(item)
@@ -8,11 +8,11 @@ module DiscussionsHelper
8
8
  end
9
9
 
10
10
  def solve_discussions_link
11
- discussions_link others_discussions_icon(t(:solve_doubts)), discussions_path(solve_discussion_params_for(current_user))
11
+ discussions_link others_discussions_icon(t(:solve_doubts)), discussions_path(solve_discussion_params_for(current_user)), class: 'dropdown-item'
12
12
  end
13
13
 
14
14
  def user_discussions_link
15
- discussions_link(user_discussions_icon(t(:my_doubts)), discussions_user_path) if current_user.watched_discussions.present?
15
+ discussions_link(user_discussions_icon(t(:my_doubts)), discussions_user_path, class: 'dropdown-item') if current_user.watched_discussions.present?
16
16
  end
17
17
 
18
18
  def others_discussions_icon(text)
@@ -60,18 +60,6 @@ module DiscussionsHelper
60
60
  }.html_safe
61
61
  end
62
62
 
63
- def discussions_link_with_teaser(item)
64
- %Q{
65
- <div>
66
- <h3>#{t(:discussions)}</h3>
67
- <p>
68
- #{t(:solve_your_doubts_teaser)}
69
- #{read_discussions_link(item)}
70
- </p>
71
- </div>
72
- }.html_safe
73
- end
74
-
75
63
  def discussion_messages_icon(discussion)
76
64
  %Q{
77
65
  <span class="discussion-icon fa-stack fa-xs">
@@ -148,7 +136,7 @@ module DiscussionsHelper
148
136
  if filters.present?
149
137
  %Q{
150
138
  <div class="dropdown discussions-toolbar-filter">
151
- <a id="dropdown-#{label}" data-toggle="dropdown" role="menu">
139
+ <a id="dropdown-#{label}" data-bs-toggle="dropdown" role="menu">
152
140
  #{t label} #{fa_icon :'caret-down', class: 'fa-xs'}
153
141
  </a>
154
142
  <ul class="dropdown-menu" aria-labelledby="dropdown-#{label}">
@@ -161,17 +149,17 @@ module DiscussionsHelper
161
149
  end
162
150
 
163
151
  def discussion_filter_list(label, filters, &block)
164
- filters.map { |it| discussion_filter_item(label, it, &block) }.join("\n")
152
+ filters.map { |it| discussion_filter_item(label, it, 'dropdown-item', &block) }.join("\n")
165
153
  end
166
154
 
167
- def discussion_filter_item(label, filter, &block)
168
- content_tag(:li, discussion_filter_link(label, filter, &block), class: ('selected' if discussion_filter_selected?(label, filter)))
155
+ def discussion_filter_item(label, filter, link_class=nil, &block)
156
+ content_tag(:li, discussion_filter_link(label, filter, link_class, &block), class: ('selected' if discussion_filter_selected?(label, filter)))
169
157
  end
170
158
 
171
159
  def discussion_filter_unselect_item(label, can_select_all)
172
160
  if can_select_all
173
161
  content_tag(:li,
174
- link_to(t(:all), discussion_filter_params_without_page.except(label)),
162
+ link_to(t(:all), discussion_filter_params_without_page.except(label), class: 'dropdown-item'),
175
163
  class: ('selected' unless discussion_filter_params.include?(label)))
176
164
  end
177
165
  end
@@ -180,12 +168,12 @@ module DiscussionsHelper
180
168
  filter.to_s == discussion_filter_params[label]
181
169
  end
182
170
 
183
- def discussion_filter_link(label, filter, &block)
184
- link_to capture(filter, &block), discussion_filter_params_without_page.merge(Hash[label, filter])
171
+ def discussion_filter_link(label, filter, clazz, &block)
172
+ link_to capture(filter, &block), discussion_filter_params_without_page.merge(Hash[label, filter]), class: clazz
185
173
  end
186
174
 
187
175
  def discussion_info(discussion)
188
- "#{t(:time_since, time: time_ago_in_words(discussion.created_at))} · #{t(:message_count, count: discussion.messages.size)}"
176
+ "#{t(:time_since, time: time_ago_in_words(discussion.created_at))} · #{t(:message_count, count: discussion.visible_messages.size)}"
189
177
  end
190
178
 
191
179
  def discussion_filter_params_without_page
@@ -197,6 +185,55 @@ module DiscussionsHelper
197
185
  end
198
186
 
199
187
  def discussion_user_name(user)
200
- user.name
188
+ user.abbreviated_name
189
+ end
190
+
191
+ def subscription_icon
192
+ fa_icon :bell, text: t(:subscribe)
193
+ end
194
+
195
+ def unsubscription_icon
196
+ fa_icon :bell, type: :regular, text: t(:unsubscribe)
197
+ end
198
+
199
+ def upvote_icon
200
+ fa_icon 'thumbs-up', text: t(:upvote)
201
+ end
202
+
203
+ def undo_upvote_icon
204
+ fa_icon 'thumbs-up', type: :regular, text: t(:undo_upvote)
205
+ end
206
+
207
+ def discussion_delete_message_link(discussion, message)
208
+ link_to fa_icon('trash-alt', type: :regular, class: 'fa-lg'), discussion_message_path(discussion, message, motive: :self_deleted),
209
+ method: :delete, data: { confirm: t(:are_you_sure, action: t(:destroy_message)) }, class: 'discussion-delete-message'
210
+ end
211
+
212
+ def discussion_delete_message_dropdown(discussion, message)
213
+ %Q{
214
+ <span class="dropdown">
215
+ #{content_tag :span, fa_icon('trash-alt', type: :regular, class: 'fa-lg'), role: 'menu', 'data-bs-toggle': 'dropdown',
216
+ class: 'discussion-delete-message', id: 'deleteDiscussionDropdown'}
217
+ <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="deleteDiscussionDropdown">
218
+ #{discussion_delete_message_option discussion, message, :inappropriate_content, 'times-circle'}
219
+ #{discussion_delete_message_option discussion, message, :shares_solution, :code}
220
+ #{discussion_delete_message_option discussion, message, :discloses_personal_information, 'user-tag'}
221
+ </ul>
222
+ </span>
223
+ }.html_safe
224
+ end
225
+
226
+ def discussion_delete_message_option(discussion, message, motive, icon)
227
+ %Q{
228
+ <li>
229
+ #{link_to fa_icon(icon, text: t("deletion_motive.#{motive}.present"), class: 'fa-fw fixed-icon'),
230
+ discussion_message_path(discussion, message, motive: motive), method: :delete, class: 'dropdown-item',
231
+ role: 'menuitem', data: { confirm: t(:are_you_sure, action: t(:destroy_message)) } }
232
+ </li>
233
+ }.html_safe
234
+ end
235
+
236
+ def message_deleted_text(message)
237
+ t(:message_deleted, motive: t("deletion_motive.#{message.deletion_motive}.past").downcase, forum_terms: link_to_forum_terms).html_safe
201
238
  end
202
239
  end
@@ -1,20 +1,24 @@
1
1
  module EditorTabsHelper
2
2
  def extra_code_tab
3
- "<li role='presentation'> <a data-target='#visible-extra' aria-controls='visible-extra' role='tab' data-toggle='tab' class='editor-tab'>#{fa_icon 'code'} #{t 'activerecord.attributes.exercise.extra'}</a> </li>".html_safe
3
+ "<li role='presentation'>
4
+ <a class='editor-tab nav-link' data-bs-target='#visible-extra' aria-controls='visible-extra' role='tab' data-bs-toggle='tab'>
5
+ #{fa_icon 'code', text: (t 'activerecord.attributes.exercise.extra')}
6
+ </a>
7
+ </li>".html_safe
4
8
  end
5
9
 
6
10
  def console_tab(active: false)
7
- "<li role='presentation' class='#{'active' if active}'>
8
- <a data-target='#console' aria-controls='console' tabindex='0' role='tab' data-toggle='tab' class='editor-tab'>
9
- #{fa_icon 'terminal'}#{t :console }
11
+ "<li role='presentation'>
12
+ <a class='editor-tab nav-link #{'active' if active}' data-bs-target='#console' aria-controls='console' tabindex='0' role='tab' data-bs-toggle='tab' >
13
+ #{fa_icon 'terminal', text: (t :console)}
10
14
  </a>
11
15
  </li>".html_safe
12
16
  end
13
17
 
14
18
  def messages_tab(exercise, organization = Organization.current)
15
19
  "<li id='messages-tab' role='presentation'>
16
- <a data-target='#messages' tabindex='0' aria-controls='console' role='tab' data-toggle='tab' class='editor-tab'>
17
- #{fa_icon 'comments', type: :regular} #{t :messages }
20
+ <a class='editor-tab nav-link' data-bs-target='#messages' tabindex='0' aria-controls='console' role='tab' data-bs-toggle='tab'>
21
+ #{fa_icon 'comments', type: :regular, text: (t :messages)}
18
22
  </a>
19
23
  </li>".html_safe if organization.raise_hand_enabled? && exercise.has_messages_for?(current_user)
20
24
  end
@@ -12,9 +12,9 @@ See #{transparent_exercise_url(assignment.exercise.transparent_params)}
12
12
  EOM
13
13
  end
14
14
 
15
- def permissions_help_email_body(user)
15
+ def permissions_help_email_body(user, organization)
16
16
  <<EOM
17
- #{t :want_permissions}: #{user.try(:uid)} - #{user.try(:email)}
17
+ #{t :want_permissions} #{organization.name}: #{user.try(:uid)} - #{user.try(:email)}
18
18
  EOM
19
19
  end
20
20
  end
@@ -53,10 +53,9 @@ module ExerciseInputHelper
53
53
  waiting_text = t(options.waiting_t) if options.waiting_t.present?
54
54
  %Q{
55
55
  <div class="btn-submit-container">
56
- <button class="btn btn-success btn-block btn-submit #{options.classes}"
56
+ <button class="btn btn-complementary w-100 btn-submit #{options.classes}"
57
57
  data-waiting="#{waiting_text}">
58
- #{fa_icon 'play'}
59
- #{text} #{remaining_attempts_text(assignment)}
58
+ #{fa_icon 'play', text: ([text, remaining_attempts_text(assignment)].join('')).html_safe}
60
59
  </button>
61
60
  </div>
62
61
  }.html_safe
@@ -25,13 +25,16 @@ module LinksHelper
25
25
  def teacher_info_button(item)
26
26
  if current_user&.teacher_here? && item.teacher_info.present?
27
27
  %Q{
28
- <a
29
- class="mu-popover"
30
- data-toggle="popover"
31
- data-html="true"
32
- title="#{t :teacher_info}"
33
- data-placement="bottom"
34
- data-content="#{html_rescape item.teacher_info_html}">#{fixed_fa_icon('info-circle')}</a>
28
+ <div data-bs-toggle="tooltip" title="#{t :teacher_info}">
29
+ <a
30
+ class="mu-popover"
31
+ data-bs-toggle="popover"
32
+ data-bs-html="true"
33
+ title="#{t :teacher_info}"
34
+ data-bs-placement="bottom"
35
+ data-bs-content="#{html_rescape item.teacher_info_html}">#{fixed_fa_icon('info-circle')}
36
+ </a>
37
+ </div>
35
38
  }.html_safe
36
39
  end
37
40
  end
@@ -48,7 +51,7 @@ module LinksHelper
48
51
  mail_to Organization.current.contact_email,
49
52
  Organization.current.contact_email,
50
53
  subject: I18n.t(:permissions),
51
- body: permissions_help_email_body(current_user)
54
+ body: permissions_help_email_body(current_user, Organization.current)
52
55
  end
53
56
 
54
57
  def link_to_profile_terms
@@ -88,7 +91,7 @@ module LinksHelper
88
91
  return unless current_user&.writer?
89
92
 
90
93
  url = yield
91
- link_to fixed_fa_icon('pencil-alt'), url, target: "_blank", title: t(:edit)
94
+ link_to fixed_fa_icon('pencil-alt'), url, target: "_blank", 'data-bs-toggle': 'tooltip', title: t(:edit)
92
95
  end
93
96
 
94
97
  def url_for_bibliotheca_guide(guide)
@@ -40,7 +40,7 @@ module MenuBarHelper
40
40
  end
41
41
 
42
42
  def menu_item(icon, name, url, translation_params = {})
43
- link_to fixed_fa_icon(icon, text: t(name, translation_params)), url, role: 'menuitem', tabindex: '-1'
43
+ link_to fixed_fa_icon(icon, text: t(name, translation_params)), url, role: 'menuitem', tabindex: '-1', class: 'dropdown-item'
44
44
  end
45
45
 
46
46
  def any_menu_bar_links?
@@ -4,7 +4,7 @@ module MessagesHelper
4
4
  end
5
5
 
6
6
  def hidden_pending(assignment)
7
- assignment.pending_messages? ? '' : 'hidden'
7
+ assignment.pending_messages? ? '' : 'd-none'
8
8
  end
9
9
 
10
10
  def disabled_submit_class(assignment)
@@ -1,25 +1,35 @@
1
1
  module OverlappedButtonsHelper
2
2
  def expand_icon
3
- overlapped_button_icon :fullscreen, :expand
3
+ overlapped_link :fullscreen, :expand, class: 'editor-resize'
4
4
  end
5
5
 
6
- def restart_icon(data_placement='left')
7
- overlapped_button_icon :restart, :undo, data_placement
6
+ def format_icon
7
+ overlapped_link :format, :indent, class: 'editor-format'
8
8
  end
9
9
 
10
- def format_icon
11
- overlapped_button_icon :format, :indent
10
+ def restart_icon(source='console', **options)
11
+ overlapped_link :restart, :undo, class: "#{source}-reset submission-reset", **options
12
12
  end
13
13
 
14
14
  def restart_guide_link(guide)
15
- link_to restart_icon('top'),
16
- guide_progress_path(guide),
17
- class: 'mu-content-toolbar-item mu-restart-guide',
18
- data: {confirm: t(:confirm_restart)},
19
- method: :delete
15
+ all_options = tooltip_options(:restart).merge!(
16
+ {class: 'mu-content-toolbar-item mu-restart-guide',
17
+ data: {confirm: t(:confirm_restart)}, method: :delete, 'data-bs-placement': 'top'})
18
+
19
+ link_to overlapped_button_icon(:undo), guide_progress_path(guide), all_options
20
+ end
21
+
22
+ private
23
+
24
+ def overlapped_link(key, icon, **options)
25
+ content_tag :a, overlapped_button_icon(icon), tooltip_options(key).merge!(options)
26
+ end
27
+
28
+ def overlapped_button_icon(icon)
29
+ fa_icon icon, class: 'fa-fw', role: 'button'
20
30
  end
21
31
 
22
- def overlapped_button_icon(key, icon, data_placement='left')
23
- fa_icon(icon, title: t(key), class: 'fa-fw', role: 'button', 'aria-label': t(key), 'data-placement': data_placement)
32
+ def tooltip_options(key)
33
+ {title: t(key), 'aria-label': t(key), 'data-bs-toggle': 'tooltip', 'data-bs-placement': 'left'}
24
34
  end
25
35
  end
@@ -1,13 +1,13 @@
1
1
  module ProfileHelper
2
2
  def edit_profile_button
3
- link_to t(:edit_profile), :edit_user, class: 'btn btn-success'
3
+ link_to t(:edit_profile), :edit_user, class: 'btn btn-complementary'
4
4
  end
5
5
 
6
6
  def cancel_edit_profile_button
7
- link_to t(:cancel), :user, class: 'btn btn-default' if current_user.profile_completed?
7
+ link_to t(:cancel), :user, class: 'btn btn-secondary' if current_user.profile_completed?
8
8
  end
9
9
 
10
10
  def save_edit_profile_button(form)
11
- form.submit t(:save), disabled: true, class: 'btn btn-success mu-edit-profile-btn'
11
+ form.submit t(:save), disabled: true, class: 'btn btn-complementary mu-edit-profile-btn'
12
12
  end
13
13
  end
@@ -0,0 +1,27 @@
1
+ module ToastHelper
2
+ def toast_notice(text)
3
+ toast_for('success', 'check-circle', text)
4
+ end
5
+
6
+ def toast_alert(text)
7
+ toast_for('error', 'times-circle', text)
8
+ end
9
+
10
+ def toast_info(text)
11
+ toast_for('info', 'info-circle', text)
12
+ end
13
+
14
+ private
15
+
16
+ def toast_for(type, icon, text)
17
+ "<div class='toast mu-toast-#{type}' role='alert'>
18
+ <div class='toast-body'>
19
+ <div class='d-flex align-items-center'>
20
+ #{fa_icon icon, class: 'fa-lg me-3'}
21
+ <span class='flex-grow-1 text-break'>#{text}</span>
22
+ <button type='button' class='btn-close btn-close-white mx-2 flex-shrink-0' data-bs-dismiss='toast' aria-label='Close'></button>
23
+ </div>
24
+ </div>
25
+ </div>".html_safe
26
+ end
27
+ end