Skip to content

Commit

Permalink
Add order link for all columns with a link option
Browse files Browse the repository at this point in the history
  • Loading branch information
sineed committed Apr 26, 2017
1 parent 50afd90 commit 914314c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/ex_admin/table.ex
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,13 @@ defmodule ExAdmin.Table do
end
end
end

def build_th({field_name, opts}, table_opts) do
build_th(to_string(field_name), opts, table_opts)
end
def build_th(field_name, _),
do: th(".th-#{parameterize field_name} #{humanize field_name}")
def build_th(field_name, opts, %{fields: fields} = table_opts) do
if String.to_atom(field_name) in fields and opts in [%{}, %{link: true}] do
if opts[:link] == true do
_build_th(field_name, opts, table_opts)
else
th(".th-#{field_name_to_class(field_name)} #{humanize Map.get(opts, :label, to_string(field_name))}")
Expand Down

0 comments on commit 914314c

Please sign in to comment.