Files
codeocean/app/views/application/_breadcrumbs_and_title.html.slim
Sebastian Serth 944b455194 Introduce Dark Mode
This commit mainly changes the color definitions. Mostly, those changes are semantically equally, but there are a few changes that occurred to align the color scheme within the app.
2023-07-31 11:48:42 +02:00

36 lines
1.4 KiB
Plaintext

- model = controller_path.classify.constantize rescue nil
- if model
- object = model.find_by(id: params[:id])
- if model.try(:nested_resource?)
- root_element = model.model_name.human(count: 2)
- if object
- current_element = object
- else
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), send(:"#{model.model_name.collection}_path"))
- if object
- current_element = link_to_if(current_user && policy(object).show?, object, send(:"#{model.model_name.singular}_path", object))
- if I18n.exists?("shared.#{params[:action]}")
- active_action = t("shared.#{params[:action]}", model: model&.model_name&.human)
- else
- active_action = t("#{controller_name}.index.#{params[:action]}", model: model&.model_name&.human)
- else
- active_action = t("breadcrumbs.#{controller_name}.#{params[:action]}")
- title = "#{active_action} - #{application_name}"
- content_for :breadcrumbs do
.container.mb-4
ul.breadcrumb.bg-body-secondary.px-3.py-2
- if root_element.present?
li.breadcrumb-item.small
= root_element
- if current_element.present?
li.breadcrumb-item.small
= current_element
- title = "#{object} - #{title}"
- else
- title = "#{model.model_name.human(count: 2)} - #{title}"
li.breadcrumb-item.active.small
= active_action
- content_for :title, title