Sha256: b4d671c4e13e03aa83860f421b43deec5138a8b918392f6272139374743c9481

Contents?: true

Size: 707 Bytes

Versions: 5

Compression:

Stored size: 707 Bytes

Contents

module Locomotive
  class ApiKeyInput < ::SimpleForm::Inputs::Base

    include Locomotive::SimpleForm::Inputs::FasterTranslate

    def input(wrapper_options)
      api_key_html + regenerate_button
    end

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

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

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
locomotivecms-3.0.0.rc6 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.0.0.rc5 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.0.0.rc4 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.0.0.rc3 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.0.0.rc2 app/inputs/locomotive/api_key_input.rb