Class: KonoUtils::Object::Cell::Buttons::Delete

Inherits:
KonoUtils::Object::Cell::Base show all
Defined in:
app/concepts/kono_utils/object/cell/buttons/delete.rb

Direct Known Subclasses

NestedWrappers::RemoveButton

Instance Method Summary collapse

Methods inherited from KonoUtils::Object::Cell::Base

#_prefixes, #base_class, #concept, #content_for_layout, #content_for_layout?, #destroy_custom_polymorphic_path, #edit_custom_polymorphic_path, #index_custom_polymorphic_path, #kono_user, #legacy_concept, logger, #model_gender, #new_custom_polymorphic_path, #show_custom_polymorphic_path, #title_del, #title_del_g, #title_edit_g, #title_mod, #title_new, #title_new_g, #title_newa, #title_show_g

Methods included from KonoUtilsBootstrapView4::ApplicationIconHelper

#fa_icon, #icon

Instance Method Details

#automatic_remove_optionsObject

Metodo che è possibili fare override per rimuovere le funzioni di rails di conferma automatica



22
23
24
25
26
27
# File 'app/concepts/kono_utils/object/cell/buttons/delete.rb', line 22

def automatic_remove_options
  {
    method: :delete,
    data: { confirm: t(:are_you_sure), title: I18n.t('kono_utils.bootstrap4.buttons.delete.title') },
  }
end

#btn_opts(opts = {}) ⇒ Object



15
16
17
18
# File 'app/concepts/kono_utils/object/cell/buttons/delete.rb', line 15

def btn_opts(opts = {})
  custom_options = options.dig(:button_options) || opts
  super(automatic_remove_options.merge(custom_options))
end

#button_contentObject



29
30
31
# File 'app/concepts/kono_utils/object/cell/buttons/delete.rb', line 29

def button_content
  options.fetch(:content, fa_icon("trash"))
end

#specific_button_classObject



11
12
13
# File 'app/concepts/kono_utils/object/cell/buttons/delete.rb', line 11

def specific_button_class
  'btn-danger'
end

#url_toObject



7
8
9
# File 'app/concepts/kono_utils/object/cell/buttons/delete.rb', line 7

def url_to
  options[:url_to] || destroy_custom_polymorphic_path(model)
end