fix card and section delete
This commit is contained in:
@ -31,7 +31,7 @@ module Merged
|
||||
end
|
||||
|
||||
def destroy
|
||||
@card.delete_save!
|
||||
@card.delete_and_reset_index
|
||||
redirect_to section_cards_url(@card.section.id) , notice: "#{@card.header} removed"
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ module Merged
|
||||
end
|
||||
|
||||
def destroy
|
||||
@section.delete_save!
|
||||
@section.delete_and_reset_index
|
||||
redirect_to page_sections_url(@section.page.id) , notice: "Section #{@section.header} removed"
|
||||
end
|
||||
|
||||
|
@ -38,6 +38,12 @@ module Merged
|
||||
CardStyle.find_by_template( self.template )
|
||||
end
|
||||
|
||||
def delete_and_reset_index
|
||||
delete_save!
|
||||
section.reset_index
|
||||
save
|
||||
end
|
||||
|
||||
def self.new_card(card_template , section_id , index)
|
||||
data = { section_id: section_id , index: index}
|
||||
template = CardStyle.find_by_template( card_template )
|
||||
|
@ -76,6 +76,12 @@ module Merged
|
||||
delete_save!()
|
||||
end
|
||||
|
||||
def delete_and_reset_index
|
||||
delete
|
||||
page.reset_index
|
||||
save
|
||||
end
|
||||
|
||||
def self.new_section(template , page_id , index)
|
||||
data = { template: template , index: index , page_id: page_id}
|
||||
style = SectionStyle.find_by_template( template)
|
||||
|
Reference in New Issue
Block a user