Sha256: 7c3a012566cd9995255e7d44979c2f78129c3284d5faab31431e137f8c21a169

Contents?: true

Size: 715 Bytes

Versions: 30

Compression:

Stored size: 715 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-sm form-control-button',
        data:   {
          url:      url,
          confirm:  I18n.t('locomotive.messages.confirm')
        }
    end

  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
locomotivecms-4.1.1 app/inputs/locomotive/api_key_input.rb
locomotivecms-4.1.0 app/inputs/locomotive/api_key_input.rb
locomotivecms-4.1.0.rc1 app/inputs/locomotive/api_key_input.rb
locomotivecms-4.0.3 app/inputs/locomotive/api_key_input.rb
locomotivecms-4.0.2 app/inputs/locomotive/api_key_input.rb
locomotivecms-4.0.1 app/inputs/locomotive/api_key_input.rb
locomotivecms-4.0.0 app/inputs/locomotive/api_key_input.rb
locomotivecms-4.0.0.rc0 app/inputs/locomotive/api_key_input.rb
locomotivecms-4.0.0.alpha3 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.4.1 app/inputs/locomotive/api_key_input.rb
locomotivecms-4.0.0.alpha2 app/inputs/locomotive/api_key_input.rb
locomotivecms-4.0.0.alpha1 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.4.0 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.3.0 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.3.0.rc3 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.3.0.rc2 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.1.2 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.2.1 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.3.0.rc1 app/inputs/locomotive/api_key_input.rb
locomotivecms-3.2.0 app/inputs/locomotive/api_key_input.rb