From c8bc45bb49eb5b6b9536f256e52ec425d8447551 Mon Sep 17 00:00:00 2001 From: "stephen@cubedesigners.com" Date: Wed, 6 Apr 2022 11:49:56 +0000 Subject: [PATCH] Wait #5113 @11 --- mdryvescouzy.com/wp-config.php | 4 +- .../wp-content/mu-plugins/cube-loader.php | 30 +++ .../wp-content/mu-plugins/cube/composer.json | 15 ++ .../wp-content/mu-plugins/cube/composer.lock | 204 ++++++++++++++++++ .../mu-plugins/cube/resources/jobs.php | 66 ++++++ .../mu-plugins/cube/src/CPT/Jobs.php | 167 ++++++++++++++ .../mu-plugins/cube/src/Common/Setup.php | 21 ++ .../wp-content/mu-plugins/cube/src/Init.php | 42 ++++ .../includes/theme-scripts.php | 5 +- .../YvesCouzy/images/up-arrows-white.png | Bin 0 -> 119 bytes .../themes/YvesCouzy/js/job-offers.js | 9 + .../themes/YvesCouzy/main-style.css | 97 +++++++++ .../wp-content/themes/YvesCouzy/style.less | 146 +++++++++++++ 13 files changed, 801 insertions(+), 5 deletions(-) create mode 100644 mdryvescouzy.com/wp-content/mu-plugins/cube-loader.php create mode 100644 mdryvescouzy.com/wp-content/mu-plugins/cube/composer.json create mode 100644 mdryvescouzy.com/wp-content/mu-plugins/cube/composer.lock create mode 100644 mdryvescouzy.com/wp-content/mu-plugins/cube/resources/jobs.php create mode 100644 mdryvescouzy.com/wp-content/mu-plugins/cube/src/CPT/Jobs.php create mode 100644 mdryvescouzy.com/wp-content/mu-plugins/cube/src/Common/Setup.php create mode 100644 mdryvescouzy.com/wp-content/mu-plugins/cube/src/Init.php create mode 100644 mdryvescouzy.com/wp-content/themes/YvesCouzy/images/up-arrows-white.png create mode 100644 mdryvescouzy.com/wp-content/themes/YvesCouzy/js/job-offers.js diff --git a/mdryvescouzy.com/wp-config.php b/mdryvescouzy.com/wp-config.php index 4c7974e0..321422ef 100644 --- a/mdryvescouzy.com/wp-config.php +++ b/mdryvescouzy.com/wp-config.php @@ -75,8 +75,6 @@ define('WP_DEBUG', false); define( 'WP_POST_REVISIONS', 5 ); -define( 'AUTOMATIC_UPDATER_DISABLED', true ); - /* C'est tout, ne touchez pas à ce qui suit ! Bon blogging ! */ /** Chemin absolu vers le dossier de WordPress. */ @@ -84,4 +82,4 @@ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); /** Réglage des variables de WordPress et de ses fichiers inclus. */ -require_once(ABSPATH . 'wp-settings.php'); \ No newline at end of file +require_once(ABSPATH . 'wp-settings.php'); diff --git a/mdryvescouzy.com/wp-content/mu-plugins/cube-loader.php b/mdryvescouzy.com/wp-content/mu-plugins/cube-loader.php new file mode 100644 index 00000000..58162e95 --- /dev/null +++ b/mdryvescouzy.com/wp-content/mu-plugins/cube-loader.php @@ -0,0 +1,30 @@ +=5.3" + }, + "require-dev": { + "mockery/mockery": "^0.9.7", + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Carbon_Fields\\": "core/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-only" + ], + "authors": [ + { + "name": "htmlBurger", + "email": "wordpress@htmlburger.com", + "homepage": "https://htmlburger.com/", + "role": "Developer" + }, + { + "name": "Miroslav Mitev", + "email": "mmitev.2create@gmail.com", + "role": "Developer" + }, + { + "name": "Atanas Angelov", + "email": "atanas.angelov.dev@gmail.com", + "role": "Developer" + }, + { + "name": "Georgi Stoyanov", + "email": "stoyanov.gs@gmail.com", + "role": "Developer" + }, + { + "name": "Plamen Kostadinov", + "email": "pkostadinov.2create@gmail.com", + "homepage": "http://plasmen.info/", + "role": "Developer" + }, + { + "name": "Stanimir Panchev", + "email": "Stan4omir@gmail.com", + "role": "Developer" + }, + { + "name": "Marin Atanasov", + "email": "contact@marinatanasov.com", + "homepage": "http://marinatanasov.com/", + "role": "Developer" + }, + { + "name": "Siyan Panayotov", + "homepage": "http://siyanpanayotov.com/", + "role": "Developer" + }, + { + "name": "Peter Petrov", + "email": "peter.petrov89@gmail.com", + "role": "Developer" + }, + { + "name": "Stanimir Stoyanov", + "email": "stanimir.k.stoyanov@gmail.com", + "role": "Developer" + }, + { + "name": "Kaloyan Ivanov", + "email": "kaloyanxivanov@gmail.com", + "homepage": "http://vilepixels.com/", + "role": "Developer" + }, + { + "name": "Georgi Popov", + "homepage": "http://magadanski.com/", + "role": "Developer" + }, + { + "name": "German Velchev", + "email": "germozy@gmail.com", + "role": "Developer" + }, + { + "name": "Rashko Petrov", + "email": "brutalenemy666@gmail.com", + "homepage": "http://errorfactory.com/", + "role": "Developer" + }, + { + "name": "Alexander Panayotov", + "email": "alexander.panayotov@gmail.com", + "homepage": "http://alexanderpanayotov.com/", + "role": "Developer" + }, + { + "name": "Viktor Vasilev", + "email": "liberalcho@gmail.com", + "role": "Developer" + }, + { + "name": "Georgi Georgiev", + "email": "george.georgiev96@gmail.com", + "role": "Developer" + }, + { + "name": "Atanas Vasilev", + "email": "atanasvasilev91@gmail.com", + "role": "Developer" + } + ], + "description": "WordPress developer-friendly custom fields for post types, taxonomy terms, users, comments, widgets, options and more.", + "homepage": "http://carbonfields.net/", + "support": { + "docs": "http://carbonfields.net/docs/", + "email": "wordpress@htmlburger.com", + "issues": "https://github.com/htmlburger/carbon-fields/issues", + "source": "https://github.com/htmlburger/carbon-fields" + }, + "time": "2021-04-22T13:24:34+00:00" + }, + { + "name": "jjgrainger/posttypes", + "version": "2.1", + "source": { + "type": "git", + "url": "https://github.com/jjgrainger/PostTypes.git", + "reference": "a87584606e9ef726f7621c1d71a184fdf7282172" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jjgrainger/PostTypes/zipball/a87584606e9ef726f7621c1d71a184fdf7282172", + "reference": "a87584606e9ef726f7621c1d71a184fdf7282172", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "8.*", + "squizlabs/php_codesniffer": "3.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "PostTypes\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joe Grainger", + "email": "hello@jjgrainger.co.uk", + "homepage": "https://jjgrainger.co.uk" + } + ], + "description": "Simple WordPress custom post types.", + "homepage": "https://github.com/jjgrainger/posttype", + "support": { + "issues": "https://github.com/jjgrainger/PostTypes/issues", + "source": "https://github.com/jjgrainger/PostTypes/tree/v2.1" + }, + "time": "2020-04-12T13:01:12+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.1.0" +} diff --git a/mdryvescouzy.com/wp-content/mu-plugins/cube/resources/jobs.php b/mdryvescouzy.com/wp-content/mu-plugins/cube/resources/jobs.php new file mode 100644 index 00000000..bd98ff4c --- /dev/null +++ b/mdryvescouzy.com/wp-content/mu-plugins/cube/resources/jobs.php @@ -0,0 +1,66 @@ + + +

Il n'y a pas d'offres d'emploi actuellement.

+ +
+ +
+
+
+ post_title ?> +
+
+ contract_type ?> +
+
+ post_date)) ?> +
+
+ +
+
+ +
+
+ + + diff --git a/mdryvescouzy.com/wp-content/mu-plugins/cube/src/CPT/Jobs.php b/mdryvescouzy.com/wp-content/mu-plugins/cube/src/CPT/Jobs.php new file mode 100644 index 00000000..9fd2a456 --- /dev/null +++ b/mdryvescouzy.com/wp-content/mu-plugins/cube/src/CPT/Jobs.php @@ -0,0 +1,167 @@ + 'job-offer', + 'singular' => "Offre d'emploi", + 'plural' => "Offres d'emploi", + 'slug' => 'emplois' + ]; + + // Jobs are not like normal posts since we only want to use them to build the job listing widget + // Ref: https://wordpress.stackexchange.com/a/108658 + protected $post_type_options = [ + 'public' => false, // it's not public, so it shouldn't have its own permalink (used only to build jobs list) + 'publicly_queryable' => true, // still needs to be queryable + 'show_ui' => true, // editable in wp-admin + 'exclude_from_search' => true, + 'show_in_nav_menus' => false, // don't allow jobs to be added to menus + 'has_archive' => false, // it shouldn't have archive page + 'rewrite' => false, // it shouldn't have rewrite rules + ]; + + + public function register() { + + // Initialise custom post type + $jobs = new PostType($this->post_type, $this->post_type_options); + $jobs->icon('dashicons-groups'); + $jobs->register(); + + // Register custom fields + add_action('carbon_fields_register_fields', [$this, 'fields']); + + // Register [jobs-listing] shortcode + add_shortcode('jobs-listing', [$this, 'shortcode']); + + // Set default content for editor to provide a flexible template + add_filter('default_content', function($content, $post) { + if ($post->post_type == $this->post_type['name']) { + $content = '

