From 2f93cc07ad7fec9285e60a197c1a5a153badcca9 Mon Sep 17 00:00:00 2001 From: Ed Bond Date: Fri, 12 Jul 2019 00:39:17 -0500 Subject: [PATCH] table_for fix along with warning cleanup --- lib/ex_admin/form.ex | 16 ++++++++-------- lib/ex_admin/render.ex | 1 - lib/ex_admin/show.ex | 3 ++- lib/ex_admin/table.ex | 4 +--- lib/ex_admin/themes/active_admin/index.ex | 2 +- lib/ex_admin/themes/admin_lte2/index.ex | 2 +- lib/ex_admin/utils.ex | 1 - mix.exs | 4 ++-- mix.lock | 7 +++++-- .../themes/admin_lte2/layout/title_bar.html.eex | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/ex_admin/form.ex b/lib/ex_admin/form.ex index 1c895828..1c8c3714 100644 --- a/lib/ex_admin/form.ex +++ b/lib/ex_admin/form.ex @@ -1168,7 +1168,7 @@ defmodule ExAdmin.Form do end) end - defp build_checkboxes(conn, name, collection, opts, resource, model_name, errors, name_ids) do + defp build_checkboxes(conn, name, collection, _opts, resource, model_name, errors, name_ids) do theme_module(conn, Form).wrap_collection_check_boxes(fn -> for opt <- collection do opt_id = Schema.get_id(opt) @@ -1602,13 +1602,13 @@ defmodule ExAdmin.Form do defp build_select(_name, type, value, opts) do value = - if Range.range?(value) do - Enum.map(value, fn x -> - val = Integer.to_string(x) - {val, val} - end) - else - value + case value do + _first.._last -> + Enum.map(value, fn x -> + val = Integer.to_string(x) + {val, val} + end) + _ -> value end select "", [{:class, "form-control date-time"} | opts] do diff --git a/lib/ex_admin/render.ex b/lib/ex_admin/render.ex index 2443e561..af6bafe8 100644 --- a/lib/ex_admin/render.ex +++ b/lib/ex_admin/render.ex @@ -1,4 +1,3 @@ -alias ExAdmin.Utils defprotocol ExAdmin.Render do # @fallback_to_any true diff --git a/lib/ex_admin/show.ex b/lib/ex_admin/show.ex index 671deba5..da14cf51 100644 --- a/lib/ex_admin/show.ex +++ b/lib/ex_admin/show.ex @@ -65,6 +65,7 @@ defmodule ExAdmin.Show do import ExAdmin.Utils import ExAdmin.ViewHelpers _ = var!(resource) + _ = unquote(resource) # allow others downstream to not have warnings of not using markup safe: true do unquote(contents) @@ -501,7 +502,7 @@ defmodule ExAdmin.Show do |> Enum.map(&{translate_field(defn, &1), %{}}) |> Enum.reject(&is_nil(&1)) - ExAdmin.Table.attributes_table(conn, resource, %{rows: columns}) + ExAdmin.Table.attributes_table(conn, resource, %{rows: columns}) #|> IO.inspect end end diff --git a/lib/ex_admin/table.ex b/lib/ex_admin/table.ex index e0c9e45a..e7c1a425 100644 --- a/lib/ex_admin/table.ex +++ b/lib/ex_admin/table.ex @@ -126,9 +126,7 @@ defmodule ExAdmin.Table do do: output |> Enum.reverse() - |> Enum.map(&Phoenix.HTML.safe_to_string(Phoenix.HTML.html_escape(&1))) |> Enum.join() - |> Phoenix.HTML.raw() def do_panel( conn, @@ -329,7 +327,7 @@ defmodule ExAdmin.Table do # |> Phoenix.HTML.raw() end) |> Enum.join(" ") - res = markup do + _res = markup do td to_class(".td-", field_name) do content end diff --git a/lib/ex_admin/themes/active_admin/index.ex b/lib/ex_admin/themes/active_admin/index.ex index 5a12c60d..b1436b04 100644 --- a/lib/ex_admin/themes/active_admin/index.ex +++ b/lib/ex_admin/themes/active_admin/index.ex @@ -94,7 +94,7 @@ defmodule ExAdmin.Theme.ActiveAdmin.Index do cellpadding: "0", paginator: "true" do tbody do - Enum.chunk(page.entries, columns, columns, [nil]) + Enum.chunk_every(page.entries, columns, columns, [nil]) |> Enum.map(fn list -> tr do Enum.map(list, fn item -> diff --git a/lib/ex_admin/themes/admin_lte2/index.ex b/lib/ex_admin/themes/admin_lte2/index.ex index e7aab885..fa4386ef 100644 --- a/lib/ex_admin/themes/admin_lte2/index.ex +++ b/lib/ex_admin/themes/admin_lte2/index.ex @@ -89,7 +89,7 @@ defmodule ExAdmin.Theme.AdminLte2.Index do div ".container-fluid" do col_width = Kernel.div(12, columns) - Enum.chunk(page.entries, columns, columns, [nil]) + Enum.chunk_every(page.entries, columns, columns, [nil]) |> Enum.map(fn list -> div ".row" do Enum.map(list, fn item -> diff --git a/lib/ex_admin/utils.ex b/lib/ex_admin/utils.ex index 496ffa0b..30d3e459 100644 --- a/lib/ex_admin/utils.ex +++ b/lib/ex_admin/utils.ex @@ -381,7 +381,6 @@ defmodule ExAdmin.Utils do false end - @doc false @doc "Pads with zero" def zero_pad(val, count) do num = Integer.to_string(val) diff --git a/mix.exs b/mix.exs index b98d7449..9ba032ad 100644 --- a/mix.exs +++ b/mix.exs @@ -72,8 +72,8 @@ defmodule ExAdmin.Mixfile do {:xain, "0.6.1"}, #TODO: https://github.com/smpallen99/xain/issues/20 {:csvlixir, "~> 1.0.0"}, {:exactor, "~> 2.2.0"}, - {:ex_doc, "~> 0.11", only: :dev}, - {:earmark, "~> 0.1", only: :dev}, + {:ex_doc, "~> 0.16.2", only: :dev}, + {:earmark, "~> 1.1", only: :dev}, {:ex_queb, github: "iwarshak/ex_queb"}, {:excoveralls, "~> 0.5", only: :test}, {:gettext, "~> 0.11"}, diff --git a/mix.lock b/mix.lock index 6d58c691..bbc92739 100644 --- a/mix.lock +++ b/mix.lock @@ -6,9 +6,9 @@ "csvlixir": {:hex, :csvlixir, "1.0.0", "e9fd30abfca2d312390060e86bb7ec52487c813824dcccad45bb13e85ecad6b1", [:mix], [], "hexpm"}, "db_connection": {:hex, :db_connection, "2.1.0", "122e2f62c4906bf2e49554f1e64db5030c19229aa40935f33088e7d543aa79d0", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm"}, "decimal": {:hex, :decimal, "1.7.0", "30d6b52c88541f9a66637359ddf85016df9eb266170d53105f02e4a67e00c5aa", [:mix], [], "hexpm"}, - "earmark": {:hex, :earmark, "0.2.1", "ba6d26ceb16106d069b289df66751734802777a3cbb6787026dd800ffeb850f3", [:mix], [], "hexpm"}, + "earmark": {:hex, :earmark, "1.3.2", "b840562ea3d67795ffbb5bd88940b1bed0ed9fa32834915125ea7d02e35888a5", [:mix], [], "hexpm"}, "ecto": {:hex, :ecto, "3.1.6", "e890bf66c1d4d8e2b8e010f7cba092a08139b55437bc3382371f72a6ee40757e", [:mix], [{:decimal, "~> 1.6", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm"}, - "ex_doc": {:hex, :ex_doc, "0.12.0", "b774aabfede4af31c0301aece12371cbd25995a21bb3d71d66f5c2fe074c603f", [:mix], [{:earmark, "~> 0.2", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"}, + "ex_doc": {:hex, :ex_doc, "0.20.2", "1bd0dfb0304bade58beb77f20f21ee3558cc3c753743ae0ddbb0fd7ba2912331", [:mix], [{:earmark, "~> 1.3", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.10", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, "ex_queb": {:git, "https://github.com/iwarshak/ex_queb.git", "32bac2a5727f3a35800ddbd70b0ba7b8ce933b72", []}, "exactor": {:hex, :exactor, "2.2.4", "5efb4ddeb2c48d9a1d7c9b465a6fffdd82300eb9618ece5d34c3334d5d7245b1", [:mix], [], "hexpm"}, "excoveralls": {:hex, :excoveralls, "0.10.3", "b090a3fbcb3cfa136f0427d038c92a9051f840953ec11b40ee74d9d4eac04d1e", [:mix], [{:hackney, "~> 1.13", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"}, @@ -25,11 +25,14 @@ "inflex": {:hex, :inflex, "1.10.0", "8366a7696e70e1813aca102e61274addf85d99f4a072b2f9c7984054ea1b9d29", [:mix], [], "hexpm"}, "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"}, "jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm"}, + "makeup": {:hex, :makeup, "0.8.0", "9cf32aea71c7fe0a4b2e9246c2c4978f9070257e5c9ce6d4a28ec450a839b55f", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.13.0", "be7a477997dcac2e48a9d695ec730b2d22418292675c75aa2d34ba0909dcdeda", [:mix], [{:makeup, "~> 0.8", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"}, "mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm"}, "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm"}, "mochiweb": {:hex, :mochiweb, "2.18.0", "eb55f1db3e6e960fac4e6db4e2db9ec3602cc9f30b86cd1481d56545c3145d2e", [:rebar3], [], "hexpm"}, "mochiweb_html": {:hex, :mochiweb_html, "2.15.0", "d7402e967d7f9f2912f8befa813c37be62d5eeeddbbcb6fe986c44e01460d497", [:rebar3], []}, + "nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm"}, "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"}, "phoenix": {:hex, :phoenix, "1.4.0", "56fe9a809e0e735f3e3b9b31c1b749d4b436e466d8da627b8d82f90eaae714d2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm"}, "phoenix_ecto": {:hex, :phoenix_ecto, "4.0.0", "c43117a136e7399ea04ecaac73f8f23ee0ffe3e07acfcb8062fe5f4c9f0f6531", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, diff --git a/web/templates/themes/admin_lte2/layout/title_bar.html.eex b/web/templates/themes/admin_lte2/layout/title_bar.html.eex index 16d3bd41..67426bcb 100644 --- a/web/templates/themes/admin_lte2/layout/title_bar.html.eex +++ b/web/templates/themes/admin_lte2/layout/title_bar.html.eex @@ -8,7 +8,7 @@ <%= case name do %> <%= "admin" -> %> <%= name %> - <%= _ -> %> + <% _ -> %> <%= truncate name , length: 15 %> <% end %>