Class: Locomotive::ApiKeyInput
- Inherits:
-
Object
- Object
- Locomotive::ApiKeyInput
- Includes:
- Formtastic::Inputs::Base
- Defined in:
- app/inputs/locomotive/api_key_input.rb
Instance Method Summary collapse
- #api_key_html ⇒ Object
- #errors? ⇒ Boolean
- #input_wrapping(&block) ⇒ Object
- #regenerate_button ⇒ Object
- #to_html ⇒ Object
Instance Method Details
#api_key_html ⇒ Object
20 21 22 23 |
# File 'app/inputs/locomotive/api_key_input.rb', line 20 def api_key_html api_key = self.object.api_key || I18n.t('locomotive.api_key.none') template.content_tag :code, api_key end |
#errors? ⇒ Boolean
35 36 37 |
# File 'app/inputs/locomotive/api_key_input.rb', line 35 def errors? false end |
#input_wrapping(&block) ⇒ Object
13 14 15 16 17 18 |
# File 'app/inputs/locomotive/api_key_input.rb', line 13 def input_wrapping(&block) template.content_tag(:li, [template.capture(&block), hint_html].join("\n").html_safe, ) end |
#regenerate_button ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/inputs/locomotive/api_key_input.rb', line 25 def url = [:url] template.content_tag :button, I18n.t('locomotive.api_key.button'), class: 'regenerate', data: { url: url, confirm: I18n.t('locomotive.messages.confirm') } end |
#to_html ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/inputs/locomotive/api_key_input.rb', line 5 def to_html input_wrapping do label_html << api_key_html << end end |