Class: Decidim::DecidimAwesome::Admin::MenuForm

Inherits:
Form
  • Object
show all
Includes:
TranslatableAttributes
Defined in:
app/forms/decidim/decidim_awesome/admin/menu_form.rb

Constant Summary collapse

VISIBILITY_STATES =
%w(default hidden logged non_logged verified_user).freeze

Instance Method Summary collapse

Instance Method Details

#map_model(model) ⇒ Object

remove query string from native menu element (to avoid interactions with the locale in the generated url)



23
24
25
# File 'app/forms/decidim/decidim_awesome/admin/menu_form.rb', line 23

def map_model(model)
  self.url = Addressable::URI.parse(model.url).path if model.native?
end

#to_paramsObject



27
28
29
30
31
32
33
34
35
# File 'app/forms/decidim/decidim_awesome/admin/menu_form.rb', line 27

def to_params
  {
    label: raw_label,
    position:,
    url:,
    target:,
    visibility:
  }
end