diff --git a/Gemfile b/Gemfile index 89bbc1d17c5685b3ff993cb8ca1f209b8371f193..3965ec4501bc74ed118980561f109216a452ec8a 100644 --- a/Gemfile +++ b/Gemfile @@ -41,6 +41,7 @@ gem "mini_magick" gem "octokit" gem "omniauth-rails_csrf_protection", "~> 1.0" gem "omniauth-saml", "~> 2.0" +gem "pexels", "~> 0.5.0" gem "pg", "~> 1.1" gem "puma" gem "rails", "~> 7.0" diff --git a/Gemfile.lock b/Gemfile.lock index 513997b348527d4e79b574dee6966d3c23de36ca..2d5afe7f2c7fc9695c119d4085b58e1a736cc517 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -354,6 +354,8 @@ GEM time uri orm_adapter (0.5.0) + pexels (0.5.0) + requests (~> 1.0.2) pg (1.4.5) popper_js (2.11.6) public_suffix (5.0.1) @@ -404,6 +406,7 @@ GEM rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (2.6.1) + requests (1.0.2) responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) @@ -571,6 +574,7 @@ DEPENDENCIES octokit omniauth-rails_csrf_protection (~> 1.0) omniauth-saml (~> 2.0) + pexels (~> 0.5.0) pg (~> 1.1) puma rack-mini-profiler (~> 2.0) diff --git a/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.eot b/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.eot new file mode 100755 index 0000000000000000000000000000000000000000..390803abc2fcda8b7d27550389b58e818f1fecb1 Binary files /dev/null and b/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.eot differ diff --git a/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.ttf b/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.ttf new file mode 100755 index 0000000000000000000000000000000000000000..4d6459646cb14e45c699a8a92308879fd9416ffd Binary files /dev/null and b/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.ttf differ diff --git a/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.woff b/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.woff new file mode 100755 index 0000000000000000000000000000000000000000..0ddef095ff7f63abe723ac24456cfdb9f6cfb887 Binary files /dev/null and b/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.woff differ diff --git a/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.woff2 b/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.woff2 new file mode 100755 index 0000000000000000000000000000000000000000..2d57f6eab291dbdd173c083093c1e1e42317c0a0 Binary files /dev/null and b/app/assets/fonts/Basier-Square/basiersquare-semibold-webfont.woff2 differ diff --git a/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.eot b/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.eot new file mode 100755 index 0000000000000000000000000000000000000000..4f95be87f157d51e37c05678b9b68a2896722f1e Binary files /dev/null and b/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.eot differ diff --git a/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.ttf b/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.ttf new file mode 100755 index 0000000000000000000000000000000000000000..42f12fee34130024708354b4d7de57f7a28db63c Binary files /dev/null and b/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.ttf differ diff --git a/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.woff b/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.woff new file mode 100755 index 0000000000000000000000000000000000000000..825002aa04c58a72191f89c56ce15e7b9e19ac8b Binary files /dev/null and b/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.woff differ diff --git a/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.woff2 b/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.woff2 new file mode 100755 index 0000000000000000000000000000000000000000..5a9b153f89ccb984d000b08d1f648d6bfac588a5 Binary files /dev/null and b/app/assets/fonts/Basier-Square/basiersquare-semibolditalic-webfont.woff2 differ diff --git a/app/assets/images/communication/photo_imports/pexels.png b/app/assets/images/communication/photo_imports/pexels.png new file mode 100644 index 0000000000000000000000000000000000000000..0fdda8d646eaefdee64a9275b0e5c523f5db2946 Binary files /dev/null and b/app/assets/images/communication/photo_imports/pexels.png differ diff --git a/app/assets/images/communication/photo_imports/unsplash.svg b/app/assets/images/communication/photo_imports/unsplash.svg new file mode 100644 index 0000000000000000000000000000000000000000..adde50407ec75afc84751ee02c48c49c6b1276ef --- /dev/null +++ b/app/assets/images/communication/photo_imports/unsplash.svg @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 457.2 104.2" style="enable-background:new 0 0 457.2 104.2;" xml:space="preserve"> +<style type="text/css"> + .st0{clip-path:url(#SVGID_2_);} +</style> +<g> + <defs> + <rect id="SVGID_1_" width="457.2" height="104.2"/> + </defs> + <clipPath id="SVGID_2_"> + <use xlink:href="#SVGID_1_" style="overflow:visible;"/> + </clipPath> + <path class="st0" d="M59.9,38.7h27.5v48.7H0V38.7h27.5V63h32.3V38.7z M152.9,63.6c0,8.3-5.4,13.1-12.9,13.1 + c-7.3,0-12.8-4.9-12.8-13.1V24.4H115v39.1c0,15.4,11,25.2,25.1,25.2c14.2,0,25.1-9.8,25.1-25.2V24.4h-12.2V63.6z M196.6,42.5 + c-4.7,0-9.9,2-12.6,6.6v-5.4h-11.4v43.7h11.8V62.2c0-5.1,3-9.1,8.2-9.1c5.7,0,8.1,3.8,8.1,8.7v25.5h11.8V59.8 + C212.4,50.2,207.4,42.5,196.6,42.5 M239.9,60.9c0,0-4-0.8-6.5-1.3c-2.5-0.5-4-1.8-4-3.9c0-2.5,2.2-4.3,5.3-4.3 + c4.4,0,6.1,2.2,6.5,4.9h10.2c-0.1-6-4.8-13.8-16.5-13.8c-9.4,0-16.3,6.5-16.3,14.3c0,6.1,3.8,11.2,12.2,13l6,1.3 + c3.4,0.7,4.7,2.3,4.7,4.3c0,2.3-2.1,4.3-6,4.3c-4.7,0-7.3-2.7-7.9-5.8l-10.5,0c0.6,6.5,5.3,14.8,18.5,14.8 + c11.4,0,17.2-7.3,17.2-14.4C252.9,67.9,248.5,62.7,239.9,60.9 M303.1,65.4c0,13.2-8.3,23-20.6,23c-6,0-10.5-2.4-12.6-5.3v21.1 + h-11.8V43.7h11.4v5.4c2-3.4,6.8-6.4,13.4-6.4C295.7,42.7,303.1,52.5,303.1,65.4 M291.5,65.5c0-7.7-4.8-12.2-10.8-12.2 + s-10.9,4.5-10.9,12.2c0,7.7,4.9,12.3,10.9,12.3S291.5,73.3,291.5,65.5 M359.5,43.7h11.4v43.7h-11.8V82c-2,3.5-6.6,6.4-12.6,6.4 + c-12.3,0-20.6-9.8-20.6-23c0-13,7.4-22.7,20.1-22.7c6.6,0,11.3,3,13.4,6.4V43.7z M359.3,65.5c0-7.7-4.9-12.2-10.9-12.2 + s-10.8,4.5-10.8,12.2c0,7.8,4.8,12.3,10.8,12.3S359.3,73.2,359.3,65.5 M308.6,87.3h11.8V24.4h-11.8V87.3z M441,42.5 + c-4.2,0-9,1.4-11.8,4.8l0-22.9h-11.8l0,62.9l11.8,0l0-25.6c0.3-4.8,3.2-8.5,8.2-8.5c5.7,0,8.1,3.8,8.1,8.7l0,25.5l11.8,0l0-27.5 + C457.2,50.2,452.1,42.5,441,42.5 M399,60.9c0,0-4-0.8-6.5-1.3c-2.5-0.5-4-1.8-4-3.9c0-2.5,2.2-4.3,5.3-4.3c4.4,0,6.1,2.2,6.5,4.9 + h10.2c-0.1-6-4.8-13.8-16.5-13.8c-9.4,0-16.3,6.5-16.3,14.3c0,6.1,3.8,11.2,12.2,13l6,1.3c3.4,0.7,4.7,2.3,4.7,4.3 + c0,2.3-2.1,4.3-6,4.3c-4.7,0-7.3-2.7-7.9-5.8l-10.5,0c0.6,6.5,5.3,14.8,18.5,14.8c11.4,0,17.2-7.3,17.2-14.4 + C412,67.9,407.6,62.7,399,60.9 M59.9,0H27.5v24.4h32.3V0z"/> +</g> +</svg> diff --git a/app/assets/javascripts/admin/pure.js b/app/assets/javascripts/admin/pure.js index aa96e4785e2122a1d5a8f8f4f5c96192ec2041f6..ce84c279a86652825ff124a99876d8cf2f5339c1 100644 --- a/app/assets/javascripts/admin/pure.js +++ b/app/assets/javascripts/admin/pure.js @@ -6,6 +6,7 @@ //= require simple_form_bs5_file_input //= require cropperjs/dist/cropper //= require jquery-cropper/dist/jquery-cropper +// TODO remove appstack js //= require appstack/app //= require gdpr/cookie_consent //= require sortablejs/Sortable diff --git a/app/assets/stylesheets/admin/appstack/style.sass b/app/assets/stylesheets/admin/appstack/style.sass index 1dc6a960393144b77ff31327402e27e1b859989c..1853079914fc84a1ba924f0a138c6156b2e110b5 100644 --- a/app/assets/stylesheets/admin/appstack/style.sass +++ b/app/assets/stylesheets/admin/appstack/style.sass @@ -48,7 +48,8 @@ main.content h1 margin-bottom: 30px - +p + color: black .sidebar-nav .fas min-width: 20px @@ -75,6 +76,10 @@ h1 .sidebar-item.active > .sidebar-link color: white +.website__sidebar + .list-group-item.active + color: $primary + #topbar padding-left: $grid-gutter-width padding-right: $grid-gutter-width @@ -113,4 +118,33 @@ h1 padding-bottom: 6px .pure__separation - display: none \ No newline at end of file + display: none + +// Menu item +.kind--selected + * + color: white + +// Photo imports +.photo_import + &__unsplash + border-right: 1px solid rgba(0, 0, 0, 0.3) + +// Bloc datatable +.fake-table + border: 1px solid $border-color + display: table + margin-bottom: 10px + .tr + border-bottom: 1px solid $border-color + .td + min-width: 120px + padding: 10px !important + &:not(:first-child) + border-left: 1px solid $border-color + .tbody + .tr + &:nth-child(even) + background: $table-striped-bg + &:hover + background: $table-hover-bg \ No newline at end of file diff --git a/app/assets/stylesheets/admin/commons/batch-selectable.sass b/app/assets/stylesheets/admin/commons/batch-selectable.sass new file mode 100644 index 0000000000000000000000000000000000000000..d6668a68fdae941bb3f13d8a13bd4a48f065c4b5 --- /dev/null +++ b/app/assets/stylesheets/admin/commons/batch-selectable.sass @@ -0,0 +1,7 @@ +[data-batch-selectable] + [data-batch-selectable-role] + opacity: 0.1 + transition: opacity 0.25s ease + &:hover + [data-batch-selectable-role] + opacity: 1 \ No newline at end of file diff --git a/app/assets/stylesheets/admin/commons/filters.sass b/app/assets/stylesheets/admin/commons/filters.sass new file mode 100644 index 0000000000000000000000000000000000000000..2b94774f13aaa6b9d462d87285c60feb49b586cd --- /dev/null +++ b/app/assets/stylesheets/admin/commons/filters.sass @@ -0,0 +1,10 @@ +.filters + position: relative + &__button + min-width: 100px + position: absolute + right: 0 + top: 0 + &__content + padding-bottom: 30px + padding-right: 200px diff --git a/app/assets/stylesheets/admin/commons/style.sass b/app/assets/stylesheets/admin/commons/style.sass index 6792bc31581b7fba2aee808547acca2856526b8e..7b0183f498222788e2a7192a544a6ca79598f731 100644 --- a/app/assets/stylesheets/admin/commons/style.sass +++ b/app/assets/stylesheets/admin/commons/style.sass @@ -4,4 +4,9 @@ &:last-of-type // Buttons opacity: 1 .handle - cursor: move \ No newline at end of file + cursor: move + +.a11y + &__status + &__icon + vertical-align: sub \ No newline at end of file diff --git a/app/assets/stylesheets/admin/commons/table.sass b/app/assets/stylesheets/admin/commons/table.sass new file mode 100644 index 0000000000000000000000000000000000000000..a9f375aa740f6ac52276f8138bd2d55d9fb276b4 --- /dev/null +++ b/app/assets/stylesheets/admin/commons/table.sass @@ -0,0 +1,8 @@ +.table + th:first-of-type, + td:first-of-type + padding-left: 0 + &--with-actions + td:last-of-type + padding-right: 0 + text-align: right \ No newline at end of file diff --git a/app/assets/stylesheets/admin/commons/treeview.sass b/app/assets/stylesheets/admin/commons/treeview.sass index b683239ec23342067392afe950424531d9a0617f..971a90d4545f53fa4f3c2003d53c324d81e68ef4 100644 --- a/app/assets/stylesheets/admin/commons/treeview.sass +++ b/app/assets/stylesheets/admin/commons/treeview.sass @@ -32,6 +32,11 @@ & > .treeview__children display: none + &--draft + > .treeview__label + > .leaf-title + opacity: 0.5 + &--opened & > .treeview__label & > a .close_btn, diff --git a/app/assets/stylesheets/admin/pure.sass b/app/assets/stylesheets/admin/pure.sass index b7fbeb0d0b706bc0130c63de3045c10b4941ef11..1831b576ee4a42cc26499eddf700b2b982a0470e 100644 --- a/app/assets/stylesheets/admin/pure.sass +++ b/app/assets/stylesheets/admin/pure.sass @@ -12,4 +12,7 @@ @import 'gdpr/cookie_consent' @import '../commons/*' @import 'commons/*' +@import 'pure/blocks' +@import 'pure/buttons' +@import 'pure/navigation' @import 'pure/style' diff --git a/app/assets/stylesheets/admin/pure/blocks.sass b/app/assets/stylesheets/admin/pure/blocks.sass new file mode 100644 index 0000000000000000000000000000000000000000..8b02bcf755010293a9fd6d2d2d2cc2c0e3115090 --- /dev/null +++ b/app/assets/stylesheets/admin/pure/blocks.sass @@ -0,0 +1,8 @@ +.blocks + &__list + &__handle + width: 20px + &__image + width: 150px + &__buttons + width: 170px \ No newline at end of file diff --git a/app/assets/stylesheets/admin/pure/buttons.sass b/app/assets/stylesheets/admin/pure/buttons.sass new file mode 100644 index 0000000000000000000000000000000000000000..150d278fc5e908c73b0326109b6d82cf2bf5c415 --- /dev/null +++ b/app/assets/stylesheets/admin/pure/buttons.sass @@ -0,0 +1,7 @@ +.btn-xs + font-size: 14px + padding: 2px 7px + +.btn-light + background: $color-background + border-color: $color-border diff --git a/app/assets/stylesheets/admin/pure/fonts.sass b/app/assets/stylesheets/admin/pure/fonts.sass index 001a9d14141e30dda057c97e7e284c9dbf26f9b2..d5d812a345cafcd7126b8713aca29774f9b611c8 100644 --- a/app/assets/stylesheets/admin/pure/fonts.sass +++ b/app/assets/stylesheets/admin/pure/fonts.sass @@ -17,11 +17,11 @@ font-family: 'Basier Square' font-style: normal font-weight: 700 - src: asset-url("Basier-Square/basiersquare-bold-webfont.woff2") format("woff2"), url("Basier-Square/basiersquare-bold-webfont.woff") format("woff") + src: asset-url("Basier-Square/basiersquare-semibold-webfont.woff2") format("woff2"), url("Basier-Square/basiersquare-semibold-webfont.woff") format("woff") @font-face font-display: swap font-family: 'Basier Square' font-style: italic font-weight: 700 - src: asset-url("Basier-Square/basiersquare-bolditalic-webfont.woff2") format("woff2"), url("Basier-Square/basiersquare-bolditalic-webfont.woff") format("woff") + src: asset-url("Basier-Square/basiersquare-semibolditalic-webfont.woff2") format("woff2"), url("Basier-Square/basiersquare-semibolditalic-webfont.woff") format("woff") diff --git a/app/assets/stylesheets/admin/pure/navigation.sass b/app/assets/stylesheets/admin/pure/navigation.sass new file mode 100644 index 0000000000000000000000000000000000000000..02cd813268f12a9346ea734208ae563dd1efdd8a --- /dev/null +++ b/app/assets/stylesheets/admin/pure/navigation.sass @@ -0,0 +1,42 @@ +.navbar + left: 0 + padding-top: $spacing2 + position: absolute + right: 0 + .bi + font-size: 26px + vertical-align: middle + .navbar-brand + img + width: 100px + .btn-open + margin-right: -14px +#menu + background: black + bottom: 0 + color: white + left: 0 + overflow-y: scroll + padding-bottom: 30px + position: fixed + right: 0 + top: 0 + z-index: 1000 + .avatar + width: 80px + .menu-content + margin-top: 150px + position: relative + ul + list-style-type: none + padding: 0 + li + padding: 5px 0 + span + opacity: 0.2 + a + color: white + text-decoration-color: rgba(255, 255, 255, 0.2) + text-decoration-line: underline + &:hover + text-decoration-color: rgba(255, 255, 255, 1) diff --git a/app/assets/stylesheets/admin/pure/style.sass b/app/assets/stylesheets/admin/pure/style.sass index a5b981a046dbb371f9aa788cc53db4df64b57489..511469210c475bef716565923075c68cdac9a452 100644 --- a/app/assets/stylesheets/admin/pure/style.sass +++ b/app/assets/stylesheets/admin/pure/style.sass @@ -15,54 +15,22 @@ border-width: 10px margin-bottom: $spacing3 -.navbar - position: absolute - left: 0 - right: 0 - padding-top: $spacing2 - .bi - font-size: 26px - vertical-align: middle - .navbar-brand - img - width: 100px - .btn-open - margin-right: -14px -#menu - position: fixed - top: 0 - left: 0 - right: 0 - bottom: 0 - background: black - color: white - overflow-y: scroll - z-index: 1000 - padding-bottom: 30px - .avatar - width: 80px - .menu-content - position: relative - margin-top: 150px - ul - list-style-type: none - padding: 0 - li - padding: 5px 0 - span - opacity: 0.2 - a - color: white - text-decoration: underline - text-decoration-color: #FFFFFF66 - &:hover - text-decoration-color: #FFFFFFFF +.dashboard-index + .pure__section + .float-end + // No icon in cards + display: none + +.draggable-item + margin-bottom: $spacing1 .hero padding-top: 150px padding-bottom: 30px background-color: $color-background-alt margin-bottom: 30px + @media (min-height: 800px) + padding-top: 250px main min-height: 70vh @@ -101,6 +69,8 @@ a border-color: $color-valid .form-label color: $color-text-alt +p + .form-label + margin-top: $spacing0 .card margin-bottom: $spacing1 @@ -125,16 +95,8 @@ a color: $color-accent font-weight: bold -.btn-xs - font-size: 14px - padding: 2px 7px - -.btn-light - background: $color-background - border-color: $color-border - .commands - background: $color-background-alt + background: $color-commands position: sticky bottom: 0 left: 0 @@ -155,30 +117,21 @@ a &__description font-size: px2rem(14) -.filters - position: absolute - top: 0 - right: 0 - margin-top: 0 !important - -#collapseFilters - padding-top: 0 !important - + br - display: none - .sdfi-deletable-file__preview margin-top: 10px -#collapseFilters - padding-top: 50px - .table input[type=checkbox] margin-right: 10px th color: $color-text-alt + font-size: $form-label-font-size font-weight: normal +.handle + margin-right: 10px + margin-top: 5px + footer min-height: 300px a diff --git a/app/assets/stylesheets/admin/pure/variables.sass b/app/assets/stylesheets/admin/pure/variables.sass index 5fc44d4938c9cbcc059b02a3a82acb35bdd25c31..bcd959e9ea98b566114aeabdef909d7929e94cca 100644 --- a/app/assets/stylesheets/admin/pure/variables.sass +++ b/app/assets/stylesheets/admin/pure/variables.sass @@ -6,6 +6,8 @@ $color-border: rgba(0, 0, 0, 0.1) $color-background-alt: #F2F2F2 $color-background: #FFFFFF +$color-commands: #222222 + $color-valid: #BEDABE // Spacing diff --git a/app/assets/stylesheets/commons/_block.sass b/app/assets/stylesheets/commons/_block.sass index a76ade84fea284a34a7928b7a122a6277b1338b1..29e55c9ea10976aebe3ee455c823843621152f3d 100644 --- a/app/assets/stylesheets/commons/_block.sass +++ b/app/assets/stylesheets/commons/_block.sass @@ -6,25 +6,21 @@ display: none .fake-table - display: table border-collapse: collapse caption-side: bottom - border: 1px solid $border-color + display: table .thead, .tbody display: table-row-group + .tr + .td + padding-bottom: 5px + padding-right: 5px .tr display: table-row - border-bottom: 1px solid $border-color .td display: table-cell min-width: 120px - &:not(:first-child) - border-left: 1px solid $border-color .thead white-space: nowrap - .tbody - .tr - &:nth-child(even) - background: $table-striped-bg - &:hover - background: $table-hover-bg + .btn-danger + margin-left: 5px diff --git a/app/controllers/admin/administration/qualiopi/indicators_controller.rb b/app/controllers/admin/administration/qualiopi/indicators_controller.rb index 4527aec57bd7cea38f575a5fdd93843e158f1749..420e7f41a03b8a9cb33dcda2ba3db1be7009e4a6 100644 --- a/app/controllers/admin/administration/qualiopi/indicators_controller.rb +++ b/app/controllers/admin/administration/qualiopi/indicators_controller.rb @@ -6,6 +6,10 @@ class Admin::Administration::Qualiopi::IndicatorsController < Admin::Administrat end def show + dir = "admin/administration/qualiopi/evaluations/" + file = "#{dir}_criterion_#{@indicator.number}" + file_exists = lookup_context.find_all(file).any? + @partial = "#{dir}criterion_#{@indicator.number}" if file_exists breadcrumb end diff --git a/app/controllers/admin/communication/photo_imports_controller.rb b/app/controllers/admin/communication/photo_imports_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..a98aac1b7cbf3b7d6f47d0cb5a33d72291cae154 --- /dev/null +++ b/app/controllers/admin/communication/photo_imports_controller.rb @@ -0,0 +1,37 @@ +class Admin::Communication::PhotoImportsController < Admin::Communication::ApplicationController + layout false + before_action :prepare + + def unsplash + return if @query.blank? + p = { + query: @query, + page: @page, + per_page: @per_page, + lang: @lang + } + p[:orientation] = params[:orientation] if params.has_key? :orientation + @search = Unsplash::Search.search "/search/photos", Unsplash::Photo, p + @total = @search.total + @total_pages = @search.total_pages + end + + def pexels + return if @query.blank? + @search = Pexels::Client.new.photos.search(@query, page: @page, per_page: @per_page) + @total = @search.total_results + @total_pages = @search.total_pages + end + + protected + + def prepare + @query = "#{params[:query]}" + @page = params[:page].presence || 1 + @per_page = params[:per_page].presence || 12 + @lang = params[:lang].presence || 'en' + @search = [] + @total = 0 + @total_pages = 0 + end +end diff --git a/app/controllers/admin/communication/unsplash_controller.rb b/app/controllers/admin/communication/unsplash_controller.rb deleted file mode 100644 index 964023c35472cc05eea1139e46bc0552738addd9..0000000000000000000000000000000000000000 --- a/app/controllers/admin/communication/unsplash_controller.rb +++ /dev/null @@ -1,22 +0,0 @@ -class Admin::Communication::UnsplashController < Admin::Communication::ApplicationController - layout false - - def index - if params[:query].blank? - @search = [] - @total = 0 - @total_pages = 0 - else - p = { - query: params[:query], - page: (params[:page].presence || 1), - per_page: (params[:per_page].presence || 10), - lang: (params[:lang].presence || 'en') - } - p[:orientation] = params[:orientation] if params.has_key? :orientation - @search = Unsplash::Search.search "/search/photos", Unsplash::Photo, p - @total = @search.total - @total_pages = @search.total_pages - end - end -end diff --git a/app/controllers/admin/communication/websites/categories_controller.rb b/app/controllers/admin/communication/websites/categories_controller.rb index 6f0b27b6e3834c7866bc5398dafe4c45302b4f80..b0fe23ac07eb54a65f5573a31f8433feb8286ea7 100644 --- a/app/controllers/admin/communication/websites/categories_controller.rb +++ b/app/controllers/admin/communication/websites/categories_controller.rb @@ -56,7 +56,7 @@ class Admin::Communication::Websites::CategoriesController < Admin::Communicatio def create @category.website = @website - @category.add_unsplash_image params[:unsplash] + @category.add_photo_import params[:photo_import] if @category.save_and_sync redirect_to admin_communication_website_category_path(@category), notice: t('admin.successfully_created_html', model: @category.to_s) else @@ -66,7 +66,7 @@ class Admin::Communication::Websites::CategoriesController < Admin::Communicatio end def update - @category.add_unsplash_image params[:unsplash] + @category.add_photo_import params[:photo_import] if @category.update_and_sync(category_params) redirect_to admin_communication_website_category_path(@category), notice: t('admin.successfully_updated_html', model: @category.to_s) else diff --git a/app/controllers/admin/communication/websites/pages_controller.rb b/app/controllers/admin/communication/websites/pages_controller.rb index 4c12a6a2b5549534b9cd20dae6ba8c0f1373b816..896913746ee9f9c4a2a9be773026d520b1b2f0ad 100644 --- a/app/controllers/admin/communication/websites/pages_controller.rb +++ b/app/controllers/admin/communication/websites/pages_controller.rb @@ -55,7 +55,7 @@ class Admin::Communication::Websites::PagesController < Admin::Communication::We def create @page.website = @website - @page.add_unsplash_image params[:unsplash] + @page.add_photo_import params[:photo_import] if @page.save_and_sync redirect_to admin_communication_website_page_path(@page), notice: t('admin.successfully_created_html', model: @page.to_s) else @@ -66,7 +66,7 @@ class Admin::Communication::Websites::PagesController < Admin::Communication::We end def update - @page.add_unsplash_image params[:unsplash] + @page.add_photo_import params[:photo_import] if @page.update_and_sync(page_params) redirect_to admin_communication_website_page_path(@page), notice: t('admin.successfully_updated_html', model: @page.to_s) else diff --git a/app/controllers/admin/communication/websites/posts/curations_controller.rb b/app/controllers/admin/communication/websites/posts/curations_controller.rb index 028c45310dfd317acfce08da54362b96dbdb6a8f..98bb804cfcd3a1f2ad685d67e1337c19681ee6d9 100644 --- a/app/controllers/admin/communication/websites/posts/curations_controller.rb +++ b/app/controllers/admin/communication/websites/posts/curations_controller.rb @@ -10,7 +10,8 @@ class Admin::Communication::Websites::Posts::CurationsController < Admin::Commun notice: t('admin.successfully_created_html', model: @curator.post.to_s) else breadcrumb - flash[:alert] = "Erreur lors de la curation" + @url = curation_params[:url] + flash[:alert] = t('curation.error') render :new, status: :unprocessable_entity end end diff --git a/app/controllers/admin/communication/websites/posts_controller.rb b/app/controllers/admin/communication/websites/posts_controller.rb index b9d47807d28410f762ef5ef87330d2f80aabcea5..92fbb46fe980d4f00769d13c9ca4550634fc5681 100644 --- a/app/controllers/admin/communication/websites/posts_controller.rb +++ b/app/controllers/admin/communication/websites/posts_controller.rb @@ -59,7 +59,7 @@ class Admin::Communication::Websites::PostsController < Admin::Communication::We def create @post.website = @website - @post.add_unsplash_image params[:unsplash] + @post.add_photo_import params[:photo_import] if @post.save_and_sync redirect_to admin_communication_website_post_path(@post), notice: t('admin.successfully_created_html', model: @post.to_s) else @@ -69,7 +69,7 @@ class Admin::Communication::Websites::PostsController < Admin::Communication::We end def update - @post.add_unsplash_image params[:unsplash] + @post.add_photo_import params[:photo_import] if @post.update_and_sync(post_params) redirect_to admin_communication_website_post_path(@post), notice: t('admin.successfully_updated_html', model: @post.to_s) else diff --git a/app/controllers/admin/education/programs_controller.rb b/app/controllers/admin/education/programs_controller.rb index b193f6384b3383f30ae4a54e9020931b781fd90e..2aa617c06b74f800626a1b70ad88eb4458502b28 100644 --- a/app/controllers/admin/education/programs_controller.rb +++ b/app/controllers/admin/education/programs_controller.rb @@ -76,7 +76,7 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro def create @program.university = current_university - @program.add_unsplash_image params[:unsplash] + @program.add_photo_import params[:photo_import] if @program.save_and_sync redirect_to [:admin, @program], notice: t('admin.successfully_created_html', model: @program.to_s) else @@ -86,7 +86,7 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro end def update - @program.add_unsplash_image params[:unsplash] + @program.add_photo_import params[:photo_import] if @program.update_and_sync(program_params) redirect_to [:admin, @program], notice: t('admin.successfully_updated_html', model: @program.to_s) else diff --git a/app/controllers/admin/research/journals/volumes_controller.rb b/app/controllers/admin/research/journals/volumes_controller.rb index 34af4361e191c471b94552603c35d26f1ff2022e..654fabf5e3b604648c3b381c4657adffcb2b9b49 100644 --- a/app/controllers/admin/research/journals/volumes_controller.rb +++ b/app/controllers/admin/research/journals/volumes_controller.rb @@ -31,7 +31,7 @@ class Admin::Research::Journals::VolumesController < Admin::Research::Journals:: end def create - @volume.add_unsplash_image params[:unsplash] + @volume.add_photo_import params[:photo_import] @volume.assign_attributes(journal: @journal, university: current_university) if @volume.save_and_sync redirect_to admin_research_journal_volume_path(@volume), notice: t('admin.successfully_created_html', model: @volume.to_s) @@ -42,7 +42,7 @@ class Admin::Research::Journals::VolumesController < Admin::Research::Journals:: end def update - @volume.add_unsplash_image params[:unsplash] + @volume.add_photo_import params[:photo_import] if @volume.update_and_sync(volume_params) redirect_to admin_research_journal_volume_path(@volume), notice: t('admin.successfully_updated_html', model: @volume.to_s) else diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index cde3b0187511206ac396d4e39e9da96863be7768..449763dbc83d21409d17b65e2108001e73f0cae0 100644 --- a/app/helpers/admin/application_helper.rb +++ b/app/helpers/admin/application_helper.rb @@ -61,8 +61,13 @@ module Admin::ApplicationHelper end end - def osuny_label(title) - raw "<label class=\"form-label\">#{title}</label>" + def osuny_label(title, classes: '') + raw "<label class=\"form-label #{classes}\">#{title}</label>" + end + + def if_appstack(string) + return '' if current_admin_theme != 'appstack' + " #{string}" end def duplicate_link(object) @@ -86,8 +91,14 @@ module Admin::ApplicationHelper classes end - def table_classes - 'table table-hover' + def table_classes(with_actions: true) + classes = 'table' + classes += ' table--with-actions' if with_actions + classes + end + + def table_actions_cell + 'text-end pe-0' end def submit(form) diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index 2022004ccb846dcab17e96f812181e45fec206e3..361cbb6b04c8f67256764b3fabdf1d667999e08c 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -43,9 +43,9 @@ class Communication::Website < ApplicationRecord include WithGit include WithGitRepository include WithImport - include WithMenus include WithProgramCategories include WithSpecialPages + include WithMenus # Menus must be created after special pages, so we can fill legal menu include WithStyle include WithTheme diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index 01499c8da5d93e38fb7fd87600ed886ba953d0e4..dcf2c6fd4f5765fde1b497578c0f4b8d8b405a8b 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -107,6 +107,7 @@ class Communication::Website::Page < ApplicationRecord blocks.ordered.each do |block| b = block.duplicate b.about = page + b.position = block.position b.save end page diff --git a/app/models/communication/website/page/accessibility.rb b/app/models/communication/website/page/accessibility.rb index a9819518ef78045d98d64203e9fecb33087f9376..ef0fd58644fee35315173bb0b4054fad8995cf4d 100644 --- a/app/models/communication/website/page/accessibility.rb +++ b/app/models/communication/website/page/accessibility.rb @@ -44,5 +44,9 @@ class Communication::Website::Page::Accessibility < Communication::Website::Page def draftable? false end + + def is_listed_among_children? + false + end end diff --git a/app/models/communication/website/page/legal_term.rb b/app/models/communication/website/page/legal_term.rb index 61ef387ca2740c5c9c48dae2c6d5603b34eabebe..607cf9cf2709beeb9f445d5ffe745076925972b0 100644 --- a/app/models/communication/website/page/legal_term.rb +++ b/app/models/communication/website/page/legal_term.rb @@ -44,5 +44,9 @@ class Communication::Website::Page::LegalTerm < Communication::Website::Page def draftable? false end + + def is_listed_among_children? + false + end end diff --git a/app/models/communication/website/page/privacy_policy.rb b/app/models/communication/website/page/privacy_policy.rb index 4b7d8da2638870a8c1c4fe0f245d251788a243f8..e94f7b8854b23d129df9afc513bf8ee8fb945b4a 100644 --- a/app/models/communication/website/page/privacy_policy.rb +++ b/app/models/communication/website/page/privacy_policy.rb @@ -44,5 +44,9 @@ class Communication::Website::Page::PrivacyPolicy < Communication::Website::Page def draftable? false end + + def is_listed_among_children? + false + end end diff --git a/app/models/communication/website/page/sitemap.rb b/app/models/communication/website/page/sitemap.rb index b1c16f4ec42c1d13b76edba815e297c6f188173b..6da00584bc11275950ea23f0411cae9d3415d1e1 100644 --- a/app/models/communication/website/page/sitemap.rb +++ b/app/models/communication/website/page/sitemap.rb @@ -56,6 +56,10 @@ class Communication::Website::Page::Sitemap < Communication::Website::Page def show_toc? true end + + def is_listed_among_children? + false + end def static_layout 'sitemap' diff --git a/app/models/communication/website/page/with_type.rb b/app/models/communication/website/page/with_type.rb index e8d5829bf2eb690f8179e92edff97b761a59e16c..c465ecd000765298eb3fe26fdbe044371d2e4586 100644 --- a/app/models/communication/website/page/with_type.rb +++ b/app/models/communication/website/page/with_type.rb @@ -54,6 +54,10 @@ module Communication::Website::Page::WithType true end + def is_listed_among_children? + true + end + def editable_width? true end diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index e81056ab8e7f3ef8cb8ed10b115401719048f1db..9d38b4b54887e612bf804d509f2f47fcba52eaff 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -65,7 +65,7 @@ class Communication::Website::Post < ApplicationRecord validates :title, presence: true - before_validation :set_published_at, if: :published_changed? + before_validation :set_published_at after_save_commit :update_authors_statuses!, if: :saved_change_to_author_id? scope :published, -> { @@ -80,7 +80,7 @@ class Communication::Website::Post < ApplicationRecord DATE(communication_website_posts.published_at) > now() ") } - scope :ordered, -> { order(published_at: :desc, created_at: :desc) } + scope :ordered, -> { order(pinned: :desc, published_at: :desc, created_at: :desc) } scope :recent, -> { order(published_at: :desc).limit(5) } scope :for_author, -> (author_id) { where(author_id: author_id) } scope :for_category, -> (category_id) { joins(:categories).where(communication_website_categories: { id: category_id }).distinct } diff --git a/app/models/communication/website/with_menus.rb b/app/models/communication/website/with_menus.rb index d25cf040425b6139407765b2f8f99f0b938637a6..8ed45032fc4cdc2f4c721ab795b723444d17da9e 100644 --- a/app/models/communication/website/with_menus.rb +++ b/app/models/communication/website/with_menus.rb @@ -7,7 +7,7 @@ module Communication::Website::WithMenus foreign_key: :communication_website_id, dependent: :destroy - after_create :initialize_menus + after_save :initialize_menus end def menu_item_kinds @@ -64,15 +64,35 @@ module Communication::Website::WithMenus protected def initialize_menus - create_menu 'primary' - create_menu 'legal' - create_menu 'social' + find_or_create_menu 'primary' + find_or_create_menu 'social' + menu = find_or_create_menu 'legal' + fill_legal_menu menu end - def create_menu(identifier) + def fill_legal_menu(menu) + return if menu.items.any? + [ + Communication::Website::Page::LegalTerm, + Communication::Website::Page::PrivacyPolicy, + Communication::Website::Page::Accessibility, + Communication::Website::Page::Sitemap + ].each do |page_class| + page = special_page(page_class) + menu.items.where( kind: 'page', + about: page, + university: university, + website: self) + .first_or_create do |item| + item.title = page.title + end + end + end + + def find_or_create_menu(identifier) title = Communication::Website::Menu.human_attribute_name(identifier) - menus.create title: title, - identifier: identifier, - university: university + menus.where(identifier: identifier, university: university).first_or_create do |menu| + menu.title = title + end end end diff --git a/app/models/concerns/with_featured_image.rb b/app/models/concerns/with_featured_image.rb index 4543ce6fc1c2b948ba663ed3168e9a9551508f9b..615a2e0ba03810fa32efafddb0585040351a10ad 100644 --- a/app/models/concerns/with_featured_image.rb +++ b/app/models/concerns/with_featured_image.rb @@ -24,8 +24,12 @@ module WithFeaturedImage best_featured_image_source.featured_image_credit end - def add_unsplash_image(id) - return if id.blank? + def add_photo_import(params) + photo_import_unsplash(params['unsplash']) if params['unsplash'].present? + photo_import_pexels(params['pexels']) if params['pexels'].present? + end + + def photo_import_unsplash(id) photo = Unsplash::Photo.find id url = "#{photo['urls']['full']}&w=2048&fit=max" filename = "#{photo['id']}.jpg" @@ -36,4 +40,16 @@ module WithFeaturedImage rescue end end + + def photo_import_pexels(id) + photo = Pexels::Client.new.photos.find id + url = "#{photo.src['original']}?auto=compress&cs=tinysrgb&w=2048" + filename = "#{photo.id}.png" + begin + file = URI.open url + featured_image.attach(io: file, filename: filename) + rescue + byebug + end + end end diff --git a/app/models/concerns/with_inheritance.rb b/app/models/concerns/with_inheritance.rb index 7f7dd625cd2ebe8d9f2f7e7500242fce0f72b047..3b3002479c448757e8f92e421554e9810eea9ce7 100644 --- a/app/models/concerns/with_inheritance.rb +++ b/app/models/concerns/with_inheritance.rb @@ -23,12 +23,13 @@ module WithInheritance def best(property) value = send(property) - value.blank? ? parent&.send("best_#{property}") : value + html = value.nil? ? '' : value.to_html + Static.blank?(html) ? parent&.send("best_#{property}") : value end def best_source(property, is_ancestor: false) value = send(property) - return (is_ancestor ? self : nil) if value.present? + return (is_ancestor ? self : nil) if Static.has_content?(value&.to_html) parent&.send(:best_source, property, is_ancestor: true) end end diff --git a/app/models/education/program.rb b/app/models/education/program.rb index 9eec8676b0ec5d81319b22b27f3d8ec226a917fa..112fdc565d996dbe0a82f7013ce855bd8753a350 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -134,7 +134,7 @@ class Education::Program < ApplicationRecord end def git_path(website) - return unless for_website?(website) + return unless published? && for_website?(website) clean_path = Static.clean_path "#{git_path_content_prefix(website)}programs/#{path}/" "#{clean_path}_index.html" end diff --git a/app/models/university/person.rb b/app/models/university/person.rb index 15d6948192bcf7b41f40e9ad30c10db73ba96d28..7da64b342f8c3d74c2d827d49bb3383b43090cb4 100644 --- a/app/models/university/person.rb +++ b/app/models/university/person.rb @@ -2,42 +2,39 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/administrator.rb b/app/models/university/person/administrator.rb index 8532be880cb943b9417e1be51055c9ce2208e583..bac4deebe718a2416d90e51c40693d7e3c8c8339 100644 --- a/app/models/university/person/administrator.rb +++ b/app/models/university/person/administrator.rb @@ -2,42 +2,39 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/alumnus.rb b/app/models/university/person/alumnus.rb index 729d7b2125dbbefebf2fd15ee9f4b37237d4d22e..cecc421cd2f061798f2cfc03a20c9fa04c20ef6b 100644 --- a/app/models/university/person/alumnus.rb +++ b/app/models/university/person/alumnus.rb @@ -2,42 +2,39 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/author.rb b/app/models/university/person/author.rb index 3a875d33f05df556031caa3d72147c657390fcc8..ce3bad531fb8019ade2136e103b17bdf299d4128 100644 --- a/app/models/university/person/author.rb +++ b/app/models/university/person/author.rb @@ -2,42 +2,39 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/researcher.rb b/app/models/university/person/researcher.rb index 2a36ac0640951b40e287aa14b93a28e985caffe0..aa2415f64931c64dab1857e259cff3b0d4e75ed1 100644 --- a/app/models/university/person/researcher.rb +++ b/app/models/university/person/researcher.rb @@ -2,42 +2,39 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/models/university/person/teacher.rb b/app/models/university/person/teacher.rb index aaf4ac554a2374e8abf196c5bde1f22504106540..66d8f2af271b6524093d1648bd4710861269a039 100644 --- a/app/models/university/person/teacher.rb +++ b/app/models/university/person/teacher.rb @@ -2,42 +2,39 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/app/services/curator.rb b/app/services/curator.rb index 003f5e358edecba93ca5cb82bb1d017347cacb46..e00294534042c9eab0d457130569b7ca4a65b832 100644 --- a/app/services/curator.rb +++ b/app/services/curator.rb @@ -7,6 +7,7 @@ class Curator @url = url create_post! attach_image! unless page.image.blank? + rescue end def valid? diff --git a/app/services/static.rb b/app/services/static.rb index f74f72c2fca26feb70671fd54c06155833bad5f6..7281431d57ab258bc1782add3aee5e80ea4ea13c 100644 --- a/app/services/static.rb +++ b/app/services/static.rb @@ -9,6 +9,16 @@ class Static string end + def self.has_content?(html) + !blank?(html) + end + + def self.blank?(html) + text = ActionController::Base.helpers.strip_tags html + text = text.to_s.strip + text.blank? + end + def self.render(template_static, about, website) code = ApplicationController.render( template: template_static, diff --git a/app/views/admin/administration/qualiopi/evaluations/_list.html.erb b/app/views/admin/administration/qualiopi/evaluations/_list.html.erb index 4a1a84b7826c88e413665b46bd6695ebce23b214..1d15f6796c7018ef9b52e8a7739ca05f3ec01cf6 100644 --- a/app/views/admin/administration/qualiopi/evaluations/_list.html.erb +++ b/app/views/admin/administration/qualiopi/evaluations/_list.html.erb @@ -1,5 +1,5 @@ <div class="table-responsive"> - <table class="<%= table_classes %> mt-5"> + <table class="<%= table_classes(with_actions: false) %> mt-5"> <thead> <tr> <th><%= Education::Program.model_name.human %></th> diff --git a/app/views/admin/administration/qualiopi/indicators/index.html.erb b/app/views/admin/administration/qualiopi/indicators/index.html.erb index 372ca77509d841363a420c9c344c3f55899637c6..c0a5e8bcace3562dec2b61c5332c7fd85cf93a37 100644 --- a/app/views/admin/administration/qualiopi/indicators/index.html.erb +++ b/app/views/admin/administration/qualiopi/indicators/index.html.erb @@ -16,7 +16,7 @@ <td><%= indicator.criterion %></td> <td><%= indicator.number %></td> <td><%= link_to indicator, [:admin, indicator] %></td> - <td class="text-end"> + <td> <%= edit_link indicator %> <%= destroy_link indicator %> </td> diff --git a/app/views/admin/administration/qualiopi/indicators/show.html.erb b/app/views/admin/administration/qualiopi/indicators/show.html.erb index 4a149cb8ededa40a57dedc120040dcbb3bff707d..50ea59e1194e8168bd6054a1e4c6bdbb53d18d2b 100644 --- a/app/views/admin/administration/qualiopi/indicators/show.html.erb +++ b/app/views/admin/administration/qualiopi/indicators/show.html.erb @@ -16,12 +16,4 @@ <% end %> </div> </div> - -<% -partial = "admin/administration/qualiopi/evaluations/criterion_#{@indicator.number}" -# TODO render only if file exists, so we can have errors -%> -<% begin %> -<%= render "admin/administration/qualiopi/evaluations/criterion_#{@indicator.number}" %> -<% rescue %> -<% end %> +<%= render @partial unless @partial.nil? %> diff --git a/app/views/admin/application/_dependencies.html.erb b/app/views/admin/application/_dependencies.html.erb index c732511f88c2fee0eac6cea7dd281de321081d1e..b9aa06804d5bd5bd433980ac994ea4777059d4d9 100644 --- a/app/views/admin/application/_dependencies.html.erb +++ b/app/views/admin/application/_dependencies.html.erb @@ -2,57 +2,54 @@ expanded ||= false %> <% if current_user.server_admin? %> -<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> - <p class="text-muted mb-0">Dépendances</p> - <p class="small text-muted">Visible uniquement pour les server admins</p> - <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> +<i class="fas fa-gear text-muted" + data-bs-toggle="collapse" + data-bs-target="#dependencies" + aria-expanded="<%= expanded %>" + aria-controls="dependencies"></i> +<div id="dependencies" class="collapse"> + <%= osuny_panel 'Dependencies', subtitle: 'Only for server admins' do %> + <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> -</section> + <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> + <% end %> +</div> <% end %> diff --git a/app/views/admin/application/_filters.html.erb b/app/views/admin/application/_filters.html.erb index 9e03627f76e8139581be0b54798c4f250ddf3344..5378f14976bac2f134b718abb4d9ac259dd67477 100644 --- a/app/views/admin/application/_filters.html.erb +++ b/app/views/admin/application/_filters.html.erb @@ -4,9 +4,9 @@ should_be_open = false filters.each { |filter| should_be_open = true if params.has_key?(filter[:scope_name]) } %> -<% if collapsable %> - <div class="text-end filters mt-n5"> - <a class="btn btn-outline-secondary btn-sm" +<div class="filters"> + <% if collapsable %> + <a class="btn btn-outline-secondary btn-sm filters__button" data-bs-toggle="collapse" href="#collapseFilters" role="button" @@ -15,18 +15,16 @@ filters.each { |filter| should_be_open = true if params.has_key?(filter[:scope_n <i class="fas fa-filter"></i> <%= t('filters.buttons.expand') %> </a> - </div> -<% end %> -<div class="mt-4 mb-n3 collapse <%= (!collapsable || should_be_open) ? 'show' : '' %>" id="collapseFilters"> - <%= form_tag current_path, method: :get, class: 'do-not-unlock' do |f| %> - <div class="row"> + <% end %> + <div class="collapse filters__content <%= (!collapsable || should_be_open) ? 'show' : '' %>" id="collapseFilters"> + <%= form_tag current_path, method: :get, class: 'do-not-unlock' do |f| %> <% filters.each do |filter| %> - <div class="col-md-4"> + <div class="filters__content__filter"> <% if filter[:scope_name] == :for_search_term %> <%= text_field_tag filter[:scope_name], params[filter[:scope_name]], placeholder: filter[:label], - class: 'form-control mb-3 filter' %> + class: 'form-control mb-2 filter' %> <% else %> <% if filter[:tree] %> <% choices = collection_tree(filter[:choices]).map { |elmt| [elmt[:label].html_safe, elmt[:id]] } %> @@ -37,16 +35,12 @@ filters.each { |filter| should_be_open = true if params.has_key?(filter[:scope_n <%= select_tag field_name, options_for_select(choices, params[filter[:scope_name]]), include_blank: filter[:label], - class: 'form-select mb-3 filter' %> + class: 'form-select mb-2 filter' %> <% end %> </div> <% end %> - <div class="col-md-4"> - <%= submit_tag t('filters.buttons.submit'), class: 'btn btn-primary btn-submit' %> - <%= link_to t('reset'), current_path, class: 'btn btn-secondary' %> - </div> - </div> - <% end %> -</div> - -<br> + <%= submit_tag t('filters.buttons.submit'), class: 'btn btn-primary btn-submit' %> + <%= link_to t('reset'), current_path, class: 'btn btn-secondary' %> + <% end %> + </div> +</div> \ No newline at end of file diff --git a/app/views/admin/application/a11y/_status.html.erb b/app/views/admin/application/a11y/_status.html.erb index 0f06d6502912431c3dd2c14bcc79eafbddeb5b09..20ae8394f155e52ec7d84c369b01434f13e31765 100644 --- a/app/views/admin/application/a11y/_status.html.erb +++ b/app/views/admin/application/a11y/_status.html.erb @@ -1,4 +1,7 @@ -<p class="m-0"> - <i class="lead fas fa-universal-access <%= about.accessible? ? 'text-success' : 'text-danger'%>"></i> - <%= t "accessibility.status.#{about.accessible?}" %> -</p> +<% +$color = about.accessible? ? 'text-success' : 'text-danger' +%> +<span class="small a11y__status"> + <i class="a11y__status__icon lead fas fa-universal-access <%= $color %>"></i> + <%= t "accessibility.status.#{about.accessible?}" %> +</span> diff --git a/app/views/admin/application/a11y/_widget.html.erb b/app/views/admin/application/a11y/_widget.html.erb index 22fcc065b4d04c41fbe0baa95758acb3e07b1b58..6da09712b7044b74ed0fea3db2e4710d6b8e77aa 100644 --- a/app/views/admin/application/a11y/_widget.html.erb +++ b/app/views/admin/application/a11y/_widget.html.erb @@ -4,17 +4,13 @@ action = "<i class=\"fas fa-universal-access fa-2x float-end #{ color}\"></i>" %> <%= osuny_panel t('accessibility.label'), action: action do %> <% if about.accessibility_errors.any? %> - <h3 class="h5 text-danger"> - <%= t 'accessibility.errors', count: about.accessibility_errors.count %> - </h3> + <%= osuny_label t('accessibility.errors', count: about.accessibility_errors.count), classes: 'text-danger' %> <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> + <%= osuny_label t("#{key}.title"), classes: 'text-danger' %> + <p><%= t "#{key}.text_html" %></p> </li> <% end %> </ol> @@ -22,14 +18,12 @@ action = "<i class=\"fas fa-universal-access fa-2x float-end #{ color}\"></i>" <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> + <%= osuny_label t('accessibility.warnings', count: about.accessibility_warnings.count) %> <ul class="list-unstyled"> <% about.accessibility_warnings.each do |key| %> <li> <hr> - <h3 class="h5"><%= t "#{key}.title" %></h3> + <%= osuny_label t("#{key}.title") %> <p> <%= t "#{key}.text_html" %> </p> diff --git a/app/views/admin/application/featured_image/_edit.html.erb b/app/views/admin/application/featured_image/_edit.html.erb index 9fec944db6df5ae758aa6acd0de3e1ab6c03d885..d06e8ba72065e3fcdcdf4116c398d63daf58f695 100644 --- a/app/views/admin/application/featured_image/_edit.html.erb +++ b/app/views/admin/application/featured_image/_edit.html.erb @@ -16,5 +16,5 @@ input_html: { data: { 'summernote-config' => 'link' } } %> - <%= render 'admin/communication/unsplash/selector', about: about, f:f %> + <%= render 'admin/communication/photo_imports/selector', about: about, f:f %> <% end %> diff --git a/app/views/admin/application/meta_description/_show.html.erb b/app/views/admin/application/meta_description/_show.html.erb index dc73b186085f9a1434760703c2c729ce7ab57f78..d69a0ec4d8a75f8ca6cc54d36c704aa7dc46ee5e 100644 --- a/app/views/admin/application/meta_description/_show.html.erb +++ b/app/views/admin/application/meta_description/_show.html.erb @@ -1,4 +1,4 @@ <%= osuny_panel t('seo') do %> - <h3 class="h5"><%= t('admin.meta_description.label') %></h3> + <%= osuny_label t('admin.meta_description.label') %> <p><%= sanitize about.meta_description %></p> <% end unless about.meta_description.blank? %> diff --git a/app/views/admin/application/property/_summernote_embeds.html.erb b/app/views/admin/application/property/_summernote_embeds.html.erb index 4953d5ce5680f6984f8ce54d898b9e854b5ac8e3..22dac78fd23104c78bc46305abc352641ffac0a9 100644 --- a/app/views/admin/application/property/_summernote_embeds.html.erb +++ b/app/views/admin/application/property/_summernote_embeds.html.erb @@ -1,4 +1,4 @@ -<h3 class="h5"><%= object.class.human_attribute_name(property) %></h3> +<%= osuny_label object.class.human_attribute_name(property) %> <% if object.summernote_embeds.any? %> <% object.summernote_embeds.each do |embed| %> <div class="row mb-3"> diff --git a/app/views/admin/application/property/_text.html.erb b/app/views/admin/application/property/_text.html.erb index 42e023087a32681dcda45950a6ee4e6825d0d63b..9e05d1f266b8618588b8eb6c45059f7a93705b43 100644 --- a/app/views/admin/application/property/_text.html.erb +++ b/app/views/admin/application/property/_text.html.erb @@ -4,18 +4,16 @@ if object.respond_to? "best_#{property}" value = object.public_send("best_#{property}").to_s source = object.public_send("best_#{property}_source") end +title = object.class.human_attribute_name(property) +if source + title += ' <span class="small">' + title += t 'admin.inheritance.sentence_html', link: link_to(source, [:admin, source]) + title += '</span>' +end %> -<h3 class="h5"> - <%= object.class.human_attribute_name(property) %> - <% if source %> - <span class="small text-muted"> - <%= t 'admin.inheritance.sentence_html', - link: link_to(source, [:admin, source]) %> - </span> - <% end %> -</h3> +<%= osuny_label title %> <p> - <% if value.blank? %> + <% if Static.blank?(value) %> <i class="fa fa-exclamation-circle text-danger"></i> <%= t 'properties.text.missing' %> <% else %> diff --git a/app/views/admin/communication/blocks/_list.html.erb b/app/views/admin/communication/blocks/_list.html.erb index 012f773b96d7c8130c3dda13a98fc13e2b0fc5c7..856b5fdc9089a1da4942f664d80d35c5e4149908 100644 --- a/app/views/admin/communication/blocks/_list.html.erb +++ b/app/views/admin/communication/blocks/_list.html.erb @@ -1,6 +1,6 @@ <% action = '' -action += link_to t('add'), +action += link_to t('admin.communication.blocks.add'), new_admin_communication_block_path(about_id: about.id, about_type: about.class.name), class: button_classes if can? :create, Communication::Block %> @@ -12,18 +12,18 @@ action += link_to t('add'), <% about.blocks.ordered.each do |block| %> <tr data-id="<%= block.id %>" class="<%= 'draft' unless block.published? %>"> <% if can? :reorder, Communication::Block %> - <td class="ps-0"><i class="fa fa-bars handle"></i></td> + <td class="ps-0 blocks__list__handle"><i class="fa fa-bars handle"></i></td> <% end %> - <td> + <td class="blocks__list__name"> <%= block.to_s.truncate(50) %><br> <span class="small"><%= block.template_kind_i18n %></span> + <%= render 'admin/application/a11y/status', about: block %> </td> - <td class="p-0"> + <td class="p-0 blocks__list__image"> <%= image_tag "communication/blocks/templates/#{block.template_kind}.jpg", height: "100px", alt: '', style:"max-height: 75px" %> </td> - <td><%= render 'admin/application/a11y/status', about: block %></td> - <td class="text-end pe-0"> + <td class="blocks__list__buttons"> <div class="btn-group"> <%= duplicate_link block %> <%= edit_link block %> @@ -33,6 +33,9 @@ action += link_to t('add'), <% end %> </tbody> </table> + <% if about.blocks.count > 9 %> + <%= raw action %> + <% end %> </div> <% end %> <% end %> diff --git a/app/views/admin/communication/blocks/components/file/_edit.html.erb b/app/views/admin/communication/blocks/components/file/_edit.html.erb index 9b5ddb9c6e59ecba5945637e57f53e7c155106c1..ad296973efa93cf54e6be4fd95c6ecc343d09035 100644 --- a/app/views/admin/communication/blocks/components/file/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/file/_edit.html.erb @@ -17,7 +17,7 @@ remove = t 'admin.communication.blocks.components.file.input.remove' </div> <div v-if="<%= model %>.<%= property %>.id"> <p><b>{{ element.file.filename }}</b></p> - <a class="btn btn-sm btn-danger" + <a class="btn btn-sm text-danger" v-on:click="<%= model %>.<%= property %>={}"> <i class="fas fa-times"></i> <%= remove %> diff --git a/app/views/admin/communication/blocks/components/image/_edit.html.erb b/app/views/admin/communication/blocks/components/image/_edit.html.erb index 2517ab791b6fab11e93a23d363be214c8f772b37..7a48179ec35d0ce7db0351289734be1fdcb09943 100644 --- a/app/views/admin/communication/blocks/components/image/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/image/_edit.html.erb @@ -17,7 +17,7 @@ remove = t 'admin.communication.blocks.components.image.input.remove' <div v-if="<%= model %>.<%= property %>.id"> <img :src="getImageUrl(<%= model %>.<%= property %>)" class="img-fluid mb-3" /> </div> - <a class="btn btn-sm btn-danger" + <a class="btn btn-sm text-danger" v-on:click="<%= model %>.<%= property %>={}" v-if="<%= model %>.<%= property %>.id"> <i class="fas fa-times"></i> diff --git a/app/views/admin/communication/blocks/edit.html.erb b/app/views/admin/communication/blocks/edit.html.erb index e537888e3063a5b7e4515bbdfe133783668f4b68..d57c344baacdba41e8e45f2cabe0122919169d07 100644 --- a/app/views/admin/communication/blocks/edit.html.erb +++ b/app/views/admin/communication/blocks/edit.html.erb @@ -1,4 +1,7 @@ <% content_for :title, @block %> +<% content_for :title_right do %> + <%= t "enums.communication.block.template_kind.#{@block.template_kind}" %> +<% end %> <div id="app" v-cloak> <div class="spinner-border text-primary" role="status"> <span class="sr-only"><%= t 'loading' %></span> diff --git a/app/views/admin/communication/blocks/new.html.erb b/app/views/admin/communication/blocks/new.html.erb index 0676c2d0960096517d7a76612bef496f318d783f..248ef51bbc9bb377162c3d4f863f197c20c280e8 100644 --- a/app/views/admin/communication/blocks/new.html.erb +++ b/app/views/admin/communication/blocks/new.html.erb @@ -14,9 +14,9 @@ %> <% next unless template.allowed_for_about? %> <div class="col-xxl-2 col-lg-3 col-md-4 d-flex"> - <div class="<%= 'card' if current_admin_theme == 'appstack' %> flex-fill position-relative js-validate-form-click"> + <div class="<%= if_appstack 'card' %> flex-fill position-relative js-validate-form-click"> <%= image_tag "communication/blocks/templates/#{kind}.jpg", alt: '', class:"card-img-top block__image" %> - <div class="<%= 'card-body' if current_admin_theme == 'appstack' %>"> + <div class="<%= if_appstack 'card-body' %>"> <h3 class="h4 block__title"><%= t "enums.communication.block.template_kind.#{kind}" %></h4> <p class="mb-0 block__description"> <%= t "admin.communication.blocks.templates.#{kind}.description" %> 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 8536cd91acfdbdded821b40802678761ed59b405..ba5e9f19bba7a030b0b957c60759615011020c57 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 @@ -21,35 +21,33 @@ </div> <h3 class="h4"><%= t '.buttons' %></h3> -<draggable :list="data.elements" handle=".dragHandle" class="list-group"> - <div v-for="(element, index) in data.elements" class="list-group-item"> - <div class="d-flex"> - <div> - <a class="btn ps-0 pt-0 dragHandle"> - <i class="fa fa-bars handle"></i> - </a> - </div> - <div class="flex-fill"> - <div class="row mb-n3"> - <div class="col-lg-3"> - <%= block_component_edit :title, template: @element %> - </div> - <div class="col-lg-4"> - <%= block_component_edit :url, template: @element %> - </div> - <div class="col-lg-4"> - <label class="form-label d-none d-xl-block"> </label> - <%= block_component_edit :target_blank, template: @element %> - </div> - <div class="col-lg-1"> - <a class="btn btn-sm btn-danger float-end" - v-on:click="data.elements.splice(data.elements.indexOf(element), 1)"> - <i class="fas fa-times"></i> - </a> - </div> +<draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> + <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> + <div> + <a class="btn ps-0 pt-0 dragHandle"> + <i class="fa fa-bars handle"></i> + </a> + </div> + <div class="flex-fill"> + <div class="row pure__row--small mb-n3"> + <div class="col-lg-4"> + <%= block_component_edit :title, template: @element %> + </div> + <div class="col-lg-4"> + <%= block_component_edit :url, template: @element %> + </div> + <div class="col-lg-4"> + <label class="form-label d-none d-xl-block"> </label> + <%= block_component_edit :target_blank, template: @element %> </div> </div> </div> + <div class="text-end"> + <a class="btn btn-sm text-danger" + v-on:click="data.elements.splice(data.elements.indexOf(element), 1)"> + <i class="fas fa-times"></i> + </a> + </div> </div> </draggable> <div class="mt-3"> 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 bd17197b00a13b5aba56ee63ecca98b15017d087..23e543361997318a4b97cc6b7082913542870039 100644 --- a/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb @@ -6,9 +6,7 @@ <%= block_component_edit :notes %> </div> <div class="col-xxl-4"> - <label class="form-label"> - <%= t "admin.communication.blocks.templates.chapter.edit.image.label" %> - </label> + <h2 class="h4"><%= t("admin.communication.blocks.templates.chapter.edit.image.label") %></h2> <%= block_component_edit :image %> <%= block_component_edit :alt, label: t('admin.communication.blocks.components.image.alt.label'), 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 4b5d8277cc6f4bafc9c1290c8c0dad86a63d27ea..78408b9bf45f58ed50d11651e127a5591013c287 100644 --- a/app/views/admin/communication/blocks/templates/contact/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/contact/_edit.html.erb @@ -3,8 +3,8 @@ <%= block_component_edit :description %> </div> </div> -<div class="row mb-4"> - <div class="col-md-6 col-xl-4"> +<div class="row pure__row--small mb-4"> + <div class="col-xl-6"> <div class="card"> <div class="card-header d-flex"> <h3 class="h4"><%= t '.contacts' %></h3> @@ -12,7 +12,7 @@ <div class="card-body"> <%= block_component_edit :name %> <%= block_component_edit :address %> - <div class="row"> + <div class="row pure__row--small"> <div class="col-md-4"> <%= block_component_edit :zipcode %> </div> @@ -24,52 +24,46 @@ </div> </div> </div> - <div class="col-md-6 col-xl-8"> - <div class="row"> - <div class="col-xl-6"> - <div class="card"> - <div class="card-header d-flex"> - <h3 class="h4 pt-1 flex-fill"><%= t '.phones.label' %></h3> - <a class="btn bn-sm btn-primary" v-on:click="data.phone_numbers.push('')"> - <%= t('.add') %> + <div class="col-xl-6"> + <div class="card"> + <div class="card-header d-flex"> + <h3 class="h4 pt-1 flex-fill"><%= t '.phones.label' %></h3> + <a class="btn bn-sm btn-primary" v-on:click="data.phone_numbers.push('')"> + <%= t('.add') %> + </a> + </div> + <div class="card-body mb-n2"> + <div v-for="(element, index) in data.phone_numbers"> + <div class="d-flex mb-2"> + <input type="tel" + class="form-control" + placeholder="<%= t '.phones.placeholder' %>" + v-model="data.phone_numbers[index]"> + <a class="btn text-danger" v-on:click="data.phone_numbers.splice(index, 1)"> + <i class="fas fa-times"></i> </a> </div> - <div class="card-body mb-n2"> - <div v-for="(element, index) in data.phone_numbers"> - <div class="d-flex mb-2"> - <input type="tel" - class="form-control" - placeholder="<%= t '.phones.placeholder' %>" - v-model="data.phone_numbers[index]"> - <a class="btn text-danger" v-on:click="data.phone_numbers.splice(index, 1)"> - <i class="fas fa-times"></i> - </a> - </div> - </div> - </div> </div> </div> - <div class="col-xl-6"> - <div class="card"> - <div class="card-header d-flex"> - <h3 class="h4 flex-fill"><%= t '.mails.label' %></h3> - <a class="btn bn-sm btn-primary" v-on:click="data.emails.push('')"> - <%= t('.add') %> + </div> + <div class="card"> + <div class="card-header d-flex"> + <h3 class="h4 flex-fill"><%= t '.mails.label' %></h3> + <a class="btn bn-sm btn-primary" v-on:click="data.emails.push('')"> + <%= t('.add') %> + </a> + </div> + <div class="card-body mb-n2"> + <div v-for="(element, index) in data.emails"> + <div class="d-flex mb-2"> + <input type="email" + class="form-control" + placeholder="<%= t '.mails.placeholder' %>" + v-model="data.emails[index]"> + <a class="btn text-danger" v-on:click="data.emails.splice(index, 1)"> + <i class="fas fa-times"></i> </a> </div> - <div class="card-body mb-n2"> - <div v-for="(element, index) in data.emails"> - <div class="d-flex mb-2"> - <input type="email" - class="form-control" - placeholder="<%= t '.mails.placeholder' %>" - v-model="data.emails[index]"> - <a class="btn text-danger" v-on:click="data.emails.splice(index, 1)"> - <i class="fas fa-times"></i> - </a> - </div> - </div> - </div> </div> </div> </div> @@ -78,33 +72,31 @@ <h3 class="h4"><%= t '.slots' %></h3> <%= block_component_add_element t('.add_slot') %> -<draggable :list="data.elements" handle=".dragHandle" class="list-group"> - <div v-for="(element, index) in data.elements" class="list-group-item"> - <div class="d-flex"> - <div> - <a class="btn ps-0 pt-0 dragHandle"> - <i class="fa fa-bars handle"></i> - </a> - </div> - <div class="flex-fill"> - <div class="row mb-n3"> - <div class="col-xl-4"> - <%= block_component_edit :title, template: @element %> - </div> - <div class="col-xl-4 col-md-6"> - <%= block_component_edit :time_slot_morning, template: @element %> - </div> - <div class="col-xl-4 col-md-6"> - <%= block_component_edit :time_slot_afternoon, template: @element %> - </div> +<draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> + <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> + <div> + <a class="btn ps-0 pt-0 dragHandle"> + <i class="fa fa-bars handle"></i> + </a> + </div> + <div class="flex-fill"> + <div class="row pure__row--small mb-n3"> + <div class="col-xl-4"> + <%= block_component_edit :title, template: @element %> + </div> + <div class="col-xl-4 col-md-6"> + <%= block_component_edit :time_slot_morning, template: @element %> + </div> + <div class="col-xl-4 col-md-6"> + <%= block_component_edit :time_slot_afternoon, template: @element %> </div> </div> - <div> - <a class="btn text-danger position-absolute top-0 end-0" - v-on:click="data.elements.splice(index, 1)"> - <i class="fas fa-times"></i> - </a> - </div> + </div> + <div> + <a class="btn text-danger position-absolute top-0 end-0" + v-on:click="data.elements.splice(index, 1)"> + <i class="fas fa-times"></i> + </a> </div> </div> </draggable> 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 546c3eaa3fb8f86e7253fd23949ec2bfd4a35d14..3656e86ffbeedd89b234d51454e802c17deee1fc 100644 --- a/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb @@ -9,7 +9,7 @@ </div> <div class="table-responsive mb-5"> - <div class="fake-table table"> + <div class="fake-table"> <div class="thead"> <div class="tr"> <div class="td" v-for="(column, index) in data.columns"> @@ -17,21 +17,17 @@ <input type="text" class="form-control" v-model="data.columns[index]"> - <a class="btn btn-danger ms-2" + <a class="btn text-danger" v-on:click="data.columns.splice(index, 1); data.elements.forEach(row => row.cells.splice(index, 1));"> <i class="fas fa-times"></i> </a> </div> </div> - <div class="td text-end"> - <a class="btn btn-primary me-2" + <div class="td"> + <a class="btn btn-primary mt-n1" v-on:click="data.columns.push('')"> <i class="fas fa-plus"></i> colonne </a> - <a class="btn btn-primary" - v-on:click="data.elements.push({cells: []})"> - <i class="fas fa-plus"></i> ligne - </a> </div> </div> </div> @@ -44,12 +40,11 @@ </div> <div class="td" class="text-end"> <div class="d-flex"> - <a class="btn btn-danger" + <a class="btn text-danger" v-on:click="data.elements.splice(index, 1)"> <i class="fas fa-times"></i> </a> - - <a class="btn ms-auto dragHandle"> + <a class="btn dragHandle"> <i class="fa fa-bars handle"></i> </a> </div> @@ -57,6 +52,10 @@ </div> </draggable> </div> + <a class="btn btn-primary" + v-on:click="data.elements.push({cells: []})"> + <i class="fas fa-plus"></i> ligne + </a> </div> <div class="row"> 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 acf892a73e2e6eea8ea5c2fd740d94d23b04d0ad..209859a3f6ffdfeea38d99fd5d555c0fb0dd18ce 100644 --- a/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb @@ -4,37 +4,30 @@ </div> </div> -<%= block_component_add_element t('.add_definition') %> - -<draggable :list="data.elements" handle=".dragHandle"> - <div v-for="(element, index) in data.elements"> - <div class="card"> - <div class="card-body"> - <div class="d-flex"> - <div> - <a class="btn ps-0 pt-0 dragHandle"> - <i class="fa fa-bars handle"></i> - </a> - </div> - <div class="flex-fill"> - <div class="row mb-n3"> - <div class="col-lg-5"> - <%= block_component_edit :title, template: @element %> - </div> - <div class="col-lg-7"> - <%= block_component_edit :description, template: @element %> - </div> - </div> - </div> - <div> - <a class="btn btn-sm btn-danger ms-3" - v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" - title="<%= t '.remove_definition' %>"> - <i class="fas fa-times"></i> - </a> - </div> +<draggable :list="data.elements" handle=".dragHandle" class="mb-3 <%= if_appstack 'list-group' %>"> + <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> + <div> + <a class="btn ps-0 pt-0 dragHandle"> + <i class="fa fa-bars handle"></i> + </a> + </div> + <div class="flex-fill"> + <div class="row pure__row--small mb-n3"> + <div class="col-lg-5"> + <%= block_component_edit :title, template: @element %> + </div> + <div class="col-lg-7"> + <%= block_component_edit :description, template: @element %> </div> </div> </div> + <div> + <a class="btn btn-sm text-danger ms-3" + v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" + title="<%= t '.remove_definition' %>"> + <i class="fas fa-times"></i> + </a> + </div> </div> </draggable> +<%= block_component_add_element t('.add_definition') %> 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 dd7c974b6f0273f86a2a06b7b664548a65164673..918d8db735d04eb8caacb4d4053bfad6f081dee3 100644 --- a/app/views/admin/communication/blocks/templates/files/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_edit.html.erb @@ -14,7 +14,7 @@ <i class="fa fa-bars handle"></i> </a> <div class="float-end"> - <a class="btn btn-sm btn-danger" + <a class="btn btn-sm text-danger" v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" title="<%= t '.remove_file' %>"> <i class="fas fa-times"></i> 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 f3a67262ffd83aa59d8686fd05757949e19c7497..20a8b508ac8c1e5cd25a10cbb5b7c57036977616 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb @@ -6,64 +6,55 @@ <%= block_component_edit :layout %> -<div v-show="data.elements.length > 1"> - <hr class="my-5"> - - <p>Déplacer les images ci-dessous pour les mettre dans l'ordre souhaité</p> - - <draggable :list="data.elements" class="row pure__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"> - <i class="fas fa-arrows-alt"></i> - </div> - <div v-if="element.image.id"> - <img :src="getImageUrl(element.image)" class="img-fluid" /> - </div> +<p>Déplacer les images ci-dessous pour les mettre dans l'ordre souhaité</p> +<draggable :list="data.elements" class="row pure__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"> + <i class="fas fa-arrows-alt"></i> + </div> + <div v-if="element.image.id"> + <img :src="getImageUrl(element.image)" class="img-fluid" /> </div> </div> - </draggable> -</div> + </div> +</draggable> <hr class="my-5"> <p>Envoyer les images et saisir les textes ci-dessous</p> -<div v-for="(element, index) in data.elements"> - <div class="card"> - <div class="card-body"> - <div class="float-end"> - <a class="btn btn-sm btn-danger" - v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" - title="<%= t '.remove_image' %>"> - <i class="fas fa-times"></i> - </a> +<div v-for="(element, index) in data.elements" class="mb-5"> + <%= osuny_panel 'Image' do %> + <div class="text-end"> + <a class="btn btn-sm text-danger mt-n4" + v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" + title="<%= t 'admin.communication.blocks.templates.gallery.edit.remove_image' %>"> + <i class="fas fa-times"></i> + </a> + </div> + <div class="row pure__row--small"> + <div class="col-lg-6"> + <%= block_component_edit :image, + template: @element, + label: t('admin.communication.blocks.components.image.input.label'), + placeholder: t('admin.communication.blocks.components.image.input.placeholder') %> </div> - <div class="flex-fill"> - <div class="row mb-n3"> - <div class="col-lg-6"> - <%= block_component_edit :image, - template: @element, - label: t('admin.communication.blocks.components.image.input.label'), - placeholder: t('admin.communication.blocks.components.image.input.placeholder') %> - </div> - <div class="col-lg-6"> - <%= block_component_edit :alt, - template: @element, - label: t('admin.communication.blocks.components.image.alt.label'), - placeholder: t('admin.communication.blocks.components.image.alt.placeholder') %> - <%= block_component_edit :credit, - template: @element, - label: t('admin.communication.blocks.components.image.credit.label'), - placeholder: t('admin.communication.blocks.components.image.credit.placeholder'), - summernote_config: 'link' %> - <%= block_component_edit :text, - template: @element %> - </div> - </div> + <div class="col-lg-6"> + <%= block_component_edit :alt, + template: @element, + label: t('admin.communication.blocks.components.image.alt.label'), + placeholder: t('admin.communication.blocks.components.image.alt.placeholder') %> + <%= block_component_edit :credit, + template: @element, + label: t('admin.communication.blocks.components.image.credit.label'), + placeholder: t('admin.communication.blocks.components.image.credit.placeholder'), + summernote_config: 'link' %> + <%= block_component_edit :text, + template: @element %> </div> </div> - </div> + <% end %> </div> <%= block_component_add_element t('.add_image') %> 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 d3326874eea26998e8bccb4ec468c811d0855a12..492cf2199e757e9970d327264bfc10d1778037fd 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 @@ -6,38 +6,32 @@ <%= block_component_add_element t('.add_key') %> -<draggable :list="data.elements" handle=".dragHandle"> - <div v-for="(element, index) in data.elements"> - <div class="card"> - <div class="card-body"> - <div class="d-flex"> - <div> - <a class="btn ps-0 pt-0 dragHandle"> - <i class="fa fa-bars handle"></i> - </a> - </div> - <div class="flex-fill"> - <div class="row mb-n3"> - <div class="col-lg-2"> - <%= block_component_edit :number, template: @element %> - </div> - <div class="col-lg-3"> - <%= block_component_edit :unit, template: @element %> - </div> - <div class="col-lg-7"> - <%= block_component_edit :description, template: @element, rows: 1 %> - </div> - </div> - </div> - <div> - <a class="btn btn-sm btn-danger ms-3" - v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" - title="<%= t '.remove_key' %>"> - <i class="fas fa-times"></i> - </a> - </div> +<draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> + <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> + <div> + <a class="btn ps-0 dragHandle"> + <i class="fa fa-bars handle"></i> + </a> + </div> + <div class="flex-fill"> + <div class="row pure__row--small mb-n3"> + <div class="col-lg-2"> + <%= block_component_edit :number, template: @element %> + </div> + <div class="col-lg-3"> + <%= block_component_edit :unit, template: @element %> + </div> + <div class="col-lg-7"> + <%= block_component_edit :description, template: @element, rows: 1 %> </div> </div> </div> + <div> + <a class="btn btn-sm text-danger ms-3" + v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" + title="<%= t '.remove_key' %>"> + <i class="fas fa-times"></i> + </a> + </div> </div> </draggable> 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 5997f3dcebf51be5f0ad6bcfbb8a735cca8b06b7..e4ef15e319252aca51f10bb64abb1768588452bc 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 @@ -10,8 +10,9 @@ </div> </div> -<draggable :list="data.elements" class="list-group mb-3" handle=".dragHandle"> - <div v-for="(element, index) in data.elements" class="list-group-item"> +<%= osuny_label University::Person.model_name.human(count: 2) %> +<draggable :list="data.elements" class="mb-3<%= if_appstack 'list-group' %>" handle=".dragHandle"> + <div v-for="(element, index) in data.elements" class="<%= if_appstack 'list-group-item' %> draggable-item"> <div class="d-flex"> <div> <a class="btn ps-0 pt-0 dragHandle" title="<%= t '.drag_title' %>"> @@ -19,7 +20,7 @@ </a> </div> <div class="flex-fill"> - <div class="row mb-n3"> + <div class="row pure__row--small mb-n3"> <div class="col-md-6"> <%= block_component_edit :id, template: @element, label: '' %> </div> @@ -29,7 +30,7 @@ </div> </div> <div> - <a class="btn btn-sm btn-danger ms-3" + <a class="btn btn-sm text-danger" v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" title="<%= t '.delete_title' %>"> <i class="fas fa-times"></i> 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 115ca7b2936d2fd00a0a329c671781bcf016fd00..5f305eb00677543b3134351492e0020f11ed1835 100644 --- a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb @@ -16,8 +16,8 @@ <div class="mb-4" v-if="data.mode == 'selection'"> <h2 class="h3"><%= t '.selection.title' %></h2> <%= block_component_add_element t('.selection.add') %> - <draggable :list="data.elements" handle=".dragHandle" class="list-group"> - <div v-for="(element, index) in data.elements" class="list-group-item"> + <draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> + <div v-for="(element, index) in data.elements" class="draggable-item <%= if_appstack 'list-group-item' %>"> <div class="d-flex mb-n3"> <div> <a class="btn ps-0 pt-0 dragHandle" title="Drag and drop"> @@ -28,7 +28,7 @@ <%= block_component_edit :id, template: @element %> </div> <div> - <a class="btn btn-sm btn-danger ms-3" + <a class="btn btn-sm text-danger ms-3" v-on:click="data.elements.splice(data.elements.indexOf(page), 1)" title="Supprimer"> <i class="fas fa-times"></i> 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 8decbfa3caaddeebce784f87c7586e08808659a4..f6385d0273d0c831f4c31bc6b76c11211427a998 100644 --- a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_edit.html.erb @@ -8,8 +8,8 @@ <%= block_component_edit :alphabetical %> </div> </div> -<draggable :list="data.elements" class="list-group mb-3" handle=".partnerHandle"> - <div v-for="(element, index) in data.elements" class="list-group-item"> +<draggable :list="data.elements" class="mb-3 <%= if_appstack 'list-group' %>" handle=".partnerHandle"> + <div v-for="(element, index) in data.elements" class="draggable-item <%= if_appstack 'list-group-item' %>"> <div class="d-flex mb-n3"> <div> <a class="btn ps-0 pt-0 partnerHandle"> @@ -18,7 +18,7 @@ </div> <div class="flex-fill"> <%= block_component_edit :id, template: @element, label: '' %> - <div class="row" v-if="!element.id"> + <div class="row pure__row--small mt-n2" v-if="!element.id"> <div class="col-xl-4 col-md-6"> <%= block_component_edit :name, template: @element %> </div> @@ -31,7 +31,7 @@ </div> </div> <div> - <a class="btn btn-sm btn-danger ms-3" + <a class="btn btn-sm text-danger ms-3" v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" title="<%= t '.remove_partner' %>"> <i class="fas fa-times"></i> 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 bfaa46d91ff1aeb8ace74b158f4df59f9d011fdc..471f3108d4188179f02696eb3d67593ad8823049 100644 --- a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb @@ -15,21 +15,19 @@ </div> <div v-if="data.mode === 'selection'"> <%= block_component_add_element t('.add_post') %> - <draggable :list="data.elements" handle=".dragHandle" class="list-group"> - <div v-for="(element, index) in data.elements" class="list-group-item"> - <div class="d-flex"> - <a class="btn ps-0 dragHandle" title="Drag and drop"> - <i class="fa fa-bars handle"></i> - </a> - <div class="flex-fill"> - <%= block_component_edit :id, template: @element %> - </div> - <a class="btn btn-danger ms-3" - v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" - title="Delete"> - <i class="fas fa-times"></i> - </a> + <draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> + <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> + <a class="btn ps-0 dragHandle" title="Drag and drop"> + <i class="fa fa-bars handle"></i> + </a> + <div class="flex-fill"> + <%= block_component_edit :id, template: @element %> </div> + <a class="btn text-danger ms-3" + v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" + title="Delete"> + <i class="fas fa-times"></i> + </a> </div> </draggable> </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 16b83310392d5b0cff88581abfbd659faa7456df..a5103398fe0553988fc0e12f918c1a6ffb596e8e 100644 --- a/app/views/admin/communication/blocks/templates/programs/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/programs/_edit.html.erb @@ -1,30 +1,21 @@ <% pages = collection_tree(@block.university.programs) %> - -<div class="row pure__row--small"> - <div class="col-lg-6"> - <div class="mb-4"> - <%= block_component_add_element t('.add') %> - <draggable :list="data.elements" handle=".dragHandle" class="list-group"> - <div v-for="(element, index) in data.elements" class="list-group-item"> - <div class="d-flex mb-n3"> - <div> - <a class="btn ps-0 pt-0 dragHandle" title="Drag and drop"> - <i class="fa fa-bars handle"></i> - </a> - </div> - <div class="flex-fill"> - <%= block_component_edit :id, template: @element, label: false %> - </div> - <div> - <a class="btn btn-sm btn-danger ms-3" - v-on:click="data.elements.splice(data.elements.indexOf(page), 1)" - title="Supprimer"> - <i class="fas fa-times"></i> - </a> - </div> - </div> - </div> - </draggable> +<draggable :list="data.elements" handle=".dragHandle" class="mb-3 <%= if_appstack 'list-group' %>"> + <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> + <div> + <a class="btn ps-0 pt-0 dragHandle" title="Drag and drop"> + <i class="fa fa-bars handle"></i> + </a> + </div> + <div class="flex-fill mb-n3"> + <%= block_component_edit :id, template: @element, label: false %> + </div> + <div> + <a class="btn btn-sm text-danger ms-3" + v-on:click="data.elements.splice(data.elements.indexOf(page), 1)" + title="Supprimer"> + <i class="fas fa-times"></i> + </a> </div> </div> -</div> +</draggable> +<%= 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 c31511b79de89dc7b42349cd1518639dcafc31d7..b5ab2cbd81b527f6f3799096a96f5135815d9ca6 100644 --- a/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb @@ -1,15 +1,17 @@ +<p class="small"><%= t('.title_disclaimer') %></p> + <%= block_component_add_element t('.add_testimonial') %> -<draggable :list="data.elements" handle=".dragHandle" class="row pure__row--small"> - <div v-for="(element, index) in data.elements" class="list-group-item"> - <div class="d-flex"> +<draggable :list="data.elements" handle=".dragHandle" class="row pure__row--small <%= if_appstack 'list-group' %>"> + <div v-for="(element, index) in data.elements" class="<%= if_appstack 'list-group-item' %>"> + <div class="d-flex mb-5"> <div> <a class="btn ps-0 pt-0 dragHandle"> <i class="fa fa-bars handle"></i> </a> </div> <div class="flex-fill"> - <div class="row mb-n3"> + <div class="row pure__row--small mb-n3"> <div class="col-lg-4"> <%= block_component_edit :text, template: @element %> </div> @@ -23,7 +25,7 @@ </div> </div> <div> - <a class="btn btn-sm btn-danger ms-3" + <a class="btn btn-sm text-danger ms-3" v-on:click="data.elements.splice(data.elements.indexOf(testimonial), 1)" title="<%= t '.remove_testimonial' %>"> <i class="fas fa-times"></i> diff --git a/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb b/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb index 5d3951c2f2ffa95cfb029c03173d7298ed47f93e..c5bbe37d4fe44b18a21db4f7c65cf86d106ea27e 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb @@ -1,31 +1,29 @@ <%= block_component_edit :layout %> <%= block_component_add_element t('.add_event') %> -<draggable :list="data.elements" handle=".dragHandle" class="list-group"> - <div v-for="(element, index) in data.elements" class="list-group-item"> - <div class="d-flex"> - <div> - <a class="btn ps-0 pt-0 dragHandle"> - <i class="fa fa-bars handle"></i> - </a> - </div> - <div class="flex-fill"> - <div class="row mb-n3"> - <div class="col-lg-5"> - <%= block_component_edit :title, template: @element %> - </div> - <div class="col-lg-7"> - <%= block_component_edit :text, template: @element %> - </div> +<draggable :list="data.elements" handle=".dragHandle" class="<%= if_appstack 'list-group' %>"> + <div v-for="(element, index) in data.elements" class="d-flex draggable-item <%= if_appstack 'list-group-item' %>"> + <div> + <a class="btn ps-0 pt-0 dragHandle"> + <i class="fa fa-bars handle"></i> + </a> + </div> + <div class="flex-fill"> + <div class="row pure__row--small mb-n3"> + <div class="col-lg-5"> + <%= block_component_edit :title, template: @element %> + </div> + <div class="col-lg-7"> + <%= block_component_edit :text, template: @element %> </div> </div> - <div> - <a class="btn btn-sm btn-danger ms-3" - v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" - title="<%= t '.remove_event' %>"> - <i class="fas fa-times"></i> - </a> - </div> + </div> + <div> + <a class="btn btn-sm text-danger ms-3" + v-on:click="data.elements.splice(data.elements.indexOf(element), 1)" + title="<%= t '.remove_event' %>"> + <i class="fas fa-times"></i> + </a> </div> </div> </draggable> \ No newline at end of file diff --git a/app/views/admin/communication/photo_imports/_selector.html.erb b/app/views/admin/communication/photo_imports/_selector.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..5672edce072c7237eab9920602036369dda4c882 --- /dev/null +++ b/app/views/admin/communication/photo_imports/_selector.html.erb @@ -0,0 +1,289 @@ +<% +# L'Escale du livre 2022 +search = about.to_s +# communication_website_page +about_identifier = about.class.base_class.to_s.parameterize.underscore +# .communication_website_post_featured_image +about_featured_image_image = ".#{about_identifier}_featured_image" +# #communication_website_page_featured_image_alt +about_featured_image_alt = "##{about_identifier}_featured_image_alt" +# #communication_website_page_featured_image_credit +about_featured_image_credit = "##{about_identifier}_featured_image_credit" +# fr, en... +lang = about&.language&.iso_code if about.respond_to? :language +# /admin/communication/photo_import.json?query=Page%20de%20test&per_page=12&page=1&lang=fr +unsplash_path = admin_communication_unsplash_path(website_id: nil, format: :json) +pexels_path = admin_communication_pexels_path(website_id: nil, format: :json) +%> + +<div id="photo-import-app" v-cloak> + <div class="spinner-border text-primary" role="status"> + <span class="sr-only"><%= t 'loading' %></span> + </div> + <div class="app-content"> + <button type="button" + class="btn btn-secondary btn-sm" + data-bs-toggle="modal" + data-bs-target="#photoImportModal" + > + <%= t 'photo_import.open' %> + </button> + <input type="hidden" + name="photo_import[unsplash]" + v-model="unsplash.selected"> + <input class="form-control string optional" + type="hidden" + name="photo_import[pexels]" + v-model="pexels.selected"> + <div class="modal fade" + id="photoImportModal" + tabindex="-1" + aria-labelledby="Unsplash" + aria-hidden="true"> + <div class="modal-dialog modal-fullscreen modal-dialog-scrollable"> + <div class="modal-content"> + <div class="modal-header"> + <div class="col-auto"> + <h5 class="modal-title"><%= t 'photo_import.title' %></h5> + </div> + <div class="col-auto d-flex flex-fill mx-5"> + <input type="text" + name="search" + placeholder="<%= t 'photo_import.placeholder' %>" + v-model="query" + class="form-control ms-auto"> + <button type="button" + class="btn btn-primary me-auto" + v-on:click="research" + aria-label="<%= t 'photo_import.search' %>"> + <%= t 'photo_import.search' %> + </button> + </div> + <div class="col-auto"> + <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> + </div> + </div> + <div class="modal-body"> + <div class="row"> + <div class="col-md-6"> + <div class="photo_import__unsplash photo_import__unsplash__results row pure__row--small" ref="results"> + <p v-if="unsplash.data.results.length === 0 || !unsplash.data" > + <%= t 'photo_import.nothing' %> + </p> + <div v-for="image in unsplash.data.results" class="col-6 col-lg-4"> + <img :src="image.thumb" + :alt="image.alt" + v-on:click="selectUnsplash(image)" + class="img-fluid img-thumbnail mb-3"> + </div> + </div> + </div> + <div class="col-md-6"> + <div class="photo_import__pexels photo_import__pexels__results row pure__row--small" ref="results"> + <p v-if="pexels.data.results.length === 0 || !pexels.data" > + <%= t 'photo_import.nothing' %> + </p> + <div v-for="image in pexels.data.results" class="col-6 col-lg-4"> + <img :src="image.thumb" + :alt="image.alt" + v-on:click="selectPexels(image)" + class="img-fluid img-thumbnail mb-3"> + </div> + </div> + </div> + </div> + </div> + <div class="modal-footer d-block"> + <div class="row"> + <div class="col-md-6"> + <div class="row photo_import__unsplash photo_import__unsplash__nav"> + <div class="col-lg-5"> + <a href="#" + v-if="unsplash.page > 1" + v-on:click="unsplash.page = unsplash.page - 1" + class="btn btn-light btn-sm"> + <%= t 'photo_import.previous' %> + </a> + </div> + <div class="col-lg-2 text-center"> + <%= image_tag 'communication/photo_imports/unsplash.svg', width: 100, alt: 'Unsplash' %> + </div> + <div class="col-lg-5 text-end"> + <a href="#" v-if="unsplash.page < unsplash.data.total_pages" + v-on:click="unsplash.page = unsplash.page + 1" + class="btn btn-light btn-sm"> + <%= t 'photo_import.next' %> + </a> + </div> + </div> + </div> + <div class="col-md-6"> + <div class="row photo_import__pexels photo_import__pexels__nav"> + <div class="col-lg-5"> + <a href="#" + v-if="pexels.page > 1" + v-on:click="pexels.page = pexels.page - 1" + class="btn btn-light btn-sm"> + <%= t 'photo_import.previous' %> + </a> + </div> + <div class="col-lg-2 text-center"> + <%= image_tag 'communication/photo_imports/pexels.png', width: 100, alt: 'Unsplash' %> + </div> + <div class="col-lg-5 text-end"> + <a href="#" + v-if="pexels.page < pexels.data.total_pages" + v-on:click="pexels.page = pexels.page + 1" + class="btn btn-light btn-sm"> + <%= t 'photo_import.next' %> + </a> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + </div> +</div> + +<%# Include vue.js before call Vue.createApp %> +<%= javascript_include_tag 'vue' %> + +<script> + var app = Vue.createApp({ + data() { + return { + parameters: { + per_page: 12, + lang: '<%= lang %>', + }, + query: '<%= search || "" %>', + unsplash: { + url: '<%= unsplash_path %>', + page: 1, + data: { + results: [], + total: 0 + }, + selected: null + }, + pexels: { + url: '<%= pexels_path %>', + page: 1, + data: { + results: [], + total: 0 + }, + selected: null + }, + targets: { + image: document.querySelector('<%= about_featured_image_image %> img'), + imageContainer: document.querySelector('<%= about_featured_image_image %> .sdfi-deletable-file__preview'), + alt: document.querySelector('<%= about_featured_image_alt %>'), + credit: document.querySelector('<%= about_featured_image_credit %>') + }, + isOpened: false, + isReady: false + } + }, + mounted() { + var modalElement = document.querySelector('#photoImportModal') + this.modal = bootstrap.Modal.getOrCreateInstance(modalElement); + + modalElement.addEventListener('show.bs.modal', function (){ + this.isOpened = true; + this.research() + }.bind(this)); + + modalElement.addEventListener('hide.bs.modal', function() { + this.isOpened = false; + }.bind(this)); + + document.addEventListener("keydown", function(event) { + if (event.key === "Enter" && this.isOpened) { + event.preventDefault(); + event.stopImmediatePropagation(); + this.research(); + } + }.bind(this)); + + this.isReady = true; + }, + watch: { + 'unsplash.page': function(newVal, oldVal) { + this.searchUnsplash(); + }, + 'pexels.page': function(newVal, oldVal) { + this.searchPexels(); + } + }, + methods: { + research() { + this.searchUnsplash(); + this.searchPexels(); + }, + searchUnsplash() { + var url = this.unsplash.url + + '?query=' + this.query + + '&page=' + this.unsplash.page + + '&per_page=' + this.parameters.per_page + + '&lang=' + this.parameters.lang + this.search(url, this.unsplash); + }, + searchPexels() { + var url = this.pexels.url + + '?query=' + this.query + + '&page=' + this.pexels.page + + '&per_page=' + this.parameters.per_page + + '&lang=' + this.parameters.lang + this.search(url, this.pexels); + }, + search(url, source) { + if (!this.query) { + return null; + } + var xmlHttp = new XMLHttpRequest(); + xmlHttp.onreadystatechange = function() { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + source.data = JSON.parse(xmlHttp.responseText); + } + }.bind(this); + xmlHttp.open("GET", url, false); + xmlHttp.send(null); + }, + selectUnsplash(image) { + this.unsplash.selected = image.id; + this.pexels.selected = null; + this.select(image); + }, + selectPexels(image) { + this.unsplash.selected = null; + this.pexels.selected = image.id; + this.select(image); + }, + select(image) { + if (!this.targets.image) { + this.targets.image = document.createElement('img'); + this.targets.image.classList.add('img-fluid', 'img-thumbnail'); + this.targets.image.width = 1000; + this.targets.imageContainer.appendChild(this.targets.image); + } + + this.targets.image.setAttribute('src', image.preview); + this.targets.imageContainer.parentElement.classList.add('sdfi-deletable-file--with-file'); + + $(this.targets.credit).summernote('code', image.credit); + + this.modal.hide(); + } + } + }); + + window.addEventListener('load', function(){ + setTimeout(function() { + app.mount('#photo-import-app'); + }, 1000); + }); +</script> diff --git a/app/views/admin/communication/photo_imports/pexels.json.jbuilder b/app/views/admin/communication/photo_imports/pexels.json.jbuilder new file mode 100644 index 0000000000000000000000000000000000000000..0c00b26f0d77c96eaf4d1505c935c82b0dc6eb73 --- /dev/null +++ b/app/views/admin/communication/photo_imports/pexels.json.jbuilder @@ -0,0 +1,9 @@ +json.total @total +json.total_pages @total_pages +json.results @search.photos do |photo| + json.id photo.id + json.filename "#{photo.id}.png" + json.credit "Photo by <a href=\"#{photo.user.url}\">#{photo.user.name}</a> on <a href=\"https://www.pexels.com\">Pexels</a>" + json.thumb photo.src['large'] + json.preview photo.src['large2x'] +end diff --git a/app/views/admin/communication/photo_imports/unsplash.json.jbuilder b/app/views/admin/communication/photo_imports/unsplash.json.jbuilder new file mode 100644 index 0000000000000000000000000000000000000000..59eeb59df36a37a80c3750cc5a7771d25c886647 --- /dev/null +++ b/app/views/admin/communication/photo_imports/unsplash.json.jbuilder @@ -0,0 +1,10 @@ +json.total @total +json.total_pages @total_pages +json.results @search do |photo| + json.id photo['id'] + json.filename "#{photo['id']}.jpg" + json.alt photo['alt_description'] + json.credit "Photo by <a href=\"https://unsplash.com/@#{ photo['user']['username'] }?utm_source=#{ Unsplash.configuration.utm_source }&utm_medium=referral\"> #{ photo['user']['name'] }</a> on <a href=\"https://unsplash.com/?utm_source=#{ Unsplash.configuration.utm_source }&utm_medium=referral\">Unsplash</a>" + json.thumb photo['urls']['small'] + json.preview photo['urls']['regular'] +end diff --git a/app/views/admin/communication/unsplash/_photo.json.jbuilder b/app/views/admin/communication/unsplash/_photo.json.jbuilder deleted file mode 100644 index 34175cfbd7f1daaedbc030b953bb03b2d294d643..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/unsplash/_photo.json.jbuilder +++ /dev/null @@ -1,6 +0,0 @@ -json.id photo['id'] -json.filename "#{photo['id']}.jpg" -json.alt photo['alt_description'] -json.credit "Photo by <a href=\"https://unsplash.com/@#{ photo['user']['username'] }?utm_source=#{ Unsplash.configuration.utm_source }&utm_medium=referral\"> #{ photo['user']['name'] }</a> on <a href=\"https://unsplash.com/?utm_source=#{ Unsplash.configuration.utm_source }&utm_medium=referral\">Unsplash</a>" -json.thumb photo['urls']['thumb'] -json.preview photo['urls']['regular'] diff --git a/app/views/admin/communication/unsplash/_selector.html.erb b/app/views/admin/communication/unsplash/_selector.html.erb deleted file mode 100644 index 93de143eef4042fe5d188ad450d8f0ddac98c6dd..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/unsplash/_selector.html.erb +++ /dev/null @@ -1,208 +0,0 @@ -<% -# L'Escale du livre 2022 -search = about.to_s -# communication_website_page -about_identifier = about.class.base_class.to_s.parameterize.underscore -# .communication_website_post_featured_image -about_featured_image_image = ".#{about_identifier}_featured_image" -# #communication_website_page_featured_image_alt -about_featured_image_alt = "##{about_identifier}_featured_image_alt" -# #communication_website_page_featured_image_credit -about_featured_image_credit = "##{about_identifier}_featured_image_credit" -# fr, en... -lang = about&.language&.iso_code if about.respond_to? :language -# /admin/communication/unsplash.json?query=Page%20de%20test&per_page=12&page=1&lang=fr -path = admin_communication_unsplash_path(website_id: nil, format: :json) -%> - -<div id="unsplash-app" v-cloak> - <div class="spinner-border text-primary" role="status"> - <span class="sr-only"><%= t 'loading' %></span> - </div> - <div class="app-content"> - <button type="button" - class="btn btn-secondary btn-sm" - data-bs-toggle="modal" - data-bs-target="#unsplashModal" - > - <%= t 'unsplash.open' %> - </button> - <input class="form-control string optional" - type="hidden" - name="unsplash" - v-model="selected.id"> - <div class="modal fade" - id="unsplashModal" - tabindex="-1" - aria-labelledby="Unsplash" - aria-hidden="true"> - <div class="modal-dialog modal-xl modal-dialog-centered modal-dialog-scrollable"> - <div class="modal-content"> - <div class="modal-header"> - <h5 class="modal-title" id="exampleModalLabel"> - <%= t 'unsplash.title' %> - </h5> - <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> - </div> - <div class="modal-body"> - <div class="row mb-3"> - <div class="col-lg-9"> - <input type="text" - name="search" - placeholder="<%= t 'unsplash.placeholder' %>" - v-model="query" - class="form-control"> - </div> - <div class="col-lg-3 d-grid"> - <button type="button" - class="btn btn-primary" - v-on:click="research" - aria-label="<%= t 'unsplash.search' %>"> - <%= t 'unsplash.search' %> - </button> - </div> - </div> - <div class="row" ref="results"> - <p v-if="data.results.length === 0 || !data" > - <%= t 'unsplash.nothing' %> - </p> - <div v-for="image in data.results" class="col-6 col-lg-2"> - <img - :src="image.thumb" - :alt="image.alt" - v-on:click="select(image)" - class="img-fluid img-thumbnail mb-3" - :class="image === selected ? 'bg-secondary' : ''"> - </div> - </div> - <div class="d-flex" - :class="page === 1 ? 'justify-content-end' : 'justify-content-between'"> - <div href="#" - v-if="page > 1" - v-on:click="page = page - 1" - class="btn btn-light btn-sm"><%= t 'unsplash.previous' %></div> - <div href="#" - v-if="page < data.total_pages" - v-on:click="page = page + 1" - class="btn btn-light bt-sm"><%= t 'unsplash.next' %></div> - </div> - </div> - </div> - </div> - </div> - </div> -</div> - -<%# Include vue.js before call Vue.createApp %> -<%= javascript_include_tag 'vue' %> - -<script> - var app = Vue.createApp({ - data() { - return { - selected: {}, - parameters: { - url: '<%= path %>', - per_page: 12, - lang: '<%= lang %>', - }, - query: '<%= search || "" %>', - page: 1, - targets: { - image: '<%= about_featured_image_image %> img', - imageContainer: '<%= about_featured_image_image %> .sdfi-deletable-file__preview', - alt: '<%= about_featured_image_alt %>', - credit: '<%= about_featured_image_credit %>' - }, - data: { - results: [], - total: 0 - }, - isOpened: false, - isReady: false - } - }, - mounted() { - var modalElement = document.querySelector('#unsplashModal') - this.modal = bootstrap.Modal.getOrCreateInstance(modalElement); - - modalElement.addEventListener('show.bs.modal', function (){ - this.isOpened = true; - this.search() - }.bind(this)); - - modalElement.addEventListener('hide.bs.modal', function() { - this.isOpened = false; - }.bind(this)); - - document.addEventListener("keydown", function(event) { - if (event.key === "Enter" && this.isOpened) { - event.preventDefault(); - event.stopImmediatePropagation(); - this.research(); - } - }.bind(this)); - - this.isReady = true; - }, - watch: { - page(value) { - this.search(); - } - }, - methods: { - research() { - this.page = 1; - this.search(); - }, - search() { - if (!this.query) { - return null; - } - - var xmlHttp = new XMLHttpRequest(); - xmlHttp.onreadystatechange = function() { - if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { - this.data = JSON.parse(xmlHttp.responseText); - } - }.bind(this); - - xmlHttp.open( "GET", - this.parameters.url - + '?query=' + this.query - + '&per_page=' + this.parameters.per_page - + '&page=' + this.page - + '&lang=' + this.parameters.lang, - false ); - xmlHttp.send( null ); - }, - select(image) { - var inputImage = document.querySelector(this.targets.image), - inputImageContainer = document.querySelector(this.targets.imageContainer), - inputAlt = document.querySelector(this.targets.alt), - inputCredit = document.querySelector(this.targets.credit); - - this.selected = image; - - if (!inputImage) { - inputImage = document.createElement('img'); - inputImage.classList.add('img-fluid', 'img-thumbnail'); - inputImage.width = 1000; - inputImageContainer.appendChild(inputImage); - } - - inputImage.setAttribute('src', image.preview); - inputImageContainer.parentElement.classList.add('sdfi-deletable-file--with-file'); - - $(inputCredit).summernote('code', image.credit); - this.modal.hide(); - } - } - }); - - window.addEventListener('load', function(){ - setTimeout(function() { - app.mount('#unsplash-app'); - }, 1000); - }); -</script> diff --git a/app/views/admin/communication/unsplash/index.json.jbuilder b/app/views/admin/communication/unsplash/index.json.jbuilder deleted file mode 100644 index b086b20e32d7618a7812cbc37f9fcd5bd0a3f010..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/unsplash/index.json.jbuilder +++ /dev/null @@ -1,5 +0,0 @@ -json.total @total -json.total_pages @total_pages -json.results @search do |photo| - json.partial! 'admin/communication/unsplash/photo', photo: photo -end diff --git a/app/views/admin/communication/websites/_sidebar.html.erb b/app/views/admin/communication/websites/_sidebar.html.erb index 2c170bb7653e10cc31c9d3345220424ffc906ff3..0698c734baf612a77ad9a3b5ef49f1762dc809e9 100644 --- a/app/views/admin/communication/websites/_sidebar.html.erb +++ b/app/views/admin/communication/websites/_sidebar.html.erb @@ -1,55 +1,53 @@ -<div class="row mt-2"> +<div class="row mt-2 website__sidebar"> <div class="col-lg-3 col-xl-2"> - <div class="card"> - <div class="list-group list-group-flush" role="tablist"> - <% - navigation = [ - { - title: Communication::Website.model_name.human, - path: admin_communication_website_path(id: @website, website_id: nil), - icon: Icon::COMMUNICATION_WEBSITE_HOME, - ability: can?(:read, @website) - }, - { - title: Communication::Website::Post.model_name.human(count: 2), - path: admin_communication_website_posts_path(website_id: @website), - icon: Icon::COMMUNICATION_WEBSITE_POST, - ability: can?(:read, Communication::Website::Post) - }, - { - title: t('admin.communication.website.pages.structure'), - path: admin_communication_website_pages_path(website_id: @website), - icon: Icon::COMMUNICATION_WEBSITE_PAGES, - ability: can?(:read, Communication::Website::Page) - }, - { - title: Communication::Website::Menu.model_name.human(count: 2), - path: admin_communication_website_menus_path(website_id: @website), - icon: Icon::COMMUNICATION_WEBSITE_MENUS, - ability: can?(:read, Communication::Website::Category) - } - ] - - navigation << { - title: t('communication.website.analytics'), - path: analytics_admin_communication_website_path(@website.id, website_id: nil), - icon: Icon::COMMUNICATION_WEBSITE_ANALYTICS, + <div class="list-group list-group-flush" role="tablist"> + <% + navigation = [ + { + title: Communication::Website.model_name.human, + path: admin_communication_website_path(id: @website, website_id: nil), + icon: Icon::COMMUNICATION_WEBSITE_HOME, ability: can?(:read, @website) - } if @website.plausible_url.present? + }, + { + title: Communication::Website::Post.model_name.human(count: 2), + path: admin_communication_website_posts_path(website_id: @website), + icon: Icon::COMMUNICATION_WEBSITE_POST, + ability: can?(:read, Communication::Website::Post) + }, + { + title: t('admin.communication.website.pages.structure'), + path: admin_communication_website_pages_path(website_id: @website), + icon: Icon::COMMUNICATION_WEBSITE_PAGES, + ability: can?(:read, Communication::Website::Page) + }, + { + title: Communication::Website::Menu.model_name.human(count: 2), + path: admin_communication_website_menus_path(website_id: @website), + icon: Icon::COMMUNICATION_WEBSITE_MENUS, + ability: can?(:read, Communication::Website::Category) + } + ] + + navigation << { + title: t('communication.website.analytics'), + path: analytics_admin_communication_website_path(@website.id, website_id: nil), + icon: Icon::COMMUNICATION_WEBSITE_ANALYTICS, + ability: can?(:read, @website) + } if @website.plausible_url.present? - navigation.each_with_index do |object, index| - next unless object[:ability] - active = index.zero? ? object[:path] == request.path - : object[:path].in?(request.path) - %> - <a class="list-group-item list-group-item-action<%= ' active' if active %>" href="<%= object[:path] %>"> - <%= object[:title].html_safe %> - <span class="float-end"> - <i class="fas fa-<%= object[:icon] %>"></i> - </span> - </a> - <% end %> - </div> + navigation.each_with_index do |object, index| + next unless object[:ability] + active = index.zero? ? object[:path] == request.path + : object[:path].in?(request.path) + %> + <a class="list-group-item bg-transparent px-0 list-group-item-action<%= ' active' if active %>" href="<%= object[:path] %>"> + <%= object[:title].html_safe %> + <span class="float-end"> + <i class="fas fa-<%= object[:icon] %>"></i> + </span> + </a> + <% end %> </div> </div> <div class="col-lg-9 col-xl-10"> diff --git a/app/views/admin/communication/websites/authors/show.html.erb b/app/views/admin/communication/websites/authors/show.html.erb index acbdfd209ea086819e7fa99e6c5d306c30055eb1..5f3b06837e120e951f992ee2bb8b9fcd8d7f71dd 100644 --- a/app/views/admin/communication/websites/authors/show.html.erb +++ b/app/views/admin/communication/websites/authors/show.html.erb @@ -3,19 +3,12 @@ <%= render 'admin/communication/websites/sidebar' do %> <%= render 'admin/university/people/main_infos', person: @author %> - <% if @posts.total_count > 0 %> - <div class="card"> - <div class="card-header"> - <h5><%= "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %></h5> - </div> + <% if @posts.any? %> + <%= osuny_panel Communication::Website::Post.model_name.human(count: 2), + subtitle: "#{@posts.total_count} #{Communication::Website::Post.model_name.human(count: @posts.total_count).downcase}" do %> <%= render 'admin/communication/websites/posts/list', posts: @posts, hide_author: true %> - <% if @posts.total_pages > 1 %> - <div class="card-footer"> - <%= paginate @posts, theme: 'bootstrap-5' %> - </div> - <% end %> - </div> - + <%= paginate @posts, theme: 'bootstrap-5' if @posts.total_pages > 1 %> + <% end %> <% end %> <% end %> diff --git a/app/views/admin/communication/websites/categories/show.html.erb b/app/views/admin/communication/websites/categories/show.html.erb index dc7cec38208c318ba9ae95e13ad5bac0af38cef8..001de20aeb3bac00bb1a4f3dd9ef15ad0bfce01e 100644 --- a/app/views/admin/communication/websites/categories/show.html.erb +++ b/app/views/admin/communication/websites/categories/show.html.erb @@ -7,51 +7,42 @@ <%= render 'admin/communication/blocks/list', about: @category %> </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::Category.human_attribute_name('slug') %></h3> - <p><%= @category.slug %></p> - <% if @category.parent %> - <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('parent') %></h3> - <p><%= link_to_if can?(:read, @category.parent), - @category.parent, - admin_communication_website_category_path( - website_id: @website.id, - id: @category.parent.id - ) %></p> - <% end %> - <% if @category.children.any? %> - <h3 class="h5"><%= Communication::Website::Category.human_attribute_name('children') %></h3> - <ul class="list-unstyled mb-0"> - <% @category.children.each do |child| %> - <li><%= link_to_if can?(:read, child), - child, - admin_communication_website_category_path( - website_id: @website.id, - id: child.id - ) %></li> - <% end %> - </ul> - <% end %> - </div> - </div> + <%= osuny_panel t('metadata') do %> + <%= osuny_label Communication::Website::Category.human_attribute_name('slug') %> + <p><%= @category.slug %></p> + <% if @category.parent %> + <%= osuny_label Communication::Website::Category.human_attribute_name('parent') %> + <p><%= link_to_if can?(:read, @category.parent), + @category.parent, + admin_communication_website_category_path( + website_id: @website.id, + id: @category.parent.id + ) %></p> + <% end %> + <% if @category.children.any? %> + <%= osuny_label Communication::Website::Category.human_attribute_name('children') %> + <ul class="list-unstyled mb-0"> + <% @category.children.each do |child| %> + <li><%= link_to_if can?(:read, child), + child, + admin_communication_website_category_path( + website_id: @website.id, + id: child.id + ) %></li> + <% end %> + </ul> + <% end %> + <% end %> <%= render 'admin/application/featured_image/show', about: @category %> <%= render 'admin/application/meta_description/show', about: @category %> </div> </div> <% if @posts.total_count > 0 %> - <div class="card"> - <div class="card-header"> - <h5><%= "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %></h5> - </div> + <%= osuny_panel Communication::Website::Post.model_name.human(count: 2), + subtitle: "#{@posts.total_count} #{Communication::Website::Post.model_name.human(count: @posts.total_count).downcase }" do %> <%= render 'admin/communication/websites/posts/list', posts: @posts, hide_category: true %> - <div class="card-footer"> - <%= paginate @posts, theme: 'bootstrap-5' %> - </div> - </div> + <%= paginate @posts, theme: 'bootstrap-5' %> + <% end %> <% end %> <% end %> diff --git a/app/views/admin/communication/websites/menus/_form.html.erb b/app/views/admin/communication/websites/menus/_form.html.erb index c6f81f77858e24cdc91e36b519181624c12db619..f15d5e60ddfeed643318842eb85683896d0055d6 100644 --- a/app/views/admin/communication/websites/menus/_form.html.erb +++ b/app/views/admin/communication/websites/menus/_form.html.erb @@ -4,11 +4,9 @@ <div class="row"> <div class="col-md-8"> - <h2 class="h3"><%= t('content') %></h2> <%= f.input :title %> </div> <div class="col-md-4"> - <h2 class="h3"><%= t('metadata') %></h2> <%= f.input :identifier, input_html: menu.persisted? ? {} : { class: 'js-slug-input', diff --git a/app/views/admin/communication/websites/menus/_list.html.erb b/app/views/admin/communication/websites/menus/_list.html.erb index 28058373ffd712d6b5cdabdbca9ea1ab71133d27..1e162483b622a0f77858a3b6f99ed7dba2f335a8 100644 --- a/app/views/admin/communication/websites/menus/_list.html.erb +++ b/app/views/admin/communication/websites/menus/_list.html.erb @@ -12,7 +12,7 @@ <tr> <td><%= link_to menu, admin_communication_website_menu_path(website_id: menu.website.id, id: menu.id) %></td> <td><%= menu.items.count %></td> - <td class="text-end"> + <td> <div class="btn-group" role="group"> <%= link_to t('edit'), edit_admin_communication_website_menu_path(website_id: menu.website.id, id: menu.id), 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 fd977e794c0002efccc44992949e1f295bc0d0ad..b54a740d557edeeab4cb644cfcec6c27bfefe013 100644 --- a/app/views/admin/communication/websites/menus/items/_form.html.erb +++ b/app/views/admin/communication/websites/menus/items/_form.html.erb @@ -4,76 +4,70 @@ <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> <%= f.input :parent_id, as: :hidden, wrapper: false %> - <h2 class="h3"><%= t('content') %></h2> - <div class="card-body"> - <div class="row pure__row--small"> - <div class="col-lg-6"> - <%= f.input :title %> - </div> - <div class="col-lg-6"> - <div data-kind-if="url"> - <%= f.input :url, as: :string %> - </div> - <div class="<%= 'd-none' unless item.has_about? %> js-about-fields"> - <% - if item.has_about? - if item.kind_page? - about_collection = collection_tree @website.pages - elsif item.kind_diploma? - about_collection = collection @website.education_diplomas - elsif item.kind_program? - about_collection = collection_tree @website.education_programs - elsif item.kind_category? - about_collection = collection_tree @website.categories - elsif item.kind_post? - about_collection = collection @website.posts - elsif item.kind_volume? - about_collection = collection @website.research_volumes - elsif item.kind_paper? - about_collection = collection @website.research_papers - end - else - about_collection = [] - end - %> - <%= f.association :about, - collection: about_collection, - label_method: ->(p) { sanitize p[:label] }, - value_method: ->(p) { p[:id] }, - input_html: { class: 'js-about-id' } %> - <%= f.input :about_type, as: :hidden, input_html: { class: 'js-about-type' } %> + <%= f.input :kind, + as: :hidden, + input_html: { + data: { + url: kind_switch_admin_communication_website_menu_items_path + } + } %> + <div> + <label class="form-label required"> + <%= Communication::Website::Menu::Item.human_attribute_name('kind') %> + <abbr title="required">*</abbr> + </label> + <div class="row pure__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"> + <%= osuny_label t("enums.communication.website.menu.item.kind.#{kind}") %> + <p class="text-end mb-0"> + <i class="<%= Communication::Website::Menu::Item.icon_for(kind) %>"></i><br> + </p> + <a class="stretched-link"></a> + </div> </div> </div> + <% end %> + </div> + </div> + <div class="row pure__row--small"> + <div class="col-lg-6"> + <%= f.input :title %> + </div> + <div class="col-lg-6"> + <div data-kind-if="url"> + <%= f.input :url, as: :string %> </div> - <%= f.input :kind, - as: :hidden, - input_html: { - data: { - url: kind_switch_admin_communication_website_menu_items_path - } - } %> - <div> - <label class="form-label required"> - <%= Communication::Website::Menu::Item.human_attribute_name('kind') %> - <abbr title="required">*</abbr> - </label> - <div class="row pure__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"> - <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> - </div> - </div> - <% end %> - </div> + <div class="<%= 'd-none' unless item.has_about? %> js-about-fields"> + <% + if item.has_about? + if item.kind_page? + about_collection = collection_tree @website.pages + elsif item.kind_diploma? + about_collection = collection @website.education_diplomas + elsif item.kind_program? + about_collection = collection_tree @website.education_programs + elsif item.kind_category? + about_collection = collection_tree @website.categories + elsif item.kind_post? + about_collection = collection @website.posts + elsif item.kind_volume? + about_collection = collection @website.research_volumes + elsif item.kind_paper? + about_collection = collection @website.research_papers + end + else + about_collection = [] + end + %> + <%= f.association :about, + collection: about_collection, + label_method: ->(p) { sanitize p[:label] }, + value_method: ->(p) { p[:id] }, + input_html: { class: 'js-about-id' } %> + <%= f.input :about_type, as: :hidden, input_html: { class: 'js-about-type' } %> </div> </div> </div> diff --git a/app/views/admin/communication/websites/menus/show.html.erb b/app/views/admin/communication/websites/menus/show.html.erb index b504928cbfa47a88a83b140d43af5eadd79a271c..0ac9ed5b1f63d9202130f675512eeb83abb03972 100644 --- a/app/views/admin/communication/websites/menus/show.html.erb +++ b/app/views/admin/communication/websites/menus/show.html.erb @@ -12,10 +12,10 @@ class: button_classes if can?(:create, Communication::Website::Menu::Item) %> </div> <div class="col-md-4"> - <h2 class="h3"><%= t('metadata') %></h2> - <h3 class="h5"><%= Communication::Website::Menu.human_attribute_name('identifier') %></h3> - <p><%= @menu.identifier %></p> - </div> + <%= osuny_panel t('metadata') do %> + <%= osuny_label Communication::Website::Menu.human_attribute_name('identifier') %> + <p><%= @menu.identifier %></p> + <% end %> </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 ddf7c391408e571aca1314dfa7056bbf8d25f52c..c9b287d2e7343350379e648cacb320c9b1d73ff1 100644 --- a/app/views/admin/communication/websites/pages/_form.html.erb +++ b/app/views/admin/communication/websites/pages/_form.html.erb @@ -19,8 +19,7 @@ url = page.new_record? ? admin_communication_website_pages_path </div> <div class="col-md-4"> <% unless page.is_home? %> - <section class="mb-5"> - <h2 class="h3"><%= t('metadata') %></h2> + <%= osuny_panel t('metadata') do %> <%= f.input :published if page.draftable? %> <%= f.input :slug, as: :string, @@ -41,7 +40,7 @@ url = page.new_record? ? admin_communication_website_pages_path 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> + <% end %> <% else %> <% if @website.languages.many? %> <div class="card flex-fill w-100"> diff --git a/app/views/admin/communication/websites/pages/_treebranch.html.erb b/app/views/admin/communication/websites/pages/_treebranch.html.erb index 9af88b3f66416afd0e35138de0cb2a6b20032a82..e9df75c218279b0b40e15c268ab749205fb091fa 100644 --- a/app/views/admin/communication/websites/pages/_treebranch.html.erb +++ b/app/views/admin/communication/websites/pages/_treebranch.html.erb @@ -1,5 +1,5 @@ <% pages.each do |page| %> - <li class="treeview__element js-treeview-element <%= 'treeview__element--empty' unless page.has_children? %>" data-id="<%= page.id %>" data-parent="<%= page.parent_id %>"> + <li class="treeview__element js-treeview-element <%= 'treeview__element--draft' unless page.published %> <%= 'treeview__element--empty' unless page.has_children? %>" data-id="<%= page.id %>" data-parent="<%= page.parent_id %>"> <div class="d-flex align-items-center treeview__label border-bottom p-1"> <%= link_to children_admin_communication_website_page_path(website_id: page.website.id, id: page.id), class: 'js-treeview-openzone d-inline-block p-2 ps-0', style: 'width: 22px', remote: true do %> @@ -14,7 +14,7 @@ <% end %> <%= link_to page, admin_communication_website_page_path(website_id: page.website.id, id: page.id), - class: "#{'draft' unless page.published?}" %> + class: "leaf-title" %> <% unless page.is_home? %> <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span> <% end %> diff --git a/app/views/admin/communication/websites/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb index 4012ee619468d5d6208602881a2817755233cbfb..86cc6372c5d1fb195e60abcec5cd3cd49045e7b4 100644 --- a/app/views/admin/communication/websites/pages/show.html.erb +++ b/app/views/admin/communication/websites/pages/show.html.erb @@ -4,12 +4,6 @@ <div class="row"> <div class="col-md-8"> - <% if @page.is_special_page? %> - <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/summary/show', about: @page %> <%= render 'admin/communication/blocks/list', about: @page %> <%= render 'admin/application/dependencies', diff --git a/app/views/admin/communication/websites/pages/show/_metadata.html.erb b/app/views/admin/communication/websites/pages/show/_metadata.html.erb index f197216a5ec32b0bb41386914a68e58508167ca7..58222d6e909323110ac9f14ef062a30e60c374da 100644 --- a/app/views/admin/communication/websites/pages/show/_metadata.html.erb +++ b/app/views/admin/communication/websites/pages/show/_metadata.html.erb @@ -2,17 +2,21 @@ action = link_to t('open'), @page.url, target: :_blank, class: 'btn btn-light btn-xs' %> <%= osuny_panel t('metadata'), action: action do %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('published') %></h3> + <%= osuny_label Communication::Website::Page.human_attribute_name('published') %> <p><%= t @page.published %></p> + <% if @page.is_special_page? %> + <%= osuny_label Communication::Website::Page.human_attribute_name('special_page') %> + <p><%= t("communication.website.pages.defaults.#{@page.type_key}.title") %></p> + <% end %> <% unless @page.slug.blank? %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('slug') %></h3> + <%= osuny_label Communication::Website::Page.human_attribute_name('slug') %> <p><%= @page.slug %></p> <% end %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('path') %></h3> + <%= osuny_label Communication::Website::Page.human_attribute_name('path') %> <p><%= @page.path %></p> <% if @page.parent %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('parent') %></h3> + <%= osuny_label Communication::Website::Page.human_attribute_name('parent') %> <p><%= link_to_if can?(:read, @page.parent), @page.parent, admin_communication_website_page_path( @@ -23,7 +27,7 @@ action = link_to t('open'), @page.url, target: :_blank, class: 'btn btn-light bt <% end %> <% if can?(:edit, @website) && @page.best_bodyclass %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('bodyclass') %></h3> + <%= osuny_label Communication::Website::Page.human_attribute_name('bodyclass') %> <p> <%= @page.best_bodyclass %> <% if @page.bodyclass.blank? %> @@ -35,13 +39,11 @@ action = link_to t('open'), @page.url, target: :_blank, class: 'btn btn-light bt </p> <% end %> - <% if @page.editable_width? %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('full_width') %></h3> - <p><%= t @page.full_width %></p> - <% end %> + <%= osuny_label Communication::Website::Page.human_attribute_name('full_width') %> + <p><%= t @page.full_width %></p> <% if @page.children.any? %> - <h3 class="h5"><%= Communication::Website::Page.human_attribute_name('children') %></h3> + <%= osuny_label Communication::Website::Page.human_attribute_name('children') %> <ul class="list-unstyled mb-0"> <% @page.children.ordered.each do |child| %> <li> diff --git a/app/views/admin/communication/websites/pages/static.html.erb b/app/views/admin/communication/websites/pages/static.html.erb index e9297aaa5b6d4a3948eb63d95c6d2fed6e4196d6..84092f13b66caa1dddcf1cf8e7d6910d68b2974b 100644 --- a/app/views/admin/communication/websites/pages/static.html.erb +++ b/app/views/admin/communication/websites/pages/static.html.erb @@ -19,7 +19,10 @@ bodyclass: <%= @about.best_bodyclass %> <%= render 'admin/application/featured_image/static' %> <% if @about.children.published.any? %> children: -<% @about.children.published.ordered.each do |child| %> +<% +@about.children.published.ordered.each do |child| + next unless child.is_listed_among_children? +%> - <%= child.path %> <% end %> <% end %> diff --git a/app/views/admin/communication/websites/posts/_form.html.erb b/app/views/admin/communication/websites/posts/_form.html.erb index c53bd9a5876ffb03287a3cad0f0b0b53ff55f285..fbdcea1d787919b561a77bca600387c51d2ac6a2 100644 --- a/app/views/admin/communication/websites/posts/_form.html.erb +++ b/app/views/admin/communication/websites/posts/_form.html.erb @@ -36,7 +36,7 @@ <%= f.input :pinned %> </div> </div> - <%= f.input :published_at, html5: true %> + <%= f.input :published_at, html5: true, as: :date %> <% end %> <% if @website.languages.many? %> <%= f.input :language_id, collection: @website.languages, include_blank: false %> diff --git a/app/views/admin/communication/websites/posts/_list.html.erb b/app/views/admin/communication/websites/posts/_list.html.erb index 7a37bed6ebdb76ef124ba88b3c56044d78a76172..a0d4eaee12affb789ea19e4dda895258f714a9d1 100644 --- a/app/views/admin/communication/websites/posts/_list.html.erb +++ b/app/views/admin/communication/websites/posts/_list.html.erb @@ -22,7 +22,7 @@ </thead> <tbody> <% posts.each do |post| %> - <tr> + <tr <% unless post.published? %>class="draft"<% end %>> <% if selectable %> <td class="ps-0"> <%= check_box_tag "ids[]", post.id, false, data: { batch_selectable_role: "select-single" } %> @@ -31,8 +31,8 @@ <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'), - height: 50 if post.featured_image.attached? && post.featured_image.representable? %></td> + <td class="p-0"><%= image_tag post.featured_image.representation(resize: 'x100'), + height: 50 if post.featured_image.attached? && post.featured_image.representable? %></td> <td> <p class="small mb-0"> <%= l post.published_at, format: :date_with_explicit_month if post.published_at %> @@ -53,7 +53,7 @@ <span class="badge bg-success"><%= Communication::Website::Post.human_attribute_name('pinned') %></span> <% end %> </td> - <td class="text-end"> + <td> <div class="btn-group" role="group"> <%= link_to t('edit'), edit_admin_communication_website_post_path(website_id: post.website.id, id: post.id), diff --git a/app/views/admin/communication/websites/posts/curations/new.html.erb b/app/views/admin/communication/websites/posts/curations/new.html.erb index 4a8e7f5f4e392986432f7e002f1c36dce0125138..8f90ef1ec73c43c413ca14dcc79f6e73b993702b 100644 --- a/app/views/admin/communication/websites/posts/curations/new.html.erb +++ b/app/views/admin/communication/websites/posts/curations/new.html.erb @@ -3,8 +3,9 @@ <%= simple_form_for :curation, url: admin_communication_website_post_curations_path, html: { id: 'new_communication_website_post_curation' } do |f| %> <%= f.error_notification %> <%= f.input :url, - label: 'URL', - value: params.dig(:curation, :url) %> + label: t('curation.label'), + placeholder: t('curation.placeholder'), + input_html: { value: @url } %> <% content_for :action_bar_right do %> <%= submit f %> diff --git a/app/views/admin/communication/websites/posts/index.html.erb b/app/views/admin/communication/websites/posts/index.html.erb index 346aad96228e1b75a2b3ee1a553daa872e9d5544..121bd4a01c1e99be71a9634fec90a94dbcee8d57 100644 --- a/app/views/admin/communication/websites/posts/index.html.erb +++ b/app/views/admin/communication/websites/posts/index.html.erb @@ -6,37 +6,31 @@ <% end %> <%= render 'admin/communication/websites/sidebar' do %> - <%= osuny_panel Communication::Website::Post.model_name.human(count: 2) do %> - <%= render 'filters', current_path: admin_communication_website_posts_path, filters: @filters if @filters.any? %> - <div data-batch-selectable> - <%= form_tag publish_admin_communication_website_posts_path do %> - <%= render 'admin/communication/websites/posts/list', posts: @posts, selectable: true %> - <div> - <% if @posts.total_pages > 1 %> - <div class="float-end mb-3"> - <%= paginate @posts, theme: 'bootstrap-5' %> + <%= render 'filters', current_path: admin_communication_website_posts_path, filters: @filters %> + <div data-batch-selectable class="mb-5"> + <%= form_tag publish_admin_communication_website_posts_path do %> + <%= render 'admin/communication/websites/posts/list', posts: @posts, selectable: true %> + <%= paginate @posts, theme: 'bootstrap-5' %> + <div> + <div data-batch-selectable-role="actions-container"> + <div class="d-flex align-items-center"> + <div class="col-auto me-3"> + <%= t('batch_selectable.title') %> </div> - <% end %> - <div data-batch-selectable-role="actions-container"> - <div class="d-flex align-items-center"> - <div class="col-auto me-3"> - <%= t('batch_selectable.title') %> - </div> - <div class="col-auto me-3"> - <select name="published" class="form-select"> - <option value="false"><%= t('communication.website.posts.unpublished') %></option> - <option value="true"><%= t('communication.website.posts.published') %></option> - </select> - </div> - <div class="col-auto me-3"> - <%= submit_tag t("save"), class: "btn btn-primary" %> - </div> + <div class="col-auto me-3"> + <select name="published" class="form-select"> + <option value="false"><%= t('communication.website.posts.unpublished') %></option> + <option value="true"><%= t('communication.website.posts.published') %></option> + </select> + </div> + <div class="col-auto me-3"> + <%= submit_tag t("save"), class: "btn btn-primary" %> </div> </div> </div> - <% end %> - </div> - <% end %> + </div> + <% end %> + </div> <div class="row"> <% if can?(:create, Communication::Website::Category) || (@root_categories.any? && can?(:edit, @root_categories.first)) %> <div class="col-md-6"> diff --git a/app/views/admin/communication/websites/posts/show.html.erb b/app/views/admin/communication/websites/posts/show.html.erb index 3bb68a4febef181c28c913ad0f90885288560a76..fc2206f9ccc424b2061c25c429f5fa249b273afc 100644 --- a/app/views/admin/communication/websites/posts/show.html.erb +++ b/app/views/admin/communication/websites/posts/show.html.erb @@ -17,7 +17,7 @@ <%= osuny_panel t('metadata'), action: action do %> <div class="row pure__row--small"> <div class="col-6"> - <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('published') %></h3> + <%= osuny_label Communication::Website::Post.human_attribute_name('published') %> <p> <%= t @post.published %><% if @post.published & @post.published_at %>, <%= l @post.published_at.to_date, format: :long if @post.published_at %> @@ -25,23 +25,23 @@ </p> </div> <div class="col-6"> - <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('pinned') %></h3> + <%= osuny_label Communication::Website::Post.human_attribute_name('pinned') %> <p><%= t @post.pinned %></p> </div> </div> <% if @post.author %> - <h3 class="h5"><%= Communication::Website::Post.human_attribute_name('author') %></h3> + <%= osuny_label Communication::Website::Post.human_attribute_name('author') %> <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> + <%= osuny_label Communication::Website::Post.human_attribute_name('categories') %> <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> + <%= osuny_label Communication::Website::Post.human_attribute_name('slug') %> <p><%= @post.slug %></p> <% end %> <%= render 'admin/application/featured_image/show', about: @post %> diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb index 75b8f71708b81ead46eab95b8572a8e2819ba7dd..ccf96fe7257548ea536c91cd57d4849e12631d1b 100644 --- a/app/views/admin/dashboard/index.html.erb +++ b/app/views/admin/dashboard/index.html.erb @@ -17,13 +17,13 @@ Osuny a un nouveau thème pour l'administration, "Pure". <br> Voulez-vous l'essayer ? </p> - <%= link_to 'Changer de thème', admin_set_theme_path(theme: 'pure'), method: :put, class: button_classes %> + <%= link_to 'Changer de thème', admin_set_theme_path(theme: 'pure'), method: :put %> <% else %> <p> Vous utilisez le thème "Pure" pour l'administration. <br> Voulez-vous revenir au thème "Appstack" ? </p> - <%= link_to 'Changer de thème', admin_set_theme_path(theme: 'appstack'), method: :put, class: button_classes %> + <%= link_to 'Changer de thème', admin_set_theme_path(theme: 'appstack'), method: :put %> <% end %> <% end %> </div> diff --git a/app/views/admin/education/cohorts/show.html.erb b/app/views/admin/education/cohorts/show.html.erb index e6597d907d6a6c5a9949f2ee2baffbb584556fa6..dff68265f6e01ff274adb4a8128ff2e579ef473c 100644 --- a/app/views/admin/education/cohorts/show.html.erb +++ b/app/views/admin/education/cohorts/show.html.erb @@ -4,11 +4,11 @@ <div class="col-md-8"> <div class="card flex-fill w-100"> <div class="card-body"> - <h3 class="h5"><%= Education::Cohort.human_attribute_name('school') %></h3> + <%= osuny_label Education::Cohort.human_attribute_name('school') %> <p><%= link_to_if can?(:read, @cohort.school), @cohort.school, [:admin, @cohort.school] %></p> - <h3 class="h5"><%= Education::Cohort.human_attribute_name('program') %></h3> + <%= osuny_label Education::Cohort.human_attribute_name('program') %> <p><%= link_to_if can?(:read, @cohort.program), @cohort.program, [:admin, @cohort.program] %></p> - <h3 class="h5"><%= Education::Cohort.human_attribute_name('year') %></h3> + <%= osuny_label Education::Cohort.human_attribute_name('year') %> <p><%= link_to_if can?(:read, @cohort.academic_year), @cohort.academic_year, [:admin, @cohort.academic_year] %></p> </div> </div> diff --git a/app/views/admin/education/programs/_list.html.erb b/app/views/admin/education/programs/_list.html.erb index 4d511d9355db2f844d1defc2026fafedaa3b7e40..f8aef89853ae5689182ba7f19e10c0c0e4f2d9da 100644 --- a/app/views/admin/education/programs/_list.html.erb +++ b/app/views/admin/education/programs/_list.html.erb @@ -22,11 +22,10 @@ parent = program.parent diploma = program.diploma %> - <tr> + <tr <% unless program.published? %> class="draft"<% end %>> <td><%= link_to_if can?(:read, program), program, - [:admin, program], - class: "#{'draft' unless program.published?}" %></td> + [:admin, program] %></td> <% unless hide_diploma %> <td><%= link_to_if can?(:read, diploma), diploma, [:admin, diploma] if diploma %></td> <% end %> diff --git a/app/views/admin/education/programs/_treebranch.html.erb b/app/views/admin/education/programs/_treebranch.html.erb index 9d34101c0f60ec5a0a9d8f0143f383a14c25d7b8..fa9062d6f734c8b5eea2d112e6f829456ae0b047 100644 --- a/app/views/admin/education/programs/_treebranch.html.erb +++ b/app/views/admin/education/programs/_treebranch.html.erb @@ -1,5 +1,5 @@ <% programs.each do |program| %> - <li class="treeview__element js-treeview-element <%= 'treeview__element--empty' unless program.has_children? %>" data-id="<%= program.id %>" data-parent="<%= program.parent_id %>"> + <li class="treeview__element js-treeview-element <%= 'treeview__element--draft' unless program.published %> <%= 'treeview__element--empty' unless program.has_children? %>" data-id="<%= program.id %>" data-parent="<%= program.parent_id %>"> <div class="d-flex align-items-center treeview__label border-bottom p-1"> <%= link_to children_admin_education_program_path(id: program.id), class: 'js-treeview-openzone d-inline-block p-2 ps-0', style: 'width: 22px', remote: true do %> @@ -14,7 +14,7 @@ <% end %> <%= link_to program, admin_education_program_path(id: program.id), - class: "#{'draft' unless program.published?}" %> + class: 'leaf-title' %> <span class="move_btn py-2 ps-2"><i class="fas fa-sort"></i></span> <%= link_to children_admin_education_program_path(id: program.id), class: 'js-treeview-openzone small ps-2', remote: true do %> diff --git a/app/views/admin/education/programs/show.html.erb b/app/views/admin/education/programs/show.html.erb index 9a06e426584fbcaddb09e86e09a1a5ed10256139..c6926ee2b30901731198fd1d38b6acc7e197ee85 100644 --- a/app/views/admin/education/programs/show.html.erb +++ b/app/views/admin/education/programs/show.html.erb @@ -8,18 +8,12 @@ collapsed: false do %> <div class="row"> <div class="col-lg-6"> - <h3 class="h5"> - <%= Education::Program.human_attribute_name('name') %> - </h3> + <%= osuny_label Education::Program.human_attribute_name('name') %> <p><%= @program.name %></p> - <h3 class="h5 mt-4"> - <%= Education::Program.human_attribute_name('diploma') %> - </h3> + <%= osuny_label Education::Program.human_attribute_name('diploma') %> <p><%= link_to @program.diploma, [:admin, @program.diploma] if @program.diploma %></p> <% if @program.schools.any? %> - <h3 class="h5 mt-4"> - <%= Education::Program.human_attribute_name('schools') %> - </h3> + <%= osuny_label Education::Program.human_attribute_name('schools') %> <ul class="list-unstyled"> <% @program.schools.ordered.each do |school| %> <li><%= link_to_if can?(:read, school), school, [:admin, school] %></li> @@ -28,30 +22,18 @@ <% end %> </div> <div class="col-lg-6"> - <h3 class="h5"> - <%= Education::Program.human_attribute_name('short_name') %> - </h3> + <%= osuny_label Education::Program.human_attribute_name('short_name') %> <p><%= @program.short_name %></p> - <h3 class="h5 mt-4"> - <%= Education::Program.human_attribute_name('capacity') %> - </h3> + <%= osuny_label Education::Program.human_attribute_name('capacity') %> <p><%= @program.capacity %></p> - <h3 class="h5 mt-4"> - <%= Education::Program.human_attribute_name('initial') %> - </h3> + <%= osuny_label Education::Program.human_attribute_name('initial') %> <p><%= t @program.initial %></p> - <h3 class="h5 mt-4"> - <%= Education::Program.human_attribute_name('continuing') %> - </h3> + <%= osuny_label Education::Program.human_attribute_name('continuing') %> <p><%= t @program.continuing %></p> - <h3 class="h5 mt-4"> - <%= Education::Program.human_attribute_name('apprenticeship') %> - </h3> + <%= osuny_label Education::Program.human_attribute_name('apprenticeship') %> <p><%= t @program.apprenticeship %></p> <% if @program.downloadable_summary.attached? %> - <h3 class="h5 mt-4"> - <%= Education::Program.human_attribute_name('downloadable_summary') %> - </h3> + <%= osuny_label Education::Program.human_attribute_name('downloadable_summary') %> <p><%= link_to "#{@program.downloadable_summary.filename} (#{ number_to_human_size @program.downloadable_summary.blob.byte_size })", url_for(@program.downloadable_summary), target: :_blank %></p> @@ -62,10 +44,7 @@ <%= render 'admin/education/programs/forms/part', part: :presentation, collapsed: true do %> <div class="row"> <div class="col-xxl-6"> - <h3 class="h5"> - <%= Education::Program.human_attribute_name('presentation') %> - </h3> - <p><%= @program.presentation %></p> + <%= render 'admin/application/property/text', object: @program, property: :presentation %> </div> <div class="col-xxl-6"> <%= render 'admin/application/property/text', object: @program, property: :objectives %> @@ -108,7 +87,7 @@ <%= render 'admin/application/property/text', object: @program, property: :accessibility %> <%= render 'admin/application/property/text', object: @program, property: :contacts %> <% if @program.registration_url.present? %> - <h3 class="h5"><%= Education::Program.human_attribute_name(:registration_url) %></h3> + <%= osuny_label Education::Program.human_attribute_name(:registration_url) %> <p><%= link_to @program.registration_url, @program.registration_url, target: :_blank %></p> <% end %> </div> @@ -117,24 +96,21 @@ <% end %> <% if @program.children.any? %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= Education::Program.model_name.human(count: 2) %></h5> - </div> + <%= osuny_panel Education::Program.model_name.human(count: 2) do %> <%= render 'admin/education/programs/list', programs: @program.children %> - </div> + <% end %> <% end %> <%= render 'admin/education/programs/show/cohorts' %> </div> <div class="col-lg-4 col-xxl-3"> <%= render 'admin/education/programs/forms/part', part: :technical do %> - <h3 class="h5"><%= Education::Program.human_attribute_name('published') %></h3> + <%= osuny_label Education::Program.human_attribute_name('published') %> <p><%= t @program.published %></p> - <h3 class="h5"><%= Education::Program.human_attribute_name('slug') %></h3> + <%= osuny_label Education::Program.human_attribute_name('slug') %> <p><%= @program.slug %></p> <% if @program.parent %> - <h3 class="h5"><%= Education::Program.human_attribute_name('parent') %></h3> + <%= osuny_label Education::Program.human_attribute_name('parent') %> <p><%= link_to @program.parent, [:admin, @program.parent] %></p> <% end %> <% end %> diff --git a/app/views/admin/education/programs/show/_cohorts.html.erb b/app/views/admin/education/programs/show/_cohorts.html.erb index 2abde6f5b7cd05b43bc30924221fdde89ab0f017..7fe9783c8289984fe9bc3f7778df181c513183b8 100644 --- a/app/views/admin/education/programs/show/_cohorts.html.erb +++ b/app/views/admin/education/programs/show/_cohorts.html.erb @@ -1,12 +1,6 @@ <% if @program.cohorts.any? %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <div class="float-end"> - <%= @program.alumni.count %> - <%= University::Person::Alumnus.model_name.human(count: 2).downcase %> - </div> - <h5 class="card-title mb-0"><%= Education::Cohort.model_name.human(count: 2) %></h5> - </div> + <%= osuny_panel Education::Cohort.model_name.human(count: 2), + subtitle: "#{@program.alumni.count} #{University::Person::Alumnus.model_name.human(count: @program.alumni.count).downcase}" do %> <div class="table-responsive"> <table class="<%= table_classes %>"> <thead> @@ -32,5 +26,5 @@ </tbody> </table> </div> - </div> + <% end %> <% end %> diff --git a/app/views/admin/education/programs/show/_roles.html.erb b/app/views/admin/education/programs/show/_roles.html.erb index 8d78eb47a00d19e084c2e2424681d740dd457a3e..e8e362c4185f6cb04eebdf286d4f231f4a24452b 100644 --- a/app/views/admin/education/programs/show/_roles.html.erb +++ b/app/views/admin/education/programs/show/_roles.html.erb @@ -5,7 +5,7 @@ class: button_classes if can?(:update, University::Role) %> <% end %> </div> -<h3 class="h5 mt-4 mb-3"><%= Education::Program.human_attribute_name('roles') %></h3> +<h4 class="h5 mt-4 mb-3"><%= Education::Program.human_attribute_name('roles') %></h4> <% if @roles.any? %> <div class="table-responsive"> <table class="<%= table_classes %>"> diff --git a/app/views/admin/education/programs/show/_teachers.html.erb b/app/views/admin/education/programs/show/_teachers.html.erb index 9847c86fc3617209144f143d11f0dff62756e250..3ead05e8ff9bab85cf6d61f161530167a59db34c 100644 --- a/app/views/admin/education/programs/show/_teachers.html.erb +++ b/app/views/admin/education/programs/show/_teachers.html.erb @@ -5,7 +5,7 @@ class: button_classes if can?(:update, University::Person::Involvement) %> <% end %> </div> -<h3 class="h5 mt-4 mb-3"><%= Education::Program.human_attribute_name('teachers') %></h3> +<h4 class="h5 mt-4 mb-3"><%= Education::Program.human_attribute_name('teachers') %></h4> <% if @teacher_involvements.any? %> <div class="table-responsive"> <table class="<%= table_classes %>"> diff --git a/app/views/admin/layouts/themes/appstack/_panel.html.erb b/app/views/admin/layouts/themes/appstack/_panel.html.erb index 7fd6e84c2cc23698790e06dfde368ba6b10843b8..f472e7f66163ccf612ed4315aa00b58cbf640e02 100644 --- a/app/views/admin/layouts/themes/appstack/_panel.html.erb +++ b/app/views/admin/layouts/themes/appstack/_panel.html.erb @@ -1,11 +1,14 @@ <div class="card flex-fill"> <% if title %> - <div class="card-header"> - <% if action %> - <div class="float-end"><%= raw action %></div> - <% end %> - <h2 class="card-title mb-0"><%= title %></h2> - </div> + <div class="card-header mb-n4"> + <% if action %> + <div class="float-end"><%= raw action %></div> + <% end %> + <h2 class="card-title mb-0"><%= title %></h2> + <% if subtitle %> + <p class="text-muted"><%= subtitle %></p> + <% end %> + </div> <% end %> <div class="card-body"> <%= yield %> diff --git a/app/views/admin/research/theses/show.html.erb b/app/views/admin/research/theses/show.html.erb index 9ed9ecdedc67e48982d7c7f341fc09858b6a2faa..52ae8eb490b6171c8d0aa369ed54832cdb8d9824 100644 --- a/app/views/admin/research/theses/show.html.erb +++ b/app/views/admin/research/theses/show.html.erb @@ -4,7 +4,7 @@ <div class="col-xl-6"> <%= simple_format @thesis.abstract %> </div> - <div class="col-xl-6"> + <div class="offset-xl-1 col-xl-5"> <% if @thesis.started_at %> <%= osuny_label Research::Thesis.human_attribute_name('started_at') %> <p><%= l @thesis.started_at %></p> diff --git a/app/views/admin/university/people/_list.html.erb b/app/views/admin/university/people/_list.html.erb index 6ea19c82215d9022a484d6381f7b35641a8ef743..2d1dc713de2e66a20a70b206b792a835e0f0f1a3 100644 --- a/app/views/admin/university/people/_list.html.erb +++ b/app/views/admin/university/people/_list.html.erb @@ -25,7 +25,7 @@ <%= kamifusen_tag person.best_picture, width: 40 if person.best_picture.attached? %> </td> - <td class="text-end"> + <td> <div class="btn-group" role="group"> <%= link_to t('edit'), edit_admin_university_person_path(person), diff --git a/app/views/admin/university/people/_main_infos.html.erb b/app/views/admin/university/people/_main_infos.html.erb index 72b3fd55b91e52081ab536397533917283cf6421..477cfae60f5b96433e45674daff4d32113f0d988 100644 --- a/app/views/admin/university/people/_main_infos.html.erb +++ b/app/views/admin/university/people/_main_infos.html.erb @@ -5,27 +5,27 @@ <div class="row pure__row--small"> <% unless person.gender.blank? %> <div class="col-md-6"> - <h3 class="h5"><%= University::Person.human_attribute_name('gender') %></h3> + <%= osuny_label University::Person.human_attribute_name('gender') %> <p><%= t("activerecord.attributes.university/person.genders.#{person.gender}") %></p> </div> <% end %> <% unless person.email.blank? %> <div class="col-md-6"> - <h3 class="h5"><%= University::Person.human_attribute_name('email') %></h3> + <%= osuny_label University::Person.human_attribute_name('email') %> <p><%= link_to person.email, "mailto:#{person.email}", target: '_blank' %></p> </div> <% end %> <% ['phone_mobile', 'phone_personal', 'phone_professional'].each do |phone| %> <% unless person[phone].blank? %> <div class="col-md-6"> - <h3 class="h5"><%= University::Person.human_attribute_name(phone) %></h3> + <%= osuny_label University::Person.human_attribute_name(phone) %> <p><%= link_to person[phone], "tel:#{person[phone]}", target: '_blank' %></p> </div> <% end %> <% end %> <% unless person.birthdate.blank? %> <div class="col-md-6"> - <h3 class="h5"><%= University::Person.human_attribute_name('birthdate') %></h3> + <%= osuny_label University::Person.human_attribute_name('birthdate') %> <p><%= l(person.birthdate, format: :birthday) %></p> </div> <% end %> @@ -33,32 +33,32 @@ <% value = person.send property %> <% next if value.blank? %> <div class="col-md-6"> - <h3 class="h5"><%= University::Person.human_attribute_name(property) %></h3> + <%= osuny_label University::Person.human_attribute_name(property) %> <p><%= value %></p> </div> <% end %> </div> <% unless person.biography.blank? %> - <h3 class="h5"><%= University::Person.human_attribute_name('biography') %></h3> + <%= osuny_label University::Person.human_attribute_name('biography') %> <%= person.biography %> <% end %> <% end %> <%= osuny_panel University::Person.human_attribute_name('socials') do %> <% unless person.url.blank? %> - <h3 class="h5"><%= University::Person.human_attribute_name('url') %></h3> + <%= osuny_label University::Person.human_attribute_name('url') %> <p><%= link_to person.url, person.url, target: '_blank' %></p> <% end %> <% unless person.linkedin.blank? %> - <h3 class="h5"><%= University::Person.human_attribute_name('linkedin') %></h3> + <%= osuny_label University::Person.human_attribute_name('linkedin') %> <p><%= link_to person.linkedin, person.linkedin, target: '_blank' %></p> <% end %> <% unless person.twitter.blank? %> - <h3 class="h5"><%= University::Person.human_attribute_name('twitter') %></h3> + <%= osuny_label University::Person.human_attribute_name('twitter') %> <p><%= link_to person.twitter, "https://twitter.com/#{person.twitter}", target: '_blank' %></p> <% end %> <% unless person.mastodon.blank? %> - <h3 class="h5"><%= University::Person.human_attribute_name('mastodon') %></h3> + <%= osuny_label University::Person.human_attribute_name('mastodon') %> <p><%= link_to person.mastodon, person.mastodon, target: '_blank' %></p> <% end %> <% end unless person.url.blank? && person.linkedin.blank? && person.twitter.blank? %> @@ -67,10 +67,10 @@ </div> <div class="col-md-4 col-xl-3"> <%= osuny_panel t('metadata') do %> - <h3 class="h5"><%= University::Person.human_attribute_name('slug') %></h3> + <%= osuny_label University::Person.human_attribute_name('slug') %> <p><%= person.slug %></p> <% if person.user.present? %> - <h3 class="h5"><%= University::Person.human_attribute_name('user') %></h3> + <%= osuny_label University::Person.human_attribute_name('user') %> <p><%= link_to_if can?(:read, person.user), person.user, admin_user_path(person.user) %></p> <% end %> <% end %> diff --git a/app/views/api/dashboard/index.html.erb b/app/views/api/dashboard/index.html.erb index 07de5eec15e34aac846bfce0bf61bc601336ef90..b7731499703bb51b791f2f76644488d760a55707 100644 --- a/app/views/api/dashboard/index.html.erb +++ b/app/views/api/dashboard/index.html.erb @@ -1,10 +1,17 @@ <% content_for :title, 'API' %> <h2>Lhéo</h2> -<p> - Lhéo est un <a href="http://lheo.gouv.fr/" target="_blank" rel=" - "> - Langage Harmonisé d'Échange d'informations sur l'Offre de formation. - </a>. L'API Osuny Lhéo met à disposition toute l'offre de formation à ce format. -</p> -<%= link_to 'Accéder à l\'API Lhéo', api_lheo_path, class: 'btn btn-primary' %> + +<div class="row"> + <div class="col-lg-6"> + <p> + Lhéo est un <a href="http://lheo.gouv.fr/" target="_blank" rel=" + "> + Langage Harmonisé d'Échange d'informations sur l'Offre de formation. + </a>. L'API Osuny Lhéo met à disposition toute l'offre de formation à ce format. + </p> + </div> + <div class="col-lg-6"> + <%= link_to 'Accéder à l\'API Lhéo', api_lheo_path, class: 'btn btn-primary' %> + </div> +</div> diff --git a/app/views/api/layouts/application.html.erb b/app/views/api/layouts/application.html.erb index 531f1f8a12047cfad3f61466dde7bdb6445ef5ce..29a6ebea36ce213ade8cdce3702a2260918f7191 100644 --- a/app/views/api/layouts/application.html.erb +++ b/app/views/api/layouts/application.html.erb @@ -6,20 +6,20 @@ <title><%= yield :title %></title> <%= csrf_meta_tags %> <%= csp_meta_tag %> - <%= stylesheet_link_tag 'admin', media: 'all' %> - <%= javascript_include_tag 'admin' %> + <%= stylesheet_link_tag 'admin/pure', media: 'all' %> + <%= javascript_include_tag 'admin/pure' %> <%= favicon_link_tag 'favicon.png' %> </head> - <body class="<%= body_classes %>"> - <nav class="navbar navbar-light"> + <body> + <nav class="navbar navbar-expand position-relative"> <div class="container"> - <a class="navbar-brand" href="<%= api_root_path %>"> + <a class="navbar-brand mx-auto" href="<%= api_root_path %>"> <%= render 'logo' %> </a> </div> </nav> <main class="container mt-5"> - <h1><%= yield :title %></h1> + <h1 class="my-5"><%= yield :title %></h1> <%= yield %> </main> <%= render 'footer' %> diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb index e0413b71336486fe6995d1d72964d5d76ac90902..4d24f697b37fe29ea7ccd2093991c164fe8024f1 100644 --- a/app/views/devise/confirmations/new.html.erb +++ b/app/views/devise/confirmations/new.html.erb @@ -1,3 +1,5 @@ +<%= content_for :title, t('.title') %> + <h2 class="mb-4"><%= t(".resend_confirmation_instructions") %></h2> <%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index 91f5153e65816179e16167dec28509c9e454ea48..44071e8c97b72162ef84bcad2adf7a1747786742 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -1,3 +1,5 @@ +<%= content_for :title, t('.title') %> + <h2 class="mb-4"><%= t(".change_your_password") %></h2> <%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index 6a26084622965182e80d70984d75e9f2f531888b..0a10d6323f73c72f68ab680e2768f1cf252f53d2 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,3 +1,5 @@ +<%= content_for :title, t('.title') %> + <h2 class="mb-4"><%= t(".forgot_your_password") %></h2> <%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index a8502cf959b6585ea1038e36c51dc674ba8b722a..34db524df5ac26e9ec94e93f7afb440ab5d695eb 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,3 +1,5 @@ +<%= content_for :title, t('.title') %> + <h2 class="mb-4"><%= t(".sign_up") %></h2> <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 6e3fe9e20108bda7e7cc596b8689b347432e4b2f..b88f05d8d82afd9f702a3aba0aa3a9905bc6b719 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,3 +1,5 @@ +<%= content_for :title, t('.title') %> + <div class="row"> <div class="col-md-6 mb-5"> <h2 class="mb-4"><%= t('login.already_registered') %></h2> diff --git a/app/views/devise/two_factor_authentication/max_login_attempts_reached.html.erb b/app/views/devise/two_factor_authentication/max_login_attempts_reached.html.erb index b0e613863d58d910f854e42d60740a45d499624b..5e94595182dc71f67aa2a3c12d1f7af64138bfdb 100644 --- a/app/views/devise/two_factor_authentication/max_login_attempts_reached.html.erb +++ b/app/views/devise/two_factor_authentication/max_login_attempts_reached.html.erb @@ -1,3 +1,5 @@ +<%= content_for :title, t('.title') %> + <div class="alert alert-danger" role="alert"> <%= t('devise.two_factor_authentication.max_login_attempts_reached').html_safe %> </div> diff --git a/app/views/devise/two_factor_authentication/show.html.erb b/app/views/devise/two_factor_authentication/show.html.erb index 5a9fca5a6ce8c5a726a0b1a33829551479098c16..964870ab3d7a2c78b0fa0198938d3c72bffb8b79 100644 --- a/app/views/devise/two_factor_authentication/show.html.erb +++ b/app/views/devise/two_factor_authentication/show.html.erb @@ -1,3 +1,5 @@ +<%= content_for :title, t('.title') %> + <h4> <% if resource.direct_otp %> <% if resource.direct_otp_delivery_method == 'mobile_phone' %> diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb index 75388e5567465268245d7e92411b5564b943bca2..1035f065a148a66bc1b078263df78dab75fbbac2 100644 --- a/app/views/devise/unlocks/new.html.erb +++ b/app/views/devise/unlocks/new.html.erb @@ -1,3 +1,5 @@ +<%= content_for :title, t('.title') %> + <h2 class="mb-4"><%= t(".resend_unlock_instructions") %></h2> <%= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> diff --git a/app/views/server/universities/_form.html.erb b/app/views/server/universities/_form.html.erb index 90b60f85f0dd4c8f8f7038c24d3e5ed3062a1732..f55c3a5bbd839f8e9efd9c5ff3fb8246a559234c 100644 --- a/app/views/server/universities/_form.html.erb +++ b/app/views/server/universities/_form.html.erb @@ -26,7 +26,7 @@ <%= f.input :logo, as: :single_deletable_file, input_html: { accept: '.jpg,.jpeg,.png,.svg' }, - preview: 200, + preview: false, direct_upload: true %> </div> </div> diff --git a/app/views/server/universities/show.html.erb b/app/views/server/universities/show.html.erb index 50b09738e5ceef415c79565d15a14c9847745dc0..45bab30c290e0cc2d84404ec5dd4dc577355fbad 100644 --- a/app/views/server/universities/show.html.erb +++ b/app/views/server/universities/show.html.erb @@ -1,7 +1,7 @@ <% content_for :title, @university %> <div class="row"> - <div class="col-xl-4"> + <div class="col-xl-8"> <%= osuny_panel t('admin.infos') do %> <div class="table-responsive"> <table class="<%= table_classes %>"> diff --git a/config/application.sample.yml b/config/application.sample.yml index c0a9ec205d473aeefc0aa5f03fd6fbd861c56a7b..f273685fe74d4c19abeb00985b75ea07beeebbff 100644 --- a/config/application.sample.yml +++ b/config/application.sample.yml @@ -1,4 +1,6 @@ APPLICATION_ENV: development +# Can be used when working on two incompatible branches (e.g. main & i18n) +OSUNY_DEVELOPMENT_DBNAME: BUGSNAG_JAVASCRIPT_KEY: BUGSNAG_RUBY_KEY: @@ -26,6 +28,7 @@ SMTP_PASSWORD: UNSPLASH_ACCESS_KEY: UNSPLASH_SECRET: +PEXELS_API_KEY: # Pour les tests automatisés TEST_GITHUB_BRANCH: diff --git a/config/database.yml b/config/database.yml index 98f9fb7aee1ea0d2563069c4f1ee300531611853..4dba8854c8485e51835eca0c5ace8ab18436f885 100644 --- a/config/database.yml +++ b/config/database.yml @@ -5,7 +5,7 @@ default: &default development: <<: *default - database: osuny_development + database: <%= ENV.fetch("OSUNY_DEVELOPMENT_DBNAME", "osuny_development") %> test: <<: *default diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index dae2f8766da766491e3e24652a23f644273c3330..5882e7ef89c8d4438d974a49406d52d7dec0b627 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -121,6 +121,7 @@ en: published: Published? related_category: Related category slug: Slug + special_page: Special page text: Main page text title: Title website: Website @@ -151,6 +152,7 @@ en: admin: communication: blocks: + add: Add block alerts: file_is_too_big: File is too big! categories: @@ -485,6 +487,7 @@ en: edit: add_testimonial: Add testimonial remove_testimonial: Remove testimonial + title_disclaimer: The title above won't show on the website. Nevertheless, it will appear and be clickable in the table of contents if there's one on the page. element: text: label: Text @@ -536,7 +539,6 @@ en: website: pages: delete_special_page_notice: Can't delete this page - is_special_page: "This is a page with a special behaviour:" structure: Structure post: pinned_status: Pinned status @@ -667,6 +669,10 @@ en: persons: Staff teachers: Educational staff url: URL + curation: + error: Import error, be sure to use a valid URL + label: URL of the post to import + placeholder: https://... simple_form: hints: communication_extranet: diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 5f8baf67812083cfaefefc03f7c923cea6879632..06742087e3317c21c41e4d2dd07babe81ad45f54 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -121,6 +121,7 @@ fr: published: Publié ? related_category: Catégorie liée slug: Identifiant + special_page: Page spéciale text: Texte principal de la page title: Titre website: Site Web @@ -151,6 +152,7 @@ fr: admin: communication: blocks: + add: Ajouter un bloc alerts: file_is_too_big: Le fichier est trop lourd ! categories: @@ -427,7 +429,7 @@ fr: partners: description: Une liste d'organisations, avec leur logo, leur site et leur nom. edit: - add_partner: Ajouter un partenaire + add_partner: Ajouter une organisation alphabetical: label: Ordre alphabétique description: @@ -487,6 +489,7 @@ fr: edit: add_testimonial: Ajouter un témoignage remove_testimonial: Enlever le témoignage + title_disclaimer: Le titre ci-dessus ne s'affichera pas dans le site Web. Il sera en revanche présent et cliquable dans la table des matières, si elle est présente. element: text: label: Texte @@ -538,7 +541,6 @@ fr: website: pages: delete_special_page_notice: Impossible de supprimer cette page - is_special_page: "Ceci est une page avec un comportement spécial :" structure: Arborescence post: pinned_status: Mise en avant @@ -669,6 +671,10 @@ fr: persons: Équipe teachers: Équipe pédagogique url: URL + curation: + error: Erreur lors de la curation, veillez à utiliser une URL valide + label: URL de l'article à importer + placeholder: https://... simple_form: hints: communication_extranet: diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml new file mode 100644 index 0000000000000000000000000000000000000000..a6530d7da264102f4008c1eec24d4819778873ee --- /dev/null +++ b/config/locales/devise.en.yml @@ -0,0 +1,26 @@ +en: + devise: + confirmations: + new: + title: Account confirmation + passwords: + edit: + new: Password change + new: + title: Password forgotton + registrations: + edit: + title: Account edition + new: + title: Register on Osuny + sessions: + new: + title: Welcome to Osuny + two_factor_authentication: + max_login_attempts_reached: + title: Maximul login attemps reached + show: + title: Multi-factor authentication + unlocks: + new: + title: Account unlocking diff --git a/config/locales/devise.fr.yml b/config/locales/devise.fr.yml new file mode 100644 index 0000000000000000000000000000000000000000..8682c0c11b2dc3742b7025206027554230173773 --- /dev/null +++ b/config/locales/devise.fr.yml @@ -0,0 +1,26 @@ +fr: + devise: + confirmations: + new: + title: Confirmation de compte + passwords: + edit: + new: Changement de mot de passe + new: + title: Mot de passe oublié + registrations: + edit: + title: Modification de votre compte + new: + title: Inscription sur Osuny + sessions: + new: + title: Bienvenue sur Osuny + two_factor_authentication: + max_login_attempts_reached: + title: Maximum d'essais atteint + show: + title: Authentification multi-facteur + unlocks: + new: + title: Déblocage de compte diff --git a/config/locales/education/fr.yml b/config/locales/education/fr.yml index 77e0483a0c33e463c9d4c6c6a129fee08f808753..bc51c0384bbfbf77f7fa51eacd092bced4019b84 100644 --- a/config/locales/education/fr.yml +++ b/config/locales/education/fr.yml @@ -101,7 +101,7 @@ fr: hint: Haut de page, résumé de la formation. presentation: label: Présentation - hint: Complétées par les blocs, afin de permettre une présentation libre et riche de la formation. + hint: Complétée par les blocs, afin de permettre un descriptif libre et riche de la formation. pedagogy: label: Pédagogie hint: Mode d'enseignement et d'évaluation, et présentation de l'équipe pédagogique. diff --git a/config/locales/en.yml b/config/locales/en.yml index dba8c22cd519ed83b99f09f6f1f8cc08943b8ba1..318ac19cf9f1b3422ccfe68abcec04bd4b6c31df 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -292,14 +292,14 @@ en: date_with_hour: "%B %d, %Y %H:%M" today: Today true: Yes - unsplash: + photo_import: next: Next image nothing: No results for this search open: Search an image placeholder: Type your search here previous: Previous images search: Search - title: Images on Unsplash + title: Photo search validate: Validate views: pagination: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index b4db6f3ee8fcdb9033c06790f3edc94293b68812..28b2136d766f093d50d237587c102e1fea8fe7c6 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -292,14 +292,14 @@ fr: date_with_hour: "%d %B %Y %H:%M" today: Aujourd'hui true: Oui - unsplash: + photo_import: next: Images suivantes nothing: Aucun résultat pour cette recherche open: Chercher une image placeholder: Tapez votre recherche previous: Images précédentes search: Chercher - title: Recherche d'image sur Unsplash + title: Recherche d'image validate: Valider views: pagination: diff --git a/config/routes/admin/communication.rb b/config/routes/admin/communication.rb index c8f3af92d272bf049aa7c52cf9552f8fa054dd93..6e5ee1727dd78f239763d03da4c2c920ec243a43 100644 --- a/config/routes/admin/communication.rb +++ b/config/routes/admin/communication.rb @@ -1,5 +1,8 @@ namespace :communication do - get 'unsplash' => 'unsplash#index' + scope 'photo-imports' do + get 'unsplash' => 'photo_imports#unsplash' + get 'pexels' => 'photo_imports#pexels' + end resources :websites do member do get :import diff --git a/db/schema.rb b/db/schema.rb index 788fd636df29d9867cd853ac0ad24dcbd8fa106b..50a9de2b78181c49e803e1a72980e5e803480f5a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -16,7 +16,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do enable_extension "plpgsql" enable_extension "unaccent" - create_table "action_text_rich_texts", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "action_text_rich_texts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name", null: false t.text "body" t.string "record_type", null: false @@ -26,7 +26,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true end - create_table "active_storage_attachments", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "active_storage_attachments", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false t.uuid "record_id", null: false @@ -36,7 +36,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end - create_table "active_storage_blobs", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "active_storage_blobs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "key", null: false t.string "filename", null: false t.string "content_type" @@ -50,13 +50,13 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_active_storage_blobs_on_university_id" end - create_table "active_storage_variant_records", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "active_storage_variant_records", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "blob_id", null: false t.string "variation_digest", null: false t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true end - create_table "administration_qualiopi_criterions", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "administration_qualiopi_criterions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.integer "number" t.text "name" t.text "description" @@ -64,7 +64,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.datetime "updated_at", null: false end - create_table "administration_qualiopi_indicators", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "administration_qualiopi_indicators", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "criterion_id", null: false t.integer "number" t.text "name" @@ -78,7 +78,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["criterion_id"], name: "index_administration_qualiopi_indicators_on_criterion_id" end - create_table "communication_blocks", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_blocks", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "about_type" t.uuid "about_id" @@ -93,7 +93,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_communication_blocks_on_university_id" end - create_table "communication_extranets", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_extranets", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.uuid "university_id", null: false t.string "host" @@ -117,7 +117,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_communication_extranets_on_university_id" end - create_table "communication_website_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "communication_website_id", null: false t.string "name" @@ -147,7 +147,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["communication_website_post_id", "communication_website_category_id"], name: "post_category" end - create_table "communication_website_git_files", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_git_files", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "previous_path" t.string "about_type", null: false t.uuid "about_id", null: false @@ -159,7 +159,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["website_id"], name: "index_communication_website_git_files_on_website_id" end - create_table "communication_website_imported_authors", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_authors", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "website_id", null: false t.uuid "author_id" @@ -175,7 +175,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["website_id"], name: "idx_communication_website_imported_auth_on_website" end - create_table "communication_website_imported_categories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "website_id", null: false t.uuid "category_id" @@ -193,7 +193,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["website_id"], name: "idx_communication_website_imported_cat_on_website" end - create_table "communication_website_imported_media", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_media", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "identifier" t.jsonb "data" t.text "file_url" @@ -208,7 +208,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["website_id"], name: "index_communication_website_imported_media_on_website_id" end - create_table "communication_website_imported_pages", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_pages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "website_id", null: false t.uuid "page_id" @@ -232,7 +232,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["website_id"], name: "index_communication_website_imported_pages_on_website_id" end - create_table "communication_website_imported_posts", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_posts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "website_id", null: false t.uuid "post_id" @@ -257,7 +257,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["website_id"], name: "index_communication_website_imported_posts_on_website_id" end - create_table "communication_website_imported_websites", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_imported_websites", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "website_id", null: false t.integer "status", default: 0 @@ -267,7 +267,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["website_id"], name: "index_communication_website_imported_websites_on_website_id" end - create_table "communication_website_menu_items", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_menu_items", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "website_id", null: false t.uuid "menu_id", null: false @@ -287,7 +287,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["website_id"], name: "index_communication_website_menu_items_on_website_id" end - create_table "communication_website_menus", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_menus", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "communication_website_id", null: false t.string "title" @@ -299,7 +299,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_communication_website_menus_on_university_id" end - create_table "communication_website_pages", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_pages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "communication_website_id", null: false t.string "title" @@ -314,10 +314,10 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.text "github_path" t.string "featured_image_alt" t.text "text" - t.text "summary" t.string "breadcrumb_title" t.text "header_text" t.integer "kind" + t.text "summary" t.string "bodyclass" t.uuid "language_id" t.text "featured_image_credit" @@ -343,7 +343,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["website_id"], name: "index_communication_website_permalinks_on_website_id" end - create_table "communication_website_posts", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_website_posts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "communication_website_id", null: false t.string "title" @@ -367,7 +367,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_communication_website_posts_on_university_id" end - create_table "communication_websites", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "communication_websites", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" t.string "url" @@ -419,7 +419,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["priority", "run_at"], name: "delayed_jobs_priority" end - create_table "education_academic_years", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "education_academic_years", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.integer "year" t.datetime "created_at", null: false @@ -434,7 +434,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_person_id", "education_academic_year_id"], name: "index_person_academic_year" end - create_table "education_cohorts", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "education_cohorts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "program_id", null: false t.uuid "academic_year_id", null: false @@ -455,7 +455,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_person_id", "education_cohort_id"], name: "index_person_cohort" end - create_table "education_diplomas", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "education_diplomas", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "short_name" t.integer "level", default: 0 @@ -469,7 +469,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_education_diplomas_on_university_id" end - create_table "education_programs", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "education_programs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" t.integer "capacity" @@ -529,7 +529,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["education_program_id", "user_id"], name: "index_education_programs_users_on_program_id_and_user_id" end - create_table "education_schools", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "education_schools", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" t.string "address" @@ -544,7 +544,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_education_schools_on_university_id" end - create_table "imports", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "imports", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.integer "number_of_lines" t.jsonb "processing_errors" t.integer "kind" @@ -557,7 +557,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["user_id"], name: "index_imports_on_user_id" end - create_table "languages", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "languages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "iso_code" t.datetime "created_at", null: false @@ -576,7 +576,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_research_journal_paper_kinds_on_university_id" end - create_table "research_journal_papers", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_journal_papers", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "title" t.datetime "published_at", precision: nil t.uuid "university_id", null: false @@ -609,7 +609,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["researcher_id"], name: "index_research_journal_papers_researchers_on_researcher_id" end - create_table "research_journal_volumes", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_journal_volumes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "research_journal_id", null: false t.string "title" @@ -629,7 +629,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_research_journal_volumes_on_university_id" end - create_table "research_journals", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_journals", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "title" t.text "meta_description" @@ -640,7 +640,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_research_journals_on_university_id" end - create_table "research_laboratories", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_laboratories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" t.string "address" @@ -652,14 +652,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_research_laboratories_on_university_id" end - create_table "research_laboratories_publications", id: false, force: :cascade do |t| - t.uuid "research_publication_id", null: false - t.uuid "research_laboratory_id", null: false - t.index ["research_laboratory_id", "research_publication_id"], name: "index_laboratory_publication" - t.index ["research_publication_id", "research_laboratory_id"], name: "index_publication_laboratory" - end - - create_table "research_laboratory_axes", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_laboratory_axes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "research_laboratory_id", null: false t.string "name" @@ -673,28 +666,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_research_laboratory_axes_on_university_id" end - create_table "research_publications", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.string "docid" - t.jsonb "data" - t.string "title" - t.string "url" - t.string "ref" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "hal_url" - t.date "publication_date" - t.string "doi" - t.string "slug" - end - - create_table "research_publications_university_people", id: false, force: :cascade do |t| - t.uuid "research_publication_id", null: false - t.uuid "university_person_id", null: false - t.index ["research_publication_id", "university_person_id"], name: "index_publication_person" - t.index ["university_person_id", "research_publication_id"], name: "index_person_publication" - end - - create_table "research_theses", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "research_theses", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "research_laboratory_id", null: false t.uuid "author_id", null: false @@ -712,7 +684,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_research_theses_on_university_id" end - create_table "universities", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "universities", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "identifier" t.string "address" @@ -737,7 +709,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.string "sso_button_label" end - create_table "university_organizations", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" t.string "long_name" @@ -764,7 +736,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_university_organizations_on_university_id" end - create_table "university_people", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_people", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "user_id" t.string "last_name" @@ -796,15 +768,12 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.string "zipcode" t.string "city" t.string "country" - t.string "hal_person_identifier" - t.string "hal_doc_identifier" - t.string "hal_form_identifier" t.string "mastodon" t.index ["university_id"], name: "index_university_people_on_university_id" t.index ["user_id"], name: "index_university_people_on_user_id" end - create_table "university_person_experiences", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_person_experiences", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "person_id", null: false t.uuid "organization_id", null: false @@ -818,7 +787,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_university_person_experiences_on_university_id" end - create_table "university_person_involvements", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_person_involvements", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "person_id", null: false t.integer "kind" @@ -833,7 +802,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_university_person_involvements_on_university_id" end - create_table "university_roles", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "university_roles", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "target_type" t.uuid "target_id" @@ -845,7 +814,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_19_164205) do t.index ["university_id"], name: "index_university_roles_on_university_id" end - create_table "users", id: :uuid, default: -> { "public.gen_random_uuid()" }, force: :cascade do |t| + create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "first_name" t.string "last_name" diff --git a/test/fixtures/university/people.yml b/test/fixtures/university/people.yml index efbd6df9f389ff68d7a4d9f573aef5272ddf9c68..49c568d5195415d1b2944fba5c22dc17997a8f7f 100644 --- a/test/fixtures/university/people.yml +++ b/test/fixtures/university/people.yml @@ -2,42 +2,39 @@ # # Table name: university_people # -# id :uuid not null, primary key -# address :string -# biography :text -# birthdate :date -# city :string -# country :string -# email :string -# first_name :string -# gender :integer -# habilitation :boolean default(FALSE) -# hal_doc_identifier :string -# hal_form_identifier :string -# hal_person_identifier :string -# is_administration :boolean -# is_alumnus :boolean default(FALSE) -# is_author :boolean -# is_researcher :boolean -# is_teacher :boolean -# last_name :string -# linkedin :string -# mastodon :string -# meta_description :text -# name :string -# phone_mobile :string -# phone_personal :string -# phone_professional :string -# slug :string -# summary :text -# tenure :boolean default(FALSE) -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid indexed +# id :uuid not null, primary key +# address :string +# biography :text +# birthdate :date +# city :string +# country :string +# email :string +# first_name :string +# gender :integer +# habilitation :boolean default(FALSE) +# is_administration :boolean +# is_alumnus :boolean default(FALSE) +# is_author :boolean +# is_researcher :boolean +# is_teacher :boolean +# last_name :string +# linkedin :string +# mastodon :string +# meta_description :text +# name :string +# phone_mobile :string +# phone_personal :string +# phone_professional :string +# slug :string +# summary :text +# tenure :boolean default(FALSE) +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# user_id :uuid indexed # # Indexes # diff --git a/test/system/.keep b/test/system/.keep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000