defmodule <%= application_module %>.ErrorHelpers do
  @moduledoc """
  Conveniences for translating and building error messages.
  """
  <%= if html do %>
  use Phoenix.HTML

  @doc """
  Generates tag for inlined form input errors.
  """
  def error_tag(form, field) do
    if error = form.errors[field] do
      content_tag :span, translate_error(error), class: "help-block"
    end
  end
  <% end %>
  @doc """
  Translates an error message using gettext.
  """
  def translate_error({msg, opts}) do
    # Because error messages were defined within Ecto, we must
    # call the Gettext module passing our Gettext backend. We
    # also use the "errors" domain as translations are placed
    # in the errors.po file. On your own code and templates,
    # this could be written simply as:
    #
    #     dngettext "errors", "1 file", "%{count} files", count
    #
    Gettext.dngettext(<%= application_module %>.Gettext, "errors", msg, msg, opts[:count], opts)
  end

  def translate_error(msg) do
    Gettext.dgettext(<%= application_module %>.Gettext, "errors", msg)
  end
end

defmodule <%= application_module %>.ErrorHelpers do
  @moduledoc """
  Conveniences for translating and building error messages.
  """
<%= if html do %>
  use Phoenix.HTML

  @doc """
  Generates tag for inlined form input errors.
  """
  def error_tag(form, field) do
    if error = form.errors[field] do
      content_tag :span, translate_error(error), class: "help-block"
    end
  end
<% end %>
  @doc """
  Translates an error message using gettext.
  """
  def translate_error({msg, opts}) do
    # Because error messages were defined within Ecto, we must
    # call the Gettext module passing our Gettext backend. We
    # also use the "errors" domain as translations are placed
    # in the errors.po file. On your own code and templates,
    # this could be written simply as:
    #
    #     dngettext "errors", "1 file", "%{count} files", count
    #
    Gettext.dngettext(<%= application_module %>.Gettext, "errors", msg, msg, opts[:count], opts)
  end

  def translate_error(msg) do
    Gettext.dgettext(<%= application_module %>.Gettext, "errors", msg)
  end
end

Remove trailing whitespace in generated file
Remove trailing whitespace in generated file
seejee/phoenix,mobileoverlord/phoenix,pap/phoenix,ericmj/phoenix,pap/phoenix,dmarkow/phoenix,phoenixframework/phoenix,gjaldon/phoenix,cas27/phoenix,CultivateHQ/phoenix,Gazler/phoenix,michalmuskala/phoenix,mschae/phoenix,Kosmas/phoenix,mschae/phoenix,optikfluffel/phoenix,vic/phoenix,Ben-Evolently/phoenix,Rumel/phoenix,stevedomin/phoenix,jamilabreu/phoenix,mitchellhenke/phoenix,evax/phoenix,bsmr-erlang/phoenix,iStefo/phoenix,gjaldon/phoenix,eksperimental/phoenix,korobkov/phoenix,jwarwick/phoenix,Rumel/phoenix,0x00evil/phoenix,nshafer/phoenix,andrewvy/phoenix,trarbr/phoenix,CultivateHQ/phoenix,andrewvy/phoenix,Gazler/phoenix,mitchellhenke/phoenix,ephe-meral/phoenix,trarbr/phoenix,keathley/phoenix,ericmj/phoenix,Joe-noh/phoenix,rafbgarcia/phoenix,bsmr-erlang/phoenix,seejee/phoenix,ybur-yug/phoenix,Smulligan85/phoenix,ybur-yug/phoenix,stevedomin/phoenix,dmarkow/phoenix,cas27/phoenix,wsmoak/phoenix,jwarwick/phoenix,optikfluffel/phoenix,ephe-meral/phoenix,jamilabreu/phoenix,rafbgarcia/phoenix,optikfluffel/phoenix,Joe-noh/phoenix,Smulligan85/phoenix,rafbgarcia/phoenix,wsmoak/phoenix,phoenixframework/phoenix,mobileoverlord/phoenix,iStefo/phoenix,Kosmas/phoenix,michalmuskala/phoenix,eksperimental/phoenix,nshafer/phoenix,keathley/phoenix,evax/phoenix,0x00evil/phoenix,0x00evil/phoenix,vic/phoenix,nshafer/phoenix,phoenixframework/phoenix,korobkov/phoenix