Sha256: 33a80c1cd01c7e846b715548eb48a0ebbdd7b3b48f1e8d1e54cfb104b7e12f44

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

module ExpressAdmin
  class SettingForm < ExpressTemplates::Components::Container
    include ExpressTemplates::Components::Capabilities::Configurable

    # .widget-box
    #   %h2.widget-header Blog
    #   .widget-body
    #     = form_tag admin_blog_settings_path, id: 'blog-setting-form', onSubmit: 'return false;', method: 'patch' do
    #       = hidden_field_tag :form_id, 'blog-setting-form'
    #       - ExpressBlog.settings.blog_setting.each do |setting|
    #         = edit_setting setting
    #       .form-group.widget-buttons
    #         = submit_tag 'Save', class: 'button tiny right radius ajax-submit'


    helper(:save_button) { submit_tag 'Save', class: 'button tiny right radius ajax-submit' }

    helper(:settings_path) { self.send("admin_#{current_module_path_name.gsub(/express_/, '')}_settings_path") }

    helper(:settings) { |setting_type|
      current_module.settings.send("#{setting_type}_setting").map do |setting|
        edit_setting(setting)
      end.join()
    }

    emits -> {
        widget_box(my[:id]) {
          setting_selector = my[:id].to_s.gsub('_', '-')
          form(href: ExpressAdmin::SettingForm.settings_path, id: "#{setting_selector}-setting-form", onSubmit: 'return false;', method: 'POST') {
            form_rails_support(:patch)
            hidden_field_tag :form_id, "#{setting_selector}-setting-form"
            div._form_group {
              _yield
            }
            settings(my[:id])
            div._form_group._widget_buttons {
              save_button
            }
          }
        }
      }


  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
express_admin-1.2.1 app/components/express_admin/setting_form.rb
express_admin-1.2.0 app/components/express_admin/setting_form.rb
express_admin-1.1.0 app/components/express_admin/setting_form.rb