Skip to content
Snippets Groups Projects
Commit 4996f786 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

extranet nav

parent 65c08f9a
No related branches found
No related tags found
No related merge requests found
class Admin::Communication::Extranets::AlumniController < Admin::Communication::Extranets::ApplicationController
def index
@about = @extranet.about
@alumni = @extranet.alumni
@cohorts = @extranet.cohorts
@years = @extranet.years
@organizations = @extranet.organizations
breadcrumb
add_breadcrumb Communication::Extranet.human_attribute_name(:feature_alumni)
end
end
\ No newline at end of file
class Admin::Communication::Extranets::ApplicationController < Admin::Communication::ApplicationController
load_and_authorize_resource :extranet,
class: Communication::Extranet,
through: :current_university,
through_association: :communication_extranets
protected
def breadcrumb
super
add_breadcrumb Communication::Extranet.model_name.human(count: 2), admin_communication_extranets_path
breadcrumb_for @extranet
end
def default_url_options
options = {}
if @extranet.present?
options[:extranet_id] = @extranet.id
end
options
end
end
......@@ -12,11 +12,6 @@ class Admin::Communication::ExtranetsController < Admin::Communication::Applicat
end
def show
@about = @extranet.about
@alumni = @extranet.alumni
@cohorts = @extranet.cohorts
@years = @extranet.years
@organizations = @extranet.organizations
breadcrumb
end
......
......@@ -15,6 +15,8 @@ class Icon
COMMUNICATION_WEBSITE_PREVIEW_DESKTOP = 'fas fa-laptop'
COMMUNICATION_WEBSITE_MENU_BLANK = 'fas fa-font'
COMMUNICATION_WEBSITE_MENU_URL = 'fas fa-globe'
COMMUNICATION_EXTRANET_HOME = COMMUNICATION_WEBSITE_HOME
COMMUNICATION_EXTRANET_ALUMNI = 'fas fa-user-graduate'
COMMUNICATION_NEWSLETTERS = 'fas fa-envelope'
EDUCATION_DIPLOMA = 'fas fa-graduation-cap'
......
<div class="row mt-2 website__sidebar">
<div class="col-lg-3 col-xl-2">
<ul class="list-unstyled" role="tablist">
<%
navigation = [
{
title: Communication::Extranet.model_name.human,
path: admin_communication_extranet_path(id: @extranet),
icon: Icon::COMMUNICATION_EXTRANET_HOME
},
{
title: Communication::Extranet.human_attribute_name(:feature_alumni),
path: admin_communication_extranet_alumni_path(extranet_id: @extranet),
icon: Icon::COMMUNICATION_EXTRANET_ALUMNI
},
]
navigation.each_with_index do |object, index|
active = index.zero? ? controller_name == "extranets" && action_name == "show"
: object[:path].in?(request.path)
%>
<li class="mb-3">
<a class="d-block py-1 <%= active ? 'text-black' : 'text-muted' %>" href="<%= object[:path] %>">
<i class="<%= object[:icon] %>" style="min-width: 30px"></i>
<%= object[:title].html_safe %>
</a>
</li>
<% end %>
</ul>
</div>
<div class="col-lg-9 col-xl-10">
<%= yield %>
</div>
</div>
<% content_for :title, Communication::Extranet.human_attribute_name(:feature_alumni) %>
<%= render 'admin/communication/extranets/sidebar' do %>
<% if @alumni %>
<p>
<%= @alumni.count %>
<%= University::Person::Alumnus.model_name.human(count: @alumni.count).downcase %>
</p>
<% end %>
<% if @cohorts %>
<p>
<%= @cohorts.count %>
<%= Education::Cohort.model_name.human(count: @cohorts.count).downcase %>
</p>
<% end %>
<% if @years %>
<p>
<%= @years.count %>
<%= Education::AcademicYear.model_name.human(count: @years.count).downcase %>
</p>
<% end %>
<% if @organizations %>
<p>
<%= @organizations.count %>
<%= University::Organization.model_name.human(count: @organizations.count).downcase %>
</p>
<% end %>
<% end %>
\ No newline at end of file
......@@ -10,29 +10,8 @@
<% end %>
<% end %>
<% if @alumni %>
<p>
<%= @alumni.count %>
<%= University::Person::Alumnus.model_name.human(count: @alumni.count).downcase %>
</p>
<% end %>
<% if @cohorts %>
<p>
<%= @cohorts.count %>
<%= Education::Cohort.model_name.human(count: @cohorts.count).downcase %>
</p>
<% end %>
<% if @years %>
<p>
<%= @years.count %>
<%= Education::AcademicYear.model_name.human(count: @years.count).downcase %>
</p>
<% end %>
<% if @organizations %>
<p>
<%= @organizations.count %>
<%= University::Organization.model_name.human(count: @organizations.count).downcase %>
</p>
<%= render 'admin/communication/extranets/sidebar' do %>
<% end %>
<% content_for :action_bar_left do %>
......
......@@ -65,7 +65,9 @@ namespace :communication do
post :duplicate
end
end
resources :extranets, controller: 'extranets'
resources :extranets, controller: 'extranets' do
resources :alumni, only: :index, controller: 'extranets/alumni'
end
resources :alumni do
collection do
resources :imports, only: [:index, :show, :new, :create]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment