Compare commits
No commits in common. "e3be26b295c1d787fa0b172c530e4870f1e02fe0" and "2a6018e35d3b14b47a05c9a3c135ca8a72d0b08b" have entirely different histories.
e3be26b295
...
2a6018e35d
|
|
@ -59,7 +59,7 @@ function update_post_status_based_on_mdp_status($post_id)
|
||||||
add_action('acf/save_post', 'update_post_status_based_on_mdp_status', 20);
|
add_action('acf/save_post', 'update_post_status_based_on_mdp_status', 20);
|
||||||
|
|
||||||
/* ---------------------------------------
|
/* ---------------------------------------
|
||||||
CUSTOM TOP CONTENT AFTER POST TYPE TITLE
|
CUSTOM CONTENT AFTER POST TYPE TITLE
|
||||||
------------------------------------------*/
|
------------------------------------------*/
|
||||||
add_action('edit_form_after_title', function () {
|
add_action('edit_form_after_title', function () {
|
||||||
$screen = get_current_screen();
|
$screen = get_current_screen();
|
||||||
|
|
|
||||||
|
|
@ -133,60 +133,11 @@ add_action('edit_form_after_title', function () {
|
||||||
$return_to = isset($_GET['return_to']) ? $_GET['return_to'] : '';
|
$return_to = isset($_GET['return_to']) ? $_GET['return_to'] : '';
|
||||||
$edit_artisan_link = get_edit_post_link($linked_artisan_id);
|
$edit_artisan_link = get_edit_post_link($linked_artisan_id);
|
||||||
?>
|
?>
|
||||||
<div id="post-custom-superior-toolbar">
|
<?php if ($return_to) : ?>
|
||||||
<?php if ($return_to) : ?>
|
<a href="<?php echo esc_url($return_to) ?>" class="edit-fiche-artisan-link"><img src='<?php echo get_stylesheet_directory_uri() . '/resources/img/icons/tools.svg' ?>' /> Voir la fiche de l'artisan </a>
|
||||||
<a href="<?php echo esc_url($return_to) ?>" class="edit-fiche-artisan-link"><img src='<?php echo get_stylesheet_directory_uri() . '/resources/img/icons/tools.svg' ?>' /> Voir la fiche de l'artisan </a>
|
<?php elseif ($linked_artisan_id) : ?>
|
||||||
<?php elseif ($linked_artisan_id) : ?>
|
<a href="<?php echo esc_url($edit_artisan_link) ?>" class="edit-fiche-artisan-link"><img src='<?php echo get_stylesheet_directory_uri() . '/resources/img/icons/tools.svg' ?>' /> Voir la fiche de l'artisan </a>
|
||||||
<a href="<?php echo esc_url($edit_artisan_link) ?>" class="edit-fiche-artisan-link"><img src='<?php echo get_stylesheet_directory_uri() . '/resources/img/icons/tools.svg' ?>' /> Voir la fiche de l'artisan </a>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
|
||||||
<div id="save-post-custom">
|
|
||||||
<button class="">Sauvegarder</button>
|
|
||||||
<span class="spinner"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
jQuery(function($) {
|
|
||||||
$('#save-post-custom').on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
const $button = $(this.querySelector('button'));
|
|
||||||
const $spinner = $(this.querySelector('.spinner'));
|
|
||||||
|
|
||||||
// Désactiver le bouton et changer le texte
|
|
||||||
$button.prop('disabled', true).text('Sauvegarde en cours...');
|
|
||||||
$spinner.show();
|
|
||||||
$spinner.addClass('is-active');
|
|
||||||
|
|
||||||
// Déclencher la sauvegarde
|
|
||||||
$('#publish').trigger('click');
|
|
||||||
|
|
||||||
// Vérifier les erreurs ACF après un court délai
|
|
||||||
setTimeout(function() {
|
|
||||||
// Vérifier s'il y a des messages d'erreur ACF
|
|
||||||
if ($('.acf-notice.-error').length > 0) {
|
|
||||||
// Réinitialiser le bouton immédiatement si une erreur est détectée
|
|
||||||
$button.prop('disabled', false).text('Sauvegarder');
|
|
||||||
$spinner.hide();
|
|
||||||
$spinner.removeClass('is-active');
|
|
||||||
}
|
|
||||||
}, 2000);
|
|
||||||
|
|
||||||
// Réactiver le bouton et restaurer le texte après un délai plus long
|
|
||||||
// (ceci ne s'exécutera que si la page n'est pas rechargée)
|
|
||||||
setTimeout(function() {
|
|
||||||
$button.prop('disabled', false).text('Sauvegarder');
|
|
||||||
$spinner.hide();
|
|
||||||
$spinner.removeClass('is-active');
|
|
||||||
}, 20000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------
|
|
||||||
CUSTOM TOP CONTENT AFTER POST TYPE TITLE
|
|
||||||
------------------------------------------*/
|
|
||||||
|
|
|
||||||
|
|
@ -31,24 +31,6 @@ function create_conseiller_role()
|
||||||
}
|
}
|
||||||
add_action('init', 'create_conseiller_role');
|
add_action('init', 'create_conseiller_role');
|
||||||
|
|
||||||
/* -----------------------------------------------------------
|
|
||||||
Ajouter la capacité export_artisans_datas aux administrateurs et éditeurs
|
|
||||||
-----------------------------------------------------------*/
|
|
||||||
function add_export_artisans_capability()
|
|
||||||
{
|
|
||||||
// Ajouter la capacité à l'administrateur
|
|
||||||
$admin_role = get_role('administrator');
|
|
||||||
if ($admin_role) {
|
|
||||||
$admin_role->add_cap('export_artisans_datas');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ajouter la capacité à l'éditeur
|
|
||||||
$editor_role = get_role('editor');
|
|
||||||
if ($editor_role) {
|
|
||||||
$editor_role->add_cap('export_artisans_datas');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
add_action('init', 'add_export_artisans_capability');
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------
|
/* -----------------------------------------------------------
|
||||||
Masquer les widgets du tableau de bord pour le rôle conseiller
|
Masquer les widgets du tableau de bord pour le rôle conseiller
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,10 @@ body.post-type-artisans {
|
||||||
/* border-top: 1px solid rgba(255, 255, 255, 0.15) !important; */
|
/* border-top: 1px solid rgba(255, 255, 255, 0.15) !important; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toplevel_page_tm-menu-main {
|
||||||
|
@apply hidden;
|
||||||
|
}
|
||||||
|
|
||||||
#menu-pages + .wp-menu-separator {
|
#menu-pages + .wp-menu-separator {
|
||||||
@apply hidden;
|
@apply hidden;
|
||||||
}
|
}
|
||||||
|
|
@ -352,9 +356,6 @@ body.post-type-artisans {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
#post-custom-superior-toolbar {
|
|
||||||
@apply flex gap-4 items-center pt-2;
|
|
||||||
}
|
|
||||||
#admin_artisan_chantier_list {
|
#admin_artisan_chantier_list {
|
||||||
@apply border border-solid border-neutral-300;
|
@apply border border-solid border-neutral-300;
|
||||||
h3 {
|
h3 {
|
||||||
|
|
@ -389,7 +390,7 @@ body.post-type-artisans {
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-fiche-artisan-link {
|
.edit-fiche-artisan-link {
|
||||||
@apply text-patrimoine-sante-securite !font-semibold flex items-center gap-2;
|
@apply pt-3 text-patrimoine-sante-securite !font-semibold flex items-center gap-2;
|
||||||
img {
|
img {
|
||||||
@apply w-6 h-6 object-contain filter-patrimoine-sante-securite;
|
@apply w-6 h-6 object-contain filter-patrimoine-sante-securite;
|
||||||
}
|
}
|
||||||
|
|
@ -608,7 +609,6 @@ select[data-enpassusermodified='yes'] {
|
||||||
CUSTOMIZATION BASED ON USER ROLE
|
CUSTOMIZATION BASED ON USER ROLE
|
||||||
------------------------------------*/
|
------------------------------------*/
|
||||||
.role-editor {
|
.role-editor {
|
||||||
#toplevel_page_tm-menu-main,
|
|
||||||
.rank-math-lock-modified-date,
|
.rank-math-lock-modified-date,
|
||||||
.misc-pub-curtime,
|
.misc-pub-curtime,
|
||||||
.misc-pub-revisions,
|
.misc-pub-revisions,
|
||||||
|
|
@ -621,16 +621,13 @@ select[data-enpassusermodified='yes'] {
|
||||||
#acfml-field-group-synchronise,
|
#acfml-field-group-synchronise,
|
||||||
#menu-tools,
|
#menu-tools,
|
||||||
#postimagediv,
|
#postimagediv,
|
||||||
#submitdiv,
|
|
||||||
#submitdiv .handle-order-higher,
|
#submitdiv .handle-order-higher,
|
||||||
#submitdiv .handle-order-lower,
|
#submitdiv .handle-order-lower,
|
||||||
#submitdiv #preview-action,
|
#submitdiv #preview-action,
|
||||||
#footer-left,
|
#footer-left,
|
||||||
.tablenav .bulkactions,
|
.tablenav .bulkactions,
|
||||||
.check-column,
|
.check-column,
|
||||||
.row-actions .edit,
|
.row-actions {
|
||||||
.row-actions .view,
|
|
||||||
.row-actions .inline.hide-if-no-js {
|
|
||||||
@apply !hidden;
|
@apply !hidden;
|
||||||
}
|
}
|
||||||
.post-type-artisans #post-body {
|
.post-type-artisans #post-body {
|
||||||
|
|
@ -639,10 +636,8 @@ select[data-enpassusermodified='yes'] {
|
||||||
}
|
}
|
||||||
|
|
||||||
.role-conseiller {
|
.role-conseiller {
|
||||||
#toplevel_page_tm-menu-main,
|
|
||||||
#rank_math_metabox,
|
#rank_math_metabox,
|
||||||
#menu-media,
|
#menu-media,
|
||||||
#submitdiv,
|
|
||||||
#menu-tools,
|
#menu-tools,
|
||||||
#toplevel_page_edit-tags-taxonomy-metiers-post_type-artisans,
|
#toplevel_page_edit-tags-taxonomy-metiers-post_type-artisans,
|
||||||
#toplevel_page_edit-tags-taxonomy-elementsbatiments-post_type-artisans,
|
#toplevel_page_edit-tags-taxonomy-elementsbatiments-post_type-artisans,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user