Skip to content

Commit

Permalink
Fix emergency link feature and made "You need further help? ..." invi…
Browse files Browse the repository at this point in the history
…sible if no link was entered by the teacher.
  • Loading branch information
Frodo161 committed Sep 17, 2023
1 parent 8f82640 commit 22bd9cc
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
4 changes: 3 additions & 1 deletion app/controllers/lectures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ def lecture_params
:organizational_concept, :muesli,
:organizational_on_top, :disable_teacher_display,
:content_mode, :passphrase, :sort, :comments_disabled,
:submission_max_team_size, :submission_grace_period]
:submission_max_team_size, :submission_grace_period,
:annotations_status, :emergency_link,
:emergency_link_status]
if action_name == 'update' && current_user.can_update_personell?(@lecture)
allowed_params.concat([:teacher_id, editor_ids: []])
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/lecture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Lecture < ApplicationRecord
# in the erdbeere database
serialize :structure_ids, Array

# if the emergency button is enabled one can add different types of links
# if the emergency button is enabled, one can add different types of links
# that e.g. bring students to the helpdesk
enum emergency_link_status: { no_link: 0, lecture_link: 1, direct_link: 2 }

Expand Down
8 changes: 5 additions & 3 deletions app/views/annotations/_form_content_definition.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<% elsif status == "direct_link" %>
<% link_name = link %>
<% end %>
<%= t('admin.annotation.further_help') %> <br>
<a href="<%= link %>"><%= link_name %></a>
</div>
<% unless link_name.blank? %>
<%= t('admin.annotation.further_help') %> <br>
<a href="<%= link %>"><%= link_name %></a>
<% end %>
</div>
28 changes: 14 additions & 14 deletions app/views/lectures/edit/_preferences.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -192,21 +192,21 @@
</div>
</div>
</div>
<% end %>
<div id="lecture-link-field">
<%= t('admin.lecture.select_helpdesk') %>
<%= f.select :lecture_link,
options_for_select(Lecture.all.map { |l| [l.title, l.lecture_path] },
[@linked_lecture&.title, @linked_lecture&.lecture_path]) %>
</div>
<div class="form-row", id="direct-link-field">
<div class="col-auto form-group">
<%= t('admin.lecture.enter_emergency_link') %>
<%= f.text_field :direct_link,
{ size: 50,
value: @direct_link } %>
<div id="lecture-link-field">
<%= t('admin.lecture.select_helpdesk') %>
<%= f.select :lecture_link,
options_for_select(Lecture.all.map { |l| [l.title, l.lecture_path] },
[@linked_lecture&.title, @linked_lecture&.lecture_path]) %>
</div>
</div>
<div class="form-row", id="direct-link-field">
<div class="col-auto form-group">
<%= t('admin.lecture.enter_emergency_link') %>
<%= f.text_field :direct_link,
{ size: 50,
value: @direct_link } %>
</div>
</div>
<% end %>
<div class="row">
<div class="col-12 text-center">
<div id="lecture-preferences-warning">
Expand Down

0 comments on commit 22bd9cc

Please sign in to comment.