mumuki-laboratory 5.0.12 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +339 -0
  3. data/app/assets/javascripts/application/bridge.js +36 -7
  4. data/app/assets/javascripts/application/kids.js +92 -7
  5. data/app/assets/javascripts/application/submission.js +2 -1
  6. data/app/assets/stylesheets/application/modules/_highlight.scss +8 -0
  7. data/app/assets/stylesheets/application/modules/_kids.scss +92 -27
  8. data/app/controllers/api/base_controller.rb +23 -0
  9. data/app/controllers/api/courses_controller.rb +26 -0
  10. data/app/controllers/api/organizations_controller.rb +28 -0
  11. data/app/controllers/api/roles_controller.rb +47 -0
  12. data/app/controllers/api/students_controller.rb +9 -0
  13. data/app/controllers/api/teachers_controller.rb +9 -0
  14. data/app/controllers/api/users_controller.rb +18 -0
  15. data/app/controllers/assets_controller.rb +2 -1
  16. data/app/controllers/concerns/on_base_organization_only.rb +11 -0
  17. data/app/controllers/concerns/organizations_controller_template.rb +34 -0
  18. data/app/controllers/concerns/users_controller_template.rb +28 -0
  19. data/app/controllers/concerns/with_api_errors.rb +37 -0
  20. data/app/controllers/concerns/with_authorization.rb +19 -0
  21. data/app/controllers/concerns/with_errors_filter.rb +32 -0
  22. data/app/helpers/reset_button_helper.rb +1 -1
  23. data/app/models/api_client.rb +27 -0
  24. data/app/models/api_client_spec.rb +6 -0
  25. data/app/models/concerns/with_assignments.rb +4 -1
  26. data/app/models/course.rb +4 -6
  27. data/app/models/exercise/challenge.rb +5 -6
  28. data/app/models/language.rb +1 -1
  29. data/app/models/organization.rb +4 -0
  30. data/app/models/user.rb +22 -1
  31. data/app/views/exercise_solutions/_kids_results_button.html.erb +11 -0
  32. data/app/views/exercise_solutions/_results.html.erb +1 -7
  33. data/app/views/exercise_solutions/_results_button.html.erb +7 -0
  34. data/app/views/layouts/_kids.html.erb +5 -2
  35. data/app/views/layouts/exercise_inputs/editors/_custom.html.erb +1 -0
  36. data/app/views/layouts/exercise_inputs/forms/_kids_form.html.erb +3 -0
  37. data/app/views/layouts/exercise_inputs/layouts/_input_kids.html.erb +3 -3
  38. data/app/views/layouts/modals/_kids_context.html.erb +0 -3
  39. data/app/views/layouts/modals/_kids_results.html.erb +2 -0
  40. data/config/routes.rb +23 -0
  41. data/db/migrate/20180129142749_add_api_client.rb +11 -0
  42. data/lib/mumuki/laboratory/controllers/results_rendering.rb +7 -1
  43. data/lib/mumuki/laboratory/extensions/string.rb +8 -0
  44. data/lib/mumuki/laboratory/locales/en.yml +4 -0
  45. data/lib/mumuki/laboratory/locales/es.yml +4 -0
  46. data/lib/mumuki/laboratory/locales/pt.yml +4 -0
  47. data/lib/mumuki/laboratory/mumukit/auth.rb +7 -0
  48. data/lib/mumuki/laboratory/version.rb +1 -1
  49. data/public/amarillo_exito.svg +11 -0
  50. data/public/amarillo_fracaso.svg +5 -0
  51. data/public/compass_rose.svg +1417 -0
  52. data/spec/controllers/api_clients_controller.rb +26 -0
  53. data/spec/controllers/confirmations_controller_spec.rb +1 -1
  54. data/spec/controllers/courses_api_controller_spec.rb +28 -0
  55. data/spec/controllers/exercise_solutions_controller_spec.rb +1 -1
  56. data/spec/controllers/messages_controller_spec.rb +1 -1
  57. data/spec/controllers/organizations_api_controller_spec.rb +235 -0
  58. data/spec/controllers/students_api_controller_spec.rb +101 -0
  59. data/spec/controllers/users_api_controller_spec.rb +56 -0
  60. data/spec/dummy/db/schema.rb +9 -0
  61. data/spec/factories/api_client_factory.rb +18 -0
  62. data/spec/factories/course_factory.rb +9 -0
  63. data/spec/features/chapter_spec.rb +1 -1
  64. data/spec/features/complements_flow_spec.rb +1 -1
  65. data/spec/features/exams_flow_spec.rb +1 -1
  66. data/spec/features/exercise_flow_spec.rb +1 -1
  67. data/spec/features/guide_reset_spec.rb +1 -1
  68. data/spec/features/guides_flow_spec.rb +1 -1
  69. data/spec/features/home_public_flow_spec.rb +1 -1
  70. data/spec/features/lessons_flow_spec.rb +1 -1
  71. data/spec/features/links_flow_spec.rb +1 -1
  72. data/spec/features/login_flow_spec.rb +1 -1
  73. data/spec/features/profile_flow_spec.rb +1 -1
  74. data/spec/features/standard_flow_spec.rb +1 -1
  75. data/spec/helpers/application_helper_spec.rb +1 -1
  76. data/spec/helpers/email_helper_spec.rb +1 -1
  77. data/spec/helpers/exercise_input_helper_spec.rb +1 -1
  78. data/spec/helpers/with_breadcrumbs_spec.rb +1 -1
  79. data/spec/helpers/with_navigation_spec.rb +1 -1
  80. data/spec/models/assignment_spec.rb +1 -1
  81. data/spec/models/book_import_spec.rb +1 -1
  82. data/spec/models/book_spec.rb +1 -1
  83. data/spec/models/course_spec.rb +1 -1
  84. data/spec/models/event_generation_spec.rb +1 -1
  85. data/spec/models/exam_spec.rb +1 -1
  86. data/spec/models/exercise_spec.rb +11 -3
  87. data/spec/models/guide_spec.rb +1 -1
  88. data/spec/models/interactive_spec.rb +1 -1
  89. data/spec/models/lesson_spec.rb +1 -1
  90. data/spec/models/message_spec.rb +1 -1
  91. data/spec/models/navigation_spec.rb +1 -1
  92. data/spec/models/organization_spec.rb +1 -1
  93. data/spec/models/problem_spec.rb +1 -1
  94. data/spec/models/question_spec.rb +1 -1
  95. data/spec/models/reading_spec.rb +1 -1
  96. data/spec/models/solution_spec.rb +1 -1
  97. data/spec/models/usage_spec.rb +1 -1
  98. data/spec/models/user_changed_spec.rb +1 -1
  99. data/spec/models/user_spec.rb +5 -5
  100. data/spec/spec_helper.rb +19 -3
  101. metadata +37 -2