Description du poste

+ ... +

Notre établissement

+ ... +

Missions

+ '; + } + + return $content; + }, 10, 2); + + + } + + public function fields() { + + Container::make('post_meta', "Détails de l'offre d'emploi") + ->where('post_type', '=', $this->post_type['name']) + ->add_fields( + [ + Field::make('text', 'contract_type', __('Type de contrat')) + ->set_attribute('placeholder', 'ex. CDI, CDD, Temps partiel...'), + + Field::make('complex', 'job_details', __('Informations')) + ->add_fields([ + Field::make('text', 'title', __('Intitulé')), + Field::make('textarea', 'details', __('Précisions'))->set_rows(3), + ])->set_header_template('<%- title %>') + ->set_default_value([ // Pre-populate repeater + [ + 'title' => 'Votre profile', + 'details' => '', + ], + [ + 'title' => 'Votre formation', + 'details' => '', + ], + [ + 'title' => 'Expérience', + 'details' => '', + ], + [ + 'title' => 'Remunération', + 'details' => '', + ], + ]), + ] + ); + } + + + /** + * Shortcode handler for [jobs-listing] + * @param array $attributes + * @return string + */ + function shortcode($attributes) { + + wp_enqueue_script('job-offers', get_theme_file_uri('js/job-offers.js'), ['jquery'], null, true); + + extract(shortcode_atts([ + 'limit' => '', // Max items to return + ], $attributes)); + + // Prepare WordPress post query arguments + $args = [ + //'post__not_in' => [get_the_ID()] + ]; + + // Allow limiting of posts + if (!empty($limit)) { + $args['posts_per_page'] = (int) $limit; + } + + $jobs = $this->fetch($args); + + // TODO: find a cleaner way of doing this. Ideally with Acorn + proper blade templates + include(dirname(__FILE__) . '/../../resources/jobs.php'); + } + + /** + * Fetch all job-offer posts + * @return array + */ + public function fetch($overrides = array(), $get_meta = true, $get_terms = false) { + + $defaults = [ + 'post_type' => $this->post_type['name'], + 'post_status' => 'publish', + 'posts_per_page' => -1, + 'suppress_filters' => false, // Ensure WPML filters work (see: https://codex.wordpress.org/Template_Tags/get_posts#Parameters) + ]; + + $args = array_merge($defaults, $overrides); + + $posts = get_posts($args); + + // Is this just a simple fetch or do we need to get all the metadata? + if (!$get_meta) { + return $posts; + } + + // Fetch meta and terms + $jobs = []; + + foreach ($posts as $post) { + + $post->contract_type = carbon_get_post_meta($post->ID, 'contract_type'); + $post->job_details = carbon_get_post_meta($post->ID, 'job_details'); + + $jobs[$post->ID] = $post; + } + + return $jobs; + } + +} diff --git a/mdryvescouzy.com/wp-content/mu-plugins/cube/src/Common/Setup.php b/mdryvescouzy.com/wp-content/mu-plugins/cube/src/Common/Setup.php new file mode 100644 index 00000000..d0777757 --- /dev/null +++ b/mdryvescouzy.com/wp-content/mu-plugins/cube/src/Common/Setup.php @@ -0,0 +1,21 @@ +register(); + } + } + } + + /** + * @param class $class Class from the services array + * @return class instance New instance of the class + */ + private static function instantiate($class) { + return new $class(); + } +} diff --git a/mdryvescouzy.com/wp-content/themes/CherryFramework/includes/theme-scripts.php b/mdryvescouzy.com/wp-content/themes/CherryFramework/includes/theme-scripts.php index 5b66fd8c..adb10c6b 100644 --- a/mdryvescouzy.com/wp-content/themes/CherryFramework/includes/theme-scripts.php +++ b/mdryvescouzy.com/wp-content/themes/CherryFramework/includes/theme-scripts.php @@ -74,7 +74,8 @@ add_action('wp_enqueue_scripts', 'cherry_scripts'); function cherry_stylesheets() { if ( CURRENT_THEME != 'cherry' ) { if ( file_exists( CHILD_DIR . '/main-style.css' ) ) { - wp_enqueue_style( CURRENT_THEME, CHILD_URL . '/main-style.css', false, null, 'all' ); + $cache_buster = filemtime(CHILD_DIR . '/main-style.css'); + wp_enqueue_style( CURRENT_THEME, CHILD_URL . '/main-style.css', false, $cache_buster, 'all' ); } if ( file_exists( CHILD_DIR . '/includes/widgets/my-flickr-widget.php' ) ) { @@ -99,4 +100,4 @@ function tz_admin_js($hook) { } } add_action('admin_enqueue_scripts', 'tz_admin_js', 10, 1); -?> \ No newline at end of file +?> diff --git a/mdryvescouzy.com/wp-content/themes/YvesCouzy/images/up-arrows-white.png b/mdryvescouzy.com/wp-content/themes/YvesCouzy/images/up-arrows-white.png new file mode 100644 index 0000000000000000000000000000000000000000..71785419d20642cd851226a099bb7d12cd6898af GIT binary patch literal 119 zcmeAS@N?(olHy`uVBq!ia0vp^Ahr+(3y?gqul)d!vh#Ft45_%4oY2tppY^}AM8LuS zE&mlJG-$Ty^r)~1w{fc~MDU!rm2ik>g_uK&W7Fr0cMmpbv52|tDA%x(V>lVP{_jJh SL+(J67(8A5T-G@yGywqhbSEhQ literal 0 HcmV?d00001 diff --git a/mdryvescouzy.com/wp-content/themes/YvesCouzy/js/job-offers.js b/mdryvescouzy.com/wp-content/themes/YvesCouzy/js/job-offers.js new file mode 100644 index 00000000..67206545 --- /dev/null +++ b/mdryvescouzy.com/wp-content/themes/YvesCouzy/js/job-offers.js @@ -0,0 +1,9 @@ +// Slide open job details +jQuery(document).on('click', '.job-offer-header', function() { + jQuery(this).parents('.job-offer').find('.job-offer-content').slideToggle(); +}); + +// Retour / close panel +jQuery(document).on('click', '.job-offer-button-collapse', function() { + jQuery(this).parents('.job-offer-content').slideToggle(); +}); diff --git a/mdryvescouzy.com/wp-content/themes/YvesCouzy/main-style.css b/mdryvescouzy.com/wp-content/themes/YvesCouzy/main-style.css index 8f0f51c9..f556f93d 100644 --- a/mdryvescouzy.com/wp-content/themes/YvesCouzy/main-style.css +++ b/mdryvescouzy.com/wp-content/themes/YvesCouzy/main-style.css @@ -6,8 +6,22 @@ html, body { body { color:#787878; min-width:1000px; + overflow-x:hidden; } a, a:hover, a:focus { color:#787878; } +hr { + height:1px; + background:#d8d8d8; + border:0; +} +.force-full-width { + width:100vw; + position:relative; + left:50%; + right:50%; + margin-left:-50vw; + margin-right:-50vw; +} .hr { border-bottom:1px solid #d8d8d8; width:100%; @@ -326,6 +340,89 @@ a, a:hover, a:focus { color:#787878; } } .html5gallery-elem-img-0 a > div { display:none !important; } .page-id-26 #custom_page_sidebar_3 { margin-top:1278px; } +.job-offer-header { + display:flex; + align-items:center; + color:#6e6e6e; + font-family:'Open Sans', sans-serif; + cursor:pointer; +} +.job-offer-title { + font-size:20px; + font-weight:600; + flex-basis:46%; +} +.job-offer-contract, .job-offer-date, .job-offer-cta { flex-basis:18%; } +.job-offer-date { text-align:center; } +.job-offer-cta { + display:flex; + justify-content:flex-end; +} +.job-offer-button { + appearance:none; + border:0; + color:#fff; + font-weight:600; + text-transform:uppercase; + background-color:#9cc12a; + padding:0.75em; + font-size:1em; + text-align:center; + display:inline-flex; + align-items:center; + justify-content:center; + min-width:136px; +} +.job-offer-button img { margin-right:0.75em; } +.job-offer-content { + position:relative; + padding-top:3em; + margin-bottom:3em; +} +.job-offer-content h2 { + color:#8daa34; + font-family:'Roboto Slab', serif; + font-size:24px; + font-weight:400; + line-height:1; + margin-bottom:0.75em; +} +.job-offer-content h2:not(:first-child) { margin-top:2em; } +.job-offer-content p { margin-bottom:0; } +.job-offer-content p:not(:last-child) { margin-bottom:1.5em; } +.job-offer-content-sidebar { padding-bottom:4em; } +.job-offer-content-sidebar > * + * { margin-top:1px; } +.job-offer-content-sidebar-detail { + background-color:#9cc12a; + color:#fff; + padding:30px 35px; + font-weight:300; +} +.job-offer-content-sidebar-detail h4 { + color:#fff; + font-family:'Roboto Slab', serif; + font-size:24px; + font-weight:400; + margin-top:0; + margin-bottom:0.75em; +} +.job-offer-apply > * + * { margin-top:0.75em; } +.job-offer-apply a, .job-offer-apply a:hover, .job-offer-apply a:focus { + font-weight:600; + text-decoration:none; +} +.job-offer-apply i.fa { + font-size:25px; + width:1em; + text-align:center; + margin-right:0.4em; + vertical-align:middle; +} +.job-offer-button-collapse { + position:absolute; + right:0; + bottom:0; +} .page-id-36 .content-holder { padding-bottom:0; } input[type="text"], input[type="email"], textarea, .btn { border-radius:0; diff --git a/mdryvescouzy.com/wp-content/themes/YvesCouzy/style.less b/mdryvescouzy.com/wp-content/themes/YvesCouzy/style.less index ca419286..fed96f60 100644 --- a/mdryvescouzy.com/wp-content/themes/YvesCouzy/style.less +++ b/mdryvescouzy.com/wp-content/themes/YvesCouzy/style.less @@ -18,6 +18,7 @@ body { body { color: #787878; min-width: 1000px; + overflow-x: hidden; } a, @@ -26,6 +27,22 @@ a:focus { color: #787878; } +hr { + height: 1px; + background: #d8d8d8; + border: 0; +} + +// Extend an element to full screen width outside its container +.force-full-width { + width: 100vw; + position: relative; + left: 50%; + right: 50%; + margin-left: -50vw; + margin-right: -50vw; +} + .hr { border-bottom: 1px solid #d8d8d8; width: 100%; @@ -557,6 +574,135 @@ a:focus { margin-top: 1278px; } +/* OFFRES D'EMPLOI PAGE */ +.job-offer { + + &-header { + display: flex; + align-items: center; + color: #6e6e6e; + font-family: 'Open Sans', sans-serif; + cursor: pointer; + } + + &-title { + font-size: 20px; + font-weight: 600; + flex-basis: 46%; + } + + &-contract, &-date, &-cta { + flex-basis: 18%; + } + + &-date { + text-align: center; + } + + &-cta { + display: flex; + justify-content: flex-end; + } + + &-button { + appearance: none; + border: 0; + color: #fff; + font-weight: 600; + text-transform: uppercase; + background-color: #9cc12a; + padding: 0.75em; + font-size: 1em; + text-align: center; + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 136px; + + img { + margin-right: 0.75em; + } + } + + &-content { + position: relative; + padding-top: 3em; + margin-bottom: 3em; + + h2 { + color: #8daa34; + font-family: 'Roboto Slab', serif; + font-size: 24px; + font-weight: 400; + line-height: 1; + margin-bottom: 0.75em; + + &:not(:first-child) { + margin-top: 2em; + } + } + + p { + margin-bottom: 0; + + &:not(:last-child) { + margin-bottom: 1.5em; + } + } + + &-sidebar { + padding-bottom: 4em; // Space for ^ Retour button + + > * + * { // Spacing between child elements + margin-top: 1px; + } + + &-detail { + background-color: #9cc12a; + color: #fff; + padding: 30px 35px; + font-weight: 300; + + h4 { + color: #fff; + font-family: 'Roboto Slab', serif; + font-size: 24px; + font-weight: 400; + margin-top: 0; + margin-bottom: 0.75em; + } + } + } + + } + + &-apply { + + > * + * { + margin-top: 0.75em; + } + + a, a:hover, a:focus { + font-weight: 600; + text-decoration: none; + } + + i.fa { + font-size: 25px; + width: 1em; + text-align: center; + margin-right: 0.4em; + vertical-align: middle; + } + } + + &-button-collapse { + position: absolute; + right: 0; + bottom: 0; + } +} + /* CONTACT PAGE */ .page-id-36 .content-holder { padding-bottom: 0; -- 2.39.5