mumuki-laboratory 8.3.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/mumuki_laboratory/application/codemirror.js +1 -1
  3. data/app/assets/javascripts/mumuki_laboratory/application/upload.js +69 -14
  4. data/app/assets/stylesheets/mumuki_laboratory/application.scss +1 -0
  5. data/app/assets/stylesheets/mumuki_laboratory/application/_codemirror-themes.scss +1 -0
  6. data/app/assets/stylesheets/mumuki_laboratory/application/_layout.scss +3 -0
  7. data/app/assets/stylesheets/mumuki_laboratory/application/_modules.scss +1 -0
  8. data/app/assets/stylesheets/mumuki_laboratory/application/codemirror-themes/_mu-light.scss +3 -0
  9. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_content_show.scss +15 -2
  10. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_discussion.scss +31 -8
  11. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_medal.scss +1 -1
  12. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_menu.scss +35 -0
  13. data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_profile.scss +11 -0
  14. data/app/controllers/api/base_controller.rb +0 -1
  15. data/app/controllers/api/courses_controller.rb +1 -1
  16. data/app/controllers/api/organizations_controller.rb +5 -2
  17. data/app/controllers/api/roles_controller.rb +4 -0
  18. data/app/controllers/api/users_controller.rb +6 -1
  19. data/app/controllers/application_controller.rb +1 -1
  20. data/app/controllers/concerns/with_authorization.rb +1 -16
  21. data/app/controllers/concerns/with_user_params.rb +4 -0
  22. data/app/controllers/discussions_messages_controller.rb +0 -1
  23. data/app/controllers/exam_authorization_requests_controller.rb +26 -0
  24. data/app/controllers/exam_registrations_controller.rb +6 -0
  25. data/app/controllers/users_controller.rb +8 -5
  26. data/app/helpers/application_helper.rb +4 -0
  27. data/app/helpers/breadcrumbs_helper.rb +4 -0
  28. data/app/helpers/content_view_helper.rb +19 -0
  29. data/app/helpers/exercise_input_helper.rb +8 -17
  30. data/app/helpers/icons_helper.rb +3 -11
  31. data/app/helpers/links_helper.rb +2 -2
  32. data/app/helpers/menu_bar_helper.rb +3 -3
  33. data/app/helpers/overlapped_buttons_helper.rb +10 -6
  34. data/app/helpers/progress_bar_helper.rb +2 -2
  35. data/app/helpers/user_menu_helper.rb +18 -0
  36. data/app/views/chapters/show.html.erb +17 -16
  37. data/app/views/complements/show.html.erb +1 -1
  38. data/app/views/discussions/_message.html.erb +7 -7
  39. data/app/views/exam_authorization_requests/show.html.erb +17 -0
  40. data/app/views/exam_registrations/show.html.erb +37 -0
  41. data/app/views/exams/show.html.erb +1 -1
  42. data/app/views/{layouts → exercises}/_exercise_skipped.html.erb +0 -0
  43. data/app/views/exercises/_exercise_title_icons.html.erb +4 -0
  44. data/app/views/exercises/show.html.erb +5 -8
  45. data/app/views/{layouts → guides}/_guide.html.erb +3 -3
  46. data/app/views/guides/_guide_container.html.erb +24 -0
  47. data/app/views/{layouts → guides}/_guide_title_icons.html.erb +1 -3
  48. data/app/views/layouts/_progress_bar.html.erb +9 -7
  49. data/app/views/layouts/_progress_listing.html.erb +5 -5
  50. data/app/views/layouts/_user_menu.html.erb +21 -0
  51. data/app/views/layouts/application.html.erb +1 -6
  52. data/app/views/layouts/exercise_inputs/editors/_upload.html.erb +11 -2
  53. data/app/views/lessons/show.html.erb +1 -1
  54. data/app/views/notifications/_discussion.html.erb +1 -0
  55. data/app/views/notifications/_dropdown.html.erb +13 -0
  56. data/app/views/notifications/_exam_authorization_request.html.erb +1 -0
  57. data/app/views/notifications/_exam_registration.html.erb +1 -0
  58. data/app/views/notifications/_message.html.erb +1 -0
  59. data/app/views/users/_user_form.html.erb +10 -8
  60. data/app/views/users/discussions.html.erb +28 -0
  61. data/app/views/users/edit.html.erb +1 -1
  62. data/app/views/users/messages.html.erb +27 -0
  63. data/app/views/users/show.html.erb +4 -51
  64. data/app/views/users/terms.html.erb +2 -2
  65. data/config/routes.rb +6 -0
  66. data/lib/mumuki/laboratory/controllers/notifications.rb +3 -22
  67. data/lib/mumuki/laboratory/locales/en.yml +35 -18
  68. data/lib/mumuki/laboratory/locales/es-CL.yml +26 -9
  69. data/lib/mumuki/laboratory/locales/es.yml +31 -15
  70. data/lib/mumuki/laboratory/locales/pt.yml +28 -11
  71. data/lib/mumuki/laboratory/version.rb +1 -1
  72. data/spec/controllers/exam_authorization_requests_controller_spec.rb +40 -0
  73. data/spec/controllers/exam_registrations_controller_spec.rb +19 -0
  74. data/spec/controllers/organizations_api_controller_spec.rb +16 -9
  75. data/spec/dummy/db/schema.rb +24 -0
  76. data/spec/features/exercise_flow_spec.rb +3 -3
  77. data/spec/features/login_flow_spec.rb +1 -1
  78. data/spec/features/menu_bar_spec.rb +24 -24
  79. data/spec/features/notifications_flow_spec.rb +46 -0
  80. data/spec/features/profile_flow_spec.rb +6 -9
  81. data/spec/features/terms_flow_spec.rb +30 -0
  82. data/spec/javascripts/bridge-spec.js +2 -2
  83. data/spec/javascripts/csrf-token-spec.js +2 -2
  84. data/spec/javascripts/editors-spec.js +7 -9
  85. data/spec/javascripts/elipsis-spec.js +4 -4
  86. data/spec/javascripts/events-spec.js +7 -7
  87. data/spec/javascripts/exercise-spec.js +7 -8
  88. data/spec/javascripts/global-spec.js +3 -3
  89. data/spec/javascripts/i18n-spec.js +23 -20
  90. data/spec/javascripts/kids-button-spec.js +6 -8
  91. data/spec/javascripts/results-renderers-spec.js +5 -5
  92. data/spec/javascripts/speech-bubble-renderer-spec.js +2 -3
  93. data/spec/javascripts/submissions-store-spec.js +14 -14
  94. data/spec/javascripts/sync-mode-spec.js +3 -3
  95. data/spec/javascripts/timeout-spec.js +2 -2
  96. data/spec/javascripts/timer-spec.js +2 -2
  97. data/spec/javascripts/upload-spec.js +80 -0
  98. metadata +129 -103
  99. data/app/views/layouts/_guide_container.html.erb +0 -28
