Class: Locomotive::ApiKeyInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Includes:
SimpleForm::Inputs::FasterTranslate
Defined in:
app/inputs/locomotive/api_key_input.rb

Instance Method Summary collapse

Methods included from SimpleForm::Inputs::FasterTranslate

#translate_from_namespace

Instance Method Details

#api_key_htmlObject


10
11
12
13
# File 'app/inputs/locomotive/api_key_input.rb', line 10

def api_key_html
  api_key = object.api_key || I18n.t('simple_form.labels.locomotive.account.no_api_key')
  template. :code, api_key
end

#input(wrapper_options) ⇒ Object


6
7
8
# File 'app/inputs/locomotive/api_key_input.rb', line 6

def input(wrapper_options)
  api_key_html + regenerate_button
end

#regenerate_buttonObject


15
16
17
18
19
20
21
22
23
# File 'app/inputs/locomotive/api_key_input.rb', line 15

def regenerate_button
  url = options[:url]
  template. :button, I18n.t('simple_form.buttons.locomotive.account.new_api_key'),
    class:  'btn btn-default btn-sm form-control-button',
    data:   {
      url:      url,
      confirm:  I18n.t('locomotive.messages.confirm')
    }
end