data/spec/spec_helper.rb CHANGED
@@ -29,19 +29,35 @@ require_relative './evaluation_helper'
29
29
 
30
30
  RSpec.configure do |config|
31
31
  config.before(:each) do
32
- set_subdomain_host! 'test'
33
- unless RSpec.current_example.metadata[:clean]
32
+ if RSpec.current_example.metadata[:organization_workspace] == :test
33
+ set_subdomain_host! 'test'
34
34
  create(:public_organization,
35
35
  name: 'test',
36
36
  book: create(:book, name: 'test', slug: 'mumuki/mumuki-the-book')).switch!
37
+ elsif RSpec.current_example.metadata[:organization_workspace] == :base
38
+ set_subdomain_host! 'base'
39
+ create(:organization, name: 'base',
40
+ logo_url: 'http://mumuki.io/logo-alt-large.png',
41
+ terms_of_service: 'Default terms of service',
42
+ theme_stylesheet: '.defaultCssFromBase { css: red }',
43
+ extension_javascript: 'function jsFromBase() {}').switch!
37
44
  end
38
45
  end
39
46
 
40
47
  config.after(:each) do
41
- Mumukit::Platform::Organization.leave!
48
+ Mumukit::Platform::Organization.leave! if RSpec.current_example.metadata[:organization_workspace]
42
49
  end
