Class: KeyPresenter

Inherits:
Gitlab::View::Presenter::Delegated show all
Defined in:
app/presenters/key_presenter.rb

Overview

rubocop:disable Gitlab/NamespacedClass

Direct Known Subclasses

DeployKeyPresenter

Instance Method Summary collapse

Methods inherited from Gitlab::View::Presenter::Delegated

#initialize

Methods included from Gitlab::Utils::DelegatorOverride

#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!

Methods included from Gitlab::View::Presenter::Base

#__subject__, #can?, #declarative_policy_delegate, #is_a?, #path_with_line_numbers, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?

Methods included from Gitlab::Routing

includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::View::Presenter::Delegated

Instance Method Details

#humanized_error_message(type: :key) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'app/presenters/key_presenter.rb', line 6

def humanized_error_message(type: :key)
  if !key_object.public_key.valid?
    help_link = help_page_link(_('supported SSH public key.'), 'user/ssh', 'supported-ssh-key-types')

    _('%{type} must be a %{help_link}').html_safe % { type: type.to_s.titleize, help_link: help_link }
  else
    key_object.errors.full_messages.join(', ').html_safe
  end
end