@@ -1 +1 @@
1
- <%= render partial: "layouts/guide_container", locals: { subject: @exam }%>
1
+ <%= render partial: "guides/guide_container", locals: { subject: @exam }%>
@@ -0,0 +1,4 @@
1
+ <div class="mu-content-title-icons">
2
+ <%= teacher_info_button @exercise %>
3
+ <%= link_to_bibliotheca_exercise @exercise %>
4
+ </div>
@@ -18,12 +18,9 @@
18
18
  <h1><%= language_icon @exercise.language %></h1>
19
19
  </div>
20
20
  <div class="mu-inline-block-left">
21
- <h1>
22
- <span class="hidden-xs"><%= t(:exercise_number, number: @exercise.number) %>:&nbsp;</span>
23
- <span><%= @exercise.name %></span>
24
- <%= teacher_info_button @exercise %>
25
- <%= link_to_bibliotheca_exercise @exercise %>
26
- </h1>
21
+ <h1 class="hidden-xs"><%= full_title_for @exercise %></h1>
22
+ <h1 class="visible-xs"><%= short_title_for @exercise %></h1>
23
+ <%= render partial: 'exercises/exercise_title_icons' %>
27
24
  </div>
28
25
  </div>
29
26
  <% end %>
@@ -58,13 +55,13 @@
58
55
 
