app/models/toc_item.rb
# I suppose we just need a move_up method and move_down could fire off a move_up to its next chapter
# but having two methods will save a few queries. Also need to figure about about moving all the way down
I suppose we just need a move_up method and move_down could fire off a move_up to its next chapter
but having two methods will save a few queries. Also need to figure about about moving all the way down
I suppose we just need a move_up method and move_down could fire off a move_up to its next chapter but having two methods will save a few queries . Also need to figure about about moving all the way down
def move_down(all_the_way = false)
    if is_major?
      if all_the_way
        move_to_last
      elsif chapter_after = next_of_type
        TocItem.swap_entries(self, chapter_after)
      end
    else  
      if all_the_way
        move_to_last
      elsif next_toc = next_of_type
        if next_toc.is_sub?
          TocItem.swap_entries(self, next_toc)
        end
      end
    end
  end
def move_down ( all_the_way = false ) if is_major? if all_the_way move_to_last elsif chapter_after = next_of_type TocItem . swap_entries ( self , chapter_after ) end else if all_the_way move_to_last elsif next_toc = next_of_type if next_toc . is_sub? TocItem . swap_entries ( self , next_toc ) end end end end
I suppose we just need a move_up method and move_down could fire off a move_up to its next chapter
but having two methods will save a few queries.
I suppose we just need a move_up method and move_down could fire off a move_up to its next chapter but having two methods will save a few queries .
# sub chapter
all_the_way
<not_specific>