43
50
  end
44
51
 
52
+
53
+ Mumukit::Auth.configure do |c|
54
+ c.clients.default = {id: 'test-client', secret: 'thisIsATestSecret'}
55
+ end
56
+
57
+ def set_api_client!
58
+ @request.env["HTTP_AUTHORIZATION"] = api_client.token
59
+ end
60
+
45
61
  def reindex_organization!(organization)
46
62
  organization.reload
47
63
  organization.reindex_usages!
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: 5.0.12
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-05 00:00:00.000000000 Z
11
+ date: 2018-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -257,12 +257,25 @@ files:
257
257
  - app/assets/stylesheets/application/modules/_upload.scss
258
258
  - app/assets/stylesheets/application/modules/guide-corollary.scss
259
259
  - app/controllers/ajax_controller.rb
260
+ - app/controllers/api/base_controller.rb
261
+ - app/controllers/api/courses_controller.rb
262
+ - app/controllers/api/organizations_controller.rb
263
+ - app/controllers/api/roles_controller.rb
264
+ - app/controllers/api/students_controller.rb
265
+ - app/controllers/api/teachers_controller.rb
266
+ - app/controllers/api/users_controller.rb
260
267
  - app/controllers/appendixes_controller.rb
261
268
  - app/controllers/application_controller.rb
262
269
  - app/controllers/assets_controller.rb
263
270
  - app/controllers/book_controller.rb
264
271
  - app/controllers/chapters_controller.rb
265
272
  - app/controllers/complements_controller.rb
273
+ - app/controllers/concerns/on_base_organization_only.rb
274
+ - app/controllers/concerns/organizations_controller_template.rb
275
+ - app/controllers/concerns/users_controller_template.rb
276
+ - app/controllers/concerns/with_api_errors.rb
277
+ - app/controllers/concerns/with_authorization.rb
278
+ - app/controllers/concerns/with_errors_filter.rb
266
279
  - app/controllers/exams_controller.rb
267
280
  - app/controllers/exercise_confirmations_controller.rb
268
281
  - app/controllers/exercise_query_controller.rb
@@ -300,6 +313,8 @@ files:
300
313
  - app/helpers/status_helper.rb
301
314
  - app/mailers/application_mailer.rb
302
315
  - app/mailers/user_mailer.rb
316
+ - app/models/api_client.rb
317
+ - app/models/api_client_spec.rb
303
318
  - app/models/application_record.rb
304
319
  - app/models/assignment.rb
305
320
  - app/models/book.rb
@@ -375,7 +390,9 @@ files:
375
390
  - app/views/errors/not_found.html.erb
376
391
  - app/views/errors/unauthorized.html.erb
377
392
  - app/views/exams/show.html.erb
393
+ - app/views/exercise_solutions/_kids_results_button.html.erb
378
394
  - app/views/exercise_solutions/_results.html.erb
395
+ - app/views/exercise_solutions/_results_button.html.erb
379
396
  - app/views/exercise_solutions/_results_title.html.erb
380
397
  - app/views/exercises/show.html.erb
381
398
  - app/views/invitations/show.html.erb
@@ -657,6 +674,7 @@ files:
657
674
  - db/migrate/20180117014110_add_custom_editor_assets_to_language.rb
658
675
  - db/migrate/20180123174410_add_initial_and_final_states_to_exercises.rb
659
676
  - db/migrate/20180123180836_add_accepts_reminders_to_users.rb
