Skip to content

Commit

Permalink
BASIRA #254 - Defaulting documents "bookmarks/registers" to "0"
Browse files Browse the repository at this point in the history
  • Loading branch information
dleadbetter committed Nov 27, 2024
1 parent 8a47b77 commit 803fc29
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions client/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
"bindingRelationshipToTextBlock": "Binding Relationship to Text Block",
"bindingType": "Binding Type",
"bookmarksRegisterColor": "Bookmark/Register Color",
"bookmarksRegisters": "Bookmarks/Registers",
"bookmarksRegisters": "Number of Bookmarks/Registers Visible",
"bookmarkRegisterStyle": "Bookmark/Register Style",
"color": "Color",
"colorOfForeEdges": "Color of Textblock Edges",
Expand Down Expand Up @@ -483,7 +483,7 @@
"bindingType": "Binding Type",
"bookmarkRegisterColor": "Color",
"bookmarkStyle": "Bookmark/Register Style",
"bookmarksRegisters": "Bookmarks/Registers",
"bookmarksRegisters": "Number of Bookmarks/Registers Visible",
"decoratedForeEdges": "Decorated Textblock Edges",
"documentFormat": "Document Format",
"documentType": "Document Type",
Expand Down
4 changes: 3 additions & 1 deletion client/src/pages/admin/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,12 @@ const Document = (props: Props) => {
required={props.isRequired('bookmarks_registers')}
>
<Dropdown
defaultValue={0}
fluid
onChange={props.onTextInputChange.bind(this, 'bookmarks_registers')}
options={zeroToTenRangeOptionsList}
selection
value={props.item.bookmarks_registers || ''}
value={props.item.bookmarks_registers}
/>
</Form.Input>
<ValueListDropdown
Expand Down
15 changes: 15 additions & 0 deletions db/data/20241127124509_reset_documents_bookmarks_registers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

class ResetDocumentsBookmarksRegisters < ActiveRecord::Migration[7.0]
def up
execute <<-SQL.squish
UPDATE documents
SET bookmarks_registers = 0
WHERE bookmarks_registers IS NULL;
SQL
end

def down
raise ActiveRecord::IrreversibleMigration
end
end
2 changes: 1 addition & 1 deletion db/data_schema.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DataMigrate::Data.define(version: 20241127121425)
DataMigrate::Data.define(version: 20241127124509)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeDocumentsBookmarksRegistersDefaultValue < ActiveRecord::Migration[7.0]
def change
change_column :documents, :bookmarks_registers, :integer, null: false, default: 0
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_11_27_121542) do
ActiveRecord::Schema[7.0].define(version: 2024_11_27_124609) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "plpgsql"
Expand Down Expand Up @@ -119,7 +119,7 @@
t.boolean "endband_present", default: false, null: false
t.boolean "uncut_fore_edges", default: false, null: false
t.text "fore_edge_text"
t.integer "bookmarks_registers", default: 0
t.integer "bookmarks_registers", default: 0, null: false
t.integer "text_columns", default: 0, null: false
t.boolean "ruling", default: false, null: false
t.boolean "rubrication", default: false, null: false
Expand Down

0 comments on commit 803fc29

Please sign in to comment.