mumuki-laboratory 9.11.0 → 9.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/app/assets/javascripts/mumuki_laboratory/application/bridge.js +15 -9
  4. data/app/assets/javascripts/mumuki_laboratory/application/confirmation.js +10 -8
  5. data/app/assets/javascripts/mumuki_laboratory/application/editors.js +5 -3
  6. data/app/assets/javascripts/mumuki_laboratory/application/progress.js +4 -4
  7. data/app/assets/javascripts/mumuki_laboratory/application/results-renderer.js +12 -1
  8. data/app/assets/javascripts/mumuki_laboratory/application/submissions-store.js +8 -2
  9. data/app/controllers/application_controller.rb +8 -4
  10. data/app/controllers/book_controller.rb +6 -0
  11. data/app/controllers/chapters_controller.rb +9 -0
  12. data/app/controllers/discussions_controller.rb +9 -0
  13. data/app/controllers/exercises_controller.rb +5 -0
  14. data/app/controllers/faqs_controller.rb +4 -0
  15. data/app/controllers/lessons_controller.rb +9 -0
  16. data/app/controllers/users_controller.rb +5 -1
  17. data/app/helpers/concerns/with_student_path_navigation.rb +1 -1
  18. data/app/helpers/content_view_helper.rb +8 -0
  19. data/app/helpers/discussions_helper.rb +1 -1
  20. data/app/helpers/links_helper.rb +5 -1
  21. data/app/helpers/menu_bar_helper.rb +2 -3
  22. data/app/helpers/overlapped_buttons_helper.rb +2 -1
  23. data/app/helpers/time_zone_helper.rb +5 -0
  24. data/app/mailers/user_mailer.rb +2 -0
  25. data/app/views/book/show.html.erb +16 -7
  26. data/app/views/chapters/show.html.erb +1 -0
  27. data/app/views/discussions/_new_message.html.erb +1 -1
  28. data/app/views/discussions/show.html.erb +5 -5
  29. data/app/views/exercise_solutions/_results.html.erb +1 -1
  30. data/app/views/guides/_guide.html.erb +2 -2
  31. data/app/views/layouts/_progress_bar.html.erb +1 -0
  32. data/app/views/layouts/_progress_listing.html.erb +1 -0
  33. data/app/views/layouts/application.html.erb +4 -0
  34. data/app/views/layouts/exercise_inputs/forms/_kids_form.html.erb +1 -1
  35. data/app/views/layouts/exercise_inputs/forms/_problem_form.html.erb +6 -2
  36. data/app/views/layouts/exercise_inputs/read_only_editors/_hidden.html.erb +0 -0
  37. data/app/views/layouts/exercise_inputs/read_only_editors/_upload.html.erb +0 -0
  38. data/app/views/notifications/previews/_exam_authorization_request_updated.html.erb +1 -1
  39. data/app/views/user_mailer/_mail_template.erb +1 -1
  40. data/app/views/user_mailer/notifications/_exam_registration.html.erb +1 -1
  41. data/app/views/user_mailer/notifications/exam_authorization_request_updated/_approved.html.erb +1 -1
  42. data/app/views/users/manage_notifications.html.erb +1 -1
  43. data/app/views/users/notifications.html.erb +1 -1
  44. data/lib/mumuki/laboratory.rb +1 -0
  45. data/lib/mumuki/laboratory/controllers.rb +1 -0
  46. data/lib/mumuki/laboratory/controllers/authorization.rb +5 -1
  47. data/lib/mumuki/laboratory/controllers/validate_access_mode.rb +15 -0
  48. data/lib/mumuki/laboratory/locales/en.yml +1 -0
  49. data/lib/mumuki/laboratory/locales/es-CL.yml +1 -0
  50. data/lib/mumuki/laboratory/locales/es.yml +1 -0
  51. data/lib/mumuki/laboratory/locales/pt.yml +1 -0
  52. data/lib/mumuki/laboratory/mailers/message_delivery.rb +15 -0
  53. data/lib/mumuki/laboratory/version.rb +1 -1
  54. data/spec/features/menu_bar_spec.rb +3 -2
  55. data/spec/features/not_found_private_flow_spec.rb +1 -1
  56. data/spec/features/read_only_flow_spec.rb +920 -0
  57. data/spec/javascripts/editors-spec.js +21 -3
  58. data/spec/javascripts/submissions-store-spec.js +11 -0
  59. data/spec/mailers/previews/user_mailer_preview.rb +48 -6
  60. metadata +15 -14
