Skip to content

Commit

Permalink
Sync production with mampf-next (#464)
Browse files Browse the repository at this point in the history
* added watchlist authorization

* Revert "Merge remote-tracking branch 'origin/imap-server' into mampf-next"

This reverts commit c45a6f2, reversing
changes made to 775ecbf.

* Revert "Merge branch 'updates' into mampf-next"

This reverts commit 11009ac, reversing
changes made to 78a7a0b.

* Revert "Revert "Merge branch 'updates' into mampf-next""

This reverts commit 7fb05e4.

* Revert "Revert "Merge remote-tracking branch 'origin/imap-server' into mampf-next""

This reverts commit 4311633.

* fix missing media in user edit view

* Check if lecture variable is present

and pass it into lecture_path(...)

* add authentification to main routes and remove old home

* render sidebar only if lecture is present

---------

Co-authored-by: Fabian Kontor <[email protected]>
Co-authored-by: Fabian K <[email protected]>
Co-authored-by: fosterfarrell9 <[email protected]>
  • Loading branch information
4 people authored Apr 18, 2023
1 parent e7f7829 commit 1ed5b4e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
3 changes: 1 addition & 2 deletions app/controllers/main_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# MainController
class MainController < ApplicationController
skip_before_action :authenticate_user!, only: [:home, :about, :news,
:sponsors]

before_action :check_for_consent
authorize_resource class: false, only: :start
layout 'application_no_sidebar'
Expand Down
17 changes: 10 additions & 7 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
<%= render partial: 'shared/navbar' %>
<div class="d-flex container-fluid flex-grow-1">
<div class="row" id="main-content-row">
<div id="sidebar-container"
class="col-sm-4 col-md-3 col-xl-2">
<nav id="sidebar">
<%= render partial: 'shared/sidebar',
locals: { lecture: @lecture || current_lecture } %>
</nav>
</div>
<% lecture = @lecture || current_lecture %>
<% if lecture %>
<div id="sidebar-container"
class="col-sm-4 col-md-3 col-xl-2">
<nav id="sidebar">
<%= render partial: 'shared/sidebar',
locals: { lecture: lecture } %>
</nav>
</div>
<% end %>
<main class="col-sm-8 ml-auto col-md-9 col-xl-10 pt-3" role="main">
<div class="alert alert-danger" id="js-messages" role="alert"
style="display: none;">
Expand Down
20 changes: 11 additions & 9 deletions app/views/shared/_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
<ul class="nav nav-pills flex-column">

<%# Overview %>
<% fullpath = lecture_path(lecture)%>
<% active_class = get_class_for_path(lecture_path()) %>
<li class="sidebar-item nav-link <%= active_class %>
<%= !lecture ? "disabled" : ""%>">
<a href="<%= url_for(fullpath)%>">
<i class="bi bi-house<%= active_class.present? ? "-fill" : "" %>"></i>
<%= t('basics.overview') %>
</a>
</li>
<% if lecture %>
<% fullpath = lecture_path(lecture)%>
<% active_class = get_class_for_path(lecture_path(lecture)) %>
<li class="sidebar-item nav-link <%= active_class %>
<%= !lecture ? "disabled" : ""%>">
<a href="<%= url_for(fullpath)%>">
<i class="bi bi-house<%= active_class.present? ? "-fill" : "" %>"></i>
<%= t('basics.overview') %>
</a>
</li>
<% end %>

<%# Lectures (Kaviar) %>
<% project_name = 'kaviar' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_data.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</div>
<div class="card-body">
<% if user.edited_courses.any? || user.edited_lectures.any? ||
user.given_lectures.any? %>
user.given_lectures.any? || user.edited_media.any? %>
<%= render partial: 'users/content',
locals: { user: user,
f: f } %>
Expand Down
4 changes: 1 addition & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@
authenticated :user do
root to: 'main#start'
end

unauthenticated do
root to: 'devise/sessions#new', as: :unauthenticated_root
end
Expand All @@ -873,8 +873,6 @@
get 'error',
to: 'main#error'

get 'main/home'

get 'main/news',
to: 'main#news',
as: 'news'
Expand Down

0 comments on commit 1ed5b4e

Please sign in to comment.