<commit_before>#
# Controllers that include this must define:
#
# request_path(*args) -- returns a path for the args. First arg is a request object.
#

module Common::Requests

  def self.included(base)
    base.class_eval do

      helper_method :current_state
      helper_method :left_id
      helper_method :right_id
      helper_method :request_path
    end
  end

  protected

  def current_state
    case params[:state]
      when 'approved' then :approved;
      when 'rejected' then :rejected;
      else :pending;
    end
  end

  def left_id(request)
    "panel_left_#{request.dom_id}"
  end

  def right_id(request)
    "panel_right_#{request.dom_id}"
  end

  def request_path(*args)
    raise 'you forgot to override this method'<commit_msg>Tweaks when dealing with split panels and requests.<commit_after>#
# Controllers that include this must define:
#
# request_path(*args) -- returns a path for the args. First arg is a request object.
#

module Common::Requests

  def self.included(base)
    base.class_eval do

      helper_method :current_state
      helper_method :left_id
      helper_method :right_id
      helper_method :request_path
    end
  end

  protected

  def current_state
    case params[:state]
      when 'approved' then :approved;
      when 'rejected' then :rejected;
      else :pending;
    end
  end

  def left_id(request)
    dom_id(request, :panel_left)
  end

  def right_id(request)
    dom_id(request, :panel_right)
  end

  def request_path(*args)
    raise 'you forgot to override this method'
{'fraction_non_alphanumeric': 0.07577720207253887, 'fraction_numerical': 0.0, 'mean_word_length': 3.186991869918699, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5696144', 'n_tokens_mistral': 494, 'n_tokens_neox': 479, 'n_words': 148}