-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4123 from benwbrum/3768-error-saving-field-based-…
…page-fix 3768 - Fix error saving field-based page
- Loading branch information
Showing
4 changed files
with
68 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
class TranscriptionField < ApplicationRecord | ||
belongs_to :collection, optional: true | ||
acts_as_list :scope => :collection | ||
|
||
acts_as_list scope: :collection | ||
|
||
has_many :table_cells | ||
has_many :spreadsheet_columns, -> { order 'position' }, :dependent => :destroy | ||
validates :options, presence: true, if: Proc.new {|field| field.input_type == 'select'}, on: [:create, :update] | ||
has_many :spreadsheet_columns, -> { order 'position' }, dependent: :destroy | ||
|
||
validates :options, presence: true, if: Proc.new { |field| field.input_type == 'select' }, on: [:create, :update] | ||
validates :percentage, numericality: { allow_nil: true, greater_than: 0, less_than_or_equal_to: 100 } | ||
validates :page_number, numericality: { allow_nil: true, greater_than: 0, less_than_or_equal_to: 1000 } | ||
|
||
validates :label, format: { without: /[\[\]]/, message: "cannot contain '[' or ']'" } | ||
|
||
module FieldType | ||
TRANSCRIPTION = 'transcription' | ||
METADATA = 'metadata' | ||
end | ||
|
||
|
||
TRANSCRIPTION_INPUTS = ["text", "select", "date", "textarea", "description", "instruction", "spreadsheet", "alt text"] | ||
METADATA_INPUTS = ["text", "select", "date", "multiselect", "textarea", "instruction", "alt text"] | ||
TRANSCRIPTION_INPUTS = ['text', 'select', 'date', 'textarea', | ||
'description', 'instruction', 'spreadsheet', 'alt text'].freeze | ||
METADATA_INPUTS = ['text', 'select', 'date', 'multiselect', 'textarea', 'instruction', 'alt text'].freeze | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters