mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-05 03:14:43 +08:00
Removed variable
This commit is contained in:
parent
566705cb67
commit
01e4ab3cd5
4 changed files with 8 additions and 11 deletions
|
@ -1,4 +1,7 @@
|
|||
class ChecklistItem < ApplicationRecord
|
||||
|
||||
attr_accessor :with_paragraphs
|
||||
|
||||
auto_strip_attributes :text, nullify: false
|
||||
validates :text,
|
||||
presence: true,
|
||||
|
|
|
@ -8,6 +8,10 @@ class ChecklistItemSerializer < ActiveModel::Serializer
|
|||
|
||||
attributes :id, :text, :checked, :position, :urls, :sa_text, :with_paragraphs
|
||||
|
||||
def with_paragraphs
|
||||
object.text.include?("\n")
|
||||
end
|
||||
|
||||
def sa_text
|
||||
@user = scope[:user] || @instance_options[:user]
|
||||
custom_auto_link(object.text,
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddWithParagraphsToChecklistItem < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_column :checklist_items, :with_paragraphs, :boolean, default: false
|
||||
|
||||
ChecklistItem.where("text ~ '^.*\\n.*$'").update_all(with_paragraphs: true)
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_09_21_142200) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_09_04_080206) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "btree_gist"
|
||||
enable_extension "pg_trgm"
|
||||
|
@ -115,7 +115,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_09_21_142200) do
|
|||
t.bigint "created_by_id"
|
||||
t.bigint "last_modified_by_id"
|
||||
t.integer "position"
|
||||
t.boolean "with_paragraphs", default: false
|
||||
t.index "trim_html_tags((text)::text) gin_trgm_ops", name: "index_checklist_items_on_text", using: :gin
|
||||
t.index ["checklist_id", "position"], name: "index_checklist_items_on_checklist_id_and_position", unique: true
|
||||
t.index ["checklist_id"], name: "index_checklist_items_on_checklist_id"
|
||||
|
|
Loading…
Add table
Reference in a new issue