Skip to content

Commit

Permalink
enable omission of teacher's name for term independent lectures
Browse files Browse the repository at this point in the history
  • Loading branch information
fosterfarrell9 committed Sep 7, 2020
1 parent 6a0eaa2 commit 2b51264
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/controllers/lectures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ def lecture_params
:start_section, :organizational, :locale,
:organizational_concept, :muesli,
:organizational_on_top,
:disable_teacher_display,
:content_mode, :passphrase, :sort,
:comments_disabled,
editor_ids: [])
Expand Down
1 change: 1 addition & 0 deletions app/models/lecture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ def title_term_info
end

def title_term_info_no_type
return course.title unless term
"#{course.title}, #{term_to_label}"
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/courses/_image.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<div class="row mb-3">
<div class="col-12">
<%= image_tag(course.image_url_with_host.presence ||
'/teachable_thumbnail.png',
'/no_course_information.png',
class: 'img-fluid',
id: 'image-preview') %>
</div>
Expand Down
16 changes: 16 additions & 0 deletions app/views/lectures/edit/_preferences.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,22 @@
</div>
</div>
</div>
<% if !lecture.term %>
<div class="row">
<div class="col-12">
<div class="custom-control custom-checkbox">
<%= f.check_box :disable_teacher_display,
class: 'custom-control-input',
disabled: inspection %>
<%= f.label :disable_teacher_display,
t('admin.lecture.disable_teacher_display'),
{ class: 'custom-control-label' } %>
<%= helpdesk(t('admin.lecture.info.disable_teacher_display'),
false) %>
</div>
</div>
</div>
<% end %>
<div class="row">
<div class="col-12 text-center">
<div id="lecture-preferences-warning">
Expand Down
14 changes: 8 additions & 6 deletions app/views/lectures/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
<span id="lecture-title" class="mr-3">
<%= @lecture.title_term_info_no_type %>
</span>
<span>
<%= link_to @lecture.teacher.name,
teacher_path(@lecture.teacher),
id: 'lecture-teacher',
class: 'text-dark' %>
</span>
<% if @lecture.term || !@lecture.disable_teacher_display %>
<span>
<%= link_to @lecture.teacher.name,
teacher_path(@lecture.teacher),
id: 'lecture-teacher',
class: 'text-dark' %>
</span>
<% end %>
<% privileged = current_user.admin ||
current_user.in?(@lecture.editors_with_inheritance) %>
<%= link_to '',
Expand Down
10 changes: 7 additions & 3 deletions app/views/main/start/_lecture_card.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,23 @@
<% if !current && lecture.term %>
<%= lecture.term.to_label_short %>,
<% end %>
<%= lecture.teacher.name %>
<% if lecture.term || !lecture.disable_teacher_display %>
<%= lecture.teacher.name %>
<% else %>
<br>
<% end %>
</div>
</div>
</div>
<% if subscribed %>
<%= link_to image_tag(lecture.course.normalized_image_url_with_host ||
'/teachable_thumbnail.png',
'/no_course_information.png',
class: 'card-img-top teachableThumbnail border-bottom',
alt: 'Card image cap'),
lecture %>
<% else %>
<%= image_tag(lecture.course.normalized_image_url_with_host ||
'/teachable_thumbnail.png',
'/no_course_information.png',
class: 'card-img-top teachableThumbnail border-bottom',
alt: 'Card image cap') %>
<% end %>
Expand Down
7 changes: 7 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ de:
new_posts: 'neue Forenbeiträge'
no_rights: >
Du hast keine Berechtigung, diese Veranstaltung zu abonnieren.
disable_teacher_display: Anzeige des DozentInnen-Namens unterdrücken
info:
course: >
Hier kannst Du das Modul auswählen, zu dem diese
Expand Down Expand Up @@ -553,6 +554,12 @@ de:
Hier kannst Du Text eingeben, nach dem im Titel der Veranstaltung
gesucht wird. Wenn Du dieses Feld leer lässt (bzw. weniger als zwei Buchstaben
eingibst), wird es bei der Suche ignoriert.
disable_teacher_display: >
Wenn Du dieses Feld aktivierst, wird auf der Vorlesungs-Karten auf der
Startseite und auf der Vorlesungsseite für generische Nutzer
der DozentInnen-Name nicht angezeigt. Das macht z.B. Sinn, wenn
eine semesterunabhängige Veranstaltung von jemandem nur administrativ
als "DozentIn" begleitet wird.
show_media: 'Medien einblenden'
workflow: 'Workflow'
content_mode: 'Inhaltsermittlung'
Expand Down
6 changes: 6 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ en:
new_media: 'new media'
new_posts: 'new forum posts'
no_rights: 'You are not authorized to subscribe this event series.'
disable_teacher_display: disable the display of the teacher's name
info:
course: >
Here you can select the course to which this event series belongs.
Expand Down Expand Up @@ -520,6 +521,11 @@ en:
Here you can enter text that will be searched for in the title of the
event series. If you leave the text field empty (or enter less than two letters),
it will be ignored.
disable_teacher_display: >
If you check this box, the teacher's name will be omitted from the
lecture card on the start page and from the lecture page for generic
users. This could make sense e.g. if a lecture that is term
independent is only administratively supervised by a "teacher".
show_media: 'Show media'
workflow: 'Workflow'
content_mode: 'Content determination'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddDisableTeacherDisplayToLecture < ActiveRecord::Migration[6.0]
def change
add_column :lectures, :disable_teacher_display, :boolean, default: false
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_09_03_152249) do
ActiveRecord::Schema.define(version: 2020_09_07_113337) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -264,6 +264,7 @@
t.text "structure_ids"
t.boolean "comments_disabled"
t.boolean "organizational_on_top"
t.boolean "disable_teacher_display", default: false
t.index ["teacher_id"], name: "index_lectures_on_teacher_id"
t.index ["term_id"], name: "index_lectures_on_term_id"
end
Expand Down
Binary file added public/no_course_information.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/teachable_thumbnail.png
Binary file not shown.

0 comments on commit 2b51264

Please sign in to comment.