59
56
  <%= content_for :no_container do %>
60
57
  <% if @assignment.skipped? %>
61
- <%= render partial: 'layouts/exercise_skipped' %>
58
+ <%= render partial: 'exercises/exercise_skipped' %>
62
59
  <% end %>
63
60
 
64
61
  <% if in_gamified_context? %>
65
62
  <%= render partial: 'layouts/modals/level_up' %>
66
63
  <% end %>
67
64
 
68
- <%= render partial: 'layouts/modals/guide_corollary', locals: {guide: @guide} %>
65
+ <%= render partial: 'layouts/modals/guide_corollary', locals: {guide: @guide} if @stats.almost_done? %>
69
66
  <%= render partial: 'layouts/modals/new_message', locals: {exercise: @exercise} if should_render_message_input?(@exercise) %>
70
67
  <% end if current_user? %>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <%= render partial: 'layouts/authoring', locals: {guide: @guide} %>
4
4
 
5
- <% if subject.timed? && subject.started?(current_user) && !current_user.teacher? %>
5
+ <% if subject.timed? && @stats.started? && !current_user.teacher? %>
6
6
  <%= render partial: 'layouts/timer', locals: {end_time: subject.real_end_time(current_user)} %>
7
7
  <% end %>
8
8
 
@@ -10,10 +10,10 @@
10
10
 
11
11
  <h3>
12
12
  <%= t :exercises %>
13
- <%= restart_guide_link(@guide) if current_user && @guide.started?(current_user) && @guide.resettable? %>
13
+ <%= restart_guide_link(@guide) if current_user && @stats.started? && @guide.resettable? %>
14
14
  </h3>
15
15
 
16
- <%= render partial: 'layouts/progress_listing', locals: {exercises: @guide.exercises} %>
16
+ <%= render partial: 'layouts/progress_listing', locals: { guide: @guide } %>
17
17
 
18
18
  <% if @stats&.done? %>
19
19
  <div class="text-box">
@@ -0,0 +1,24 @@
1
+ <%= content_for :breadcrumbs do %>
2
+ <%= breadcrumbs subject %>
3
+ <% end %>
4
+
5
+ <%= render layout: 'guides/guide', locals: { subject: subject } do %>
6
+
7
+ <div class="row">
8
+ <div class="mu-inline-block-right hidden-xs">
9
+ <h1><%= language_icon @guide.language %></h1>
10
+ </div>
11
+ <div class="mu-inline-block-left">
12
+ <h1><%= short_title_for @guide %></h1>
13
+ <%= render partial: 'guides/guide_title_icons' %>
14
+ </div>
15
+ </div>
16
+ <div class="row">
17
+ <div class="col-md-12">
18
+ <div class="text-box">
19
+ <%= @guide.description_html %>
20
+ </div>
21
+ </div>
22
+ </div>
23
+
24
+ <% end %>
@@ -1,8 +1,6 @@
1
- <div class="guide-title-icons pull-left">
1
+ <div class="mu-content-title-icons">
2
2
  <% if current_user? && should_display_medal?(@guide, Organization.current) %>
3
- <div class="pull-left">
4
3
  <%= content_medal_for(@guide, current_user) %>
5
- </div>
6
4
  <% end %>
7
5
  <%= teacher_info_button @guide %>
8
6
  <%= link_to_bibliotheca_guide @guide %>
@@ -1,12 +1,14 @@
1
1
  <div class="progress-list-flex">