@@ -33,7 +33,7 @@ describe('editors', () => {
33
33
  }
34
34
  });
35
35
 
36
- expect(mumuki.editors.getSubmission()).toEqual({"solution[content]":"the custom solution"});
36
+ expect(mumuki.editors.getSubmission()).toEqual({"_pristine": true, "solution[content]":"the custom solution"});
37
37
  });
38
38
 
39
39
  it('reads the form if no sources', () => {
@@ -43,7 +43,24 @@ describe('editors', () => {
43
43
  <textarea class="form-control editor" name="solution[content]" id="solution_content">the solution</textarea>
44
44
  </div>
45
45
  </form>`);
46
- expect(mumuki.editors.getSubmission()).toEqual({"solution[content]":"the solution"});
46
+ expect(mumuki.editors.getSubmission()).toEqual({"_pristine": true, "solution[content]":"the solution"});
47
+ });
48
+
49
+ it('reads the form when it is not the first submission', () => {
50
+ $('body').html(`
51
+ <form role="form" class="new_solution">
52
+ <div class="editor-code">
53
+ <textarea class="form-control editor" name="solution[content]" id="solution_content">the solution</textarea>
54
+ </div>
55
+ </form>
56
+ <div class=" submission-results">
57
+ <div class="bs-callout bs-callout-success">
58
+ <h4 class="text-success">
59
+ <strong><i class="fas fa-check-circle"></i> ¡Muy bien!</strong>
60
+ </h4>
61
+ </div>
62
+ </div>`);
63
+ expect(mumuki.editors.getSubmission()).toEqual({"_pristine": false, "solution[content]":"the solution"});
47
64
  });
48
65
 
49
66
  it('reads the form if no sources and exercise is multifile', () => {
@@ -63,6 +80,7 @@ describe('editors', () => {
63
80
  </div>
64
81
  </form>`);
65
82
  expect(mumuki.editors.getSubmission()).toEqual({
83
+ "_pristine": true,
66
84
  "solution[content[index.html]]": "some html",
67
85
  "solution[content[receta.css]]": "some css"
68
86
  });
@@ -70,6 +88,6 @@ describe('editors', () => {
70
88
 
71
89
  it('produces empty submission if no form nor sources', () => {
72
90
  $('body').html(``);
73
- expect(mumuki.editors.getSubmission()).toEqual({});
91
+ expect(mumuki.editors.getSubmission()).toEqual({_pristine: true});
74
92
  });
75
93
  });
@@ -18,6 +18,17 @@ describe("SubmissionsStore", () => {
18
18
  mumuki.SubmissionsStore.setSubmissionResultFor(1, passedEmptyProgramSubmissionAndResult);
19
19
  expect(mumuki.SubmissionsStore.getLastSubmissionAndResult(1)).toEqual(passedEmptyProgramSubmissionAndResult);
20
20
  });
21
+
22
+ it("answers the last submission result, ignoring pristiness", () => {
23
+ mumuki.SubmissionsStore.setSubmissionResultFor(1, {
24
+ submission: {
25
+ ...emptyProgramSubmission,
26
+ _pristine: true
27
+ },
28
+ result: passedSubmissionResult
29
+ });
30
+ expect(mumuki.SubmissionsStore.getLastSubmissionAndResult(1)).toEqual(passedEmptyProgramSubmissionAndResult);
31
+ });
21
32
  });
22
33
 
23
34
  describe('getLastSubmissionStatus', () => {
@@ -7,19 +7,64 @@ class UserMailerPreview < ActionMailer::Preview
7
7
  end
8
8
 
9
9
  def custom_content_plain_text_notification
10
- UserMailer.notification notification
10
+ UserMailer.notification notification subject: :custom,
11
+ custom_content_plain_text: 'This is the text of the mail. Awesome!',
12
+ custom_title: 'This is the title!'
11
13
  end
12
14
 
13
15
  def custom_content_html_notification
14
- UserMailer.notification notification(custom_content_html: 'This is <em>the text</em> of the mail. <strong>Awesome!</strong>')
16
+ UserMailer.notification notification subject: :custom,
17
+ custom_content_html: 'This is <em>the text</em> of the mail. <strong>Awesome!</strong>',
18
+ custom_title: 'This is the title!'
15
19
  end
16
20
 
17
21
  def certificate_preview
18
22
  UserMailer.certificate certificate
19
23
  end
20
24
 
25
+ def exam_registration_preview
26
+ notification = notification target: exam_registration, subject: :exam_registration
27
+
28
+ UserMailer.notification notification
29
+ end
30
+
31
+ def exam_authorization_request_approved
32
+ notification = notification target: exam_authorization_request('approved'), subject: :exam_authorization_request_updated
33
+
34
+ UserMailer.notification notification
35
+ end
36
+
37
+ def exam_authorization_request_rejected
38
+ notification = notification target: exam_authorization_request('rejected'), subject: :exam_authorization_request_updated
39
+
40
+ UserMailer.notification notification
41
+ end
42
+
21
43
  private
22
44
 
45
+ def exam_registration
46
+ ExamRegistration.new id: 1,
47
+ organization: organization,
48
+ description: 'Some test description',
49
+ start_time: 5.minute.ago,
50
+ end_time: 5.minutes.since
51
+
52
+ end
53
+
54
+ def exam_authorization_request(status)
55
+ ExamAuthorizationRequest.new id: 1,
56
+ user: user,
57
+ status: status,
58
+ exam: exam,
59
+ organization: organization
60
+ end
61
+
62
+ def exam
63
+ Exam.new organization: organization,
64
+ start_time: 5.minute.ago,
65
+ end_time: 5.minutes.since
66
+ end
67
+
23
68
  def user
24
69
  User.new uid: 'some_user@gmail.com',
25
70
  first_name: 'Some',
@@ -45,9 +90,6 @@ class UserMailerPreview < ActionMailer::Preview
45
90
 
46
91
  def notification(**hash)
47
92
  Notification.new({user: user,
48
- organization: organization,
49
- subject: :custom,
50
- custom_content_plain_text: 'This is the text of the mail. Awesome!',
51
- custom_title: 'This is the title!'}.merge hash)
93
+ organization: organization}.merge hash)
52
94
  end
53
95
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-laboratory
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.11.0
4
+ version: 9.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-06 00:00:00.000000000 Z
11
+ date: 2021-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 9.11.0
33
+ version: 9.13.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 9.11.0
40
+ version: 9.13.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mumukit-bridge
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '7.6'
61
+ version: '7.7'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '7.6'
68
+ version: '7.7'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mumukit-nuntius
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '7.8'
89
+ version: '7.11'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '7.8'
96
+ version: '7.11'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mumukit-content-type
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -353,9 +353,6 @@ dependencies:
353
353
  - - "~>"
354
354
  - !ruby/object:Gem::Version
355
355
  version: '2.0'
356
- - - "<"
357
- - !ruby/object:Gem::Version
358
- version: '2.2'
359
356
  type: :development
360
357
  prerelease: false
361
358
  version_requirements: !ruby/object:Gem::Requirement
@@ -363,9 +360,6 @@ dependencies:
363
360
  - - "~>"
364
361
  - !ruby/object:Gem::Version
365
362
  version: '2.0'
366
- - - "<"
367
- - !ruby/object:Gem::Version
368
- version: '2.2'
369
363
  - !ruby/object:Gem::Dependency
370
364
  name: webdrivers
371
365
  requirement: !ruby/object:Gem::Requirement
@@ -573,6 +567,7 @@ files:
573
567
  - app/helpers/progress_bar_helper.rb
574
568
  - app/helpers/progress_helper.rb
575
569
  - app/helpers/runner_assets_helper.rb
570
+ - app/helpers/time_zone_helper.rb
576
571
  - app/helpers/toast_helper.rb
577
572
  - app/helpers/user_activity_helper.rb
578
573
  - app/helpers/user_discussions_helper.rb
@@ -678,10 +673,12 @@ files:
678
673
  - app/views/layouts/exercise_inputs/read_only_editors/_code.html.erb
679
674
  - app/views/layouts/exercise_inputs/read_only_editors/_custom.html.erb
680
675
  - app/views/layouts/exercise_inputs/read_only_editors/_free_form.html.erb
676
+ - app/views/layouts/exercise_inputs/read_only_editors/_hidden.html.erb
681
677
  - app/views/layouts/exercise_inputs/read_only_editors/_multiple_choice.html.erb
682
678
  - app/views/layouts/exercise_inputs/read_only_editors/_multiple_files.html.erb
683
679
  - app/views/layouts/exercise_inputs/read_only_editors/_single_choice.html.erb
684
680
  - app/views/layouts/exercise_inputs/read_only_editors/_text.erb
681
+ - app/views/layouts/exercise_inputs/read_only_editors/_upload.html.erb
685
682
  - app/views/layouts/mailer.html.erb
686
683
  - app/views/layouts/mailer.text.erb
687
684
  - app/views/layouts/modals/_avatar_picker.html.erb
@@ -761,6 +758,7 @@ files:
761
758
  - lib/mumuki/laboratory/controllers/nested_in_exercise.rb
762
759
  - lib/mumuki/laboratory/controllers/notifications.rb
763
760
  - lib/mumuki/laboratory/controllers/results_rendering.rb
761
+ - lib/mumuki/laboratory/controllers/validate_access_mode.rb
764
762
  - lib/mumuki/laboratory/engine.rb
765
763
  - lib/mumuki/laboratory/events/events.rb
766
764
  - lib/mumuki/laboratory/extensions.rb
@@ -772,6 +770,7 @@ files:
772
770
  - lib/mumuki/laboratory/locales/es.yml
773
771
  - lib/mumuki/laboratory/locales/pt.yml
774
772
  - lib/mumuki/laboratory/locales/views.es.yml
773
+ - lib/mumuki/laboratory/mailers/message_delivery.rb
775
774
  - lib/mumuki/laboratory/version.rb
776
775
  - lib/tasks/assignments.rake
777
776
  - lib/tasks/events.rake
@@ -875,6 +874,7 @@ files:
875
874
  - spec/features/notifications_flow_spec.rb
876
875
  - spec/features/profile_flow_spec.rb
877
876
  - spec/features/progressive_tips_spec.rb
877
+ - spec/features/read_only_flow_spec.rb
878
878
  - spec/features/runner_assets_spec.rb
879
879
  - spec/features/standard_flow_spec.rb
880
880
  - spec/features/terms_flow_spec.rb
@@ -1007,6 +1007,7 @@ test_files:
1007
1007
  - spec/features/notifications_flow_spec.rb
1008
1008
  - spec/features/terms_flow_spec.rb
1009
1009
  - spec/features/home_private_flow_spec.rb
1010
+ - spec/features/read_only_flow_spec.rb
1010
1011
  - spec/features/runner_assets_spec.rb
1011
1012
  - spec/features/topic_flow_spec.rb
1012
1013
  - spec/features/complements_flow_spec.rb