mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 15:36:22 +08:00
Merge pull request #3320 from aignatov-bio/ai-sci-5718-remove-report-name-uniqness
Remove report name uniqueness [SCI-5718]
This commit is contained in:
commit
dde82423f1
|
@ -1057,13 +1057,11 @@ function reportHandsonTableConverter() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.reports-new').on('click', '#saveAsNewReport', function(e) {
|
$('.reports-new').on('click', '#saveAsNewReport', function(e) {
|
||||||
var params = getReportData();
|
|
||||||
params.report.name = 'New ' + params.report.name;
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: this.dataset.createUrl,
|
url: this.dataset.createUrl,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: JSON.stringify(params),
|
data: JSON.stringify(getReportData()),
|
||||||
contentType: 'application/json; charset=utf-8',
|
contentType: 'application/json; charset=utf-8',
|
||||||
success: function() {},
|
success: function() {},
|
||||||
error: function(jqxhr) {
|
error: function(jqxhr) {
|
||||||
|
|
|
@ -12,8 +12,7 @@ class Report < ApplicationRecord
|
||||||
auto_strip_attributes :name, :description, nullify: false
|
auto_strip_attributes :name, :description, nullify: false
|
||||||
validates :name,
|
validates :name,
|
||||||
length: { minimum: Constants::NAME_MIN_LENGTH,
|
length: { minimum: Constants::NAME_MIN_LENGTH,
|
||||||
maximum: Constants::NAME_MAX_LENGTH },
|
maximum: Constants::NAME_MAX_LENGTH }
|
||||||
uniqueness: { scope: %i(user_id project_id), case_sensitive: false }
|
|
||||||
validates :description, length: { maximum: Constants::TEXT_MAX_LENGTH }
|
validates :description, length: { maximum: Constants::TEXT_MAX_LENGTH }
|
||||||
validates :project, presence: true
|
validates :project, presence: true
|
||||||
validates :user, presence: true
|
validates :user, presence: true
|
||||||
|
|
Loading…
Reference in a new issue