composer require ldc/web-status-checker-laravel remove Old static status checker Fix ImportMedia WIP commands OK many fixes Fix and try to optimize folder component Fix front icons + actions based on icons Favico front fix alert Fix Media upload on depot fix folder component buttons Full front fix with perf due tu vuejs Download medias Navigate within medias superfix Move media + loader isLocked boolean and remove media fix Folder scroll fix arcadia link color red Fix panier show external Tons of fixes back as front REwrited all
249 lines
7.4 KiB
JavaScript
249 lines
7.4 KiB
JavaScript
import './vue';
|
|
window.axios = require('axios');
|
|
window.axios.defaults.headers.common = {
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
'X-CSRF-TOKEN' : document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
|
};
|
|
|
|
let _ = require('lodash');
|
|
|
|
'use strict';
|
|
|
|
try {
|
|
window.$ = window.jQuery = require('jquery')
|
|
} catch (e) {}
|
|
|
|
jQuery.fn.scrollParent = function() {
|
|
var overflowRegex = /(auto|scroll)/,
|
|
position = this.css( "position" ),
|
|
excludeStaticParent = position === "absolute",
|
|
scrollParent = this.parents().filter( function() {
|
|
var parent = $( this );
|
|
if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
|
|
return false;
|
|
}
|
|
var overflowState = parent.css(["overflow", "overflowX", "overflowY"]);
|
|
return (overflowRegex).test( overflowState.overflow + overflowState.overflowX + overflowState.overflowY );
|
|
}).eq( 0 );
|
|
|
|
return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
|
|
};
|
|
|
|
// ---- Configuration de base des filtres médias
|
|
$(window).data('offset', 0);
|
|
$(window).data('limit', 50);
|
|
$(window).data('currentFolder', 0);
|
|
$(window).data('currentBasket', null);
|
|
$(window).data('filter', {});
|
|
|
|
//confirm popup
|
|
$.fancyConfirm = function( opts ) {
|
|
opts = $.extend( true, {
|
|
title : 'Are you sure?',
|
|
message : '',
|
|
okButton : 'OK',
|
|
noButton : 'Cancel',
|
|
callback : $.noop
|
|
}, opts || {} );
|
|
|
|
$.fancybox.open({
|
|
type : 'html',
|
|
src :
|
|
'<div class="fc-content">' +
|
|
'<h3>' + opts.title + '</h3><hr/>' +
|
|
'<p class="tcenter"><i class="fa fa-question-circle"></i>' +
|
|
opts.message + '</p>' +
|
|
'<hr/><p class="button_bar">' +
|
|
'<a data-value="0" data-fancybox-close class="btn btn-black mr-10 btn-square" >' + opts.noButton + '</a>' +
|
|
'<button data-value="1" data-fancybox-close class="btn btn-square">' + opts.okButton + '</button>' +
|
|
'</p>' +
|
|
'</div>',
|
|
opts : {
|
|
animationDuration : 350,
|
|
animationEffect : 'material',
|
|
modal : true,
|
|
baseTpl :
|
|
'<div class="fancybox-container fc-container" role="dialog" tabindex="-1">' +
|
|
'<div class="fancybox-bg"></div>' +
|
|
'<div class="fancybox-inner">' +
|
|
'<div class="fancybox-stage"></div>' +
|
|
'</div>' +
|
|
'</div>',
|
|
afterClose : function( instance, current, e ) {
|
|
var button = e ? e.target || e.currentTarget : null;
|
|
var value = button ? $(button).data('value') : 0;
|
|
|
|
opts.callback( value );
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
// Message
|
|
$.fancyMessage = function( opts ) {
|
|
opts = $.extend( true, {
|
|
title: 'Are you sure?',
|
|
message: '',
|
|
type: '',
|
|
callback: $.noop
|
|
}, opts || {})
|
|
|
|
return $.fancybox.open({
|
|
type: 'html',
|
|
src:
|
|
'<div class="fc-content ' + opts.type + '">' +
|
|
'<h3>' + opts.title + '</h3><hr/>' +
|
|
`<p class="tcenter">${opts.type == "error" ? '<i class="fa fa-exclamation-triangle"></i></i>' : '<i class="fa fa-info-circle"></i>'}` +
|
|
opts.message + '</p>' +
|
|
'<hr/><p class="button_bar">' +
|
|
'<a data-value="0" data-fancybox-close class="btn btn-square ' +
|
|
(opts.type == "error" ? 'btn-red' : '') + ' " >Ok</a>' +
|
|
'</p>' +
|
|
'</div>',
|
|
opts: {
|
|
afterClose: opts.callback,
|
|
animationDuration: 350,
|
|
animationEffect: 'material',
|
|
modal: false,
|
|
baseTpl:
|
|
'<div class="fancybox-container fc-container high-level" role="dialog" tabindex="-1">' +
|
|
'<div class="fancybox-bg"></div>' +
|
|
'<div class="fancybox-inner">' +
|
|
'<div class="fancybox-stage"></div>' +
|
|
'</div>' +
|
|
'</div>'
|
|
}
|
|
});
|
|
}
|
|
|
|
if (!window.__DAM) {
|
|
window.__DAM = {}
|
|
}
|
|
|
|
if (!window.__DAM.methods) {
|
|
window.__DAM.methods = {}
|
|
}
|
|
// Session TimedOut
|
|
window.__DAM.methods.sessionTimedOut = () => {
|
|
$.fancybox.close();
|
|
$.fancyMessage({
|
|
title: 'Session expirée',
|
|
message: 'Vous allez devoir vous reconnecter pour continuer à utiliser le DAM',
|
|
type: 'error',
|
|
afterClose: () => {
|
|
location.reload()
|
|
}
|
|
});
|
|
}
|
|
|
|
// ---- Header : Menu utilisateur
|
|
$(".userbar").on('click',function(event) {
|
|
$(".submenu").toggle();
|
|
});
|
|
|
|
$(document).mouseup(function(e) {
|
|
|
|
// ---- Masque le menu utilisateur
|
|
var container = $(".userbar");
|
|
if (!container.is(e.target) && container.has(e.target).length === 0) {
|
|
$(".submenu").hide();
|
|
}
|
|
|
|
// ---- Masque le menu des paniers
|
|
var cartMenu = $(".panier_side_menu .panier_menu");
|
|
if (!cartMenu.is(e.target) && cartMenu.has(e.target).length === 0 && $("#menu_panier").has(e.target).length === 0) {
|
|
cartMenu.hide();
|
|
}
|
|
|
|
// ---- Masque les filtres de la bar de recherche
|
|
var filter_list = $(".filter_selector");
|
|
if (!filter_list.is(e.target) && filter_list.has(e.target).length === 0) {
|
|
$(".filter_selector .list").hide();
|
|
}
|
|
|
|
|
|
// ---- déselectionne les éléments si on clique en dehors
|
|
var parentOffset = $('.media_container').parent().offset();
|
|
if ( ($(e.target).hasClass('media_container') && event.pageX- parentOffset.left < $('.media_container')[0]['clientWidth'] ) || $(e.target).hasClass('wrapper')) {
|
|
$(".imageItem").attr("aria-grabbed", "false");
|
|
$(".imageItem").removeClass('flip');
|
|
}
|
|
|
|
});
|
|
|
|
// ---- Header : Ouverture formulaire de contact
|
|
$(".contact_btn").on('click',function(event) {
|
|
event.preventDefault();
|
|
var subjectId = 1;
|
|
subjectId = $(this).attr("data-subjectId");
|
|
|
|
$.fancybox.open({
|
|
src : '#form_contact',
|
|
type : 'inline',
|
|
opts : {
|
|
animationDuration : 350,
|
|
animationEffect : 'material',
|
|
beforeShow : function( instance, current ) {
|
|
$(".form_contact_type").val(subjectId);
|
|
$(".form_contact_check_ko").hide();
|
|
$(".form_contact_ok").hide();
|
|
$(".form_contact_ko").hide();
|
|
$(".form_contact_ko_custom").hide();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
// ---- Header : fermeture de la popup
|
|
$(".close_popup").on('click',function(event) {
|
|
event.preventDefault();
|
|
$.fancybox.close();
|
|
});
|
|
|
|
// ---- Header : envoi formulaire de contact
|
|
$(".form_contact_send").on('click',function(event) {
|
|
event.preventDefault();
|
|
var btn = $(this);
|
|
if($('.form_contact_message').val() == ""){
|
|
$(".form_contact_check_ko").show();
|
|
return false;
|
|
}else{
|
|
$(".form_contact_check_ko").hide();
|
|
}
|
|
btn.addClass('loading');
|
|
$.ajaxSetup({
|
|
headers: {
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
}
|
|
});
|
|
|
|
$.ajax({
|
|
url: '/send-message',
|
|
method: 'POST',
|
|
dataType : 'json',
|
|
data: {
|
|
type: $('.form_contact_type option:selected').val(),
|
|
url: $('.form_contact_url').val(),
|
|
message: $('.form_contact_message').val()
|
|
},
|
|
success: function(result){
|
|
btn.removeClass('loading');
|
|
$(".form_contact_ko_custom").hide();
|
|
$(".form_contact_ko").hide();
|
|
$(".form_contact_ok").show();
|
|
$('.form_contact_url').val('');
|
|
$('.form_contact_message').val('');
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
btn.removeClass('loading');
|
|
$(".form_contact_ko_custom").hide();
|
|
$(".form_contact_ko").hide();
|
|
if (jqXHR.status !== 500 && jqXHR.responseJSON.message) {
|
|
$(".form_contact_ko_custom").text(jqXHR.responseJSON.message).show();
|
|
} else {
|
|
$(".form_contact_ko").show();
|
|
}
|
|
}
|
|
});
|
|
});
|