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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mumuki_laboratory/application/codemirror.js +1 -1
- data/app/assets/javascripts/mumuki_laboratory/application/upload.js +69 -14
- data/app/assets/stylesheets/mumuki_laboratory/application.scss +1 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/_codemirror-themes.scss +1 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/_layout.scss +3 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/_modules.scss +1 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/codemirror-themes/_mu-light.scss +3 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_content_show.scss +15 -2
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_discussion.scss +31 -8
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_medal.scss +1 -1
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_menu.scss +35 -0
- data/app/assets/stylesheets/mumuki_laboratory/application/modules/_user_profile.scss +11 -0
- data/app/controllers/api/base_controller.rb +0 -1
- data/app/controllers/api/courses_controller.rb +1 -1
- data/app/controllers/api/organizations_controller.rb +5 -2
- data/app/controllers/api/roles_controller.rb +4 -0
- data/app/controllers/api/users_controller.rb +6 -1
- data/app/controllers/application_controller.rb +1 -1
- data/app/controllers/concerns/with_authorization.rb +1 -16
- data/app/controllers/concerns/with_user_params.rb +4 -0
- data/app/controllers/discussions_messages_controller.rb +0 -1
- data/app/controllers/exam_authorization_requests_controller.rb +26 -0
- data/app/controllers/exam_registrations_controller.rb +6 -0
- data/app/controllers/users_controller.rb +8 -5
- data/app/helpers/application_helper.rb +4 -0
- data/app/helpers/breadcrumbs_helper.rb +4 -0
- data/app/helpers/content_view_helper.rb +19 -0
- data/app/helpers/exercise_input_helper.rb +8 -17
- data/app/helpers/icons_helper.rb +3 -11
- data/app/helpers/links_helper.rb +2 -2
- data/app/helpers/menu_bar_helper.rb +3 -3
- data/app/helpers/overlapped_buttons_helper.rb +10 -6
- data/app/helpers/progress_bar_helper.rb +2 -2
- data/app/helpers/user_menu_helper.rb +18 -0
- data/app/views/chapters/show.html.erb +17 -16
- data/app/views/complements/show.html.erb +1 -1
- data/app/views/discussions/_message.html.erb +7 -7
- data/app/views/exam_authorization_requests/show.html.erb +17 -0
- data/app/views/exam_registrations/show.html.erb +37 -0
- data/app/views/exams/show.html.erb +1 -1
- data/app/views/{layouts → exercises}/_exercise_skipped.html.erb +0 -0
- data/app/views/exercises/_exercise_title_icons.html.erb +4 -0
- data/app/views/exercises/show.html.erb +5 -8
- data/app/views/{layouts → guides}/_guide.html.erb +3 -3
- data/app/views/guides/_guide_container.html.erb +24 -0
- data/app/views/{layouts → guides}/_guide_title_icons.html.erb +1 -3
- data/app/views/layouts/_progress_bar.html.erb +9 -7
- data/app/views/layouts/_progress_listing.html.erb +5 -5
- data/app/views/layouts/_user_menu.html.erb +21 -0
- data/app/views/layouts/application.html.erb +1 -6
- data/app/views/layouts/exercise_inputs/editors/_upload.html.erb +11 -2
- data/app/views/lessons/show.html.erb +1 -1
- data/app/views/notifications/_discussion.html.erb +1 -0
- data/app/views/notifications/_dropdown.html.erb +13 -0
- data/app/views/notifications/_exam_authorization_request.html.erb +1 -0
- data/app/views/notifications/_exam_registration.html.erb +1 -0
- data/app/views/notifications/_message.html.erb +1 -0
- data/app/views/users/_user_form.html.erb +10 -8
- data/app/views/users/discussions.html.erb +28 -0
- data/app/views/users/edit.html.erb +1 -1
- data/app/views/users/messages.html.erb +27 -0
- data/app/views/users/show.html.erb +4 -51
- data/app/views/users/terms.html.erb +2 -2
- data/config/routes.rb +6 -0
- data/lib/mumuki/laboratory/controllers/notifications.rb +3 -22
- data/lib/mumuki/laboratory/locales/en.yml +35 -18
- data/lib/mumuki/laboratory/locales/es-CL.yml +26 -9
- data/lib/mumuki/laboratory/locales/es.yml +31 -15
- data/lib/mumuki/laboratory/locales/pt.yml +28 -11
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/controllers/exam_authorization_requests_controller_spec.rb +40 -0
- data/spec/controllers/exam_registrations_controller_spec.rb +19 -0
- data/spec/controllers/organizations_api_controller_spec.rb +16 -9
- data/spec/dummy/db/schema.rb +24 -0
- data/spec/features/exercise_flow_spec.rb +3 -3
- data/spec/features/login_flow_spec.rb +1 -1
- data/spec/features/menu_bar_spec.rb +24 -24
- data/spec/features/notifications_flow_spec.rb +46 -0
- data/spec/features/profile_flow_spec.rb +6 -9
- data/spec/features/terms_flow_spec.rb +30 -0
- data/spec/javascripts/bridge-spec.js +2 -2
- data/spec/javascripts/csrf-token-spec.js +2 -2
- data/spec/javascripts/editors-spec.js +7 -9
- data/spec/javascripts/elipsis-spec.js +4 -4
- data/spec/javascripts/events-spec.js +7 -7
- data/spec/javascripts/exercise-spec.js +7 -8
- data/spec/javascripts/global-spec.js +3 -3
- data/spec/javascripts/i18n-spec.js +23 -20
- data/spec/javascripts/kids-button-spec.js +6 -8
- data/spec/javascripts/results-renderers-spec.js +5 -5
- data/spec/javascripts/speech-bubble-renderer-spec.js +2 -3
- data/spec/javascripts/submissions-store-spec.js +14 -14
- data/spec/javascripts/sync-mode-spec.js +3 -3
- data/spec/javascripts/timeout-spec.js +2 -2
- data/spec/javascripts/timer-spec.js +2 -2
- data/spec/javascripts/upload-spec.js +80 -0
- metadata +129 -103
- data/app/views/layouts/_guide_container.html.erb +0 -28
@@ -1 +1 @@
|
|
1
|
-
<%= render partial: "
|
1
|
+
<%= render partial: "guides/guide_container", locals: { subject: @exam }%>
|
File without changes
|
@@ -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
|
-
|
23
|
-
|
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: '
|
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? &&
|
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 && @
|
13
|
+
<%= restart_guide_link(@guide) if current_user && @stats.started? && @guide.resettable? %>
|
14
14
|
</h3>
|
15
15
|
|
16
|
-
<%= render partial: 'layouts/progress_listing', locals: {
|
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="
|
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.
|
2
|
+
<% assignments = guide.assignments_for(current_user) %>
|
3
|
+
<% assignments.each do |assignment| %>
|
4
|
+
<% exercise = assignment.exercise %>
|
3
5
|
<a
|
4
|
-
<%= turbolinks_enable_for
|
5
|
-
href="<%= exercise_path(
|
6
|
-
aria-label="<%=
|
7
|
-
title="<%=
|
8
|
-
data-mu-exercise-id="<%=
|
9
|
-
class="<%= class_for_progress_list_item(
|
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
|
-
<%
|
3
|
-
<% cache [exercise,
|
4
|
-
<li <%= turbolinks_enable_for(exercise) %>>
|
5
|
-
<%=
|
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
|
-
|
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
|
-
|
3
|
-
|
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: "
|
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><%=
|
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="
|
8
|
-
<div class="
|
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="
|
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
|
-
|
36
|
-
|
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>
|
@@ -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
|
-
|
2
|
+
<%= breadcrumbs_for_my_account %>
|
3
3
|
<% end %>
|
4
4
|
|
5
|
-
|
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-
|
20
|
-
|
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>
|
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
|
-
|
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
|
30
|
-
current_user.try(:
|
10
|
+
def notifications
|
11
|
+
current_user.try(:unread_notifications) || []
|
31
12
|
end
|
32
13
|
end
|