2
- <% guide.exercises.each do |e| %>
2
+ <% assignments = guide.assignments_for(current_user) %>
3
+ <% assignments.each do |assignment| %>
4
+ <% exercise = assignment.exercise %>
3
5
  <a
4
- <%= turbolinks_enable_for e %>
5
- href="<%= exercise_path(e)%>"
6
- aria-label="<%= e.navigable_name %>"
7
- title="<%= e.navigable_name %>"
8
- data-mu-exercise-id="<%= e.id %>"
9
- class="<%= class_for_progress_list_item(e, e == actual)%>">
6
+ <%= turbolinks_enable_for exercise %>
7
+ href="<%= exercise_path(exercise)%>"
8
+ aria-label="<%= exercise.navigable_name %>"
9
+ title="<%= exercise.navigable_name %>"
10
+ data-mu-exercise-id="<%= exercise.id %>"
11
+ class="<%= class_for_progress_list_item(assignment, exercise == actual)%>">
10
12
  </a>
11
13
  <% end %>
12
14
  </div>
@@ -1,9 +1,9 @@
1
1
  <ul class="progress-listing">
2
- <% exercises.each do |exercise| %>
3
- <% cache [exercise, exercise.status_for(current_user), Organization.current] do %>
4
- <li <%= turbolinks_enable_for(exercise) %>>
5
- <%= exercise_status_icon exercise %>
6
- <%= link_to_path_element(exercise) %>
2
+ <% guide.assignments_for(current_user).each do |assignment| %>
3
+ <% cache [assignment.exercise, assignment.status, Organization.current.name, current_user?] do %>
4
+ <li <%= turbolinks_enable_for(assignment.exercise) %>>
5
+ <%= assignment_status_icon assignment %>
6
+ <%= link_to_path_element(assignment.exercise) %>
7
7
  </li>
8
8
  <% end %>
9
9
  <% end %>
@@ -0,0 +1,21 @@
1
+ <div class="col-md-3 mu-tab-body mu-user-menu">
2
+ <div class="col-md-12">
3
+ <div class="mu-user-menu-header">
4
+ <%= t(:my_account) %>
5
+ </div>
6
+ <div class="mu-user-menu-item">
7
+ <%= profile_user_menu_link %>
8
+ </div>
9
+ <div class="mu-user-menu-divider horizontal"></div>
10
+ <div class="mu-user-menu-item">
11
+ <%= messages_user_menu_link %>
12
+ </div>
13
+ <% if current_user&.can_discuss_here? %>
14
+ <div class="mu-user-menu-item">
15
+ <%= discussions_user_menu_link %>
16
+ </div>
17
+ <% end %>
18
+ </div>
19
+ <div class="mu-user-menu-divider vertical hidden-sm hidden-xs"></div>
20
+ </div>
21
+ <div class="mu-user-menu-divider horizontal visible-sm visible-xs"></div>
@@ -25,12 +25,7 @@
25
25
  <span class="mu-level-number"></span>
26
26
  </div>
27
27
  <% end %>
28
- <div class="dropdown mu-navbar-element notifications-box <%= 'notifications-box-empty' unless has_notifications? %>">
29
- <a href=<%= "#{user_notifications_path}" %>>
30
- <i class="fas fa-bell fa-fw fa-2x mu-navbar-icon"></i>
31
- <span class="badge badge-notifications"><%= notifications_count %></span>
32
- </a>
33
- </div>
28
+ <%= render partial: 'notifications/dropdown' %>
34
29
  <div class="dropdown mu-navbar-element">
35
30
  <div id="profileDropdown" class="profile-dropdown" data-toggle="dropdown" aria-label="<%= t(:user) %>" role="menu" tabindex="0">
36
31
  <%= profile_picture_for current_user %>
@@ -1,4 +1,13 @@
1
1
  <div class="form-group">
