Sha256: 600ab9961e099e44ecd8d29857b96ec17e634bb0267c1bba0164e01b9249fefd

Contents?: true

Size: 1.72 KB

Versions: 3

Compression:

Stored size: 1.72 KB

Contents

# frozen_string_literal: true

module MinimalistAuthentication
  module ApplicationHelper
    def ma_confirm_password_field(form, options = {})
      form.password_field(
        :password_confirmation,
        options.reverse_merge(
          autocomplete: "new-password",
          minlength:    MinimalistAuthentication.user_model.password_minimum,
          placeholder:  t(".password_confirmation.placeholder"),
          required:     true
        )
      )
    end

    def ma_email_field(form, options = {})
      form.email_field(
        :email,
        options.reverse_merge(
          autocomplete: "email",
          autofocus:    true,
          placeholder:  t(".email.placeholder", default: true),
          required:     true
        )
      )
    end

    def ma_forgot_password_link
      link_to(t(".forgot_password"), new_password_reset_path)
    end

    def ma_new_password_field(form, options = {})
      form.password_field(
        :password,
        options.reverse_merge(
          autocomplete: "new-password",
          minlength:    MinimalistAuthentication.user_model.password_minimum,
          placeholder:  t(".password.placeholder"),
          required:     true
        )
      )
    end

    def ma_password_field(form, options = {})
      form.password_field(
        :password,
        options.reverse_merge(
          autocomplete: "current-password",
          placeholder:  true,
          required:     true
        )
      )
    end

    def ma_username_field(form, options = {})
      form.text_field(
        :username,
        options.reverse_merge(
          autocomplete: "username",
          autofocus:    true,
          placeholder:  true,
          required:     true
        )
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
minimalist_authentication-3.2.2 app/helpers/minimalist_authentication/application_helper.rb
minimalist_authentication-3.2.1 app/helpers/minimalist_authentication/application_helper.rb
minimalist_authentication-3.2.0 app/helpers/minimalist_authentication/application_helper.rb