Minor refactoring with hound alert fixes.

This commit is contained in:
Matej Zrimšek 2016-09-21 16:15:56 +02:00
parent 234918a76d
commit c614843044
4 changed files with 25 additions and 15 deletions

View file

@ -1511,7 +1511,8 @@ function bindNewModuleAction(gridDistX, gridDistY) {
function handleNewNameConfirm(ev) {
var input = $("#new-module-name-input");
// Validate module name
var moduleNameValid = textValidator(ev, input, TextLimitEnum.NAME_MIN_LENGTH, TextLimitEnum.NAME_MAX_LENGTH, true);
var moduleNameValid = textValidator(ev, input,
TextLimitEnum.NAME_MIN_LENGTH, TextLimitEnum.NAME_MAX_LENGTH, true);
if (moduleNameValid) {
// Set the "clicked" property to true
modal.data("submit", "true");
@ -1600,7 +1601,8 @@ function initEditModules() {
function handleRenameConfirm(modal, ev) {
var input = modal.find("#edit-module-name-input");
// Validate module name
var moduleNameValid = textValidator(ev, input, TextLimitEnum.NAME_MIN_LENGTH, TextLimitEnum.NAME_MAX_LENGTH, true);
var moduleNameValid = textValidator(ev, input,
TextLimitEnum.NAME_MIN_LENGTH, TextLimitEnum.NAME_MAX_LENGTH, true);
if (moduleNameValid) {
var newName = input.val();
var moduleId = modal.attr("data-module-id");
@ -1706,8 +1708,9 @@ function initEditModuleGroups() {
function handleRenameConfirm(modal, ev) {
var input = modal.find("#edit-module-group-name-input");
// Validate module name
var moduleNameValid = textValidator(ev, input, TextLimitEnum.REQUIRED, TextLimitEnum.NAME_MAX_LENGTH, true);
// Validate module group name
var moduleNameValid = textValidator(ev, input, TextLimitEnum.REQUIRED,
TextLimitEnum.NAME_MAX_LENGTH, true);
if (moduleNameValid) {
var newModuleGroupName = input.val();
var moduleId = modal.attr("data-module-id");

View file

@ -420,8 +420,8 @@ li.module-hover {
.panel-body {
display: flex;
flex-direction: column;
flex: 1 1 auto;
flex-direction: column;
}
.experiment-description {

View file

@ -11,12 +11,15 @@ body,
min-width: 320px;
}
/** Word wrapping everywhere, except for table header of "datatables.js" */
body, table.dataTable td {
word-break: break-word;
// Word wrapping everywhere, except for table header of "datatables.js"
body,
table.dataTable td {
text-overflow: ellipsis;
word-break: break-word;
}
table:not(.dataTable) {
// All tables are fixed, except for table of "datatables.js"
table {
table-layout: fixed;
}
@ -989,10 +992,11 @@ ul.content-module-activities {
/* Data table */
table.dataTable {
word-break: initial;
text-overflow: initial;
width: 100% !important;
background-color: $color-alabaster;
table-layout: initial;
text-overflow: initial;
width: 100%;
word-break: initial;
thead {
background-color: $color-gray;

View file

@ -3,12 +3,15 @@ class CustomField < ActiveRecord::Base
validates :name,
presence: true,
length: { maximum: NAME_MAX_LENGTH },
uniqueness: { scope: :organization, case_sensitive: true},
exclusion: {in: ["Assigned", "Sample name", "Sample type", "Sample group", "Added on", "Added by"]}
uniqueness: { scope: :organization, case_sensitive: true },
exclusion: { in: ['Assigned', 'Sample name', 'Sample type',
'Sample group', 'Added on', 'Added by'] }
validates :user, :organization, presence: true
belongs_to :user, inverse_of: :custom_fields
belongs_to :organization, inverse_of: :custom_fields
belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', class_name: 'User'
belongs_to :last_modified_by,
foreign_key: 'last_modified_by_id',
class_name: 'User'
has_many :sample_custom_fields, inverse_of: :custom_field
end