<commit_before>class BookmarksController < ApplicationController
  
  prepend_before_filter :ignore_lost_sortable_requests
  before_filter         :find_bookmark, :except => [ :create ]
  # TODO [DEMO] Controller filters
  # after_filter :expire_user_home_cache, :only => [ :new_in_box, :save_links ]
  # after_filter :expire_correct_fragment, :only => [ :sort, :trash ]
  
  
  def create
    box = current_user.boxes.find(params[:box_id])
    @bookmark = box.bookmarks.create!(params[:bookmark])
    render_json_data(@bookmark.id)
  end
  
  def sort
    head :ok
    # find_dopped_on_box
    # find_sorted_bookmark
    # Bookmark.transaction do
    #   if internal_sort?
    #     @bookmark.insert_at(params[:bmark_position])
    #   else
    #     if @box_sort
    #       convert_bookmark if !@boxmark
    #       @bookmark.insert_at_new_scope_and_position(@box.id, params[:bmark_position]) if @boxmark
    #     elsif @inbox_sort || @trashbox_sort
    #       convert_bookmark
    #     end
    #   end
    # end
    # render :update do |page|
    #   if @new_bookmark
    #     page.replace "#{@bookmark_scope}bmark_#{params[:bmark_id]}", :inline => page.bookmark_list_item, :locals => {:bmark => @new_bookmark, :box_type => @new_bookmark_scope}
    #     page.create_bookmark_sortables_code(@user,@box)
    #   end
    #   page.update_new_trashboxmark_ui_elements_and_message if @trashbox_sort
    # end
  end
  
  def trash
    find_deleted_bookmark
    if @trashboxmark
      @bookmark.destroy<commit_msg>Bookmark sort now working.<commit_after>class BookmarksController < ApplicationController
  
  prepend_before_filter :ignore_lost_sortable_requests
  before_filter         :find_bookmark, :except => [ :create ]
  # TODO [DEMO] Controller filters
  # after_filter :expire_user_home_cache, :only => [ :new_in_box, :save_links ]
  # after_filter :expire_correct_fragment, :only => [ :sort, :trash ]
  
  
  def create
    box = current_user.boxes.find(params[:box_id])
    @bookmark = box.bookmarks.create!(params[:bookmark])
    render_json_data(@bookmark.id)
  end
  
  def sort
    if internal_sort?
      @bookmark.insert_at(params[:position])
    else
      @box = current_user.boxes.find(params[:gained_id])
      @bookmark.insert_at_new_scope_and_position(@box.id, params[:position])
    end
    head :ok
  end
  
  def trash
    find_deleted_bookmark
    if @trashboxmark
      @bookmark.destroy
{'fraction_non_alphanumeric': 0.1031055900621118, 'fraction_numerical': 0.0, 'mean_word_length': 3.4990689013035383, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4725258', 'n_tokens_mistral': 832, 'n_tokens_neox': 830, 'n_words': 140}