diff --git a/app/assets/stylesheets/admin/commons/blocks.sass b/app/assets/stylesheets/admin/commons/blocks.sass index deaacc5e5d5a4542a0935ac673945c5d24930aba..6f70f7a19367cc12a780ec82b06235f647278b90 100644 --- a/app/assets/stylesheets/admin/commons/blocks.sass +++ b/app/assets/stylesheets/admin/commons/blocks.sass @@ -1,13 +1,18 @@ .blocks &__list &__element + &--hover + opacity: 0 + transition: opacity 0.25s ease &:hover - .blocks__list__handle + .blocks__list__element--hover opacity: 1 &__handle - opacity: 0 - width: 20px - transition: opacity 0.25s ease + margin-left: 10px + .fas // Icone + font-size: px2rem(13) + .handle + margin-right: 0 &__image width: 170px img diff --git a/app/assets/stylesheets/admin/pure/style.sass b/app/assets/stylesheets/admin/pure/style.sass index 62a97e91ef5b00ff6341391b3da74ebffcfd4d4e..1cf0cdac7949790f85b61d17d62420d4f31ad5ce 100644 --- a/app/assets/stylesheets/admin/pure/style.sass +++ b/app/assets/stylesheets/admin/pure/style.sass @@ -60,12 +60,21 @@ p a text-decoration: none text-decoration-thickness: 1px - text-underline-offset: 5px + text-underline-offset: 4px transition: text-decoration 0.5s, color 0.5s - &:hover color: darken($primary, 10) +.action + text-decoration: underline + text-decoration-thickness: 1px + text-decoration-color: rgba(0, 0, 0, 0.2) + text-underline-offset: 4px + transition: text-decoration 0.5s + font-size: px2rem(14) + &:hover + text-decoration-color: black + .form-control:valid, .form-control.is-valid, .form-select:valid, diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index 3379f7b00549f82a0d41f61ef5cdfe3dda13c016..01ba88e7399444340df1dcf533acddbcdc4a77ad 100644 --- a/app/helpers/admin/application_helper.rb +++ b/app/helpers/admin/application_helper.rb @@ -5,36 +5,46 @@ module Admin::ApplicationHelper polymorphic_url_param(object, **options) end - def show_link(object, **options) + def show_link(object, html_classes: button_classes, **options) link_to_if can?(:read, object), options.delete(:label) || t('show'), polymorphic_url_param(object, **options), - class: button_classes + class: html_classes end - def edit_link(object, **options) + def edit_link(object, html_classes: button_classes, **options) return unless can?(:update, object) link_to options.delete(:label) || t('edit'), polymorphic_url_param(object, prefix: :edit, **options), - class: button_classes + class: html_classes end - def destroy_link(object, **options) + def destroy_link(object, html_classes: button_classes_danger, **options) return unless can?(:destroy, object) link_to options.delete(:label) || t('delete'), polymorphic_url_param(object, **options), method: :delete, data: { confirm: options.delete(:confirm_message) || t('please_confirm') }, - class: button_classes_danger + class: html_classes end - def create_link(object_class, **options) + def create_link(object_class, html_classes: button_classes, **options) return unless can?(:create, object_class) object_class_sym = object_class.name.underscore.gsub('/', '_').to_sym link_to options.delete(:label) || t('create'), polymorphic_url_param(object_class_sym, prefix: :new, **options), - class: button_classes + class: html_classes + end + + def duplicate_link(object, html_classes: nil) + return unless can?(:update, object) + html_classes = button_classes('btn-light') if html_classes.nil? + link_to t('admin.duplicate'), + [:duplicate, :admin, object], + method: :post, + data: { confirm: t('please_confirm') }, + class: html_classes end def preview_link @@ -76,15 +86,6 @@ module Admin::ApplicationHelper " #{string}" end - def duplicate_link(object) - return unless can?(:update, object) - link_to t('admin.duplicate'), - [:duplicate, :admin, object], - method: :post, - data: { confirm: t('please_confirm') }, - class: button_classes('btn-light') - end - def button_classes(additional = '', **options) classes = "btn btn-primary btn-xs #{additional}" classes += ' disabled' if options[:disabled] diff --git a/app/views/admin/communication/blocks/_block.html.erb b/app/views/admin/communication/blocks/_block.html.erb index 071966af91676062bf750b6233dbd8e23b907450..ba4c34b9d0966d72bca56bc91f602c8a22d0ca67 100644 --- a/app/views/admin/communication/blocks/_block.html.erb +++ b/app/views/admin/communication/blocks/_block.html.erb @@ -1,13 +1,21 @@ <div class="row" data-id="block_<%= block.id %>"> <div class="offset-lg-4 col-lg-8"> <article class="blocks__list__element mt-5 <%= 'draft' unless block.published? %>"> - <div class="mb-2"> + <div class="mb-1"> <div class="float-end"> - <%= duplicate_link block %> - <%= edit_link block %> + <span class="blocks__list__handle blocks__list__element--hover"> + <span class="handle"> + <span class="small"><%= t 'organize' %></span> + <i class="<%= Icon::SORT %>"></i> + </span> + </span> + <span class="blocks__list__element--hover"> + <%= destroy_link block, html_classes: 'action text-danger ms-2' %> + <%= duplicate_link block, html_classes: 'action ms-2' %> + </span> + <%= edit_link block, html_classes: 'action ms-2' %> </div> <span class="small text-muted mb-2"><%= block.template_kind_i18n %></span> - <span class="blocks__list__handle"><i class="<%= Icon::SORT %> handle"></i></span> </div> <div class="blocks__list__preview"> <% diff --git a/app/views/admin/communication/blocks/_list.html.erb b/app/views/admin/communication/blocks/_index_edit.html.erb similarity index 80% rename from app/views/admin/communication/blocks/_list.html.erb rename to app/views/admin/communication/blocks/_index_edit.html.erb index 8be64161d1bdc282bca9f993dc85ff7bb4ebaf07..1ff42a3dd36848f5276f02a79348c8ef47ef3b29 100644 --- a/app/views/admin/communication/blocks/_list.html.erb +++ b/app/views/admin/communication/blocks/_index_edit.html.erb @@ -11,12 +11,12 @@ <div class="col-lg-4"> <%= link_to t('admin.communication.blocks.headings.add'), new_admin_communication_heading_path(about_id: about.id, about_type: about.class.name), - class: 'p-5 d-block bg-light text-center h4' if can? :create, Communication::Block::Heading%> + class: 'py-5 px-2 d-block bg-light text-center h4' if can? :create, Communication::Block::Heading%> </div> <div class="col-lg-8"> <%= link_to t('admin.communication.blocks.add'), new_admin_communication_block_path(about_id: about.id, about_type: about.class.name), - class: 'p-5 d-block bg-light text-center h4' if can? :create, Communication::Block%> + class: 'py-5 px-2 d-block bg-light text-center h4' if can? :create, Communication::Block%> </div> </div> <% end %> diff --git a/app/views/admin/communication/blocks/_show.html.erb b/app/views/admin/communication/blocks/_index_show.html.erb similarity index 100% rename from app/views/admin/communication/blocks/_show.html.erb rename to app/views/admin/communication/blocks/_index_show.html.erb diff --git a/app/views/admin/communication/blocks/edit.html.erb b/app/views/admin/communication/blocks/edit.html.erb index b498bd9a6534814eee3ff46b79b468d997b17dc6..e701c26d596fbeddf320df60c132c6d51794e615 100644 --- a/app/views/admin/communication/blocks/edit.html.erb +++ b/app/views/admin/communication/blocks/edit.html.erb @@ -34,6 +34,7 @@ </textarea> <% content_for :action_bar_left do %> <%= destroy_link @block %> + <%= duplicate_link @block %> <% end %> <% content_for :action_bar_right do %> <%= submit f %> diff --git a/app/views/admin/communication/blocks/headings/_heading.html.erb b/app/views/admin/communication/blocks/headings/_heading.html.erb index 72ce903ad04c7648011fda1c0d3f97eeec55cb9b..1af7fdccaaa69121fa5f6977603913f49035e411 100644 --- a/app/views/admin/communication/blocks/headings/_heading.html.erb +++ b/app/views/admin/communication/blocks/headings/_heading.html.erb @@ -1,7 +1,15 @@ <div data-id="heading_<%= heading.id %>" class="blocks__list__element mt-5"> <div style="padding-left: <%= (heading.level - Communication::Block::Heading::DEFAULT_LEVEL) * 48 %>px"> - <%= link_to heading, edit_admin_communication_heading_path(heading), class: 'h4' %> - <span class="ps-0 blocks__list__handle"><i class="<%= Icon::SORT %> handle"></i></span> + <span class="h4"><%= heading %></span> + <%= link_to t('edit'), + edit_admin_communication_heading_path(heading), + class: 'action ms-2' %> + <span class="blocks__list__handle blocks__list__element--hover"> + <span class="handle"> + <span class="small"><%= t 'organize' %></span> + <i class="<%= Icon::SORT %>"></i> + </span> + </span> </div> </div> <% heading.blocks.each do |block| %> diff --git a/app/views/admin/communication/blocks/templates/embed/_preview.html.erb b/app/views/admin/communication/blocks/templates/embed/_preview.html.erb index 9dd8ff9b7c8ac886687433b87553ec66f31c6302..ee1017d64ce322c5d7263aa901ad9e96b0ea4076 100644 --- a/app/views/admin/communication/blocks/templates/embed/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/embed/_preview.html.erb @@ -1 +1 @@ -<p><%= block_component_preview :transcription %></p> \ No newline at end of file +<p><%= strip_tags block_component_preview :transcription %></p> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb index 5ce92b9925a28232d49d7dbac22bf0939d8e233d..0ed3c7414e3528510b5f7897c5f1e6e1d7d2786c 100644 --- a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb @@ -1,7 +1,7 @@ <% @block.template.elements.each do |element| %> <span class="me-2"> <% if element.best_logo %> - <%= image_tag element.best_logo, width: 90 %> + <%= image_tag element.best_logo, height: 90, class: 'bg-light p-2' %> <% else %> <%= element.best_name %> <% end %> diff --git a/app/views/admin/communication/extranets/posts/categories/preview.html.erb b/app/views/admin/communication/extranets/posts/categories/preview.html.erb index b776b4a0815d7a519fb984dd80a7d28d9af1bb62..556e4ae55533ed11e9b0c8cf605dcdea4ae6a3fe 100644 --- a/app/views/admin/communication/extranets/posts/categories/preview.html.erb +++ b/app/views/admin/communication/extranets/posts/categories/preview.html.erb @@ -1,3 +1,3 @@ <% content_for :title, @post.title %> <% content_for :image, kamifusen_tag(@post.featured_image) if @post.featured_image.attached? %> -<%= render 'admin/communication/blocks/show', about: @post %> +<%= render 'admin/communication/blocks/index_show', about: @post %> diff --git a/app/views/admin/communication/extranets/posts/preview.html.erb b/app/views/admin/communication/extranets/posts/preview.html.erb index b776b4a0815d7a519fb984dd80a7d28d9af1bb62..556e4ae55533ed11e9b0c8cf605dcdea4ae6a3fe 100644 --- a/app/views/admin/communication/extranets/posts/preview.html.erb +++ b/app/views/admin/communication/extranets/posts/preview.html.erb @@ -1,3 +1,3 @@ <% content_for :title, @post.title %> <% content_for :image, kamifusen_tag(@post.featured_image) if @post.featured_image.attached? %> -<%= render 'admin/communication/blocks/show', about: @post %> +<%= render 'admin/communication/blocks/index_show', about: @post %> diff --git a/app/views/admin/communication/extranets/posts/show.html.erb b/app/views/admin/communication/extranets/posts/show.html.erb index 5332d5d25a7807e0c55c5c8c11572db40b238671..cd49d50bd984abb99c0ec25aef9eb2f3f2183321 100644 --- a/app/views/admin/communication/extranets/posts/show.html.erb +++ b/app/views/admin/communication/extranets/posts/show.html.erb @@ -4,7 +4,7 @@ <div class="row"> <div class="col-xl-8"> <%= render 'admin/application/summary/show', about: @post %> - <%= render 'admin/communication/blocks/list', about: @post %> + <%= render 'admin/communication/blocks/index_edit', about: @post %> </div> <div class="col-xl-4"> <% diff --git a/app/views/admin/communication/websites/categories/show.html.erb b/app/views/admin/communication/websites/categories/show.html.erb index 7bf64735680b08f7492a14f7bd5f42a65a8b7489..99f034375bbba8d286e0b0cb533ab78965e12cbf 100644 --- a/app/views/admin/communication/websites/categories/show.html.erb +++ b/app/views/admin/communication/websites/categories/show.html.erb @@ -4,7 +4,7 @@ <div class="row"> <div class="col-md-8"> <%= render 'admin/application/summary/show', about: @category %> - <%= render 'admin/communication/blocks/list', about: @category %> + <%= render 'admin/communication/blocks/index_edit', about: @category %> </div> <div class="col-md-4"> <%= render 'admin/application/i18n/widget', about: @category %> diff --git a/app/views/admin/communication/websites/pages/preview.html.erb b/app/views/admin/communication/websites/pages/preview.html.erb index e25884b6c56a83f82e10be46fd51f759ba4dfeed..e61751b8839cf050e5649db5b389b3f2ea96262c 100644 --- a/app/views/admin/communication/websites/pages/preview.html.erb +++ b/app/views/admin/communication/websites/pages/preview.html.erb @@ -1,3 +1,3 @@ <% content_for :title, @page.title %> <% content_for :image, kamifusen_tag(@page.best_featured_image) if @page.best_featured_image.attached? %> -<%= render 'admin/communication/blocks/show', about: @page %> +<%= render 'admin/communication/blocks/index_show', about: @page %> diff --git a/app/views/admin/communication/websites/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb index 92226d32277ce4b2adde8112c13f09d00c8a6c88..77ef8d7ccf7af2ae031636118f80795dbd3bb262 100644 --- a/app/views/admin/communication/websites/pages/show.html.erb +++ b/app/views/admin/communication/websites/pages/show.html.erb @@ -11,9 +11,9 @@ <%= render 'admin/application/featured_image/show', about: @page %> </div> </div> - <hr class="mb-5"> + <hr class="my-5"> <%= render 'admin/application/a11y/widget', about: @page, horizontal: true %> - <hr class="mb-5"> + <hr class="my-5"> <div class="row"> <div class="col-lg-4"> <%= render 'admin/communication/websites/pages/show/metadata' %> @@ -24,8 +24,8 @@ <%= render 'admin/application/meta_description/show', about: @page %> </div> </div> - <hr class="mb-5"> - <%= render 'admin/communication/blocks/list', about: @page %> + <hr class="my-5"> + <%= render 'admin/communication/blocks/index_edit', about: @page %> <% end %> <%= render 'admin/application/dependencies', diff --git a/app/views/admin/communication/websites/posts/preview.html.erb b/app/views/admin/communication/websites/posts/preview.html.erb index b776b4a0815d7a519fb984dd80a7d28d9af1bb62..556e4ae55533ed11e9b0c8cf605dcdea4ae6a3fe 100644 --- a/app/views/admin/communication/websites/posts/preview.html.erb +++ b/app/views/admin/communication/websites/posts/preview.html.erb @@ -1,3 +1,3 @@ <% content_for :title, @post.title %> <% content_for :image, kamifusen_tag(@post.featured_image) if @post.featured_image.attached? %> -<%= render 'admin/communication/blocks/show', about: @post %> +<%= render 'admin/communication/blocks/index_show', about: @post %> diff --git a/app/views/admin/communication/websites/posts/show.html.erb b/app/views/admin/communication/websites/posts/show.html.erb index 784067d9300f9191c868ba818a1d8f6cfa83249a..c560d5e920b0c1234aa262c5b3f78e5667d30389 100644 --- a/app/views/admin/communication/websites/posts/show.html.erb +++ b/app/views/admin/communication/websites/posts/show.html.erb @@ -4,7 +4,7 @@ <div class="row"> <div class="col-xl-8"> <%= render 'admin/application/summary/show', about: @post %> - <%= render 'admin/communication/blocks/list', about: @post %> + <%= render 'admin/communication/blocks/index_edit', about: @post %> </div> <div class="col-xl-4"> <%= render 'admin/application/i18n/widget', about: @post %> diff --git a/app/views/admin/education/diplomas/show.html.erb b/app/views/admin/education/diplomas/show.html.erb index 8726c107892fac6ae16e2013fb7488bb8e8f3a9c..66a4783f0ef687cbf08c414a285051300d6f2be5 100644 --- a/app/views/admin/education/diplomas/show.html.erb +++ b/app/views/admin/education/diplomas/show.html.erb @@ -3,7 +3,7 @@ <div class="row"> <div class="col-xl-8"> <%= render 'admin/application/summary/show', about: @diploma %> - <%= render 'admin/communication/blocks/list', about: @diploma %> + <%= render 'admin/communication/blocks/index_edit', about: @diploma %> <%= osuny_panel Education::Diploma.human_attribute_name('programs') do %> <%= render 'admin/education/programs/list', programs: @programs, hide_diploma: true %> <% end %> diff --git a/app/views/admin/education/programs/preview.html.erb b/app/views/admin/education/programs/preview.html.erb index f694e83e7e4a64a5f742b2540a2b5564091d981a..323ed783fceabce197e23051356f459db02ddbcf 100644 --- a/app/views/admin/education/programs/preview.html.erb +++ b/app/views/admin/education/programs/preview.html.erb @@ -49,7 +49,7 @@ </section> <div class="blocks"> - <%= render 'admin/communication/blocks/show', about: @program %> + <%= render 'admin/communication/blocks/index_show', about: @program %> </div> <section id="pedagogy"> diff --git a/app/views/admin/education/programs/show.html.erb b/app/views/admin/education/programs/show.html.erb index c6926ee2b30901731198fd1d38b6acc7e197ee85..8aa046bd90cb872f7b9e7c2356c69c87e62aa9b9 100644 --- a/app/views/admin/education/programs/show.html.erb +++ b/app/views/admin/education/programs/show.html.erb @@ -51,7 +51,7 @@ </div> </div> <% end %> - <%= render 'admin/communication/blocks/list', about: @program %> + <%= render 'admin/communication/blocks/index_edit', about: @program %> <hr class="pure__separation"> <%= render 'admin/education/programs/forms/part', part: :pedagogy, collapsed: true do %> <div class="row"> diff --git a/app/views/admin/research/journals/papers/show.html.erb b/app/views/admin/research/journals/papers/show.html.erb index 5718ef637b39b4cad79077e6c4ae1c8d0218bafd..3eb4d9c0fd4a4d0267a3690abb98fc14699dbe02 100644 --- a/app/views/admin/research/journals/papers/show.html.erb +++ b/app/views/admin/research/journals/papers/show.html.erb @@ -22,7 +22,7 @@ <%= sanitize @paper.references %> <% end %> <% end %> - <%= render 'admin/communication/blocks/list', about: @paper %> + <%= render 'admin/communication/blocks/index_edit', about: @paper %> <%= render 'admin/application/dependencies', git_dependencies: @paper.git_dependencies(@paper.journal.websites.first), active_storage_blobs: @paper.active_storage_blobs %> diff --git a/app/views/admin/university/organizations/show.html.erb b/app/views/admin/university/organizations/show.html.erb index b89bb74eb2b8ec4bef86b094650811e075458d65..3995a9c11f9fc4ed51a8a5f5a7dafca23f907d86 100644 --- a/app/views/admin/university/organizations/show.html.erb +++ b/app/views/admin/university/organizations/show.html.erb @@ -81,7 +81,7 @@ </div> <% end %> - <%= render 'admin/communication/blocks/list', about: @organization %> + <%= render 'admin/communication/blocks/index_edit', about: @organization %> </div> <div class="col-md-4"> diff --git a/app/views/admin/university/people/_main_infos.html.erb b/app/views/admin/university/people/_main_infos.html.erb index 1a52c3e35adc41e56b2e6ce2c90d06768325ed2b..2fadaf7c7731261f793aa8421ef5853183666303 100644 --- a/app/views/admin/university/people/_main_infos.html.erb +++ b/app/views/admin/university/people/_main_infos.html.erb @@ -69,7 +69,7 @@ <% end %> <% end unless person.url.blank? && person.linkedin.blank? && person.twitter.blank? %> - <%= render 'admin/communication/blocks/list', about: person %> + <%= render 'admin/communication/blocks/index_edit', about: person %> </div> <div class="col-md-4 col-xl-3"> <%= osuny_panel t('metadata') do %> diff --git a/app/views/extranet/posts/posts/show.html.erb b/app/views/extranet/posts/posts/show.html.erb index 57cade679a6e828cadc86da6d1fcd9475f329e64..95b9aa46b1e3aa1863848e92adf087190dd7a9e5 100644 --- a/app/views/extranet/posts/posts/show.html.erb +++ b/app/views/extranet/posts/posts/show.html.erb @@ -16,5 +16,5 @@ <%= link_to @post.category, posts_category_path(slug: @post.category.slug) if @post.category %> </main> -<%= render 'admin/communication/blocks/show', about: @post %> +<%= render 'admin/communication/blocks/index_show', about: @post %> <main> diff --git a/config/locales/en.yml b/config/locales/en.yml index 85a703d66c0b73e6628130a3174cc0a88e4a1dc9..a0a5498f52cde0aafcaf7f38e3fd900062b608e7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -250,6 +250,7 @@ en: sign_out: Log out metadata: Metadata open: Open + organize: Organize please_confirm: Are you sure? please_confirm_with_children: "WARNING: deleting this element will also remove every child. Are you sure?" preview: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 1e441444b1eb2e7cdc625f2a9c766e8050721f85..c55562e9c2230e5af1087f7637fc063fea561a6a 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -250,6 +250,7 @@ fr: sign_out: Déconnexion metadata: Informations open: Ouvrir + organize: Organiser please_confirm: Est-ce que vous confirmez ? please_confirm_with_children: "ATTENTION : effacer cet élément supprimera aussi tous ses enfants. Est-ce que vous confirmez ?" preview: