Compare commits

..

8 Commits

Author SHA1 Message Date
759004fb67 handlign empty card
All checks were successful
continuous-integration/drone/push Build is passing
2025-01-08 14:45:30 +01:00
ae8bd921a6 updating post artisans admin columns 2025-01-08 14:45:11 +01:00
8c0c97dc9f handling empty taxocard 2025-01-08 14:44:41 +01:00
98a5f3eeb6 responsive finetuning 2025-01-08 14:44:28 +01:00
73890e62fe updating with inputs file 2025-01-08 14:44:16 +01:00
96d506815d few tweaks 2025-01-08 14:44:08 +01:00
a12a3b95d9 styling radio buttons 2025-01-08 14:43:27 +01:00
30bae9d52f handling post status colos 2025-01-08 14:43:15 +01:00
8 changed files with 215 additions and 33 deletions

View File

@ -17,12 +17,10 @@ function metiers_patrimoine_artisans_post_updater($post_id)
if ($address && isset($address['country'])) {
$stateGenericName = getGenericStateNameFromAcfStateName($address['state']) ?? "";
// write_log($stateGenericName);
// Met à jour le champ personnalisé 'country' avec la valeur du pays de l'adresse
update_post_meta($post_id, 'state', $stateGenericName);
}
// write_log($address);
wp_update_post($my_post);
}
add_action('acf/save_post', 'metiers_patrimoine_artisans_post_updater', 20);
@ -63,12 +61,35 @@ CUSTOM CODE FOR TITLE
add_action('edit_form_after_title', function () {
// Vérifie si on est sur le bon post type
$screen = get_current_screen();
$last_modified_date = get_the_modified_date('j F Y');
if ($screen && $screen->post_type === 'artisans') {
echo '<h1 class="admin-artisan-title">' . get_the_title() . '</h1>';
// echo '<p class="last-updated"> Dernière modification : ' . $last_modified_date . '</p>';
}
});
function add_last_modified_date_to_publish_box()
{
global $post;
// Vérifiez que vous êtes dans un post et que l'ID du post est valide
if ($post && $post->ID) {
// Récupérer la date de dernière modification
$dashicon = '<span class="dashicons dashicons-update"></span>';
$last_modified_date = get_the_modified_date('j F Y \à H:i', $post->ID);
// Afficher la date de dernière modification dans le panneau
echo '<div class="misc-pub-section">';
echo $dashicon . ' Dernière update : ';
echo $last_modified_date;
echo '</div>';
}
}
add_action('post_submitbox_start', 'add_last_modified_date_to_publish_box');
/* ---------------------------
CUSTOM CHANTIER META BOX AT THE END OF THE PAGE
---------------------------*/
@ -125,13 +146,26 @@ function render_custom_chantier_box_content($post)
}
}
/* ----------------------------------------------------------------------
GESTION DE LA COLONNE METIERS DANS LA LISTE DES POSTS ARTISANS
SUPPRIMER LA COLONNE RANK MATH SEO SI ELLE EST PRÉSENTE
------------------------------------------------------------------------*/
// AJOUT D'UNE COLONNE CUSTOM
function remove_rank_math_seo_column_for_artisans($columns)
{
if (isset($columns['rank_math_seo_details'])) {
unset($columns['rank_math_seo_details']);
}
return $columns;
}
// Appliquer le filtre uniquement pour le post type "artisans"
add_filter('manage_artisans_posts_columns', 'remove_rank_math_seo_column_for_artisans', 20);
/* ----------------------------------------------------------------------
DÉCLARATION DES COLONNES CUSTOM DANS LA LISTE DES POSTS ARTISANS
------------------------------------------------------------------------*/
// **** AJOUT DES COLONNES
function metiers_patrimoine_artisans_add_acf_posts_columns($columns)
{
global $current_screen;
@ -140,23 +174,42 @@ function metiers_patrimoine_artisans_add_acf_posts_columns($columns)
if (isset($columns['date'])) {
unset($columns['date']);
}
$new_admin_col_arrays = array_slice($columns, 0, 2, true) + array('metiers' => 'Métiers') + array_slice($columns, 2, count($columns) - 2, true);
$customColumns = array(
'metiers' => 'Métiers',
'elements' => 'Éléments du bâtiment',
'conseiller' => 'Conseiller',
'status' => 'Statut',
'lastmodified' => 'Dernière modification',
'onlinedate' => 'Mise en ligne'
);
$new_admin_col_arrays = array_slice($columns, 0, 2, true) + $customColumns + array_slice($columns, 2, count($columns) - 2, true);
return array_merge($new_admin_col_arrays);
}
add_filter('manage_artisans_posts_columns', 'metiers_patrimoine_artisans_add_acf_posts_columns');
/* ----------------------------------------------------------------------
GESTION DE LA VALEUR DE CHAQUE COLONNE
------------------------------------------------------------------------*/
function metiers_patrimoine_artisans_handle_posts_custom_columns($column)
{
$post_id = get_the_ID();
if ($column == 'conseiller') {
$conseiller = get_field('conseiller', $post_id);
if (!$conseiller) return;
echo $conseiller['user_firstname'] . ' ' . $conseiller['user_lastname'];
}
if ($column == 'status') {
$status = get_field('mdp_status', $post_id);
if (!$status || !isset($status['label'])) return;
echo '<div class="status-state status-state--' . $status['value'] . '">' . $status['label'] . '</div>';
}
if ($column == 'metiers') {
$artisan = get_field('artisan', $post_id);
$terms = get_the_terms($post_id, 'metiers');
if ($terms) {
$parent_terms = array_filter($terms, function ($term) {
@ -168,7 +221,6 @@ function metiers_patrimoine_artisans_handle_posts_custom_columns($column)
// }
echo '<div class="admin-column-metiers-container">';
foreach ($terms as $term) {
// write_log($term);
echo '<a href="' . get_edit_term_link($term->term_id, 'metiers', 'artisans') . '" class="admin-column-taxonomy-term">';
echo esc_html($term->name);
echo '</a>';
@ -178,15 +230,45 @@ function metiers_patrimoine_artisans_handle_posts_custom_columns($column)
echo '<p class="no-results"> × </p>';
}
}
if ($column == 'elements') {
$terms = get_the_terms($post_id, 'elementsbatiments');
if ($terms) {
$parent_terms = array_filter($terms, function ($term) {
return $term->parent == 0;
});
echo '<div class="admin-column-metiers-container">';
foreach ($terms as $term) {
echo '<a href="' . get_edit_term_link($term->term_id, 'metiers', 'artisans') . '" class="admin-column-taxonomy-term">';
echo esc_html($term->name);
echo '</a>';
}
echo '</div >';
} else {
echo '<p class="no-results"> × </p>';
}
}
if ($column == 'lastmodified') {
// $last_modified_date = get_the_modified_date('j F Y \à H:i', $post_id);
$last_modified_date = get_the_modified_date('d/m/Y', $post_id);
if (!$last_modified_date) return;
echo $last_modified_date;
}
if ($column == 'onlinedate') {
$published_date = get_the_date('d/m/Y', $post_id);
if (!$published_date) return;
echo $published_date;
}
}
add_action('manage_artisans_posts_custom_column', 'metiers_patrimoine_artisans_handle_posts_custom_columns', 10, 2);
/* -------------------------------------------
CREATION DU DROPDOWN SELECT AVEC LES OPTIONS
---------------------------------------------*/
/* ----------------------------------------------------------------------
GESTION DDU FILTRAGES PAR METIERS
------------------------------------------------------------------------*/
// **** CREATION DU DROPDOWN SELECT AVEC LES OPTIONS
function metiers_patrimoine_filter_posts_per_metiers_declare_dropdown()
{
global $pagenow;
@ -218,11 +300,7 @@ function metiers_patrimoine_filter_posts_per_metiers_declare_dropdown()
}
add_action('restrict_manage_posts', 'metiers_patrimoine_filter_posts_per_metiers_declare_dropdown');
/* ------------------------------------------------------
FILTRAGE DES POSTS QUAND LA QUERY DE FILTER EST ENVOYEE
--------------------------------------------------------*/
// **** FILTRAGE DES POSTS QUAND LA QUERY DE FILTER EST ENVOYEE
function metiers_patrimoine_filter_post_by_metiers_query($query)
{
global $pagenow;

View File

@ -8,12 +8,64 @@ body.post-type-artisans {
}
}
.post-type-artisans #title {
/* width: 220px; */
}
.post-type-artisans #icl_translations {
width: 40px;
}
.post-type-artisans {
.status-state {
@apply font-medium !rounded-2xl px-2 py-2 w-fit mx-auto;
&--ok {
@apply text-green-700;
}
&--deleted {
@apply text-rose-700;
}
&--to_actualize {
@apply text-amber-600;
}
&--waiting_feedback,
&--new_artisan_to_contact {
@apply text-sky-600;
}
&--being_updated {
@apply text-cyan-600;
}
&--rejected {
@apply text-slate-600;
/* filter: saturate(20%); */
}
}
}
@media screen and (max-width: 1600px) {
#conseiller,
#status,
#lastmodified,
#onlinedate,
.column-lastmodified,
.column-conseiller,
.column-onlinedate,
.column-status {
@apply text-center;
}
#lastmodified,
#onlinedate,
#conseiller {
width: 100px;
}
#status {
width: 140px;
}
}
.iedit.type-artisans.hentry {
.column-title:has(strong > a) {
color: transparent;
.post-state {
@apply px-3 py-1 rounded-2xl font-medium text-xs border border-solid;
@apply px-3 py-1 rounded-2xl font-medium text-xs border border-solid inline-block w-fit;
}
}
}
@ -140,6 +192,9 @@ body.post-type-artisans {
.admin-artisan-title {
@apply text-patrimoine-sante-securite !font-semibold !text-2xl;
}
.last-updated {
@apply text-neutral-500 !text-xs my-0;
}
.edit-post-visual-editor__post-title-wrapper {
h1 {
@ -339,8 +394,9 @@ ul.striped > :nth-child(odd) {
@apply flex flex-wrap gap-2;
}
.column-elements .no-results,
.column-metiers .no-results {
@apply text-neutral-400;
@apply text-neutral-400 pl-2;
}
#rank-math-seo-filter {
@ -378,3 +434,11 @@ ul.striped > :nth-child(odd) {
}
}
}
#major-publishing-actions {
@apply !bg-neutral-50;
}
.misc-pub-section.rank-math-seo-score {
@apply !hidden;
}

View File

@ -9,6 +9,7 @@
@import './base/cta.css';
@import './base/tags.css';
@import './base/filters.css';
@import './base/inputs.css';
/* EDITOR CONTENT */
@import './editor-content/color-scheme.css';

View File

@ -0,0 +1,29 @@
input[type='radio'] {
@apply border-2 border-neutral-800 rounded-full w-5 h-5 grid;
-webkit-appearance: none;
appearance: none;
margin: 0;
font: inherit;
box-sizing: border-box; /* Assurez-vous que les dimensions incluent la bordure */
place-content: center;
transform: translateY(-1px); /* Ajustez avec un pixel entier */
&:checked {
@apply border-neutral-900;
}
}
input[type='radio']::before {
content: '';
width: 10px; /* Taille adaptée sans valeurs fractionnées */
height: 10px; /* Taille adaptée sans valeurs fractionnées */
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
transform: scale(0);
transform-origin: bottom left;
transition: 120ms transform ease-in-out;
box-shadow: inset 1em 1em #171717 !important;
}
input[type='radio']:checked::before {
transform: scale(1); /* Passez à une échelle entière */
}

View File

@ -1,5 +1,5 @@
.highlighted-purple {
@apply font-bold underline underline-offset-4;
@apply font-bold underline-offset-4;
}
.artisans-posts {
@ -34,6 +34,14 @@
.posts-results-count {
@apply shrink-0;
}
input[type='radio'] {
@apply shrink-0 mt-2;
}
input[type='radio']:before {
box-shadow: inset 1em 1em #8b2ff7;
}
&__results-indications {
@apply flex gap-1 items-center flex-wrap;
.results-count {
@ -85,6 +93,7 @@
h4 {
@apply my-0;
}
.checkbox-choice {
@apply pl-0 pt-1;
@apply flex flex-wrap;
@ -150,7 +159,7 @@
@apply block !text-neutral-400 font-normal uppercase !text-base tracking-wider mb-4;
}
.search-radio-card {
@apply bg-white rounded-lg p-4 shadowed flex justify-between cursor-pointer;
@apply bg-white rounded-lg p-4 pr-6 shadowed flex items-center justify-between cursor-pointer;
label {
@apply font-bold;
}

View File

@ -22,15 +22,15 @@
}
}
.artisan_wrapper {
@apply flex gap-10;
@apply lg:flex gap-10;
}
aside {
@apply max-w-sm shrink-0;
@apply lg:max-w-sm shrink-0;
}
.artisans-post {
&__section {
@apply !mb-12;
@apply !mb-12 pt-12 lg:pt-0;
}
&__section-title {
@apply text-3xl font-bold !m-0 pb-3;

View File

@ -2,6 +2,9 @@
@apply bg-white rounded-2xl p-8 border border-neutral-200 mt-6;
@apply flex flex-col gap-8 items-start;
&--empty {
@apply hidden;
}
&__titling {
@apply flex items-center gap-4;

View File

@ -9,14 +9,13 @@ $elementsBatimentsTerms = get_the_terms($postID, 'elementsbatiments');
$metiersTerms = get_the_terms($postID, 'metiers');
$hasEmptyTaxos = (empty($elementsBatimentsTerms) && empty($metiersTerms)) ? 'card-taxonomies--empty' : '';
?>
<article class="card-taxonomies">
<article class="card-taxonomies <?php echo $hasEmptyTaxos; ?>">
<?php if ($elementsBatimentsTerms): ?>
<div class="card-taxonomies__taxo-container card-taxonomies__taxo-elementsbatiments">
<div class="card-taxonomies__titling">
<img class="card-taxonomies__icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/pictogrammes/Homegrade_repertoire-elements.svg' ?>" alt=''>
<h4 class="card-taxonomies__title"><?php echo __("Éléments du bâtiment", "metiers-patrimoine-theme") ?></h4>
@ -41,5 +40,4 @@ $metiersTerms = get_the_terms($postID, 'metiers');
</div>
</div>
<?php endif; ?>
</article>