2
- <textarea id="solution_content" type="text" name="solution[content]" style="display: none"></textarea>
3
- <input id="upload-input" type="file" class="upload submission-control" size="5120" accept=".<%= @exercise.language.extension %>" />
2
+ <% @max_file_size = 256000 %>
3
+
4
+ <textarea id="solution_content" type="text" name="solution[content]" class="hidden"></textarea>
5
+ <input id="mu-upload-input" type="file" class="upload submission-control hidden" mu-upload-file-limit=<%= @max_file_size %> accept=".<%= @exercise.language.extension %>" />
6
+ <div>
7
+ <label id="mu-upload-label" for="mu-upload-input" class="btn btn-success">
8
+ <%= fa_icon(:upload, text: t(:select_file), id: "mu-upload-icon") %>
9
+ </label>
10
+ <div id="mu-upload-file-limit-exceeded" class="hidden">
11
+ <%= fa_icon("exclamation-triangle", text: t(:file_exceeds_max_size, size_kb: (@max_file_size / 1000))) %></div>
12
+ </div>
4
13
  </div>
@@ -1 +1 @@
1
- <%= render partial: "layouts/guide_container", locals: { subject: @lesson }%>
1
+ <%= render partial: "guides/guide_container", locals: { subject: @lesson }%>
@@ -0,0 +1 @@
1
+ <%= menu_item :comments, :new_discussion_message, url_for([target.item, target]), { title: target.item.name.truncate_words(3) } %>
@@ -0,0 +1,13 @@
1
+ <div class="dropdown mu-navbar-element notifications-box <%= 'notifications-box-empty' unless has_notifications? %>">
2
+ <div id="notificationsDropdown" class="profile-dropdown" data-toggle="dropdown" aria-label="<%= t(:notifications) %>" role="menu" tabindex="0">
3
+ <i class="fas fa-bell fa-fw fa-2x mu-navbar-icon"></i>
4
+ <span class="badge badge-notifications"><%= notifications_count %></span>
5
+ </div>
6
+ <ul id="notificationsPanel" class="dropdown-menu dropdown-menu-right" aria-labelledby="notificationsDropdown">
7
+ <% notifications.each do |it| %>
8
+ <li>
9
+ <%= notification_preview_for it.target %>
10
+ </li>
11
+ <% end %>
12
+ </ul>
13
+ </div>
@@ -0,0 +1 @@
1
+ <%= menu_item :book_open, :exam_authorization_request_updated, url_for(target), { description: target.exam_registration.description } %>
@@ -0,0 +1 @@
1
+ <%= menu_item :book_open, :exam_registration_open, url_for(target), { description: target.description } %>
@@ -0,0 +1 @@
1
+ <%= menu_item :envelope, :new_message_received, url_for(target.exercise), { sender: target.sender } %>
@@ -1,11 +1,11 @@
1
1
  <div class="mu-user-header">
2
- <h1><%= @user.name %></h1>
2
+ <h1><%= t(:my_profile) %></h1>
3
3
  <div class="mu-profile-actions hidden-xs">
4
4
  <%= edit_profile_button %>
5
5
  </div>
6
6
  </div>
7
- <div class="row mu-tab-body">
8
- <div class="col-md-4 mu-profile-info-left">
7
+ <div class="mu-profile-info">
8
+ <div class="mu-profile-info-left">
9
9
  <%= profile_picture_for(@user, id: 'mu-user-avatar', class: 'mu-user-avatar') %>
10
10
  <% if in_gamified_context? %>
11
11
  <svg class="mu-level-progress" width="300" height="300" viewBox="0 0 100 100">
@@ -18,7 +18,10 @@
18
18
  </div>
19
19
  <% end %>
20
20
  </div>
21
- <div class="col-md-8 mu-profile-info-right">
21
+ <div class="mu-profile-info-right">
22
+ <div>
23
+ <span> <strong><%= t :name %>:</strong> <%= "#{@user.name}" %> </span>
24
+ </div>
22
25
  <% if @user.age.present? %>
23
26
  <div>
24
27
  <span> <strong><%= t :age %>:</strong> <%= "#{@user.age} #{t :years}" %> </span>
