From d2a16b9e5f596c3f5cd19b07e46c48e9b8bf2395 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Sat, 21 Jan 2023 17:23:49 +0100 Subject: [PATCH] better css and less cards --- app/assets/stylesheets/admin/pure/style.sass | 60 +++++++-- .../stylesheets/admin/pure/variables.sass | 30 +++-- .../admin/application/_dependencies.html.erb | 105 +++++++-------- .../admin/application/a11y/_widget.html.erb | 72 +++++----- .../application/featured_image/_edit.html.erb | 48 +++---- .../meta_description/_form.html.erb | 22 ++- .../meta_description/_show.html.erb | 18 +-- .../admin/application/summary/_show.html.erb | 16 +-- .../admin/communication/blocks/_list.html.erb | 37 ++---- .../blocks/components/layout/_edit.html.erb | 4 +- .../admin/communication/blocks/edit.html.erb | 6 +- .../admin/communication/blocks/new.html.erb | 68 +++++----- .../templates/call_to_action/_edit.html.erb | 2 +- .../blocks/templates/chapter/_edit.html.erb | 2 +- .../blocks/templates/contact/_edit.html.erb | 2 +- .../blocks/templates/datatable/_edit.html.erb | 2 +- .../templates/definitions/_edit.html.erb | 2 +- .../blocks/templates/embed/_edit.html.erb | 4 +- .../blocks/templates/files/_edit.html.erb | 4 +- .../blocks/templates/gallery/_edit.html.erb | 4 +- .../blocks/templates/image/_edit.html.erb | 6 +- .../templates/key_figures/_edit.html.erb | 2 +- .../organization_chart/_edit.html.erb | 2 +- .../blocks/templates/pages/_edit.html.erb | 2 +- .../blocks/templates/partners/_edit.html.erb | 2 +- .../blocks/templates/posts/_edit.html.erb | 2 +- .../blocks/templates/programs/_edit.html.erb | 2 +- .../templates/testimonials/_edit.html.erb | 2 +- .../blocks/templates/video/_edit.html.erb | 2 +- .../websites/menus/_form.html.erb | 28 ++-- .../websites/menus/index.html.erb | 19 +-- .../websites/menus/items/_form.html.erb | 17 +-- .../websites/menus/show.html.erb | 30 ++--- .../websites/pages/_form.html.erb | 70 +++++----- .../websites/pages/_list.html.erb | 6 +- .../websites/pages/index.html.erb | 53 ++++---- .../websites/pages/show.html.erb | 125 +++++++++--------- .../websites/posts/_form.html.erb | 114 +++++++--------- .../websites/posts/_list.html.erb | 8 +- .../websites/posts/index.html.erb | 51 +++---- .../websites/posts/show.html.erb | 72 +++++----- .../communication/websites/show.html.erb | 2 +- .../websites/show/_pages.html.erb | 29 ++-- .../websites/show/_posts.html.erb | 32 ++--- app/views/admin/dashboard/index.html.erb | 68 +++++----- app/views/admin/users/_form.html.erb | 91 ++++++------- app/views/admin/users/show.html.erb | 62 ++++----- 47 files changed, 647 insertions(+), 760 deletions(-) diff --git a/app/assets/stylesheets/admin/pure/style.sass b/app/assets/stylesheets/admin/pure/style.sass index e9670fd39..e611a50f0 100644 --- a/app/assets/stylesheets/admin/pure/style.sass +++ b/app/assets/stylesheets/admin/pure/style.sass @@ -9,6 +9,8 @@ .navbar-brand img width: 100px + .btn-open + margin-right: -14px #menu position: fixed top: 0 @@ -55,11 +57,20 @@ h2 font-weight: bold .section + border-bottom: 1px solid $color-border font-size: $h5-font-size - margin-top: 60px !important - padding-bottom: 10px - border-bottom: 1px solid #00000033 - + font-weight: normal + margin-bottom: $spacing1 + margin-top: $spacing4 !important + padding-bottom: $spacing0 + text-transform: uppercase + +.row-small + margin-right: calc(-.5 * #{$spacing1}) + margin-left: calc(-.5 * #{$spacing1}) + > * + padding-right: calc(.5 * #{$spacing1}) + padding-left: calc(.5 * #{$spacing1}) a text-decoration: none text-decoration-thickness: 1px @@ -69,15 +80,30 @@ a &:hover color: darken($primary, 10) +.form-control:valid, +.form-control.is-valid, +.form-select:valid, +.form-select.is-valid + border-color: $color-valid +.form-label + color: $color-text-alt + .card - margin-bottom: $spacing2 - .card-header - .card-title - font-size: $h5-font-size - text-transform: uppercase - color: $color-text-alt - .card-body - margin-top: $spacing1 + margin-bottom: $spacing1 + .card-title + font-size: px2rem(18) + font-weight: bold + small + font-weight: normal + .table + margin-bottom: 0 + th, + td + padding: var(--bs-card-cap-padding-y) var(--bs-card-cap-padding-x) + &.kind--selected + background: $color-accent + border-color: $color-accent + color: $color-background .list-group-item.active color: $color-accent @@ -87,6 +113,10 @@ a font-size: 14px padding: 2px 7px +.btn-light + background: $color-background + border-color: $color-border + .commands background: $color-background-alt position: fixed @@ -94,12 +124,16 @@ a left: 0 right: 0 z-index: 100 +.blocks + .card + border: 1px solid $color-border .filters position: absolute top: 0 right: var(--bs-gutter-x) - margin-top: 0px !important + margin-top: -6px !important + z-index: 10 .sdfi-deletable-file__preview margin-top: 10px diff --git a/app/assets/stylesheets/admin/pure/variables.sass b/app/assets/stylesheets/admin/pure/variables.sass index 2f18f22fa..add89946e 100644 --- a/app/assets/stylesheets/admin/pure/variables.sass +++ b/app/assets/stylesheets/admin/pure/variables.sass @@ -2,17 +2,20 @@ $color-accent: #0038FF $color-text: #000000 $color-text-alt: #454545 -$color-border: rgba(0, 0, 0, 0.30) +$color-border: rgba(0, 0, 0, 0.1) $color-background-alt: #F2F2F2 $color-background: #FFFFFF +$color-valid: #bedabe + // Spacing -$spacing0: px2rem(10) -$spacing1: px2rem(20) -$spacing2: px2rem(40) -$spacing3: px2rem(60) -$spacing4: px2rem(120) -$spacing5: px2rem(240) +$spacing0: px2rem(12) +$spacing1: px2rem(24) +$spacing2: px2rem(48) +$spacing3: px2rem(64) +$spacing4: px2rem(128) +$spacing5: px2rem(256) +$spacing-section-y: px2rem(36) // Bootstrap @@ -21,7 +24,7 @@ $color-background-alt: #F5F5F5 $font-family-sans-serif: "Basier Square", sans-serif -$grid-gutter-width: 60px +$grid-gutter-width: 64px $border-radius: 0 $border-radius-sm: 0 @@ -29,14 +32,14 @@ $border-radius-lg: 0 $border-radius-xl: 0 $border-radius-2xl: 0 -$card-spacer-y: 0 -$card-spacer-x: 0 $card-border-width: 0 -$card-cap-bg: transparent +$card-cap-bg: $color-background-alt +$card-cap-padding-y: $spacing0 +$card-bg: $color-background-alt $transition-collapse: height 0 -$h2-font-size: 20px +$h2-font-size: px2rem(20) $h5-font-size: px2rem(14) $table-cell-padding-x: 0 @@ -46,6 +49,9 @@ $badge-font-weight: normal $form-label-font-size: $h5-font-size +$hr-color: $color-border +$hr-opacity: 1 + $breadcrumb-font-size: $h5-font-size $breadcrumb-padding-y: $spacing1 diff --git a/app/views/admin/application/_dependencies.html.erb b/app/views/admin/application/_dependencies.html.erb index 9e6bb1fa0..740bdeaca 100644 --- a/app/views/admin/application/_dependencies.html.erb +++ b/app/views/admin/application/_dependencies.html.erb @@ -2,59 +2,56 @@ expanded ||= false %> <% if current_user.server_admin? %> - <div class="card"> - <div class="card-header"> - <div class="card-actions float-end"> - <i class="fas fa-arrow-down text-muted" - data-bs-toggle="collapse" - data-bs-target="#dependencies" - aria-expanded="<%= expanded %>" - aria-controls="dependencies"></i> - </div> - <h2 class="card-title mb-0 h5 text-muted">Dependencies <small>server admin only</small></h2> - </div> - <div class="card-body collapse <%= 'show' if expanded %>" id="dependencies"> - <h2 class="h5">git_dependencies</h2> - <div class="table-responsive"> - <table class="<%= table_classes %>"> - <thead> - <tr> - <th>Id</th> - <th>Class</th> - <th>Name</th> - </tr> - </thead> - <tbody> - <% git_dependencies.each do |dependency| %> - <tr> - <td><%= dependency.id %></td> - <td><%= dependency.class %></td> - <td><%= dependency.to_s %></td> - </tr> - <% end %> - </tbody> - </table> - </div> +<section class="mt-5"> + <div class="float-end"> + <i class="fas fa-arrow-down text-muted" + data-bs-toggle="collapse" + data-bs-target="#dependencies" + aria-expanded="<%= expanded %>" + aria-controls="dependencies"></i> + </div> + <h2 class="h5 text-muted">Dépendances <small>visible uniquement pour les server admins</small></h2> + <div class="card-body collapse <%= 'show' if expanded %>" id="dependencies"> + <h2 class="h5">git_dependencies</h2> + <div class="table-responsive"> + <table class="<%= table_classes %>"> + <thead> + <tr> + <th>Id</th> + <th>Class</th> + <th>Name</th> + </tr> + </thead> + <tbody> + <% git_dependencies.each do |dependency| %> + <tr> + <td><%= dependency.id %></td> + <td><%= dependency.class %></td> + <td><%= dependency.to_s %></td> + </tr> + <% end %> + </tbody> + </table> + </div> - <h2 class="h5 mt-5">active_storage_blobs</h2> - <div class="table-responsive"> - <table class="<%= table_classes %>"> - <thead> - <tr> - <th>Id</th> - <th>Filename</th> - </tr> - </thead> - <tbody> - <% active_storage_blobs.each do |blob| %> - <tr> - <td><%= blob.id %></td> - <td><%= blob.filename %></td> - </tr> - <% end %> - </tbody> - </table> - </div> - </div> - </div> + <h2 class="h5 mt-5">active_storage_blobs</h2> + <div class="table-responsive"> + <table class="<%= table_classes %>"> + <thead> + <tr> + <th>Id</th> + <th>Filename</th> + </tr> + </thead> + <tbody> + <% active_storage_blobs.each do |blob| %> + <tr> + <td><%= blob.id %></td> + <td><%= blob.filename %></td> + </tr> + <% end %> + </tbody> + </table> + </div> +</section> <% end %> diff --git a/app/views/admin/application/a11y/_widget.html.erb b/app/views/admin/application/a11y/_widget.html.erb index 4bd2df2f8..9064054eb 100644 --- a/app/views/admin/application/a11y/_widget.html.erb +++ b/app/views/admin/application/a11y/_widget.html.erb @@ -1,47 +1,43 @@ <% color = about.accessible? ? 'text-success' : 'text-danger' %> -<div class="card"> - <div class="card-header"> - <i class="fas fa-universal-access fa-2x float-end <%= color %>"></i> - <h2 class="card-title mt-1 mb-0"> - <%= t('accessibility.label') %> - </h2> - </div> - <div class="card-body"> - <% if about.accessibility_errors.any? %> - <h2 class="h5 text-danger"> - <%= t 'accessibility.errors', count: about.accessibility_errors.count %> - </h2> - <ol class="list-unstyled"> - <% about.accessibility_errors.each do |key| %> - <li> - <hr> - <h3 class="h5 text-danger"><%= t "#{key}.title" %></h3> - <p> - <%= t "#{key}.text_html" %> - </p> - </li> - <% end %> - </ol> - <% else %> - <p><%= t 'accessibility.errors', count: 0 %></p> - <% end %> - <% if about.accessibility_warnings.any? %> - <h2 class="h5"> - <%= t 'accessibility.warnings', count: about.accessibility_warnings.count %> - </h2> - <ul class="list-unstyled"> - <% about.accessibility_warnings.each do |key| %> +<section class="mb-5"> + <i class="fas fa-universal-access fa-2x float-end <%= color %>"></i> + <h2 class="h3"> + <%= t('accessibility.label') %> + </h2> + <% if about.accessibility_errors.any? %> + <h3 class="h5 text-danger"> + <%= t 'accessibility.errors', count: about.accessibility_errors.count %> + </h3> + <ol class="list-unstyled"> + <% about.accessibility_errors.each do |key| %> <li> <hr> - <h3 class="h5"><%= t "#{key}.title" %></h3> + <h3 class="h5 text-danger"><%= t "#{key}.title" %></h3> <p> <%= t "#{key}.text_html" %> </p> </li> - <% end %> - </ul> - <% end %> - </div> -</div> + <% end %> + </ol> + <% else %> + <p><%= t 'accessibility.errors', count: 0 %></p> + <% end %> + <% if about.accessibility_warnings.any? %> + <h3 class="h5"> + <%= t 'accessibility.warnings', count: about.accessibility_warnings.count %> + </h3> + <ul class="list-unstyled"> + <% about.accessibility_warnings.each do |key| %> + <li> + <hr> + <h3 class="h5"><%= t "#{key}.title" %></h3> + <p> + <%= t "#{key}.text_html" %> + </p> + </li> + <% end %> + </ul> + <% end %> +</section> diff --git a/app/views/admin/application/featured_image/_edit.html.erb b/app/views/admin/application/featured_image/_edit.html.erb index 75f1e93e8..03293cfae 100644 --- a/app/views/admin/application/featured_image/_edit.html.erb +++ b/app/views/admin/application/featured_image/_edit.html.erb @@ -1,27 +1,21 @@ -<div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"> - <%= t('featured_image.title') %> - </h5> - </div> - <div class="card-body"> - <%= f.input :featured_image, - as: :single_deletable_file, - direct_upload: true, - label: false, - hint: '.jpg, .jpeg, .png, .svg', - input_html: { accept: '.jpg,.jpeg,.png,.svg' }, - preview: true %> - <%= f.input :featured_image_alt, - label: t('featured_image.alt.label'), - hint: t('featured_image.alt.hint') %> - <%= f.input :featured_image_credit, - as: :summernote, - label: t('featured_image.credit.label'), - hint: t('featured_image.credit.hint'), - input_html: { - data: { 'summernote-config' => 'link' } - } %> - <%= render 'admin/communication/unsplash/selector', about: about, f:f %> - </div> -</div> +<section class="mb-5"> + <h2 class="h3"><%= t('featured_image.title') %></h2> + <%= f.input :featured_image, + as: :single_deletable_file, + direct_upload: true, + label: false, + hint: '.jpg, .jpeg, .png, .svg', + input_html: { accept: '.jpg,.jpeg,.png,.svg' }, + preview: true %> + <%= f.input :featured_image_alt, + label: t('featured_image.alt.label'), + hint: t('featured_image.alt.hint') %> + <%= f.input :featured_image_credit, + as: :summernote, + label: t('featured_image.credit.label'), + hint: t('featured_image.credit.hint'), + input_html: { + data: { 'summernote-config' => 'link' } + } %> + <%= render 'admin/communication/unsplash/selector', about: about, f:f %> +</section> diff --git a/app/views/admin/application/meta_description/_form.html.erb b/app/views/admin/application/meta_description/_form.html.erb index 9e200ffd0..e9e67c6f1 100644 --- a/app/views/admin/application/meta_description/_form.html.erb +++ b/app/views/admin/application/meta_description/_form.html.erb @@ -1,13 +1,9 @@ -<div class="card"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('seo') %></h5> - </div> - <div class="card-body"> - <%= f.input :meta_description, - label: t('admin.meta_description.label'), - hint: t('admin.meta_description.hint'), - input_html: { - value: about.meta_description&.gsub('&', '&') - } %> - </div> -</div> +<section class="mb-5"> + <h2 class="h3"><%= t('seo') %></h2> + <%= f.input :meta_description, + label: t('admin.meta_description.label'), + hint: t('admin.meta_description.hint'), + input_html: { + value: about.meta_description&.gsub('&', '&') + } %> +</section> \ No newline at end of file diff --git a/app/views/admin/application/meta_description/_show.html.erb b/app/views/admin/application/meta_description/_show.html.erb index 857e45422..e40c22b21 100644 --- a/app/views/admin/application/meta_description/_show.html.erb +++ b/app/views/admin/application/meta_description/_show.html.erb @@ -1,13 +1,9 @@ <% unless about.meta_description.blank? %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-0"><%= t('seo') %></h2> - </div> - <div class="card-body"> - <p class="lead"> - <h3 class="h5"><%= t('admin.meta_description.label') %></h3> - <%= sanitize about.meta_description %> - </p> - </div> - </div> + <section class="mb-5"> + <h2 class="h3"><%= t('seo') %></h2> + <p class="lead"> + <h3 class="h5"><%= t('admin.meta_description.label') %></h3> + <%= sanitize about.meta_description %> + </p> + </section> <% end %> diff --git a/app/views/admin/application/summary/_show.html.erb b/app/views/admin/application/summary/_show.html.erb index 8e2cedf8e..96892814e 100644 --- a/app/views/admin/application/summary/_show.html.erb +++ b/app/views/admin/application/summary/_show.html.erb @@ -1,12 +1,8 @@ <% unless about.summary.blank? %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-0 h5"><%= t('admin.summary') %></h2> - </div> - <div class="card-body"> - <p class="lead"> - <%= sanitize about.summary %> - </p> - </div> - </div> + <section class="mb-5"> + <h2 class="h3"><%= t('admin.summary') %></h2> + <p class="lead"> + <%= sanitize about.summary %> + </p> + </section> <% end %> diff --git a/app/views/admin/communication/blocks/_list.html.erb b/app/views/admin/communication/blocks/_list.html.erb index 41505a23d..4d494026b 100644 --- a/app/views/admin/communication/blocks/_list.html.erb +++ b/app/views/admin/communication/blocks/_list.html.erb @@ -1,33 +1,20 @@ -<div class="card flex-fill w-100"> - <div class="card-header"> - <div class="float-end"> - <%= link_to t('add'), - new_admin_communication_block_path(about_id: about.id, about_type: about.class.name), - class: button_classes if can? :create, Communication::Block %> - </div> - <h2 class="card-title mb-0 h5"> - <%= Communication::Block.model_name.human(count: 2) %> - </h2> +<section class="mb-5"> + <div class="float-end"> + <%= link_to t('add'), + new_admin_communication_block_path(about_id: about.id, about_type: about.class.name), + class: button_classes if can? :create, Communication::Block %> </div> + <h2 class="h3 mb-3"> + <%= Communication::Block.model_name.human(count: 2) %> + </h2> <% if about.blocks.any? %> <div class="table-responsive"> <table class="<%= table_classes %>"> - <thead> - <tr> - <% if can? :reorder, Communication::Block %> - <th width="20" class="ps-0"> </th> - <% end %> - <th><%= Communication::Block.model_name.human %></th> - <th></th> - <th><%= t 'accessibility.label' %></th> - <th></th> - </tr> - </thead> <tbody data-sortable data-sort-url="<%= reorder_admin_communication_blocks_path %>"> <% about.blocks.ordered.each do |block| %> <tr data-id="<%= block.id %>" class="<%= 'draft' unless block.published? %>"> <% if can? :reorder, Communication::Block %> - <td><i class="fa fa-bars handle"></i></td> + <td class="ps-0"><i class="fa fa-bars handle"></i></td> <% end %> <td> <%= block.to_s.truncate(50) %><br> @@ -35,10 +22,10 @@ </td> <td class="p-0"> <%= image_tag "communication/blocks/templates/#{block.template_kind}.jpg", - height: "100px", alt: '', style:"max-height: 50px" %> + height: "100px", alt: '', style:"max-height: 75px" %> </td> <td><%= render 'admin/application/a11y/status', about: block %></td> - <td class="text-end"> + <td class="text-end pe-0"> <div class="btn-group"> <%= duplicate_link block %> <%= edit_link block %> @@ -50,4 +37,4 @@ </table> </div> <% end %> -</div> +</section> diff --git a/app/views/admin/communication/blocks/components/layout/_edit.html.erb b/app/views/admin/communication/blocks/components/layout/_edit.html.erb index 654db0073..61cfd7982 100644 --- a/app/views/admin/communication/blocks/components/layout/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/layout/_edit.html.erb @@ -15,7 +15,7 @@ layouts = template.class.layouts </a> </p> -<div class="row collapse" id="layouts"> +<div class="row row-small collapse" id="layouts"> <% layouts.each do |layout| %> <% i18n = "admin.communication.blocks.templates.#{template.kind}.layouts.#{layout}" @@ -25,7 +25,7 @@ layouts = template.class.layouts <div class="col-xxl-6"> <div class="card mb-4"> <label for="layout-<%= layout %>"> - <div class="row"> + <div class="row row-small"> <div class="col-8 col-xxl-6"> <div class="card-body"> <div class="form-check"> diff --git a/app/views/admin/communication/blocks/edit.html.erb b/app/views/admin/communication/blocks/edit.html.erb index f0d54ec57..b88d674bf 100644 --- a/app/views/admin/communication/blocks/edit.html.erb +++ b/app/views/admin/communication/blocks/edit.html.erb @@ -9,11 +9,11 @@ <div class="row"> <div class="col-xxl-9 col-lg-8"> - <div class="row"> - <div class="col-xxl-3 col-lg-6"> + <div class="row row-small"> + <div class="col-lg-6"> <%= f.input :title %> </div> - <div class="col-xxl-3 col-lg-6"> + <div class="col-lg-6"> <label class="form-label d-none d-lg-block"> </label> <%= f.input :published %> </div> diff --git a/app/views/admin/communication/blocks/new.html.erb b/app/views/admin/communication/blocks/new.html.erb index 6ba418532..bfe43bae6 100644 --- a/app/views/admin/communication/blocks/new.html.erb +++ b/app/views/admin/communication/blocks/new.html.erb @@ -1,43 +1,39 @@ <% content_for :title, t('communication.block.choose_template') %> <% Communication::Block::CATEGORIES.each do |category, kinds| %> - <div class="row mt-5"> - <div class="col-lg-7"> - <h2><%= t "admin.communication.blocks.categories.#{category}.label" %></h2> + <section class="mb-5 blocks"> + <div class="d-flex justify-content-between"> + <h2 class="h3"><%= t "admin.communication.blocks.categories.#{category}.label" %></h2> + <p class="text-end lead"><%= t "admin.communication.blocks.categories.#{category}.description" %></p> </div> - <div class="col-lg-5"> - <p class="lead mt-1 mb-0 text-end"> - <%= t "admin.communication.blocks.categories.#{category}.description" %> - </p> - </div> - </div> - <hr> - <div class="row"> - <% kinds.each do |kind| %> - <% - @block.template_reset! - @block.template_kind = kind - about = @block.about - template = @block.template - %> - <% next unless template.allowed_for_about? %> - <div class="col-xxl-2 col-lg-3 col-md-4 d-flex"> - <div class="card flex-fill"> - <%= image_tag "communication/blocks/templates/#{kind}.jpg", alt: '', class:"card-img-top" %> - <div class="card-body d-flex flex-column"> - <h4><%= t "enums.communication.block.template_kind.#{kind}" %></h4> - <p class="mb-0"> - <%= t "admin.communication.blocks.templates.#{kind}.description" %> - </p> - <%= simple_form_for [:admin, @block], html: { class: 'mt-auto'} do |f| %> - <%= f.input :about_type, as: :hidden %> - <%= f.input :about_id, as: :hidden %> - <%= f.input :template_kind, as: :hidden %> - <%= f.submit t('communication.block.choose'), class: button_classes %> - <% end %> + <hr class="mt-0"> + <div class="row row-small"> + <% kinds.each do |kind| %> + <% + @block.template_reset! + @block.template_kind = kind + about = @block.about + template = @block.template + %> + <% next unless template.allowed_for_about? %> + <div class="col-xxl-2 col-lg-3 col-md-4 d-flex"> + <div class="card flex-fill"> + <%= image_tag "communication/blocks/templates/#{kind}.jpg", alt: '', class:"card-img-top" %> + <div class="card-body d-flex flex-column"> + <h4><%= t "enums.communication.block.template_kind.#{kind}" %></h4> + <p class="mb-0"> + <%= t "admin.communication.blocks.templates.#{kind}.description" %> + </p> + <%= simple_form_for [:admin, @block], html: { class: 'mt-auto'} do |f| %> + <%= f.input :about_type, as: :hidden %> + <%= f.input :about_id, as: :hidden %> + <%= f.input :template_kind, as: :hidden %> + <%= f.submit t('communication.block.choose'), class: button_classes %> + <% end %> + </div> </div> </div> - </div> - <% end %> - </div> + <% end %> + </div> + </section> <% end %> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb index 99b3faffa..d49dca48f 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb @@ -1,4 +1,4 @@ -<div class="row mb-5"> +<div class="row row-small mb-5"> <div class="col-md-6"> <div class="summernote"> <%= block_component_edit :text, diff --git a/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb b/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb index d4110b4ae..c815514dc 100644 --- a/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb @@ -1,6 +1,6 @@ <%= block_component_edit :layout %> -<div class="row mb-4"> +<div class="row row-small mb-4"> <div class="col-xxl-8"> <%= block_component_edit :text %> <%= block_component_edit :notes %> diff --git a/app/views/admin/communication/blocks/templates/contact/_edit.html.erb b/app/views/admin/communication/blocks/templates/contact/_edit.html.erb index 0da97e404..00ad26147 100644 --- a/app/views/admin/communication/blocks/templates/contact/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/contact/_edit.html.erb @@ -1,4 +1,4 @@ -<div class="row"> +<div class="row row-small"> <div class="col-xl-6"> <%= block_component_edit :description %> </div> diff --git a/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb b/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb index 0b7a2e792..7686558bf 100644 --- a/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb @@ -1,4 +1,4 @@ -<div class="row"> +<div class="row row-small"> <div class="col-xl-6"> <%= block_component_edit :description %> </div> diff --git a/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb b/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb index 36a020b0c..6b669d85c 100644 --- a/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb @@ -1,4 +1,4 @@ -<div class="row"> +<div class="row row-small"> <div class="col-xl-6"> <%= block_component_edit :description %> </div> diff --git a/app/views/admin/communication/blocks/templates/embed/_edit.html.erb b/app/views/admin/communication/blocks/templates/embed/_edit.html.erb index a80ac1993..c66f6ae0a 100644 --- a/app/views/admin/communication/blocks/templates/embed/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/embed/_edit.html.erb @@ -1,9 +1,9 @@ -<div class="row"> +<div class="row row-small"> <div class="col-md-6"> <p class="text-danger lead"><%= t '.warning' %></p> </div> </div> -<div class="row"> +<div class="row row-small"> <div class="col-md-6"> <%= block_component_edit :code %> </div> diff --git a/app/views/admin/communication/blocks/templates/files/_edit.html.erb b/app/views/admin/communication/blocks/templates/files/_edit.html.erb index f79297521..b7cf262a2 100644 --- a/app/views/admin/communication/blocks/templates/files/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_edit.html.erb @@ -1,4 +1,4 @@ -<div class="row"> +<div class="row row-small"> <div class="col-xl-6"> <%= block_component_edit :description %> </div> @@ -6,7 +6,7 @@ <%= block_component_add_element t('.add_file') %> -<draggable :list="data.elements" handle=".dragHandle" class="row"> +<draggable :list="data.elements" handle=".dragHandle" class="row row-small"> <div v-for="(element, index) in data.elements" class="col-md-4"> <div class="card"> <div class="card-header border-bottom"> diff --git a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb index 39fef19e1..555dfbaae 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb @@ -1,4 +1,4 @@ -<div class="row"> +<div class="row row-small"> <div class="col-xl-6"> <%= block_component_edit :description %> </div> @@ -11,7 +11,7 @@ <p>Déplacer les images ci-dessous pour les mettre dans l'ordre souhaité</p> - <draggable :list="data.elements" class="row"> + <draggable :list="data.elements" class="row row-small"> <div v-for="(element, index) in data.elements" class="col-xxl-1 col-lg-2 col-4"> <div class="card"> <div class="card-header p-1 text-center"> diff --git a/app/views/admin/communication/blocks/templates/image/_edit.html.erb b/app/views/admin/communication/blocks/templates/image/_edit.html.erb index 79df83be1..107fd237f 100644 --- a/app/views/admin/communication/blocks/templates/image/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/image/_edit.html.erb @@ -1,8 +1,8 @@ -<div class="row mb-5"> - <div class="col-xxl-4 col-md-6"> +<div class="row row-small"> + <div class="col-md-6"> <%= block_component_edit :image %> </div> - <div class="col-xxl-4 col-md-6"> + <div class="col-md-6"> <%= block_component_edit :alt, label: t('admin.communication.blocks.components.image.alt.label'), placeholder: t('admin.communication.blocks.components.image.alt.placeholder') %> diff --git a/app/views/admin/communication/blocks/templates/key_figures/_edit.html.erb b/app/views/admin/communication/blocks/templates/key_figures/_edit.html.erb index bb2013f55..b0b070e00 100644 --- a/app/views/admin/communication/blocks/templates/key_figures/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/key_figures/_edit.html.erb @@ -1,4 +1,4 @@ -<div class="row"> +<div class="row row-small"> <div class="col-xl-6"> <%= block_component_edit :description %> </div> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_edit.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_edit.html.erb index ea633d1e2..1814ee1a5 100644 --- a/app/views/admin/communication/blocks/templates/organization_chart/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/organization_chart/_edit.html.erb @@ -1,4 +1,4 @@ -<div class="row"> +<div class="row row-small"> <div class="col-xl-6"> <%= block_component_edit :description %> </div> diff --git a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb index 08d6820ac..eef4145c8 100644 --- a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb @@ -2,7 +2,7 @@ <%= block_component_edit :layout %> -<div class="row mb-4"> +<div class="row row-small"> <div class="col-lg-6"> <div class="mb-5"> <%= block_component_edit :mode %> diff --git a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb b/app/views/admin/communication/blocks/templates/partners/_edit.html.erb index 57d9dd110..552fee473 100644 --- a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_edit.html.erb @@ -1,4 +1,4 @@ -<div class="row"> +<div class="row row-small"> <div class="col-xl-6"> <%= block_component_edit :description %> </div> diff --git a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb index 53195f164..5d81b6649 100644 --- a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb @@ -4,7 +4,7 @@ <div class="mb-3"> <%= block_component_edit :mode %> - <div class="row"> + <div class="row row-small"> <div v-if="data.mode === 'category' || data.mode === 'all'" class="col-lg-3"> <%= block_component_edit :posts_quantity %> </div> diff --git a/app/views/admin/communication/blocks/templates/programs/_edit.html.erb b/app/views/admin/communication/blocks/templates/programs/_edit.html.erb index 1faeee1fd..3dd1978b5 100644 --- a/app/views/admin/communication/blocks/templates/programs/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/programs/_edit.html.erb @@ -1,6 +1,6 @@ <% pages = collection_tree(@block.university.programs) %> -<div class="row mb-4"> +<div class="row row-small"> <div class="col-lg-6"> <div class="mb-4"> <%= block_component_add_element t('.add') %> diff --git a/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb index fbc91a554..e5e4e16e4 100644 --- a/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb @@ -1,6 +1,6 @@ <%= block_component_add_element t('.add_testimonial') %> -<draggable :list="data.elements" handle=".dragHandle" class="row"> +<draggable :list="data.elements" handle=".dragHandle" class="row row-small"> <div v-for="(element, index) in data.elements" class="list-group-item"> <div class="d-flex"> <div> diff --git a/app/views/admin/communication/blocks/templates/video/_edit.html.erb b/app/views/admin/communication/blocks/templates/video/_edit.html.erb index 2db1e4539..58e2a9d64 100644 --- a/app/views/admin/communication/blocks/templates/video/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/video/_edit.html.erb @@ -1,4 +1,4 @@ -<div class="row mb-4"> +<div class="row row-small"> <div class="col-md-6"> <%= block_component_edit :url %> <%= block_component_edit :video_title %> diff --git a/app/views/admin/communication/websites/menus/_form.html.erb b/app/views/admin/communication/websites/menus/_form.html.erb index 6c9e59450..c6f81f778 100644 --- a/app/views/admin/communication/websites/menus/_form.html.erb +++ b/app/views/admin/communication/websites/menus/_form.html.erb @@ -4,28 +4,16 @@ <div class="row"> <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('content') %></h5> - </div> - <div class="card-body"> - <%= f.input :title %> - </div> - </div> + <h2 class="h3"><%= t('content') %></h2> + <%= f.input :title %> </div> <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('metadata') %></h5> - </div> - <div class="card-body"> - <%= f.input :identifier, - input_html: menu.persisted? ? {} : { - class: 'js-slug-input', - data: { source: '#communication_website_menu_title' } - } if can?(:create, menu) %> - </div> - </div> + <h2 class="h3"><%= t('metadata') %></h2> + <%= f.input :identifier, + input_html: menu.persisted? ? {} : { + class: 'js-slug-input', + data: { source: '#communication_website_menu_title' } + } if can?(:create, menu) %> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/communication/websites/menus/index.html.erb b/app/views/admin/communication/websites/menus/index.html.erb index abf7cc422..b44d69ac8 100644 --- a/app/views/admin/communication/websites/menus/index.html.erb +++ b/app/views/admin/communication/websites/menus/index.html.erb @@ -1,14 +1,15 @@ -<% content_for :title, "#{Communication::Website::Menu.model_name.human(count: 2)} (#{@menus.count})" %> +<% content_for :title, "#{Communication::Website::Menu.model_name.human(count: 2)}" %> + +<% content_for :title_right do %> + <%= @menus.count %> + <%= Communication::Website::Menu.model_name.human(count: @menus.count).downcase %> +<% end %> <%= render 'admin/communication/websites/sidebar' do %> - <div class="card"> - <%= render 'admin/communication/websites/menus/list', menus: @menus %> - <% if @menus.total_pages > 1 %> - <div class="card-footer"> - <%= paginate @menus, theme: 'bootstrap-5' %> - </div> - <% end %> - </div> + <%= render 'admin/communication/websites/menus/list', menus: @menus %> + <% if @menus.total_pages > 1 %> + <%= paginate @menus, theme: 'bootstrap-5' %> + <% end %> <% end %> <% content_for :action_bar_right do %> diff --git a/app/views/admin/communication/websites/menus/items/_form.html.erb b/app/views/admin/communication/websites/menus/items/_form.html.erb index 6279d6348..2a1fce91e 100644 --- a/app/views/admin/communication/websites/menus/items/_form.html.erb +++ b/app/views/admin/communication/websites/menus/items/_form.html.erb @@ -4,12 +4,9 @@ <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> <%= f.input :parent_id, as: :hidden, wrapper: false %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('content') %></h5> - </div> + <h2 class="h3"><%= t('content') %></h2> <div class="card-body"> - <div class="row"> + <div class="row row-small"> <div class="col-lg-6"> <%= f.input :title %> </div> @@ -60,16 +57,16 @@ <%= Communication::Website::Menu::Item.human_attribute_name('kind') %> <abbr title="required">*</abbr> </label> - <div class="row"> + <div class="row row-small"> <% @website.menu_item_kinds.keys.each do |kind| %> <div class="col-6 col-lg-4 col-xl-3 col-xxl-2"> <div class="card kind" data-kind="<%= kind %>"> <div class="card-body"> - <p class="text-end mb-0"> - <i class="<%= Communication::Website::Menu::Item.icon_for(kind) %> fa-2x"></i><br> - </p> - <p class="mb-0"> + <h3 class="h5"> <%= t "enums.communication.website.menu.item.kind.#{kind}" %> + </h3> + <p class="text-end mb-0"> + <i class="<%= Communication::Website::Menu::Item.icon_for(kind) %>"></i><br> </p> <a class="stretched-link"></a> </div> diff --git a/app/views/admin/communication/websites/menus/show.html.erb b/app/views/admin/communication/websites/menus/show.html.erb index 5598263a0..b504928cb 100644 --- a/app/views/admin/communication/websites/menus/show.html.erb +++ b/app/views/admin/communication/websites/menus/show.html.erb @@ -3,28 +3,18 @@ <%= render 'admin/communication/websites/sidebar' do %> <div class="row"> <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-2 h5"> - <%= "#{Communication::Website::Menu::Item.model_name.human(count: 2)} (#{@root_items.size})" %> - </h2> - <%= render 'admin/communication/websites/menus/items/list', items: @root_items if @items.any? %> - <%= link_to t('create'), - new_admin_communication_website_menu_item_path(website_id: @website, menu_id: @menu.id), - class: button_classes if can?(:create, Communication::Website::Menu::Item) %> - </div> - </div> + <h2 class="h3"> + <%= "#{Communication::Website::Menu::Item.model_name.human(count: 2)} (#{@root_items.size})" %> + </h2> + <%= render 'admin/communication/websites/menus/items/list', items: @root_items if @items.any? %> + <%= link_to t('create'), + new_admin_communication_website_menu_item_path(website_id: @website, menu_id: @menu.id), + class: button_classes if can?(:create, Communication::Website::Menu::Item) %> </div> <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-0 h5"><%= t('metadata') %></h2> - </div> - <div class="card-body"> - <h3 class="h5"><%= Communication::Website::Menu.human_attribute_name('identifier') %></h3> - <p><%= @menu.identifier %></p> - </div> - </div> + <h2 class="h3"><%= t('metadata') %></h2> + <h3 class="h5"><%= Communication::Website::Menu.human_attribute_name('identifier') %></h3> + <p><%= @menu.identifier %></p> </div> </div> <% end %> diff --git a/app/views/admin/communication/websites/pages/_form.html.erb b/app/views/admin/communication/websites/pages/_form.html.erb index 68da89fc8..317d922e0 100644 --- a/app/views/admin/communication/websites/pages/_form.html.erb +++ b/app/views/admin/communication/websites/pages/_form.html.erb @@ -8,49 +8,41 @@ url = page.new_record? ? admin_communication_website_pages_path <div class="row"> <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('content') %></h5> - </div> - <div class="card-body"> - <%= f.input :title %> - <%= f.input :breadcrumb_title %> - <%= render 'admin/application/summary/form', f: f, about: page %> - <%= f.input :header_text, as: :string %> - <%= f.input :text, as: :summernote if page.text&.to_plain_text.present? %> - </div> - </div> + <section class="mb-5"> + <h2 class="h3"><%= t('content') %></h2> + <%= f.input :title %> + <%= f.input :breadcrumb_title %> + <%= render 'admin/application/summary/form', f: f, about: page %> + <%= f.input :header_text, as: :string %> + <%= f.input :text, as: :summernote if page.text&.to_plain_text.present? %> + </section> <%= render 'admin/application/meta_description/form', f: f, about: page %> </div> <div class="col-md-4"> <% unless page.is_home? %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('metadata') %></h5> - </div> - <div class="card-body"> - <%= f.input :published if page.draftable? %> - <%= f.input :slug, - as: :string, - required: true, - input_html: page.persisted? ? {} : { - class: 'js-slug-input', - data: { source: '#communication_website_page_title' } - } unless page.is_home? %> - <% if @website.languages.many? %> - <%= f.input :language_id, collection: @website.languages, include_blank: false %> - <% elsif @website.languages.any? %> - <%= f.input :language_id, as: :hidden, input_html: { value: @website.languages.first.id }, wrapper: false %> - <% end %> - <%= f.association :parent, - collection: collection_tree(@website.pages, page), - include_blank: false, - label_method: ->(p) { sanitize p[:label] }, - value_method: ->(p) { p[:id] } unless page.is_home? %> - <%= f.input :bodyclass if can?(:edit, @website) %> - <%= f.input :full_width if page.editable_width? %> - </div> - </div> + <section class="mb-5"> + <h2 class="h3"><%= t('metadata') %></h2> + <%= f.input :published if page.draftable? %> + <%= f.input :slug, + as: :string, + required: true, + input_html: page.persisted? ? {} : { + class: 'js-slug-input', + data: { source: '#communication_website_page_title' } + } unless page.is_home? %> + <% if @website.languages.many? %> + <%= f.input :language_id, collection: @website.languages, include_blank: false %> + <% elsif @website.languages.any? %> + <%= f.input :language_id, as: :hidden, input_html: { value: @website.languages.first.id }, wrapper: false %> + <% end %> + <%= f.association :parent, + collection: collection_tree(@website.pages, page), + include_blank: false, + label_method: ->(p) { sanitize p[:label] }, + value_method: ->(p) { p[:id] } unless page.is_home? %> + <%= f.input :bodyclass if can?(:edit, @website) %> + <%= f.input :full_width if page.editable_width? %> + </section> <% else %> <% if @website.languages.many? %> <div class="card flex-fill w-100"> diff --git a/app/views/admin/communication/websites/pages/_list.html.erb b/app/views/admin/communication/websites/pages/_list.html.erb index 222f25046..ebdbc91db 100644 --- a/app/views/admin/communication/websites/pages/_list.html.erb +++ b/app/views/admin/communication/websites/pages/_list.html.erb @@ -2,19 +2,19 @@ <table class="<%= table_classes %>"> <thead> <tr> - <th><%= Communication::Website::Page.human_attribute_name('title') %></th> + <th class="ps-0"><%= Communication::Website::Page.human_attribute_name('title') %></th> <th width="150"></th> </tr> </thead> <tbody> <% pages.each do |page| %> <tr> - <td> + <td class="ps-0"> <%= link_to page, admin_communication_website_page_path(website_id: page.website.id, id: page.id), class: "#{'draft' unless page.published?}" %> </td> - <td class="text-end"> + <td class="text-end pe-0"> <div class="btn-group" role="group"> <%= link_to t('edit'), edit_admin_communication_website_page_path(website_id: page.website.id, id: page.id), diff --git a/app/views/admin/communication/websites/pages/index.html.erb b/app/views/admin/communication/websites/pages/index.html.erb index 08f84bcf3..917dda572 100644 --- a/app/views/admin/communication/websites/pages/index.html.erb +++ b/app/views/admin/communication/websites/pages/index.html.erb @@ -1,32 +1,33 @@ -<% content_for :title, "#{t('admin.communication.website.pages.structure')} (#{@website.pages.count})" %> +<% content_for :title, t('admin.communication.website.pages.structure') %> + +<% content_for :title_right do %> + <%= @website.pages.count %> + <%= Communication::Website::Page.model_name.human(count: @website.pages.count).downcase %> +<% end %> <%= render 'admin/communication/websites/sidebar' do %> - <div class="card"> - <div class="card-body"> - <ul class="list-unstyled treeview"> - <li class="treeview__element treeview__element--opened treeview__element--loaded" data-id="<%= @homepage.id %>" data-parent=""> - <div class="d-flex align-items-center treeview__label border-bottom p-1"> - <div class="d-inline-block p-2 ps-0" style="width: 22px"> - <span class="close_btn text-primary"> - <i class="close_btn--with_children fas fa-folder-open"></i> - </span> - </div> - <%= link_to @homepage, - admin_communication_website_page_path(website_id: @homepage.website.id, id: @homepage.id) - %> - <div class="btn-group ms-auto" role="group"> - <%= link_to t('edit'), edit_admin_communication_website_page_path(@homepage), class: button_classes %> - </div> - </div> - <ul class="list-unstyled ms-4 treeview__children js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @homepage) %>" - data-id="<%= @homepage.id %>" - data-sort-url="<%= reorder_admin_communication_website_pages_path %>"> - <%= render 'treebranch', pages: @first_level_pages %> - </ul> - </li> + <ul class="list-unstyled treeview"> + <li class="treeview__element treeview__element--opened treeview__element--loaded" data-id="<%= @homepage.id %>" data-parent=""> + <div class="d-flex align-items-center treeview__label border-bottom p-1"> + <div class="d-inline-block p-2 ps-0" style="width: 22px"> + <span class="close_btn text-primary"> + <i class="close_btn--with_children fas fa-folder-open"></i> + </span> + </div> + <%= link_to @homepage, + admin_communication_website_page_path(website_id: @homepage.website.id, id: @homepage.id) + %> + <div class="btn-group ms-auto" role="group"> + <%= link_to t('edit'), edit_admin_communication_website_page_path(@homepage), class: button_classes %> + </div> + </div> + <ul class="list-unstyled ms-4 treeview__children js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @homepage) %>" + data-id="<%= @homepage.id %>" + data-sort-url="<%= reorder_admin_communication_website_pages_path %>"> + <%= render 'treebranch', pages: @first_level_pages %> </ul> - </div> - </div> + </li> + </ul> <% end %> <% content_for :action_bar_right do %> diff --git a/app/views/admin/communication/websites/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb index 2219e246d..b1cf768ee 100644 --- a/app/views/admin/communication/websites/pages/show.html.erb +++ b/app/views/admin/communication/websites/pages/show.html.erb @@ -9,12 +9,10 @@ <%= render 'admin/communication/blocks/list', about: @page %> <% if @page.is_special_page? %> - <div class="card"> - <div class="card-body"> - <%= t('admin.communication.website.pages.is_special_page') %> - <b><%= t("communication.website.pages.defaults.#{@page.type_key}.title") %></b> - </div> - </div> + <p> + <%= t('admin.communication.website.pages.is_special_page') %> + <b><%= t("communication.website.pages.defaults.#{@page.type_key}.title") %></b> + </p> <% end %> <%= render 'admin/application/dependencies', @@ -23,70 +21,67 @@ </div> <div class="col-md-4"> <%= render 'admin/application/a11y/widget', about: @page %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <div class="float-end"> - <% if @page.url %> - <%= link_to t('open'), - @page.url, - target: :_blank, - class: 'btn btn-light' %> - <% end %> - </div> - <h2 class="card-title mb-0 h5"><%= t('metadata') %></h2> - </div> - <div class="card-body"> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('published') %></h3> - <p><%= t @page.published %></p> - <% unless @page.slug.blank? %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('slug') %></h3> - <p><%= @page.slug %></p> - <% end %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('path') %></h3> - <p><%= @page.path %></p> - <% if @page.parent %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('parent') %></h3> - <p><%= link_to_if can?(:read, @page.parent), - @page.parent, - admin_communication_website_page_path( - website_id: @website.id, - id: @page.parent.id - ), - class: "#{'draft' unless @page.parent.published?}" %></p> + <section class="mb-5"> + <div class="float-end"> + <% if @page.url %> + <%= link_to t('open'), + @page.url, + target: :_blank, + class: 'btn btn-light' %> <% end %> + </div> + <h2 class="h3 mb-3"><%= t('metadata') %></h2> + <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('published') %></h3> + <p><%= t @page.published %></p> + <% unless @page.slug.blank? %> + <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('slug') %></h3> + <p><%= @page.slug %></p> + <% end %> + <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('path') %></h3> + <p><%= @page.path %></p> - <% if can?(:edit, @website) && @page.best_bodyclass %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('bodyclass') %></h3> - <p> - <%= @page.best_bodyclass %> - <% if @page.bodyclass.blank? %> - <br> - <span class="small text-muted"> - <%= t 'admin.inheritance.sentence_without_link' %> - </span> - <% end %> - </p> - <% end %> + <% if @page.parent %> + <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('parent') %></h3> + <p><%= link_to_if can?(:read, @page.parent), + @page.parent, + admin_communication_website_page_path( + website_id: @website.id, + id: @page.parent.id + ), + class: "#{'draft' unless @page.parent.published?}" %></p> + <% end %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('full_width') %></h3> - <p><%= t @page.full_width %></p> + <% if can?(:edit, @website) && @page.best_bodyclass %> + <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('bodyclass') %></h3> + <p> + <%= @page.best_bodyclass %> + <% if @page.bodyclass.blank? %> + <br> + <span class="small text-muted"> + <%= t 'admin.inheritance.sentence_without_link' %> + </span> + <% end %> + </p> + <% end %> - <% if @page.children.any? %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('children') %></h3> - <ul class="list-unstyled mb-0"> - <% @page.children.ordered.each do |child| %> - <li> - <%= link_to_if can?(:read, child), - child, - admin_communication_website_page_path( website_id: @website.id, id: child.id), - class: "#{'draft' unless child.published?}" %> - </li> - <% end %> - </ul> - <% end %> - </div> - </div> + <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('full_width') %></h3> + <p><%= t @page.full_width %></p> + + <% if @page.children.any? %> + <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('children') %></h3> + <ul class="list-unstyled mb-0"> + <% @page.children.ordered.each do |child| %> + <li> + <%= link_to_if can?(:read, child), + child, + admin_communication_website_page_path( website_id: @website.id, id: child.id), + class: "#{'draft' unless child.published?}" %> + </li> + <% end %> + </ul> + <% end %> + </section> <%= render 'admin/application/featured_image/show', about: @page %> <%= render 'admin/application/meta_description/show', about: @page %> </div> diff --git a/app/views/admin/communication/websites/posts/_form.html.erb b/app/views/admin/communication/websites/posts/_form.html.erb index 1cfe0a7de..92e1a03b2 100644 --- a/app/views/admin/communication/websites/posts/_form.html.erb +++ b/app/views/admin/communication/websites/posts/_form.html.erb @@ -4,77 +4,65 @@ <div class="row"> <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('content') %></h5> - </div> - <div class="card-body"> - <%= f.input :title %> - <%= render 'admin/application/summary/form', f: f, about: post %> - <%= f.input :text, as: :summernote if post.text&.to_plain_text.present? %> - </div> - </div> - <div class="row"> - <div class="col-md-6"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"> - <%= t('activerecord.attributes.communication/website/post.categories') %> - </h5> - </div> - <div class="card-body"> - <%= f.association :categories, - label_text: false, - as: :check_boxes, - collection: collection_tree_for_checkboxes(@website.categories) if @website.categories.any? %> - </div> + <section class="mb-5"> + <h2 class="h3"><%= t('content') %></h2> + <%= f.input :title %> + <%= render 'admin/application/summary/form', f: f, about: post %> + <%= f.input :text, as: :summernote if post.text&.to_plain_text.present? %> + </section> + <div class="row row-small"> + <% if @website.categories.any? %> + <div class="col-md-6"> + <h2 class="h3"> + <%= t('activerecord.attributes.communication/website/post.categories') %> + </h2> + <%= f.association :categories, + label_text: false, + as: :check_boxes, + collection: collection_tree_for_checkboxes(@website.categories) if @website.categories.any? %> </div> - </div> + <% end %> <div class="col-md-6"> <%= render 'admin/application/meta_description/form', f: f, about: post %> </div> </div> </div> <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('metadata') %></h5> - </div> - <div class="card-body"> - <% if can? :publish, post %> - <div class="row"> - <div class="col-6"> - <%= f.input :published %> - </div> - <div class="col-6"> - <%= f.input :pinned %> - </div> + <section class="mb-5"> + <h2 class="h3"><%= t('metadata') %></h2> + <% if can? :publish, post %> + <div class="row row-small"> + <div class="col-6"> + <%= f.input :published %> </div> - <%= f.input :published_at, html5: true %> - <% end %> - <% if @website.languages.many? %> - <%= f.input :language_id, collection: @website.languages, include_blank: false %> - <% elsif @website.languages.any? %> - <%= f.input :language_id, as: :hidden, input_html: { value: @website.languages.first.id }, wrapper: false %> - <% end %> - <% if current_user.author? || current_user.contributor? %> - <%= f.input :author_id, - as: :hidden, - input_html: { value: current_user.person&.id }, - wrapper: false %> - <% else %> - <%= f.association :author, - collection: current_university.people.ordered, - label_method: :to_s_alphabetical %> - <% end %> - <%= f.input :slug, - as: :string, - input_html: post.persisted? ? {} : { - class: 'js-slug-input', - data: { source: '#communication_website_post_title' } - } %> - </div> - </div> + <div class="col-6"> + <%= f.input :pinned %> + </div> + </div> + <%= f.input :published_at, html5: true %> + <% end %> + <% if @website.languages.many? %> + <%= f.input :language_id, collection: @website.languages, include_blank: false %> + <% elsif @website.languages.any? %> + <%= f.input :language_id, as: :hidden, input_html: { value: @website.languages.first.id }, wrapper: false %> + <% end %> + <% if current_user.author? || current_user.contributor? %> + <%= f.input :author_id, + as: :hidden, + input_html: { value: current_user.person&.id }, + wrapper: false %> + <% else %> + <%= f.association :author, + collection: current_university.people.ordered, + label_method: :to_s_alphabetical %> + <% end %> + <%= f.input :slug, + as: :string, + input_html: post.persisted? ? {} : { + class: 'js-slug-input', + data: { source: '#communication_website_post_title' } + } %> + </section> <%= render 'admin/application/featured_image/edit', about: @post, f: f %> </div> </div> diff --git a/app/views/admin/communication/websites/posts/_list.html.erb b/app/views/admin/communication/websites/posts/_list.html.erb index d608f73ce..7a37bed6e 100644 --- a/app/views/admin/communication/websites/posts/_list.html.erb +++ b/app/views/admin/communication/websites/posts/_list.html.erb @@ -11,11 +11,11 @@ <thead> <tr> <% if selectable %> - <th> + <th class="ps-0"> <%= check_box_tag nil, nil, false, data: { batch_selectable_role: "select-all" } %> </th> <% end %> - <th><%= Communication::Website::Post.human_attribute_name('title') %></th> + <th class="ps-0"><%= Communication::Website::Post.human_attribute_name('title') %></th> <th><%= Communication::Website::Post.human_attribute_name('featured_image') %></th> <th colspan="2"><%= Communication::Website::Post.human_attribute_name('meta') %></th> </tr> @@ -24,11 +24,11 @@ <% posts.each do |post| %> <tr> <% if selectable %> - <td> + <td class="ps-0"> <%= check_box_tag "ids[]", post.id, false, data: { batch_selectable_role: "select-single" } %> </td> <% end %> - <td><%= link_to post, + <td class="ps-0"><%= link_to post, admin_communication_website_post_path(website_id: post.website.id, id: post.id), class: "#{'draft' unless post.published?}" %></td> <td><%= image_tag post.featured_image.representation(resize: 'x100'), diff --git a/app/views/admin/communication/websites/posts/index.html.erb b/app/views/admin/communication/websites/posts/index.html.erb index 811f99a9b..4031470ae 100644 --- a/app/views/admin/communication/websites/posts/index.html.erb +++ b/app/views/admin/communication/websites/posts/index.html.erb @@ -1,12 +1,17 @@ -<% content_for :title, "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %> +<% content_for :title, "#{Communication::Website::Post.model_name.human(count: 2)}" %> + +<% content_for :title_right do %> + <%= @posts.total_count %> + <%= Communication::Website::Post.model_name.human(count: @posts.total_count).downcase %> +<% end %> <%= render 'admin/communication/websites/sidebar' do %> <%= render 'filters', current_path: admin_communication_website_posts_path, filters: @filters if @filters.any? %> - <div class="card" data-batch-selectable> + <div class="mb-5" data-batch-selectable> <%= form_tag publish_admin_communication_website_posts_path do %> <%= render 'admin/communication/websites/posts/list', posts: @posts, selectable: true %> - <div class="card-footer"> + <div> <% if @posts.total_pages > 1 %> <div class="float-end mb-3"> <%= paginate @posts, theme: 'bootstrap-5' %> @@ -34,38 +39,24 @@ <div class="row"> <% if can?(:create, Communication::Website::Category) || (@root_categories.any? && can?(:edit, @root_categories.first)) %> <div class="col-md-6"> - <div class="card"> - <div class="card-header"> - <div class="float-end"> - <%= create_link Communication::Website::Category %> - </div> - <h2 class="card-title"> - <%= Communication::Website::Category.model_name.human(count: 2) %> - </h2> - </div> - <div class="card-body"> - <ul class="list-unstyled treeview treeview--sortable js-treeview js-treeview-sortable js-treeview-sortable-container" - data-id="" - data-sort-url="<%= reorder_admin_communication_website_categories_path %>"> - <%= render 'admin/communication/websites/categories/treebranch', categories: @root_categories %> - </ul> - </div> + <div class="float-end"> + <%= create_link Communication::Website::Category %> </div> + <h2 class="h3"><%= Communication::Website::Category.model_name.human(count: 2) %></h2> + <ul class="list-unstyled treeview treeview--sortable js-treeview js-treeview-sortable js-treeview-sortable-container" + data-id="" + data-sort-url="<%= reorder_admin_communication_website_categories_path %>"> + <%= render 'admin/communication/websites/categories/treebranch', categories: @root_categories %> + </ul> </div> <% end %> <% if @authors.any? %> <div class="col-md-6"> - <div class="card"> - <div class="card-header"> - <h2 class="card-title"><%= t('communication.authors', count: 2) %></h2> - </div> - <%= render 'admin/communication/websites/authors/list', authors: @authors %> - <% if @authors.total_pages > 1 %> - <div class="card-footer"> - <%= paginate @authors, theme: 'bootstrap-5', param_name: :authors_page %> - </div> - <% end %> - </div> + <h2 class="h3"><%= t('communication.authors', count: 2) %></h2> + <%= render 'admin/communication/websites/authors/list', authors: @authors %> + <% if @authors.total_pages > 1 %> + <%= paginate @authors, theme: 'bootstrap-5', param_name: :authors_page %> + <% end %> </div> <% end %> </div> diff --git a/app/views/admin/communication/websites/posts/show.html.erb b/app/views/admin/communication/websites/posts/show.html.erb index e37dba9ad..de65b65c6 100644 --- a/app/views/admin/communication/websites/posts/show.html.erb +++ b/app/views/admin/communication/websites/posts/show.html.erb @@ -7,49 +7,43 @@ <%= render 'admin/communication/blocks/list', about: @post %> </div> <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <div class="float-end"> - <% if @post.url %> - <%= link_to t('open'), - @post.url, - target: :_blank, - class: 'btn btn-light' %> + <div class="float-end"> + <% if @post.url %> + <%= link_to t('open'), + @post.url, + target: :_blank, + class: 'btn btn-light' %> + <% end %> + </div> + <h2 class="h3"><%= t('metadata') %></h2> + <div class="row row-small"> + <div class="col-6"> + <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('published') %></h3> + <p> + <%= t @post.published %><% if @post.published & @post.published_at %>, + <%= l @post.published_at.to_date, format: :long if @post.published_at %> <% end %> - </div> - <h2 class="card-title mb-0 h5"><%= t('metadata') %></h2> + </p> </div> - <div class="card-body"> - <div class="row"> - <div class="col-6"> - <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('published') %></h3> - <p> - <%= t @post.published %><% if @post.published & @post.published_at %>, - <%= l @post.published_at.to_date, format: :long if @post.published_at %> - <% end %> - </p> - </div> - <div class="col-6"> - <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('pinned') %></h3> - <p><%= t @post.pinned %></p> - </div> - </div> - <% if @post.author %> - <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('author') %></h3> - <p><%= link_to_if can?(:read, @post.author), @post.author, admin_communication_website_author_path(@post.author) %></p> - <% end %> - <% if @post.categories.any? %> - <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('categories') %></h3> - <ul class="list-unstyled"> - <% @post.categories.each do |category| %> - <li><%= link_to_if can?(:read, category), category, [:admin, category] %></li> - <% end %> - </ul> - <% end %> - <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('slug') %></h3> - <p><%= @post.slug %></p> + <div class="col-6"> + <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('pinned') %></h3> + <p><%= t @post.pinned %></p> </div> </div> + <% if @post.author %> + <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('author') %></h3> + <p><%= link_to_if can?(:read, @post.author), @post.author, admin_communication_website_author_path(@post.author) %></p> + <% end %> + <% if @post.categories.any? %> + <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('categories') %></h3> + <ul class="list-unstyled"> + <% @post.categories.each do |category| %> + <li><%= link_to_if can?(:read, category), category, [:admin, category] %></li> + <% end %> + </ul> + <% end %> + <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('slug') %></h3> + <p><%= @post.slug %></p> <%= render 'admin/application/featured_image/show', about: @post %> <%= render 'admin/application/meta_description/show', about: @post %> </div> diff --git a/app/views/admin/communication/websites/show.html.erb b/app/views/admin/communication/websites/show.html.erb index 336236052..04543e484 100644 --- a/app/views/admin/communication/websites/show.html.erb +++ b/app/views/admin/communication/websites/show.html.erb @@ -2,7 +2,7 @@ <% content_for :title_right do %> <% unless @website.url.blank? %> - <%= link_to @website.url, @website.url, target: :_blank %> • + <%= link_to @website.url, @website.url, target: :_blank %><br> <% end %> <%= I18n.t("activerecord.attributes.communication/website.about_#{@website.about_type}") %> <% if @website.about %> diff --git a/app/views/admin/communication/websites/show/_pages.html.erb b/app/views/admin/communication/websites/show/_pages.html.erb index e66b6df5f..4d673e418 100644 --- a/app/views/admin/communication/websites/show/_pages.html.erb +++ b/app/views/admin/communication/websites/show/_pages.html.erb @@ -1,20 +1,11 @@ -<div class="card mb-5"> - <div class="card-header"> - <div class="float-end"> - <%= link_to t('create'), - new_admin_communication_website_page_path(website_id: @website), - class: button_classes if can?(:create, Communication::Website::Page) %> - </div> - <h2 class="card-title"> - <%= link_to admin_communication_website_pages_path(website_id: @website) do %> - <%= t('communication.website.last_pages') %> - <small> - - - <%= t('communication.website.see_all', number: @website.pages.accessible_by(current_ability).count) %> - </small> - <% end %> - </h2> +<section class="mb-5"> + <div class="float-end"> + <%= link_to t('create'), + new_admin_communication_website_page_path(website_id: @website), + class: button_classes if can?(:create, Communication::Website::Page) %> </div> - <%= render 'admin/communication/websites/pages/list', - pages: @pages %> -</div> + <h2 class="h3"><%= t('communication.website.last_pages') %></h2> + <p><%= link_to t('communication.website.see_all', number: @website.pages.accessible_by(current_ability).count), + admin_communication_website_pages_path(website_id: @website) %></p> + <%= render 'admin/communication/websites/pages/list', pages: @pages %> +</section> diff --git a/app/views/admin/communication/websites/show/_posts.html.erb b/app/views/admin/communication/websites/show/_posts.html.erb index 186639df5..23200846b 100644 --- a/app/views/admin/communication/websites/show/_posts.html.erb +++ b/app/views/admin/communication/websites/show/_posts.html.erb @@ -1,25 +1,17 @@ -<div class="card mb-5"> - <div class="card-header"> - <div class="float-end"> - <%= link_to t('communication.website.posts.new_curation'), - new_admin_communication_website_post_curation_path(website_id: @website.id), - class: button_classes if can?(:create, Communication::Website::Post) %> - <%= link_to t('create'), - new_admin_communication_website_post_path(website_id: @website), - class: button_classes if can?(:create, Communication::Website::Post) %> - </div> - <h2 class="card-title"> - <%= link_to admin_communication_website_posts_path(website_id: @website) do %> - <%= t('communication.website.last_posts') %> - <small> - - - <%= t('communication.website.see_all', number: @website.posts.accessible_by(current_ability).count) %> - </small> - <% end %> - </h2> +<section class="mb-5"> + <div class="float-end"> + <%= link_to t('communication.website.posts.new_curation'), + new_admin_communication_website_post_curation_path(website_id: @website.id), + class: button_classes if can?(:create, Communication::Website::Post) %> + <%= link_to t('create'), + new_admin_communication_website_post_path(website_id: @website), + class: button_classes if can?(:create, Communication::Website::Post) %> </div> + <h2 class="h3"><%= t('communication.website.last_posts') %></h2> + <p><%= link_to t('communication.website.see_all', number: @website.posts.accessible_by(current_ability).count), + admin_communication_website_posts_path(website_id: @website) %></p> <%= render 'admin/communication/websites/posts/list', posts: @posts, hide_author: true, hide_category: true %> -</div> +</section> diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb index 0343ab54d..b53917cc0 100644 --- a/app/views/admin/dashboard/index.html.erb +++ b/app/views/admin/dashboard/index.html.erb @@ -1,33 +1,25 @@ <% content_for :title, t('admin.dashboard') %> <% classes = 'col-md-6 col-xl-4 d-flex' %> -<div class="row"> - <div class="col-md-6 d-flex"> - <div class="card flex-fill"> - <div class="card-body"> - <h4><%= t('hello', name: current_user.first_name) %></h4> - <% if current_university.logo.attached? %> - <%= image_tag current_university.logo, width: 120, class: 'float-end' %> - <% else %> - <p><%= current_university %></p> - <% end %> - </div> - </div> +<div class="row mb-5"> + <div class="col-md-6 pb-4"> + <h2 class="h4"><%= t('hello', name: current_user.first_name) %></h2> + <% if current_university.logo.attached? %> + <%= image_tag current_university.logo, width: 120, class: 'float-end' %> + <% else %> + <p><%= current_university %></p> + <% end %> </div> - <div class="col-md-6 d-flex"> - <div class="card flex-fill"> - <div class="card-body py-4"> - <div class="d-flex align-items-start"> - <div class="flex-grow-1"> - <h3 class="mb-2"><%= Delayed::Job.all.length %></h3> - <p class="mb-0"><%= t 'admin.pending_tasks.label' %></p> - <p class="mb-0 small"><%= t 'admin.pending_tasks.hint' %></p> - </div> - <div class="d-inline-block ms-3"> - <div class="stat stat-sm"> - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock align-baseline"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg> - </div> - </div> + <div class="col-md-6 pb-4"> + <div class="d-flex align-items-start"> + <div class="flex-grow-1"> + <h2 class="h4 mb-2"><%= Delayed::Job.all.length %></h2> + <p class="mb-0"><%= t 'admin.pending_tasks.label' %></p> + <p class="mb-0 small"><%= t 'admin.pending_tasks.hint' %></p> + </div> + <div class="d-inline-block ms-3"> + <div class="stat stat-sm"> + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock align-baseline"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg> </div> </div> </div> @@ -35,17 +27,17 @@ </div> <% if current_university.communication_websites.any? && can?(:read, Communication::Website) %> - <h2 class="h4 my-4 section"><%= Communication::Website.model_name.human(count: 2) %></h2> - <div class="row"> + <h2 class="section"><%= Communication::Website.model_name.human(count: 2) %></h2> + <div class="row row-small"> <% current_university.communication_websites.each do |website| %> <% next unless can?(:read, website) %> <div class="<%= classes %>"> <div class="card flex-fill"> <div class="card-body"> <span class="float-end"> - <i class="fas fa-<%= Icon::COMMUNICATION_WEBSITE %> fa-2x"></i> + <i class="fas fa-<%= Icon::COMMUNICATION_WEBSITE %>"></i> </span> - <h4><%= website %></h4> + <h3 class="card-title"><%= website %></h3> <p class="small"><%= website.url %></p> <%= link_to t('show'), [:admin, website], class: button_classes('stretched-link') %> </div> @@ -56,17 +48,17 @@ <% end %> <% if current_university.communication_extranets.any? && can?(:read, Communication::Extranet) %> - <h2 class="h4 my-4 section"><%= Communication::Extranet.model_name.human(count: 2) %></h2> - <div class="row"> + <h2 class="section"><%= Communication::Extranet.model_name.human(count: 2) %></h2> + <div class="row row-small"> <% current_university.communication_extranets.each do |extranet| %> <% next unless can?(:read, extranet) %> <div class="<%= classes %>"> <div class="card flex-fill"> <div class="card-body"> <span class="float-end"> - <i class="fas fa-<%= Icon::COMMUNICATION_EXTRANET %> fa-2x"></i> + <i class="fas fa-<%= Icon::COMMUNICATION_EXTRANET %>"></i> </span> - <h4><%= extranet %></h4> + <h3 class="card-title"><%= extranet %></h3> <p class="small"><%= extranet.url %></p> <%= link_to t('show'), [:admin, extranet], class: button_classes('stretched-link') %> </div> @@ -77,17 +69,17 @@ <% end %> <% if current_university.research_journals.any? && can?(:read, Research::Journal) %> - <h2 class="h4 my-4 section"><%= Research::Journal.model_name.human(count: 2) %></h2> - <div class="row"> + <h2 class="section"><%= Research::Journal.model_name.human(count: 2) %></h2> + <div class="row row-small"> <% current_university.research_journals.each do |journal| %> <% next unless can?(:read, journal) %> <div class="<%= classes %>"> <div class="card flex-fill"> <div class="card-body"> <span class="float-end"> - <i class="fas fa-<%= Icon::RESEARCH_JOURNAL %> fa-2x"></i> + <i class="fas fa-<%= Icon::RESEARCH_JOURNAL %>"></i> </span> - <h4><%= journal %></h4> + <h3 class="card-title"><%= journal %></h3> <p> </p> <%= link_to t('show'), [:admin, journal], class: button_classes('stretched-link') %> </div> diff --git a/app/views/admin/users/_form.html.erb b/app/views/admin/users/_form.html.erb index 5d7b002bf..7c0c5ea26 100644 --- a/app/views/admin/users/_form.html.erb +++ b/app/views/admin/users/_form.html.erb @@ -4,64 +4,51 @@ <div class="row"> <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-body"> - <%= f.input :email %> - <%= f.input :first_name %> - <%= f.input :last_name %> - <%= f.association :language, - include_blank: false, - label_method: lambda { |l| t("languages.#{l.iso_code.to_s}") } %> - </div> - </div> + <%= f.input :email %> + <%= f.input :first_name %> + <%= f.input :last_name %> + <%= f.association :language, + include_blank: false, + label_method: lambda { |l| t("languages.#{l.iso_code.to_s}") } %> </div> <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-body"> - <%= f.input :password, - as: :password_with_hints, - required: user.new_record?, - hint: user.new_record? ? nil : t('admin.password_hint'), - allow_password_uncloaking: true, - validators: { - length: Devise.password_length.first, - uppercase_char: true, - lowercase_char: true, - numeric_char: true, - special_char: Rails.application.config.allowed_special_chars - }, - input_html: { autocomplete: "new-password" } %> - <%= f.input :mobile_phone %> - <%= f.input :role, include_blank: false, collection: current_user.managed_roles, label_method: lambda { |k| t("activerecord.attributes.user.roles.#{k[1]}")} %> - <div data-show-for-roles="program_manager"> - <%= f.association :programs_to_manage, - as: :check_boxes, - collection: collection_tree(current_university.education_programs.ordered), - label_method: ->(p) { sanitize p[:label] }, - value_method: ->(p) { p[:id] } %> - </div> - <div data-show-for-roles="author,contributor,website_manager"> - <%= f.association :websites_to_manage, - as: :check_boxes, - collection: current_university.communication_websites.ordered - %> - </div> - </div> + <%= f.input :password, + as: :password_with_hints, + required: user.new_record?, + hint: user.new_record? ? nil : t('admin.password_hint'), + allow_password_uncloaking: true, + validators: { + length: Devise.password_length.first, + uppercase_char: true, + lowercase_char: true, + numeric_char: true, + special_char: Rails.application.config.allowed_special_chars + }, + input_html: { autocomplete: "new-password" } %> + <%= f.input :mobile_phone %> + <%= f.input :role, include_blank: false, collection: current_user.managed_roles, label_method: lambda { |k| t("activerecord.attributes.user.roles.#{k[1]}")} %> + <div data-show-for-roles="program_manager"> + <%= f.association :programs_to_manage, + as: :check_boxes, + collection: collection_tree(current_university.education_programs.ordered), + label_method: ->(p) { sanitize p[:label] }, + value_method: ->(p) { p[:id] } %> + </div> + <div data-show-for-roles="author,contributor,website_manager"> + <%= f.association :websites_to_manage, + as: :check_boxes, + collection: current_university.communication_websites.ordered + %> </div> </div> <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-body"> - <%= f.input :picture, - as: :single_deletable_file, - input_html: { accept: '.jpg,.jpeg,.png,.svg' }, - preview: 200, - resize: 1, - direct_upload: true %> - </div> - </div> + <%= f.input :picture, + as: :single_deletable_file, + input_html: { accept: '.jpg,.jpeg,.png,.svg' }, + preview: 200, + resize: 1, + direct_upload: true %> </div> - </div> <% content_for :action_bar_right do %> <%= submit f %> diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb index 7c9769a98..6d9f32033 100644 --- a/app/views/admin/users/show.html.erb +++ b/app/views/admin/users/show.html.erb @@ -4,50 +4,40 @@ <div class="row"> <div class="col-md-6"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-0 h5"><%= t('admin.infos') %></h2> - </div> - <div class="table-responsive"> - <table class="<%= table_classes %>"> + <h2 class="h5"><%= t('admin.infos') %></h2> + <div class="table-responsive"> + <table class="<%= table_classes %>"> + <tr> + <td><%= User.human_attribute_name('email') %></td> + <td class="text-end"><%= link_to @user.email, "mailto:#{@user.email}" %></td> + </tr> + <% ['first_name', 'last_name', 'mobile_phone'].each do |variable| %> <tr> - <td><%= User.human_attribute_name('email') %></td> - <td class="text-end"><%= link_to @user.email, "mailto:#{@user.email}" %></td> + <td><%= User.human_attribute_name(variable) %></td> + <td class="text-end"><%= @user.public_send variable %></td> </tr> - <% ['first_name', 'last_name', 'mobile_phone'].each do |variable| %> - <tr> - <td><%= User.human_attribute_name(variable) %></td> - <td class="text-end"><%= @user.public_send variable %></td> - </tr> - <% end %> + <% end %> + <tr> + <td><%= User.human_attribute_name('role') %></td> + <td class="text-end"><%= t("activerecord.attributes.user.roles.#{@user.role.to_s}") %></td> + </tr> + <tr> + <td><%= User.human_attribute_name('language') %></td> + <td class="text-end"><%= t("languages.#{@user.language.iso_code.to_s}") %></td> + </tr> + <% if @user.person %> <tr> - <td><%= User.human_attribute_name('role') %></td> - <td class="text-end"><%= t("activerecord.attributes.user.roles.#{@user.role.to_s}") %></td> + <td><%= User.human_attribute_name('person') %></td> + <td class="text-end"><%= link_to @user.person, [:admin, @user.person] %></td> </tr> - <tr> - <td><%= User.human_attribute_name('language') %></td> - <td class="text-end"><%= t("languages.#{@user.language.iso_code.to_s}") %></td> - </tr> - <% if @user.person %> - <tr> - <td><%= User.human_attribute_name('person') %></td> - <td class="text-end"><%= link_to @user.person, [:admin, @user.person] %></td> - </tr> - <% end %> - </table> - </div> + <% end %> + </table> </div> </div> <% if @user.picture.attached? %> <div class="col-md-3"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-0 h5"><%= t('activerecord.attributes.user.picture') %></h2> - </div> - <div class="card-body"> - <%= kamifusen_tag @user.picture, class: 'img-fluid' %> - </div> - </div> + <h2 class="h5"><%= t('activerecord.attributes.user.picture') %></h2> + <%= kamifusen_tag @user.picture, class: 'img-fluid' %> </div> <% end %> </div> -- GitLab