Class: Adminpanel::Section

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Base
Defined in:
app/models/adminpanel/section.rb

Constant Summary collapse

VALID_EMAIL_REGEX =
/\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#correlative_order_gallery, #destroy_unattached_images

Class Method Details

.display_nameObject



50
51
52
# File 'app/models/adminpanel/section.rb', line 50

def self.display_name
  I18n.t('model.Section')
end

.form_attributesObject



36
37
38
39
40
41
42
43
44
# File 'app/models/adminpanel/section.rb', line 36

def self.form_attributes
  [
    {'description' => {'name' => 'Descripcion', 'description' => 'label', 'label' => 'Seccion'}},
    {'name' => {'name' => 'name', 'label' => 'Seccion'}},
    {'key' => {'name' => 'key', 'label' => 'Llave'}},
    {'page' => {'name' => 'page'}},
    {'sectionfiles' => {'type' => 'adminpanel_file_field', 'show' => false}},
  ]
end

.iconObject



46
47
48
# File 'app/models/adminpanel/section.rb', line 46

def self.icon
  'tasks'
end

.routes_optionsObject



62
63
64
# File 'app/models/adminpanel/section.rb', line 62

def self.routes_options
  { path: collection_name.parameterize, except: [:new, :create, :destroy] }
end

Instance Method Details

#descriptionObject



54
55
56
57
58
59
60
# File 'app/models/adminpanel/section.rb', line 54

def description
  if self.has_description
    return super.try(:html_safe)
  else
    return super
  end
end