mumuki-laboratory 9.13.1 → 9.13.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b47dd283c616c348e2ce6aab4a61cb1e12ec68fa902fcff158e8dc6a7bf63a64
4
- data.tar.gz: 44a250723c61c458d582fe87b62dab762ee846a687c74d9c5e738a9eb5b14f92
3
+ metadata.gz: 19427492957bc679a64b679d1b50e33e38a750a032e9ca916fa8ba543eef8c03
4
+ data.tar.gz: bab7ef25dbc9e0970471fca58b4d8e3a1efd592d9f34d092e6f0eeed4c8eeb5d
5
5
  SHA512:
6
- metadata.gz: 2f39b477c86a46e4eaa33535adfd2adea92fe78f2fdc858c893b6eff24ff16c943b73a3a846045fe6af5ce0b80b6251614c17af13ef29d551ce7a198d2636d94
7
- data.tar.gz: 78e3cf4b67a33b11a3dccb90551ea2382714e5f1ab3b3bdfecdc3cbeabeb45af53178fbd6843fd78859f4e5844afc56656191eba00cffa6431460d8f98858ee7
6
+ metadata.gz: bb031814c4d6bc24bcfe00e988923cbdaf0e9cdd6e033d37fd09542736be3a6d9489bc41b5b9cb85bafd52b461ef48a2483082e441a2e92a02370135ba77b3be
7
+ data.tar.gz: eb0b4b0e606f74d5e679b77cb05088eebcbd651e733730acfee0f28fb15d5aecaa490d011d5bc4319cda746951419c5a85f9398472a9aa4cf40b5f5408dc5f3a
@@ -71,6 +71,15 @@
71
71
  return this;
72
72
  }
73
73
 