@@ -31,8 +34,7 @@
31
34
  <span> <strong><%= t :programming_since %>:</strong> <%= t(:time_since, time: time_ago_in_words(@user.created_at)) %> </span>
32
35
  </div>
33
36
  </div>
34
-
35
- <div class="mu-profile-actions mobile visible-xs">
36
- <%= edit_profile_button %>
37
- </div>
37
+ </div>
38
+ <div class="mu-profile-actions mobile visible-xs">
39
+ <%= edit_profile_button %>
38
40
  </div>
@@ -0,0 +1,28 @@
1
+ <%= content_for :breadcrumbs do %>
2
+ <%= breadcrumbs_for_my_account %>
3
+ <% end %>
4
+
5
+ <%= render partial: 'layouts/user_menu' %>
6
+
7
+ <div class="col-md-9 mu-tab-body">
8
+ <div class="mu-user-header">
9
+ <h1><%= t(:discussions) %></h1>
10
+ </div>
11
+ <% if @watched_discussions.empty? %>
12
+ <div class="mu-tab-body">
13
+ <%= t :discussions_will_be_here %>
14
+ </div>
15
+ <% else %>
16
+ <table class="table table-striped">
17
+ <% @watched_discussions.each do |discussion| %>
18
+ <tr>
19
+ <td>
20
+ <%= icon_for_read(discussion.read_by?(@user)) %>
21
+ </td>
22
+ <td><%= link_to discussion.item.name, item_discussion_path(discussion) %></td>
23
+ <td><%= time_ago_in_words discussion.last_message_date %></td>
24
+ </tr>
25
+ <% end %>
26
+ </table>
27
+ <% end %>
28
+ </div>
@@ -1,5 +1,5 @@
1
1
  <%= content_for :breadcrumbs do %>
2
- <%= breadcrumbs @user %>
2
+ <%= breadcrumbs_for_my_account %>
3
3
  <% end %>
4
4
 
5
5
  <%= render partial: 'edit_user_form' %>
@@ -0,0 +1,27 @@
1
+ <%= content_for :breadcrumbs do %>
2
+ <%= breadcrumbs_for_my_account %>
3
+ <% end %>
4
+
5
+ <%= render partial: 'layouts/user_menu' %>
6
+
7
+ <div class="col-md-9 mu-tab-body">
8
+ <div class="mu-user-header">
9
+ <h1><%= t(:messages) %></h1>
10
+ </div>
11
+ <% if @messages.empty? %>
12
+ <div class="mu-tab-body">
13
+ <%= t :no_messages %>
14
+ </div>
15
+ <% else %>
16
+ <table class="table table-striped">
17
+ <% @messages.each do |message| %>
18
+ <tr>
19
+ <td><%= icon_for_read(message.read?) %></td>
20
+ <td><%= link_to message.exercise.name, exercise_path(message.exercise.id) %></td>
21
+ <td><%= mail_to message.sender %></td>
22
+ <td><%= time_ago_in_words message.created_at %></td>
23
+ </tr>
24
+ <% end %>
25
+ </table>
26
+ <% end %>
27
+ </div>
@@ -1,56 +1,9 @@
1
1
  <%= content_for :breadcrumbs do %>
2
- <%= breadcrumbs @user %>
2
+ <%= breadcrumbs_for_my_account %>
3
3
  <% end %>
4
4
 
5
- <ul class="nav nav-tabs" role="tablist">
6
- <li role="presentation" class="active">
7
- <a data-target="#info" aria-controls="info" role="tab" data-toggle="tab"><%= t :profile %></a>
8
- </li>
9
- <li role="presentation">
10
- <a data-target="#messages" aria-controls="messages" role="tab" data-toggle="tab"><%= t :messages %></a>
11
- </li>
12
- <% if @watched_discussions.present? %>
13
- <li role="presentation">
14
- <a data-target="#discussions" aria-controls="discussions" role="tab" data-toggle="tab"><%= t :discussions %></a>
15
- </li>
16
- <% end %>
17
- </ul>
5
+ <%= render partial: 'layouts/user_menu' %>
18
6
 
