Skip to content

Commit

Permalink
Add better UI feedback when closing/opening discussions (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines authored Aug 13, 2024
1 parent 6012d2d commit 948e7ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/controllers/lectures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,13 @@ def close_comments
@lecture.lessons.each do |lesson|
lesson.media.update(annotations_status: -1)
end
@lecture.touch
redirect_to "#{edit_lecture_path(@lecture)}#communication"
end

def open_comments
@lecture.open_comments!(current_user)
@lecture.touch
redirect_to "#{edit_lecture_path(@lecture)}#communication"
end

Expand Down
19 changes: 13 additions & 6 deletions app/views/lectures/edit/_comments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@

<div>
<div id="comments-buttons">
<%= link_to t('buttons.close_comments'),
lecture_close_comments_path(lecture),
class: 'btn btn-sm btn-outline-secondary' %>
<%= link_to t('buttons.open_comments'),
lecture_open_comments_path(lecture),
class: 'btn btn-sm btn-outline-secondary' %>
<% if lecture.comments_closed? %>
<%= link_to lecture_open_comments_path(lecture),
class: "btn btn-sm btn-outline-secondary", role: :button do %>
<i class="fas fa-unlock"></i>
<%= t('buttons.open_comments') %>
<% end %>
<% else %>
<%= link_to lecture_close_comments_path(lecture),
class: "btn btn-sm btn-outline-secondary", role: :button do %>
<i class="fas fa-lock"></i>
<%= t('buttons.close_comments') %>
<% end %>
<% end %>
</div>
</div>

Expand Down

0 comments on commit 948e7ca

Please sign in to comment.