Skip to content

Commit

Permalink
#292 [QuickEvent] fix : remove js from php file
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-kilyan committed Aug 29, 2024
1 parent 069f852 commit 3e9c6d1
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 17 deletions.
4 changes: 2 additions & 2 deletions admin/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,11 @@
print '<tr class="oddeven"><td>';
print $langs->trans('LabelLength');
print '</td><td>';
print $langs->trans('ProjectLabelMaxLength');
print $langs->trans('LabelLengthDescription');

print '<td class="center"></td>';

print '<td><input type="number" name="quick_event_label_length" class="minwidth200" value="' . (getDolGlobalInt('EASYCRM_EVENT_LABEL_MAX_LENGTH_VALUE') ?? 128 ) . '" min="1" max="128"></td>';
print '<td><input type="number" name="quick_event_label_length" class="minwidth200" value="' . getDolGlobalInt('EASYCRM_EVENT_LABEL_MAX_LENGTH_VALUE') . '" min="1" max="128"></td>';

print '</tr>';

Expand Down
2 changes: 1 addition & 1 deletion js/easycrm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions js/modules/quickevent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* Copyright (C) 2021-2023 EVARISK <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Library javascript to enable Browser notifications
*/

/**
* \file js/quickevent.js
* \ingroup easycrm
* \brief JavaScript quickevent file for module EasyCRM
*/

/**
* Init quickcreation JS
*
* @memberof EasyCRM_QuickEvent
*
* @since 1.3.0
* @version 1.3.0
*
* @type {Object}
*/
window.easycrm.quickevent = {};

/**
* QuickEvent init
*
* @memberof EasyCRM_QuickEvent
*
* @since 1.3.0
* @version 1.3.0
*
* @returns {void}
*/
window.easycrm.quickevent.init = function() {
window.easycrm.quickevent.event();
};

/**
* QuickEvent event
*
* @memberof EasyCRM_QuickEvent
*
* @since 1.3.0
* @version 1.3.0
*
* @returns {void}
*/
window.easycrm.quickevent.event = function() {
$(document).on('keyup', '#label', window.easycrm.quickevent.labelKeyUp);
};

/**
* QuickEvent labelkeyup
*
* @memberof EasyCRM_QuickEvent
*
* @since 1.3.0
* @version 1.3.0
*
* @returns {void}
*/
window.easycrm.quickevent.labelKeyUp = function() {
if ($("#label").val().length >= (parseInt($("#label").attr("maxlength")) * 0.7)) {
$(".quickevent-label-warning-notice").removeClass("hidden");
} else {
$(".quickevent-label-warning-notice").addClass("hidden");
}
}
4 changes: 2 additions & 2 deletions langs/fr_FR/easycrm.lang
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,6 @@ AddAssignOppStatus = Ajouter un statut d'opportunité
SelectOppStatus = Sélectionner un statut d'opportunité
OppStatusAssignedTo = Statut d'opportunité assigné à %s projet(s)
ReloadOppPercent = Calculer les probabilités d'opportunité non définies
ProjectLabelMaxLength = Taille maximum du champ libellé
LabelLengthDescription = Taille maximum du champ libellé
LabelLength = Taille libellé
WarningTaskLabelCustom = Attention, vous vous rapprochez du nombre de caractères maximum autorisé (%s)
WarningTaskLabelCustom = Attention, vous vous rapprochez du nombre de caractères maximum autorisé (%d)
12 changes: 0 additions & 12 deletions view/quickevent.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,6 @@
print '<tr><td><label for="label">' . $langs->trans('Label') . '</label></td>';
print '<td><input type="text" id="label" name="label" class="maxwidth500 widthcentpercentminusx" maxlength="' .getDolGlobalInt('EASYCRM_EVENT_LABEL_MAX_LENGTH_VALUE') . '" value="' . dol_escape_htmltag((GETPOSTISSET('label') ? GETPOST('label') : '')) . '"></td>';
print '</tr>';
print '
<script type="text/javascript">
$("#label").on("keyup", function() {
if ($("#label").val().length >= ' . max(getDolGlobalInt('EASYCRM_EVENT_LABEL_MAX_LENGTH_VALUE') * 0.7, 0) . ') {
$(".quickevent-label-warning-notice").removeClass("hidden");
} else {
$(".quickevent-label-warning-notice").addClass("hidden");
}
});
</script>
';

}

// Date start
Expand Down

0 comments on commit 3e9c6d1

Please sign in to comment.