677
+ - db/migrate/20180129142749_add_api_client.rb
660
678
  - db/migrate/20180130194923_add_last_reminded_date_to_users.rb
661
679
  - db/migrate/20180130204935_add_course.rb
662
680
  - db/migrate/20180323125804_remove_user_name.rb
@@ -718,8 +736,11 @@ files:
718
736
  - lib/tasks/users.rake
719
737
  - public/422.html
720
738
  - public/amarillo.svg
739
+ - public/amarillo_exito.svg
740
+ - public/amarillo_fracaso.svg
721
741
  - public/anim_amarillo.svg
722
742
  - public/character/kids/yellow_context.svg
743
+ - public/compass_rose.svg
723
744
  - public/email-banner.png
724
745
  - public/error_403.svg
725
746
  - public/error_404.svg
@@ -731,9 +752,14 @@ files:
731
752
  - public/logo-alt-large.png
732
753
  - public/logo-alt.png
733
754
  - spec/capybara_helper.rb
755
+ - spec/controllers/api_clients_controller.rb
734
756
  - spec/controllers/confirmations_controller_spec.rb
757
+ - spec/controllers/courses_api_controller_spec.rb
735
758
  - spec/controllers/exercise_solutions_controller_spec.rb
736
759
  - spec/controllers/messages_controller_spec.rb
760
+ - spec/controllers/organizations_api_controller_spec.rb
761
+ - spec/controllers/students_api_controller_spec.rb
762
+ - spec/controllers/users_api_controller_spec.rb
737
763
  - spec/dummy/Rakefile
738
764
  - spec/dummy/bin/bundle
739
765
  - spec/dummy/bin/rails
@@ -768,10 +794,12 @@ files:
768
794
  - spec/dummy/db/seeds.rb
769
795
  - spec/dummy/package.json
770
796
  - spec/evaluation_helper.rb
797
+ - spec/factories/api_client_factory.rb
771
798
  - spec/factories/assignments_factory.rb
772
799
  - spec/factories/book_factory.rb
773
800
  - spec/factories/chapter_factory.rb
774
801
  - spec/factories/complement_factory.rb
802
+ - spec/factories/course_factory.rb
775
803
  - spec/factories/exam_factory.rb
776
804
  - spec/factories/exercise_factory.rb
777
805
  - spec/factories/guide_factory.rb
@@ -903,9 +931,14 @@ specification_version: 4
903
931
  summary: Code assement web application for the Mumuki Platform.
904
932
  test_files:
905
933
  - spec/capybara_helper.rb
934
+ - spec/controllers/api_clients_controller.rb
906
935
  - spec/controllers/confirmations_controller_spec.rb
936
+ - spec/controllers/courses_api_controller_spec.rb
907
937
  - spec/controllers/exercise_solutions_controller_spec.rb
908
938
  - spec/controllers/messages_controller_spec.rb
939
+ - spec/controllers/organizations_api_controller_spec.rb
940
+ - spec/controllers/students_api_controller_spec.rb
941
+ - spec/controllers/users_api_controller_spec.rb
909
942
  - spec/dummy/Rakefile
910
943
  - spec/dummy/bin/bundle
911
944
  - spec/dummy/bin/rails
@@ -940,10 +973,12 @@ test_files:
940
973
  - spec/dummy/db/seeds.rb
941
974
  - spec/dummy/package.json
942
975
  - spec/evaluation_helper.rb
976
+ - spec/factories/api_client_factory.rb
943
977
  - spec/factories/assignments_factory.rb
944
978
  - spec/factories/book_factory.rb
945
979
  - spec/factories/chapter_factory.rb
946
980
  - spec/factories/complement_factory.rb
981
+ - spec/factories/course_factory.rb
947
982
  - spec/factories/exam_factory.rb
948
983
  - spec/factories/exercise_factory.rb
949
984
  - spec/factories/guide_factory.rb