19
- <div class="tab-content">
20
- <div role="tabpanel" class="tab-pane active" id="info">
21
- <%= render partial: 'user_form' %>
22
- </div>
23
- <div role="tabpanel" class="tab-pane" id="messages">
24
- <% if @messages.empty? %>
25
- <div class="row mu-tab-body col-md-12">
26
- <%= t :no_messages %>
27
- </div>
28
- <% else %>
29
- <table class="table table-striped">
30
- <% @messages.each do |message| %>
31
- <tr>
32
- <td><%= icon_for_read(message.read?) %></td>
33
- <td><%= link_to message.exercise.name, exercise_path(message.exercise.id) %></td>
34
- <td><%= mail_to message.sender %></td>
35
- <td><%= time_ago_in_words message.created_at %></td>
36
- </tr>
37
- <% end %>
38
- </table>
39
- <% end %>
40
- </div>
41
- <% if @watched_discussions.present? %>
42
- <div role="tabpanel" class="tab-pane" id="discussions">
43
- <table class="table table-striped">
44
- <% @watched_discussions.each do |discussion| %>
45
- <tr>
46
- <td>
47
- <%= icon_for_read(discussion.read_by?(@user)) %>
48
- </td>
49
- <td><%= link_to discussion.item.name, item_discussion_path(discussion) %></td>
50
- <td><%= time_ago_in_words discussion.last_message_date %></td>
51
- </tr>
52
- <% end %>
53
- </table>
54
- </div>
55
- <% end %>
7
+ <div class="col-md-9 mu-tab-body">
8
+ <%= render partial: 'user_form' %>
56
9
  </div>
@@ -1,6 +1,6 @@
1
1
  <%= content_for :breadcrumbs do %>
2
- <% if current_user? %>
3
- <%= breadcrumbs @user %>
2
+ <% if current_logged_user? %>
3
+ <%= breadcrumbs_for_my_account %>
4
4
  <% else %>
5
5
  <%= header_breadcrumbs %>
6
6
  <% end %>
data/config/routes.rb CHANGED
@@ -22,6 +22,9 @@ Rails.application.routes.draw do
22
22
  end
23
23
  end
24
24
 
25
+ resources :exam_registrations, only: [:show]
26
+ resources :exam_authorization_requests, only: [:show, :create, :update]
27
+
25
28
  resources :book, only: [:show]
26
29
  resources :chapters, only: [:show] do
27
30
  concerns :debatable, debatable_class: 'Chapter'
@@ -59,6 +62,9 @@ Rails.application.routes.draw do
59
62
 
60
63
  # Notification subscriptions
61
64
  get :unsubscribe
65
+
66
+ get :messages
67
+ get :discussions
62
68
  end
63
69
 
64
70
  resources :messages, only: [:index, :create]
@@ -1,32 +1,13 @@
1
1
  module Mumuki::Laboratory::Controllers::Notifications
2
-
3
- def user_notifications_path
4
- user_path(anchor: current_notifications_tab)
5
- end
6
-
7
2
  def has_notifications?
8
3
  notifications_count > 0
9
4
  end
10
5
 
11
6
  def notifications_count
12
- messages_count + discussions_count
13
- end
14
-
15
- private
16
-
17
- def current_notifications_tab
18
- has_messages? ? 'messages' : 'discussions'
19
- end
20
-
21
- def has_messages?
22
- messages_count > 0
23
- end
24
-
25
- def messages_count
26
- current_user.try(:unread_messages).try(:count) || 0
7
+ notifications.size
27
8
  end
28
9
 
29
- def discussions_count
30
- current_user.try(:unread_discussions).try(:count) || 0
10
+ def notifications
11
+ current_user.try(:unread_notifications) || []
31
12
  end
32
13
  end