Module: LlmLogs::PromptsHelper

Defined in:
app/helpers/llm_logs/prompts_helper.rb

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/llm_logs/prompts_helper.rb', line 3

def sort_link(label, column)
  active = @sort == column
  next_direction = active && @direction == "asc" ? "desc" : "asc"
  arrow = active ? (@direction == "asc" ? "" : "") : ""

  link_to(
    "#{label}#{arrow}",
    prompts_path(
      sort: column,
      direction: next_direction,
      tag: @active_tag
    ),
    class: "hover:text-gray-700 #{'text-gray-900' if active}"
  )
end