mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-26 09:43:29 +08:00
Added validations for date(time) column reminder [SCI-6775] (#4063)
This commit is contained in:
parent
0ae5006a10
commit
ac45edb14c
6 changed files with 28 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue