Added validations for date(time) column reminder [SCI-6775] (#4063)

This commit is contained in:
artoscinote 2022-04-28 15:30:20 +02:00 committed by GitHub
parent 0ae5006a10
commit ac45edb14c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 9 deletions

View file

@ -120,7 +120,7 @@ var RepositoryStockValues = (function() {
SmartAnnotation.init($('#repository-stock-value-comment')[0]);
$('#repository-stock-value-comment').on('keyup change', function() {
$('#repository-stock-value-comment').on('input', function() {
$(this).closest('.sci-input-container').toggleClass(
'error',
this.value.length > GLOBAL_CONSTANTS.NAME_MAX_LENGTH

View file

@ -1,4 +1,4 @@
/* global dropdownSelector */
/* global GLOBAL_CONSTANTS dropdownSelector */
/* eslint-disable no-unused-vars */
var RepositoryDateColumnType = (function() {
const columnContainer = '.date-column-type';
@ -36,6 +36,16 @@ var RepositoryDateColumnType = (function() {
$modal.on('columnModal::partialLoadedForRepositoryDateValue', function() {
initReminderUnitDropdown();
$('#date-reminder-message').on('input', function() {
$(this).closest('.sci-input-container').toggleClass(
'error',
this.value.length > GLOBAL_CONSTANTS.NAME_MAX_LENGTH
);
$('#update-repo-column-submit').toggleClass(
'disabled',
this.value.length > GLOBAL_CONSTANTS.NAME_MAX_LENGTH
);
});
});
}

View file

@ -1,4 +1,4 @@
/* global dropdownSelector */
/* global GLOBAL_CONSTANTS dropdownSelector */
/* eslint-disable no-unused-vars */
var RepositoryDateTimeColumnType = (function() {
const columnContainer = '.datetime-column-type';
@ -36,6 +36,16 @@ var RepositoryDateTimeColumnType = (function() {
$modal.on('columnModal::partialLoadedForRepositoryDateTimeValue', function() {
initReminderUnitDropdown();
$('#datetime-reminder-message').on('input', function() {
$(this).closest('.sci-input-container').toggleClass(
'error',
this.value.length > GLOBAL_CONSTANTS.NAME_MAX_LENGTH
);
$('#update-repo-column-submit').toggleClass(
'disabled',
this.value.length > GLOBAL_CONSTANTS.NAME_MAX_LENGTH
);
});
});
}

View file

@ -54,10 +54,9 @@
<%= t('libraries.manange_modal_column.datetime_type.reminder_message') %>
</label>
<div class="col-sm-9">
<div class="sci-input-container">
<input type="text" class="sci-input-field reminder-message"
<div class="sci-input-container" data-error-text="<%= t('libraries.manange_modal_column.datetime_type.reminder_message_limit') %>">
<input id="date-reminder-message" type="text" class="sci-input-field reminder-message"
placeholder="<%= t('libraries.manange_modal_column.datetime_type.enter_reminder_message')%>"
maxlength="<%= Constants::NAME_MAX_LENGTH %>"
value="<%= column&.metadata['reminder_message'] %>">
</div>
</div>

View file

@ -54,10 +54,9 @@
<%= t('libraries.manange_modal_column.datetime_type.reminder_message') %>
</label>
<div class="col-sm-9">
<div class="sci-input-container">
<input type="text" class="sci-input-field reminder-message"
<div class="sci-input-container" data-error-text="<%= t('libraries.manange_modal_column.datetime_type.reminder_message_limit') %>">
<input id="datetime-reminder-message" type="text" class="sci-input-field reminder-message"
placeholder="<%= t('libraries.manange_modal_column.datetime_type.enter_reminder_message')%>"
maxlength="<%= Constants::NAME_MAX_LENGTH %>"
value="<%= column&.metadata['reminder_message'] %>">
</div>
</div>

View file

@ -1810,6 +1810,7 @@ en:
reminder_message: 'Message (optional)'
enter_reminder_message: 'Enter a reminder message'
range_label: 'Range'
reminder_message_limit: "Maximum number of characters reached (255)"
stock_type:
multiple_options: 'selected'
all_options: 'All options'