From 80ba16f617e3e03312905d9dbc0d30f60389afc5 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Mon, 3 Jul 2023 11:30:19 +0200 Subject: [PATCH] Issue #1100 --- Gemfile.lock | 129 +++++++++--------- app/models/communication/extranet/post.rb | 3 +- .../communication/extranets/_sidebar.html.erb | 4 +- .../extranets/posts/show.html.erb | 60 +++----- .../extranets/posts/show/_metadata.html.erb | 17 +++ 5 files changed, 108 insertions(+), 105 deletions(-) create mode 100644 app/views/admin/communication/extranets/posts/show/_metadata.html.erb diff --git a/Gemfile.lock b/Gemfile.lock index deaf076b4..b52cbba8a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,47 +20,47 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.5.1) - actionpack (= 7.0.5.1) - activesupport (= 7.0.5.1) + actioncable (7.0.6) + actionpack (= 7.0.6) + activesupport (= 7.0.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.5.1) - actionpack (= 7.0.5.1) - activejob (= 7.0.5.1) - activerecord (= 7.0.5.1) - activestorage (= 7.0.5.1) - activesupport (= 7.0.5.1) + actionmailbox (7.0.6) + actionpack (= 7.0.6) + activejob (= 7.0.6) + activerecord (= 7.0.6) + activestorage (= 7.0.6) + activesupport (= 7.0.6) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.5.1) - actionpack (= 7.0.5.1) - actionview (= 7.0.5.1) - activejob (= 7.0.5.1) - activesupport (= 7.0.5.1) + actionmailer (7.0.6) + actionpack (= 7.0.6) + actionview (= 7.0.6) + activejob (= 7.0.6) + activesupport (= 7.0.6) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.5.1) - actionview (= 7.0.5.1) - activesupport (= 7.0.5.1) + actionpack (7.0.6) + actionview (= 7.0.6) + activesupport (= 7.0.6) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.5.1) - actionpack (= 7.0.5.1) - activerecord (= 7.0.5.1) - activestorage (= 7.0.5.1) - activesupport (= 7.0.5.1) + actiontext (7.0.6) + actionpack (= 7.0.6) + activerecord (= 7.0.6) + activestorage (= 7.0.6) + activesupport (= 7.0.6) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.5.1) - activesupport (= 7.0.5.1) + actionview (7.0.6) + activesupport (= 7.0.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -70,25 +70,25 @@ GEM activemodel (>= 5.2.0) activestorage (>= 5.2.0) activesupport (>= 5.2.0) - activejob (7.0.5.1) - activesupport (= 7.0.5.1) + activejob (7.0.6) + activesupport (= 7.0.6) globalid (>= 0.3.6) - activemodel (7.0.5.1) - activesupport (= 7.0.5.1) - activerecord (7.0.5.1) - activemodel (= 7.0.5.1) - activesupport (= 7.0.5.1) - activestorage (7.0.5.1) - actionpack (= 7.0.5.1) - activejob (= 7.0.5.1) - activerecord (= 7.0.5.1) - activesupport (= 7.0.5.1) + activemodel (7.0.6) + activesupport (= 7.0.6) + activerecord (7.0.6) + activemodel (= 7.0.6) + activesupport (= 7.0.6) + activestorage (7.0.6) + actionpack (= 7.0.6) + activejob (= 7.0.6) + activerecord (= 7.0.6) + activesupport (= 7.0.6) marcel (~> 1.0) mini_mime (>= 1.1.0) activestorage-scaleway-service (1.0.1) activestorage aws-sdk-s3 - activesupport (7.0.5.1) + activesupport (7.0.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -103,19 +103,19 @@ GEM execjs (~> 2) aws-eventstream (1.2.0) aws-partitions (1.782.0) - aws-sdk-core (3.175.0) + aws-sdk-core (3.176.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.67.0) - aws-sdk-core (~> 3, >= 3.174.0) + aws-sdk-kms (1.68.0) + aws-sdk-core (~> 3, >= 3.176.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.126.0) - aws-sdk-core (~> 3, >= 3.174.0) + aws-sdk-s3 (1.127.0) + aws-sdk-core (~> 3, >= 3.176.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.4) - aws-sigv4 (1.5.2) + aws-sigv4 (~> 1.6) + aws-sigv4 (1.6.0) aws-eventstream (~> 1, >= 1.0.2) bcrypt (3.1.19) bindex (0.8.1) @@ -197,7 +197,7 @@ GEM faceted_search (3.6.2) font-awesome-sass rails (>= 5.2.0) - faraday (2.7.7) + faraday (2.7.9) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-cookie_jar (0.0.7) @@ -389,24 +389,25 @@ GEM rack rack-test (2.1.0) rack (>= 1.3) - rails (7.0.5.1) - actioncable (= 7.0.5.1) - actionmailbox (= 7.0.5.1) - actionmailer (= 7.0.5.1) - actionpack (= 7.0.5.1) - actiontext (= 7.0.5.1) - actionview (= 7.0.5.1) - activejob (= 7.0.5.1) - activemodel (= 7.0.5.1) - activerecord (= 7.0.5.1) - activestorage (= 7.0.5.1) - activesupport (= 7.0.5.1) + rails (7.0.6) + actioncable (= 7.0.6) + actionmailbox (= 7.0.6) + actionmailer (= 7.0.6) + actionpack (= 7.0.6) + actiontext (= 7.0.6) + actionview (= 7.0.6) + activejob (= 7.0.6) + activemodel (= 7.0.6) + activerecord (= 7.0.6) + activestorage (= 7.0.6) + activesupport (= 7.0.6) bundler (>= 1.15.0) - railties (= 7.0.5.1) + railties (= 7.0.6) rails-autocomplete (2.0.1) rails (>= 4.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.1.1) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) rails-html-sanitizer (1.6.0) loofah (~> 2.21) @@ -414,9 +415,9 @@ GEM rails-i18n (7.0.7) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.5.1) - actionpack (= 7.0.5.1) - activesupport (= 7.0.5.1) + railties (7.0.6) + actionpack (= 7.0.6) + activesupport (= 7.0.6) method_source rake (>= 12.2) thor (~> 1.0) @@ -525,7 +526,7 @@ GEM faraday-multipart (~> 1.0.4) httparty (~> 0.20) oauth2 (>= 2.0.8) - uri (0.12.1) + uri (0.12.2) vcr (6.2.0) version_gem (1.1.3) warden (1.2.9) diff --git a/app/models/communication/extranet/post.rb b/app/models/communication/extranet/post.rb index bfd250d7a..dfcec7eb6 100644 --- a/app/models/communication/extranet/post.rb +++ b/app/models/communication/extranet/post.rb @@ -34,8 +34,9 @@ # class Communication::Extranet::Post < ApplicationRecord include Sanitizable - include WithFeaturedImage + include WithAccessibility include WithBlocks + include WithFeaturedImage include WithPublication include WithPermalink include WithSlug diff --git a/app/views/admin/communication/extranets/_sidebar.html.erb b/app/views/admin/communication/extranets/_sidebar.html.erb index 2f0e313de..be24c414d 100644 --- a/app/views/admin/communication/extranets/_sidebar.html.erb +++ b/app/views/admin/communication/extranets/_sidebar.html.erb @@ -1,5 +1,5 @@ <div class="row mt-2 website__sidebar"> - <div class="col-lg-3 col-xl-2"> + <div class="col-lg-3"> <ul class="list-unstyled" role="tablist"> <% navigation = [ @@ -32,7 +32,7 @@ <% end %> </ul> </div> - <div class="col-lg-9 col-xl-10"> + <div class="col-lg-9"> <%= yield %> </div> </div> diff --git a/app/views/admin/communication/extranets/posts/show.html.erb b/app/views/admin/communication/extranets/posts/show.html.erb index b6d807db6..d0c64ed9e 100644 --- a/app/views/admin/communication/extranets/posts/show.html.erb +++ b/app/views/admin/communication/extranets/posts/show.html.erb @@ -2,47 +2,27 @@ <%= render 'admin/communication/extranets/sidebar' do %> <div class="row"> - <div class="col-xl-8"> - <%= render 'admin/application/summary/show', about: @post %> - <%= render 'admin/communication/blocks/content/editor', about: @post %> - </div> - <div class="col-xl-4"> - <% - action = '' - action += link_to t('open'), - posts_post_url(@post.slug, host: @post.extranet.url, extranet_id: nil), - target: :_blank, - class: 'btn btn-light btn-xs' if @post.published - %> - <%= osuny_panel t('metadata'), action: action do %> - <div class="row pure__row--small"> - <div class="col-6"> - <%= osuny_label Communication::Extranet::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 %> - <% end %> - </p> - </div> - <div class="col-6"> - <%= osuny_label Communication::Extranet::Post.human_attribute_name('pinned') %> - <p><%= t @post.pinned %></p> - </div> - </div> - <% if @post.category %> - <%= osuny_label Communication::Extranet::Post.human_attribute_name('category') %> - <p><%= link_to @post.category, [:admin, @post.category] %></p> - <% end %> - <% if @post.author %> - <%= osuny_label Communication::Extranet::Post.human_attribute_name('author') %> - <p><%= @post.author %></p> - <% end %> - <%= osuny_label Communication::Extranet::Post.human_attribute_name('slug') %> - <p><%= @post.slug %></p> + <div class="col-lg-7"> + <%= osuny_panel Communication::Website::Post.human_attribute_name(:title), small: true do %> + <p class="lead"><%= @post.title %></p> <% end %> - <%= render 'admin/application/featured_image/show', about: @post %> + </div> + <div class="offset-lg-1 col-lg-4"> + <%= render 'admin/application/featured_image/show', about: @post, small: true %> + </div> + </div> + <hr class="mb-5"> + <%= render 'admin/application/a11y/widget', about: @post, horizontal: true %> + <hr class="mb-5"> + <div class="row"> + <div class="col-lg-4"> + <%= render 'admin/communication/extranets/posts/show/metadata' %> + </div> + <div class="col-lg-8"> + <%= render 'admin/application/summary/show', about: @post, small: true %> </div> </div> + <%= render 'admin/communication/blocks/content/editor', about: @post %> <% end %> <% content_for :action_bar_left do %> @@ -50,6 +30,10 @@ <% end %> <% content_for :action_bar_right do %> + <%= link_to t('open'), + posts_post_url(@post.slug, host: @post.extranet.url, extranet_id: nil), + target: :_blank, + class: 'btn btn-light btn-xs' if @post.published %> <%= preview_link %> <%= edit_link @post %> <% end %> diff --git a/app/views/admin/communication/extranets/posts/show/_metadata.html.erb b/app/views/admin/communication/extranets/posts/show/_metadata.html.erb new file mode 100644 index 000000000..25cd91b9d --- /dev/null +++ b/app/views/admin/communication/extranets/posts/show/_metadata.html.erb @@ -0,0 +1,17 @@ + +<div class="mb-4"> + <%= osuny_label t('metadata') %><br> + + <% if @post.published %> + Publié le <%= l @post.published_at.to_date %> + <% if @post.pinned %> + et mis en avant + <% end %> + <% else %> + Brouillon + <% end %> + + <% if @post.author %> + <br>par <%= @post.author %> + <% end %> +</div> \ No newline at end of file -- GitLab