Skip to content

Commit 89ef6eb

Browse files
author
Dan
committed
using config for helpers everywhere
1 parent 7b57ad1 commit 89ef6eb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/sort_view.ex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule Sortex.SortView do
44
def column_class, do: "sortex-clickable-column"
55

66
def sorted_column(conn, opts) do
7-
helper = opts[:helper]
7+
helper_action = opts[:helper]
88
action = opts[:action] || :index
99
helpers_module = Application.get_env(:sortex, :route_helpers_module)
1010

@@ -13,19 +13,19 @@ defmodule Sortex.SortView do
1313

1414
url =
1515
case opts[:route_params] do
16-
nil -> apply(helpers_module, helper, [conn, action, params])
17-
route_params -> add_params(conn, helper, action, route_params, params)
16+
nil -> apply(helpers_module, helper_action, [conn, action, params])
17+
route_params -> add_params(helpers_module, conn, helper_action, action, route_params, params)
1818
end
1919

2020
Phoenix.HTML.raw(~s(<a href="#{url}" class="#{column_class()}">#{title(opts, arrow)}</a>))
2121
end
2222

23-
defp add_params(conn, helper, action, route_params, params) when is_list(route_params) do
24-
apply(Helpers, helper, [conn, action] ++ route_params ++ [params])
23+
defp add_params(helpers_module, conn, helper_action, action, route_params, params) when is_list(route_params) do
24+
apply(helpers_module, helper_action, [conn, action] ++ route_params ++ [params])
2525
end
2626

27-
defp add_params(conn, helper, action, route_params, params) do
28-
apply(Helpers, helper, [conn, action, route_params, params])
27+
defp add_params(helpers_module, conn, helper_action, action, route_params, params) do
28+
apply(helpers_module, helper_action, [conn, action, route_params, params])
2929
end
3030

3131
defp params(opts, query_params, direction) do

0 commit comments

Comments
 (0)