diff --git a/app/assets/images/extranet/avatar.png b/app/assets/images/extranet/avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..34b4e0cdea8b2ce18e1fb644989edb762cc0dd63 Binary files /dev/null and b/app/assets/images/extranet/avatar.png differ diff --git a/app/assets/stylesheets/application/layout.sass b/app/assets/stylesheets/application/layout.sass index a76eb635e169cb3269432175e5e4022771db593c..2431819fb41ecbe4a91ed633890b7895bb249c19 100644 --- a/app/assets/stylesheets/application/layout.sass +++ b/app/assets/stylesheets/application/layout.sass @@ -9,3 +9,14 @@ footer padding: .95rem &-danger color: #82322F + +h1 + border-bottom: 1px solid + border-top: 1px solid + height: 100% + min-height: 160px + padding-top: 50px + +.breadcrumb + font-size: 14px + padding-bottom: 50px diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 325fa702c58e2ac2cfc4b9ba51ee9b4f9384211b..d3b4ac76472b87a3e4ca59fca8f6150bf7b85273 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,6 +2,7 @@ class ApplicationController < ActionController::Base include WithErrors include WithLocale include WithDomain + before_action :authenticate_user! def breadcrumb diff --git a/app/controllers/extranet/academic_years_controller.rb b/app/controllers/extranet/academic_years_controller.rb index c1d759ee055dc4e68b4db9a745c47382829147d7..a8439fd6ed87c6cfaaa3900373e67f628c97e7f3 100644 --- a/app/controllers/extranet/academic_years_controller.rb +++ b/app/controllers/extranet/academic_years_controller.rb @@ -1,12 +1,22 @@ -class Extranet::AcademicYearsController < ApplicationController +class Extranet::AcademicYearsController < Extranet::ApplicationController load_and_authorize_resource class: Education::AcademicYear, through: :current_university, through_association: :academic_years def index @academic_years = @academic_years.ordered.page(params[:page]) + breadcrumb end def show + breadcrumb + end + + protected + + def breadcrumb + super + add_breadcrumb Education::AcademicYear.model_name.human(count: 2), education_academic_years_path + add_breadcrumb @academic_year if @academic_year end end diff --git a/app/controllers/extranet/application_controller.rb b/app/controllers/extranet/application_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..6ea0f75a966bd71b4d7ad61a8455779daa63738c --- /dev/null +++ b/app/controllers/extranet/application_controller.rb @@ -0,0 +1,6 @@ +class Extranet::ApplicationController < ApplicationController + + def breadcrumb + add_breadcrumb t('home'), root_path + end +end diff --git a/app/controllers/extranet/cohorts_controller.rb b/app/controllers/extranet/cohorts_controller.rb index e5eaf425d46a911cc0067782d927fd5ae6456cfb..d6935d45b80e571b00805a48bf459a6edc06ffc4 100644 --- a/app/controllers/extranet/cohorts_controller.rb +++ b/app/controllers/extranet/cohorts_controller.rb @@ -1,12 +1,22 @@ -class Extranet::CohortsController < ApplicationController +class Extranet::CohortsController < Extranet::ApplicationController load_and_authorize_resource class: Education::Cohort, through: :current_university, through_association: :education_cohorts def index @cohorts = @cohorts.ordered.page(params[:page]) + breadcrumb end def show + breadcrumb + end + + protected + + def breadcrumb + super + add_breadcrumb Education::Cohort.model_name.human(count: 2), education_cohorts_path + add_breadcrumb @cohort if @cohort end end diff --git a/app/controllers/extranet/organizations_controller.rb b/app/controllers/extranet/organizations_controller.rb index 33633e234f5e3d55e9d239ae0d44aae1eb4a33e3..d91329fb8279c04f91c6a3b8cbc040e21114cb7b 100644 --- a/app/controllers/extranet/organizations_controller.rb +++ b/app/controllers/extranet/organizations_controller.rb @@ -1,12 +1,22 @@ -class Extranet::OrganizationsController < ApplicationController +class Extranet::OrganizationsController < Extranet::ApplicationController load_and_authorize_resource class: University::Organization, through: :current_university, through_association: :organizations def index @organizations = @organizations.ordered.page(params[:page]) + breadcrumb end def show + breadcrumb + end + + protected + + def breadcrumb + super + add_breadcrumb University::Organization.model_name.human(count: 2), university_organizations_path + add_breadcrumb @organization if @organization end end diff --git a/app/controllers/extranet/persons_controller.rb b/app/controllers/extranet/persons_controller.rb index 24b55e34c32c173a14921b7a5775fab97f03cc79..04043a9c91a75487f91f58c3dbab56b14153857a 100644 --- a/app/controllers/extranet/persons_controller.rb +++ b/app/controllers/extranet/persons_controller.rb @@ -1,11 +1,21 @@ -class Extranet::PersonsController < ApplicationController +class Extranet::PersonsController < Extranet::ApplicationController load_and_authorize_resource class: University::Person::Alumnus, through: :current_university, through_association: :people def index + breadcrumb end def show + breadcrumb + end + + protected + + def breadcrumb + super + add_breadcrumb University::Person::Alumnus.model_name.human(count: 2), university_persons_path + add_breadcrumb @person if @person end end diff --git a/app/models/university/person.rb b/app/models/university/person.rb index 6c58a15b9ba793989e9a11a6f6fab3e25c76a46b..457f07b48be05c5350cc2200dbdf85274bd9f15a 100644 --- a/app/models/university/person.rb +++ b/app/models/university/person.rb @@ -101,10 +101,10 @@ class University::Person < ApplicationRecord before_validation :sanitize_email scope :ordered, -> { order(:last_name, :first_name) } - scope :administration, -> { where(is_administration: true) } + scope :administration, -> { where(is_administration: true) } scope :teachers, -> { where(is_teacher: true) } scope :researchers, -> { where(is_researcher: true) } - scope :alumni, -> { where(is_alumnus: true) } + scope :alumni, -> { where(is_alumnus: true) } def to_s "#{first_name} #{last_name}" diff --git a/app/models/university/person/alumnus/import.rb b/app/models/university/person/alumnus/import.rb index 2f8e7bd176923217630cc06460d7b5b7bc01c6d8..bf9b5c066ebb284e313293693e80333f5edf1e2a 100644 --- a/app/models/university/person/alumnus/import.rb +++ b/app/models/university/person/alumnus/import.rb @@ -49,7 +49,7 @@ class University::Person::Alumnus::Import < ApplicationRecord # status # socialtwitter # sociallinkedin - row['program'] = '23279cab-8bc1-4c75-bcd8-1fccaa03ad55' #TMP local fix + # row['program'] = '23279cab-8bc1-4c75-bcd8-1fccaa03ad55' #TMP local fix program = university.education_programs .find_by(id: row['program']) next if program.nil? @@ -79,9 +79,20 @@ class University::Person::Alumnus::Import < ApplicationRecord person.is_alumnus = true person.url = url person.slug = person.to_s.parameterize.dasherize + person.twitter = row['socialtwitter'] + person.linkedin = row['sociallinkedin'] byebug unless person.valid? person.save cohort.people << person unless person.in?(cohort.people) + photo = row['photo'].to_s + if photo.end_with?('.jpg') || photo.end_with?('.png') + filename = File.basename photo + begin + file = URI.open photo + person.picture.attach(io: file, filename: 'some-image.jpg') + rescue + end + end end end diff --git a/app/views/extranet/academic_years/index.html.erb b/app/views/extranet/academic_years/index.html.erb index b8e0b2fef6feb3d4cbca47500d5edad04451b30a..88d5b19706f781b93404aaf4e85c07015ae065d9 100644 --- a/app/views/extranet/academic_years/index.html.erb +++ b/app/views/extranet/academic_years/index.html.erb @@ -1,5 +1,7 @@ <% content_for :title, Education::AcademicYear.model_name.human(count: 2) %> +<h1><%= Education::AcademicYear.model_name.human(count: 2) %></h1> + <table class="<%= table_classes %>"> <thead> <tr> diff --git a/app/views/extranet/academic_years/show.html.erb b/app/views/extranet/academic_years/show.html.erb index 63eacbadedf1cb55469c54f3c5233b57706ab263..48f1cdc0ec4ecbc8fdbb8de7ba2549367c66ce4a 100644 --- a/app/views/extranet/academic_years/show.html.erb +++ b/app/views/extranet/academic_years/show.html.erb @@ -1,5 +1,7 @@ <% content_for :title, @academic_year %> +<h1><%= @academic_year %></h1> + <% @academic_year.cohorts.each do |cohort| %> <%= link_to cohort, cohort %> <% end %> diff --git a/app/views/extranet/cohorts/index.html.erb b/app/views/extranet/cohorts/index.html.erb index 5341018f4f63010fdaba38e873ec34a16caf646b..ab5e66756adab71e2cce22366236959c8de40db9 100644 --- a/app/views/extranet/cohorts/index.html.erb +++ b/app/views/extranet/cohorts/index.html.erb @@ -1,5 +1,7 @@ <% content_for :title, Education::Cohort.model_name.human(count: 2) %> +<h1><%= Education::Cohort.model_name.human(count: 2) %></h1> + <table class="<%= table_classes %>"> <thead> <tr> @@ -12,7 +14,7 @@ <% @cohorts.each do |cohort| %> <tr> <td><%= link_to cohort, cohort %></td> - <td></td> + <td><%= cohort.people.count %></td> </tr> <% end %> </tbody> diff --git a/app/views/extranet/cohorts/show.html.erb b/app/views/extranet/cohorts/show.html.erb index 153a03e9a1ced7b2dd2e5245d131d8ebc95988dd..87e03ef914c18531328a7ab1fd2e426821e2c416 100644 --- a/app/views/extranet/cohorts/show.html.erb +++ b/app/views/extranet/cohorts/show.html.erb @@ -1,3 +1,5 @@ <% content_for :title, @cohort %> +<h1><%= @cohort %></h1> + <%= render 'extranet/persons/list', people: @cohort.people %> diff --git a/app/views/extranet/organizations/index.html.erb b/app/views/extranet/organizations/index.html.erb index e8810d4f6a92b7c3bdb775d7b904d2644736a2b3..8e991ba36327a5d4c931e44cbb7fc5c06023d94e 100644 --- a/app/views/extranet/organizations/index.html.erb +++ b/app/views/extranet/organizations/index.html.erb @@ -1,5 +1,7 @@ <% content_for :title, University::Organization.model_name.human(count: 2) %> +<h1><%= University::Organization.model_name.human(count: 2) %></h1> + <table class="<%= table_classes %>"> <thead> <tr> diff --git a/app/views/extranet/organizations/show.html.erb b/app/views/extranet/organizations/show.html.erb index 1a8858a8183c77fbb221e456277a8e24e78b282f..39b24130fa4451934fc800724765ad58ded63dc4 100644 --- a/app/views/extranet/organizations/show.html.erb +++ b/app/views/extranet/organizations/show.html.erb @@ -1 +1,3 @@ <% content_for :title, @organization %> + +<h1><%= @organization %></h1> diff --git a/app/views/extranet/persons/_list.html.erb b/app/views/extranet/persons/_list.html.erb index 8904fd0bfd8323a19dd30fd8d0fe07c628873cb9..d642ff08d3e4535a9a98926153711c69b25efa42 100644 --- a/app/views/extranet/persons/_list.html.erb +++ b/app/views/extranet/persons/_list.html.erb @@ -6,34 +6,20 @@ people_paged = people.ordered.page(params[:page]).per(60) <div class="row"> <% people_paged.each do |person| %> <div class="col-xxl-2 col-md-3"> - <article class="card mb-4"> - <div class="card-body"> - <%= link_to person, class: 'stretched-link' do %> - <span class="small"><%= person.first_name %></span><br> + <article class="mb-4 position-relative"> + <% if person.picture.attached? %> + <%= kamifusen_tag person.picture, width: 400, class: 'img-fluid' %> + <% else %> + <%= image_tag 'extranet/avatar.png', width: 400, class: 'img-fluid' %> + <% end %> + <%= link_to person, class: 'stretched-link' do %> + <%= person.first_name %> + <b> <%= person.last_name %> - <% end %> - </div> + </b> + <% end %> </article> </div> <% end %> </div> - -<table class="<%= table_classes %>"> - <thead> - <tr> - <th>Name</th> - <th></th> - </tr> - </thead> - - <tbody> - <% people_paged.each do |person| %> - <tr> - <td><%= link_to person, person %></td> - <td></td> - </tr> - <% end %> - </tbody> -</table> - <%= paginate people_paged, theme: 'bootstrap-5' %> diff --git a/app/views/extranet/persons/index.html.erb b/app/views/extranet/persons/index.html.erb index dfd579b639851ad9b0d7097286a59665ebded74f..b854f15b7de7cc787fc271e715f609a3fabbf04c 100644 --- a/app/views/extranet/persons/index.html.erb +++ b/app/views/extranet/persons/index.html.erb @@ -1,3 +1,5 @@ <% content_for :title, University::Person::Alumnus.model_name.human(count: 2) %> +<h1><%= University::Person::Alumnus.model_name.human(count: 2) %></h1> + <%= render 'extranet/persons/list', people: @people %> diff --git a/app/views/extranet/persons/show.html.erb b/app/views/extranet/persons/show.html.erb index c7de7737c89a9f5ffa7f7d5800459bed18fdfc9a..034873013d285abf5879d5caa5e9e22628d6738b 100644 --- a/app/views/extranet/persons/show.html.erb +++ b/app/views/extranet/persons/show.html.erb @@ -1 +1,14 @@ <% content_for :title, @person %> + +<div class="row"> + <div class="col-md-9"> + <h1><%= @person %></h1> + </div> + <div class="col-md-3"> + <% if @person.picture.attached? %> + <%= kamifusen_tag @person.picture, width: 400, class: 'img-fluid' %> + <% else %> + <%= image_tag 'extranet/avatar.png', width: 400, class: 'img-fluid' %> + <% end %> + </div> +</div> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2fb3785019f44bf66db7130a8a09417d6df46a30..d650055e705a1f5384d4a5ae5026cf80125cc622 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,7 +13,6 @@ <body class="<%= body_classes %>"> <%= render 'nav' %> <main class="container"> - <h1><%= yield :title %></h1> <%= render_breadcrumbs builder: Appstack::BreadcrumbsOnRailsBuilder %> <%= yield %> </main>