diff --git a/Gemfile b/Gemfile index a13381a629a8c0fde05c60dc8cb47010047c3e4d..cbe540a336787fe7752d573a0f0ffc9a9bb03eea 100644 --- a/Gemfile +++ b/Gemfile @@ -29,6 +29,7 @@ gem 'country_select' gem 'breadcrumbs_on_rails' gem 'simple-navigation' gem 'kaminari' +gem 'bootstrap5-kaminari-views' gem 'octokit' gem 'front_matter_parser' gem 'two_factor_authentication', git: 'https://github.com/noesya/two_factor_authentication.git' diff --git a/Gemfile.lock b/Gemfile.lock index eee6f0e028161391e206bb85ec646cac7089c5ea..2ddd2c3fa634699f17f4aee60d2e74cacb64c585 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -102,6 +102,9 @@ GEM autoprefixer-rails (>= 9.1.0) popper_js (>= 2.9.3, < 3) sassc-rails (>= 2.0.0) + bootstrap5-kaminari-views (0.0.1) + kaminari (>= 0.13) + rails (>= 3.1) breadcrumbs_on_rails (4.1.0) railties (>= 5.0) bugsnag (6.24.0) @@ -370,6 +373,7 @@ DEPENDENCIES aws-sdk-s3 bootsnap (>= 1.4.4) bootstrap + bootstrap5-kaminari-views breadcrumbs_on_rails bugsnag byebug diff --git a/app/assets/stylesheets/admin/appstack.sass b/app/assets/stylesheets/admin/appstack.sass index 7176ec504600c9cd5de9e0db0ba1cd05a5c81f8b..7052fdc00adc7eb634bff82a9c0f2f48ed6a99ce 100644 --- a/app/assets/stylesheets/admin/appstack.sass +++ b/app/assets/stylesheets/admin/appstack.sass @@ -7,3 +7,7 @@ main.content padding: .5rem position: fixed right: 0 + +table.table-striped + tbody + background: white diff --git a/app/controllers/admin/communication/websites_controller.rb b/app/controllers/admin/communication/websites_controller.rb index 2af62df5c2d4b1e848b868141bae6541e478d107..dd413263c032cbd7f7d0dd08e03bfdcdfae8e7a8 100644 --- a/app/controllers/admin/communication/websites_controller.rb +++ b/app/controllers/admin/communication/websites_controller.rb @@ -20,8 +20,8 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati flash[:notice] = t('communication.website.imported.launched') end @imported_website = @website.imported_website - @imported_pages = @imported_website.pages - @imported_posts = @imported_website.posts + @imported_pages = @imported_website.pages.page params[:pages_page] + @imported_posts = @imported_website.posts.page params[:posts_page] breadcrumb add_breadcrumb Communication::Website::Imported::Website.model_name.human end diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index bd77a0d82ead42c27635ce9923b1b7d5472df639..1504708485a5d57b23d5f97053db3f6266d7ab42 100644 --- a/app/helpers/admin/application_helper.rb +++ b/app/helpers/admin/application_helper.rb @@ -50,7 +50,7 @@ module Admin::ApplicationHelper end def table_classes - 'table table-striped' + 'table table-striped table-hover' end def submit(form) diff --git a/app/models/communication/website/imported/page.rb b/app/models/communication/website/imported/page.rb index 056f41d6b6150fd070577d67d6540bf441a35ebe..59809819e2be8bf2b489489c0b953c56a0ebbec0 100644 --- a/app/models/communication/website/imported/page.rb +++ b/app/models/communication/website/imported/page.rb @@ -36,6 +36,8 @@ class Communication::Website::Imported::Page < ApplicationRecord before_validation :sync + default_scope { order(:path) } + def to_s "#{title}" end diff --git a/app/models/communication/website/imported/post.rb b/app/models/communication/website/imported/post.rb index 9768e9fcce0509695524954d3a56c32a536c86ac..154ba20e454780993dc260d18c6461aa653d1b99 100644 --- a/app/models/communication/website/imported/post.rb +++ b/app/models/communication/website/imported/post.rb @@ -39,6 +39,8 @@ class Communication::Website::Imported::Post < ApplicationRecord before_validation :sync + default_scope { order(path: :desc) } + def to_s "#{title}" end diff --git a/app/views/admin/communication/websites/import.html.erb b/app/views/admin/communication/websites/import.html.erb index bdc56cc6592db600fff2aa451df5855e2a5abb4e..d57d6a4e4f1a0c4dcd168fbf68eb6bcb025f8f79 100644 --- a/app/views/admin/communication/websites/import.html.erb +++ b/app/views/admin/communication/websites/import.html.erb @@ -7,25 +7,32 @@ <% end %> <h2><%= @imported_posts.count %> posts</h2> -<table class="table"> +<table class="<%= table_classes %>"> <thead> <tr> - <th class="ps-0"><%= Communication::Website::Imported::Post.human_attribute_name('title') %></th> + <th><%= Communication::Website::Imported::Post.human_attribute_name('title') %></th> <th><%= Communication::Website::Imported::Post.human_attribute_name('original') %></th> + <th></th> </tr> </thead> <tbody> <% @imported_posts.each do |post| %> <tr> - <td class="ps-0"><%= link_to post, admin_communication_website_post_path(website_id: post.post.website.id, id: post.post.id) %></td> + <td><%= link_to post, admin_communication_website_post_path(website_id: post.post.website.id, id: post.post.id) %></td> <td class="small"><%= link_to post.path, post.url, target: :_blank %></td> + <td> + <%= link_to t('show'), + admin_communication_website_post_path(website_id: post.post.website.id, id: post.post.id), + class: button_classes %> + </td> </tr> <% end %> </tbody> </table> +<%= paginate @imported_posts, param_name: :posts_page, theme: 'bootstrap-5' %> <h2 class="mt-5"><%= @imported_pages.count %> pages</h2> -<table class="table"> +<table class="<%= table_classes %>"> <thead> <tr> <th class="ps-0"><%= Communication::Website::Imported::Page.human_attribute_name('title') %></th> @@ -41,3 +48,4 @@ <% end %> </tbody> </table> +<%= paginate @imported_pages, param_name: :pages_page, theme: 'bootstrap-5' %> diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb index e7ef428f818c48997bdc925fec7097fd0106fec8..f693873e81a87e002272da8386b9c1fdb715f588 100644 --- a/app/views/admin/dashboard/index.html.erb +++ b/app/views/admin/dashboard/index.html.erb @@ -5,7 +5,11 @@ <div class="card"> <div class="card-body"> <h4>Bonjour <%= current_user.first_name %> !</h4> - <p><%= current_university %></p> + <% if current_university.logo.attached? %> + <%= image_tag current_university.logo, width: 120, class: 'float-end' %> + <% else %> + <p><%= current_university %></p> + <% end %> </div> </div> </div>