mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 11:31:26 +01:00
NEW Can select several fields to personalize list before submit.
This commit is contained in:
@@ -6693,8 +6693,10 @@ class Form
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function () {
|
jQuery(document).ready(function () {
|
||||||
$(\'.multiselectcheckbox'.$htmlname.' input[type="checkbox"]\').on(\'click\', function () {
|
$(\'.multiselectcheckbox'.$htmlname.' input[type="checkbox"]\').on(\'click\', function () {
|
||||||
console.log("A new field was added/removed")
|
console.log("A new field was added/removed, we edit field input[name=formfilteraction]");
|
||||||
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\')
|
|
||||||
|
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\'); // Update field so we know we changed something on selected fields after POST
|
||||||
|
|
||||||
var title = $(this).val() + ",";
|
var title = $(this).val() + ",";
|
||||||
if ($(this).is(\':checked\')) {
|
if ($(this).is(\':checked\')) {
|
||||||
$(\'.'.$htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
|
$(\'.'.$htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
|
||||||
@@ -6703,8 +6705,10 @@ class Form
|
|||||||
$(\'.'.$htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
|
$(\'.'.$htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
|
||||||
}
|
}
|
||||||
// Now, we submit page
|
// Now, we submit page
|
||||||
$(this).parents(\'form:first\').submit();
|
//$(this).parents(\'form:first\').submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -7070,7 +7074,6 @@ class Form
|
|||||||
jQuery(".linkto").click(function() {
|
jQuery(".linkto").click(function() {
|
||||||
console.log("We choose to show/hide link for rel="+jQuery(this).attr(\'rel\'));
|
console.log("We choose to show/hide link for rel="+jQuery(this).attr(\'rel\'));
|
||||||
jQuery("#"+jQuery(this).attr(\'rel\')+"list").toggle();
|
jQuery("#"+jQuery(this).attr(\'rel\')+"list").toggle();
|
||||||
jQuery(this).toggle();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -81,13 +81,31 @@ print "});\n";
|
|||||||
// Wrapper to manage dropdown
|
// Wrapper to manage dropdown
|
||||||
if (! defined('JS_JQUERY_DISABLE_DROPDOWN'))
|
if (! defined('JS_JQUERY_DISABLE_DROPDOWN'))
|
||||||
{
|
{
|
||||||
print "\n/* JS CODE TO ENABLE dropdown */\n";
|
print "\n/* JS CODE TO ENABLE dropdown (hamburger, linkto, ...) */\n";
|
||||||
print '
|
print '
|
||||||
jQuery(document).ready(function () {
|
jQuery(document).ready(function () {
|
||||||
|
var lastopendropdown = null;
|
||||||
|
|
||||||
|
// Click onto the link "link to" or "hamburger", toggle dropdown
|
||||||
$(".dropdown dt a").on(\'click\', function () {
|
$(".dropdown dt a").on(\'click\', function () {
|
||||||
console.log("We click on dropdown");
|
console.log("toggle dropdown dt a");
|
||||||
//console.log($(this).parent().parent().find(\'dd ul\'));
|
|
||||||
$(this).parent().parent().find(\'dd ul\').slideToggle(\'fast\');
|
//$(this).parent().parent().find(\'dd ul\').slideToggle(\'fast\');
|
||||||
|
$(this).parent().parent().find(\'dd ul\').toggleClass("open");
|
||||||
|
|
||||||
|
if ($(this).parent().parent().find(\'dd ul\').hasClass("open")) {
|
||||||
|
lastopendropdown = $(this).parent().parent().find(\'dd ul\');
|
||||||
|
//console.log(lastopendropdown);
|
||||||
|
} else {
|
||||||
|
// We closed the dropdown for hamburger selectfields
|
||||||
|
if ($("input:hidden[name=formfilteraction]").val() == "listafterchangingselectedfields") {
|
||||||
|
console.log("resubmit the form saved into lastopendropdown after clicking on hamburger");
|
||||||
|
//$(".dropdown dt a").parents(\'form:first\').submit();
|
||||||
|
//$(".dropdown dt a").closest("form").submit();
|
||||||
|
lastopendropdown.closest("form").submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Note: Did not find a way to get exact height (value is update at exit) so i calculate a generic from nb of lines
|
// Note: Did not find a way to get exact height (value is update at exit) so i calculate a generic from nb of lines
|
||||||
heigthofcontent = 21 * $(this).parent().parent().find(\'dd div ul li\').length;
|
heigthofcontent = 21 * $(this).parent().parent().find(\'dd div ul li\').length;
|
||||||
if (heigthofcontent > 300) heigthofcontent = 300; // limited by max-height on css .dropdown dd ul
|
if (heigthofcontent > 300) heigthofcontent = 300; // limited by max-height on css .dropdown dd ul
|
||||||
@@ -101,17 +119,30 @@ if (! defined('JS_JQUERY_DISABLE_DROPDOWN'))
|
|||||||
console.log("We reposition top by "+pix);
|
console.log("We reposition top by "+pix);
|
||||||
$(this).parent().parent().find(\'dd\').css("top", pix);
|
$(this).parent().parent().find(\'dd\').css("top", pix);
|
||||||
}
|
}
|
||||||
// $(".dropdown dd ul").slideToggle(\'fast\');
|
|
||||||
});
|
|
||||||
$(".dropdowncloseonclick").on(\'click\', function () {
|
|
||||||
console.log("Link has class dropdowncloseonclick, so we close/hide the popup ul");
|
|
||||||
$(this).parent().parent().hide();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Click on a link into the popup "link to" or other dropdown that ask to close drop down on element click, so close dropdown
|
||||||
|
$(".dropdowncloseonclick").on(\'click\', function () {
|
||||||
|
console.log("Link has class dropdowncloseonclick, so we close/hide the popup ul");
|
||||||
|
//$(this).parent().parent().hide(); // $(this).parent().parent() is ul
|
||||||
|
$(this).parent().parent().removeClass("open"); // $(this).parent().parent() is ul
|
||||||
|
});
|
||||||
|
|
||||||
|
// Click outside of any dropdown
|
||||||
$(document).bind(\'click\', function (e) {
|
$(document).bind(\'click\', function (e) {
|
||||||
//console.log("We click outside of dropdown, so we close it.");
|
var $clicked = $(e.target); // This is element we click on
|
||||||
var $clicked = $(e.target);
|
if (!$clicked.parents().hasClass("dropdown")) {
|
||||||
if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide();
|
console.log("close dropdown dd ul - we click outside");
|
||||||
|
//$(".dropdown dd ul").hide();
|
||||||
|
$(".dropdown dd ul").removeClass("open");
|
||||||
|
|
||||||
|
if ($("input:hidden[name=formfilteraction]").val() == "listafterchangingselectedfields") {
|
||||||
|
console.log("resubmit form saved into lastopendropdown after clicking outside of dropdown and having change selectlist from selectlist field of hamburger dropdown");
|
||||||
|
//$(".dropdown dt a").parents(\'form:first\').submit();
|
||||||
|
//$(".dropdown dt a").closest("form").submit();
|
||||||
|
lastopendropdown.closest("form").submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
';
|
';
|
||||||
|
|||||||
@@ -1898,12 +1898,14 @@ function top_menu_user()
|
|||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
$(document).on("click", function(event) {
|
$(document).on("click", function(event) {
|
||||||
if (!$(event.target).closest("#topmenu-login-dropdown").length) {
|
if (!$(event.target).closest("#topmenu-login-dropdown").length) {
|
||||||
|
//console.log("close login dropdown");
|
||||||
// Hide the menus.
|
// Hide the menus.
|
||||||
$("#topmenu-login-dropdown").removeClass("open");
|
$("#topmenu-login-dropdown").removeClass("open");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#topmenu-login-dropdown .dropdown-toggle").on("click", function(event) {
|
$("#topmenu-login-dropdown .dropdown-toggle").on("click", function(event) {
|
||||||
|
console.log("toggle login dropdown");
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$("#topmenu-login-dropdown").toggleClass("open");
|
$("#topmenu-login-dropdown").toggleClass("open");
|
||||||
});
|
});
|
||||||
@@ -1954,14 +1956,14 @@ function top_menu_bookmark()
|
|||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
$(document).on("click", function(event) {
|
$(document).on("click", function(event) {
|
||||||
if (!$(event.target).closest("#topmenu-bookmark-dropdown").length) {
|
if (!$(event.target).closest("#topmenu-bookmark-dropdown").length) {
|
||||||
console.log("close");
|
//console.log("close bookmark dropdown - we click outside");
|
||||||
// Hide the menus.
|
// Hide the menus.
|
||||||
$("#topmenu-bookmark-dropdown").removeClass("open");
|
$("#topmenu-bookmark-dropdown").removeClass("open");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
|
$("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) {
|
||||||
console.log("toggle");
|
console.log("toggle bookmark dropdown");
|
||||||
openBookMarkDropDown();
|
openBookMarkDropDown();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2077,7 +2079,7 @@ function top_menu_search()
|
|||||||
// close drop down
|
// close drop down
|
||||||
$(document).on("click", function(event) {
|
$(document).on("click", function(event) {
|
||||||
if (!$(event.target).closest("#topmenu-global-search-dropdown").length) {
|
if (!$(event.target).closest("#topmenu-global-search-dropdown").length) {
|
||||||
console.log("click close");
|
console.log("click close search - we click outside");
|
||||||
// Hide the menus.
|
// Hide the menus.
|
||||||
$("#topmenu-global-search-dropdown").removeClass("open");
|
$("#topmenu-global-search-dropdown").removeClass("open");
|
||||||
}
|
}
|
||||||
@@ -2085,7 +2087,7 @@ function top_menu_search()
|
|||||||
|
|
||||||
// Open drop down
|
// Open drop down
|
||||||
$("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) {
|
$("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) {
|
||||||
console.log("click open");
|
console.log("toggle search dropdown");
|
||||||
openGlobalSearchDropDown();
|
openGlobalSearchDropDown();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ button.dropdown-item.global-search-item {
|
|||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu{
|
.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu, .dropdown dd ul.open {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4983,7 +4983,7 @@ input.select2-input {
|
|||||||
}
|
}
|
||||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||||
color: var(--colortext);
|
color: var(--colortext);
|
||||||
background-color: var(--colorbackvmenu1);
|
/* background-color: var(--colorbackvmenu1); */
|
||||||
}
|
}
|
||||||
.select2-default {
|
.select2-default {
|
||||||
color: #999 !important;
|
color: #999 !important;
|
||||||
@@ -5079,8 +5079,8 @@ input.select2-input {
|
|||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
}
|
}
|
||||||
.select2-dropdown {
|
.select2-dropdown {
|
||||||
background-color: var(--colorbackvmenu1);
|
/*background-color: var(--colorbackvmenu1);
|
||||||
border: 1px solid var(--colorbackvmenu1);;
|
border: 1px solid var(--colorbackvmenu1); */
|
||||||
box-shadow: 1px 2px 10px var(--colorbackvmenu1);
|
box-shadow: 1px 2px 10px var(--colorbackvmenu1);
|
||||||
}
|
}
|
||||||
.select2-dropdown-open {
|
.select2-dropdown-open {
|
||||||
@@ -5405,9 +5405,9 @@ dl.dropdown {
|
|||||||
.dropdown dd ul li span {
|
.dropdown dd ul li span {
|
||||||
color: #888;
|
color: #888;
|
||||||
}
|
}
|
||||||
.dropdown dd ul li a:hover {
|
/*.dropdown dd ul li a:hover {
|
||||||
background-color: var(--inputbackgroundcolor);
|
background-color: var(--inputbackgroundcolor);
|
||||||
}
|
}*/
|
||||||
dd.dropdowndd ul li {
|
dd.dropdowndd ul li {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
Reference in New Issue
Block a user