Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Node } from '@tiptap/core'

export const DonationGoalNode = Node.create({
name: 'donationGoal',
name: 'Announcement::Block::DonationGoal',
atom: true,
group: 'block',
priority: 2000,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Node } from '@tiptap/core'

export const DonationSummaryNode = Node.create({
name: 'donationSummary',
name: 'Announcement::Block::DonationSummary',
atom: true,
group: 'block',
priority: 2000,
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/controllers/tiptap/nodes/hcb_code_node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Node } from '@tiptap/core'

export const HcbCodeNode = Node.create({
name: 'hcbCode',
name: 'Announcement::Block::HcbCode',
atom: true,
group: 'block',
priority: 2000,
Expand Down
30 changes: 30 additions & 0 deletions app/jobs/one_time_jobs/migrate_block_types.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: true

module OneTimeJobs
class MigrateBlockTypes
def self.perform
Announcement.find_each do |announcement|
new_content = ProsemirrorService::Renderer.map_nodes announcement.content do |node|
new_type = case node["type"]
when "donationGoal"
"Announcement::Block::DonationGoal"
when "donationSummary"
"Announcement::Block::DonationSummary"
when "hcbCode"
"Announcement::Block::HcbCode"
else
node["type"]
end

node["type"] = new_type
end

announcement.content = new_content

announcement.save!
end

end

end
end
4 changes: 1 addition & 3 deletions app/services/prosemirror_service/donation_goal_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

module ProsemirrorService
class DonationGoalNode < ProsemirrorToHtml::Nodes::Node
include ApplicationHelper

@node_type = "donationGoal"
@node_type = "Announcement::Block::DonationGoal"
@tag_name = "div"

def tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module ProsemirrorService
class DonationSummaryNode < ProsemirrorToHtml::Nodes::Node
@node_type = "donationSummary"
@node_type = "Announcement::Block::DonationSummary"
@tag_name = "div"

def tag
Expand Down
2 changes: 1 addition & 1 deletion app/services/prosemirror_service/hcb_code_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module ProsemirrorService
class HcbCodeNode < ProsemirrorToHtml::Nodes::Node
@node_type = "hcbCode"
@node_type = "Announcement::Block::HcbCode"
@tag_name = "div"

def tag
Expand Down