74
+ setupSpellCheckedEditor() {
75
+ this.editor = this.createEditor({
76
+ inputStyle: 'contenteditable',
77
+ spellcheck: true
78
+ });
79
+
80
+ return this;
81
+ }
82
+
74
83
  setupLanguage(language) {
75
84
  var highlightMode = language || this.$textarea.data('editor-language');
76
85
  if (highlightMode === 'dynamic') {
@@ -9,12 +9,13 @@ mumuki.load(() => {
9
9
 
10
10
  function createNewMessageEditor() {
11
11
  var $textarea = $("#discussion-new-message");
12
- var textarea = $textarea[0];
13
- if (!textarea) return;
12
+ var editorContainer = $(".mu-spell-checked-editor")[0];
13
+ if (!editorContainer) return;
14
14
 
15
- return new mumuki.editor.CodeMirrorBuilder(textarea)
16
- .setupSimpleEditor()
15
+ return new mumuki.editor.CodeMirrorBuilder(editorContainer)
16
+ .setupSpellCheckedEditor()
17
17
  .setupMinLines($textarea.data('lines'))
18
+ .setupLanguage()
18
19
  .build();
19
20
  }
20
21
 
@@ -38,3 +38,14 @@
38
38
  max-width: 70vw;
39
39
  }
40
40
  }
41
+
42
+ .mu-read-only {
43
+ display: flex;
44
+ flex-direction: column;
45
+ justify-content: center;
46
+ align-content: center;
47
+ background-color: $mu-color-complementary;
48
+ color: white;
49
+ text-align: center;
50
+ padding: 15px;
51
+ }
@@ -26,6 +26,7 @@ class ApplicationController < ActionController::Base
26
26
  before_action :authorize_if_private!
27
27
  before_action :validate_user_profile!, if: :current_user?
28
28
  before_action :validate_accepted_role_terms!, if: :current_user?
29
+ before_action :ensure_restore_progress!, if: :current_user?
29
30
 
30
31
  before_action :visit_organization!, if: :current_user?
31
32
 
@@ -164,4 +165,10 @@ class ApplicationController < ActionController::Base
164
165
  def current_access_mode
165
166
  Organization.current.access_mode(current_user)
166
167
  end
168
+
169
+ def ensure_restore_progress!
170
+ if current_access_mode.restore_indicators?(Organization.current.book)
171
+ current_user.restore_organization_progress!(Organization.current)
172
+ end
173
+ end
167
174
  end
@@ -39,17 +39,19 @@ class DiscussionsController < ApplicationController
39
39
  end
40
40
 
41
41
  def responsible
42
- if subject.can_toggle_responsible? current_user
43
- subject.toggle_responsible! current_user
44
-
45
- set_flash_responsible_confirmation!
46
- status = :ok
47
- else
48
- set_flash_responsible_alert!
49
- status = :conflict
50
- end
51
-
52
- render :partial => 'layouts/toast', status: status
42
+ subject.with_pg_lock proc {
43
+ if subject.can_toggle_responsible? current_user
44
+ subject.toggle_responsible! current_user
45
+
46
+ set_flash_responsible_confirmation!
47
+ status = :ok
48
+ else
49
+ set_flash_responsible_alert!
50
+ status = :conflict
51
+ end
52
+
53
+ render :partial => 'layouts/toast', status: status
54
+ }
53
55
  end
54
56
 
55
57
  def create
@@ -29,7 +29,10 @@ class UsersController < ApplicationController
29
29
  end
30
30
 
31
31
  def discussions
32
- @watched_discussions = current_user.watched_discussions_in_organization.scoped_query_by(discussion_filter_params).unread_first
32
+ @watched_discussions = current_user.watched_discussions_in_organization
33
+ .where(exercise: Organization.current.exercises)
34
+ .scoped_query_by(discussion_filter_params)
35
+ .unread_first
33
36
  end
34
37
 
35
38
  def activity
@@ -10,4 +10,9 @@ module EditorHelper
10
10
  editor_options = editor_defaults(language, options, 'read-only-editor')
11
11
  text_area_tag :solution_content, content, editor_options
12
12
  end
13
+
14
+ def spell_checked_editor(name, options = {})
15
+ editor_options = editor_defaults('markdown', options, 'form-control mu-spell-checked-editor')
16
+ text_area_tag name, '', editor_options
17
+ end
13
18
  end
@@ -10,7 +10,7 @@
10
10
  <div class="container-fluid">
11
11
  <div class="row">
12
12
  <div class="discussion-new-message-content">
13
- <%= f.editor :content, '', { id: 'discussion-new-message', class: 'form-control', placeholder: t(:message) } %>
13
+ <%= spell_checked_editor 'message[content]', { id: 'discussion-new-message', placeholder: t(:message) } %>
14
14
  </div>
15
15
  <div class="discussion-message-content d-none" id="discussion-new-message-preview"></div>
16
16
  </div>
@@ -1,4 +1,11 @@
1
1
  <%= content_for :navbar do %>
2
+
3
+ <% if current_access_mode.read_only? %>
4
+ <div class="mu-read-only">
5
+ <small><%= t :organization_read_only_legend %></small>
6
+ </div>
7
+ <% end %>
8
+
2
9
  <%= hidden_field_tag("mu-current-exp", UserStats.exp_for(@current_user)) if in_gamified_context? %>
3
10
  <div class="<%= exercise_container_type %> px-0">
4
11
  <nav class="navbar navbar-light navbar-expand-lg mu-navbar">
@@ -275,6 +275,7 @@ en:
275
275
  only_landscape_support: Please, rotate your tablet or cellphone to continue practicing
276
276
  opened: Open
277
277
  opened_count: '%{count} opened'
278
+ organization_read_only_legend: 'You are in reading mode. You will only be able to access the exercises that you did previously and you will not be able to send new solutions'
278
279
  other: Other
279
280
  out_of_attempts: You've run out of attempts. You should proceed to the next exercise!
280
281
  output: Output
@@ -284,6 +284,7 @@ es-CL:
284
284
  one: '1 abierta'
285
285
  other: '%{count} abiertas'
286
286
  organizations: Organizaciones
287
+ organization_read_only_legend: 'Estás en modo lectura. Solo podrás acceder a los ejercicios que realizaste previamente y no podrás enviar nuevas soluciones'
287
288
  other: Otro
288
289
  out_of_attempts: Te quedaste sin intentos. ¡Sigue al próximo ejercicio!
289
290
  output: Salida
@@ -293,6 +293,7 @@ es:
293
293
  one: '1 abierta'
294
294
  other: '%{count} abiertas'
295
295
  organizations: Organizaciones
296
+ organization_read_only_legend: 'Estás en modo lectura. Solo podrás acceder a los ejercicios que realizaste previamente y no podrás enviar nuevas soluciones'
296
297
  other: Otro
297
298
  out_of_attempts: Te quedaste sin intentos. ¡Seguí al proximo ejercicio!
298
299
  output: Salida
@@ -284,6 +284,7 @@ pt:
284
284
  opened: Aberto
285
285
  opened_count: '%{count} aberto'
286
286
  organizations: Organizações
287
+ organization_read_only_legend: 'Você está no modo de leitura. Você só poderá acessar os exercícios que fez anteriormente e não poderá enviar novas soluções'
287
288
  other: Outro
288
289
  out_of_attempts: Você ficou sem tentativas. Você deve prosseguir para o próximo exercício!
289
290
  output: Sair
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Laboratory
3
- VERSION = '9.13.1'
3
+ VERSION = '9.13.2'
4
4
  end
5
5
  end
@@ -257,6 +257,19 @@ feature 'Read Only Flow' do
257
257
  visit "/exercises/#{exercise112.id}/discussions/new"
258
258
  expect(page).to have_text('You are not allowed to see this content')
259
259
  end
260
+ scenario 'reattach book' do
261
+ expect(book.has_progress_for?(user, organization)).to eq true
262
+ visit "/"
263
+ expect(page).to have_text('Chapters')
264
+ organization.update! book: create(:book_with_full_tree)
265
+ organization.reload
266
+ visit "/"
267
+ expect(page).not_to have_text('Chapters')
268
+ organization.update! book: book
269
+ organization.reload
270
+ visit "/"
271
+ expect(page).to have_text('Chapters')
272
+ end
260
273
  end
261
274
 
262
275
  context 'and user is outsider of organization' do
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.13.1
4
+ version: 9.13.2
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-19 00:00:00.000000000 Z
11
+ date: 2021-08-26 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.13.0
33
+ version: 9.13.1
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.13.0
40
+ version: 9.13.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mumukit-bridge
43
43
  requirement: !ruby/object:Gem::Requirement