move up down fixes

This commit is contained in:
2023-01-25 17:10:05 +02:00
parent 594f2b5dce
commit 75915b3fe2
4 changed files with 17 additions and 13 deletions

View File

@ -7,19 +7,19 @@ module Merged
fields :id , :index , :section_id
fields :text , :header, :image_name
def move_up
swap_index_with(next_card)
end
def change_name
pagename = section ? section.page.name : section_id.to_s
"#{pagename}:#{header}"
end
def move_down
def move_up
swap_index_with(previous_card)
end
def move_down
swap_index_with(next_card)
end
def previous_card
section.cards.where(index: index - 1).first
end

View File

@ -42,11 +42,11 @@ module Merged
end
def move_up
swap_index_with(next_section)
swap_index_with(previous_section)
end
def move_down
swap_index_with(previous_section)
swap_index_with(next_section)
end
def previous_section