Class: Adminpanel::Permission

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ApplicationHelper

#adminpanel_form_for, #full_title, #is_current_section?, #link_to_add_fields, #main_root_path, #route_symbol, #section_is_login, #symbol_class

Methods included from SharedPagesHelper

#active_tab, #belong_to_object_name, #class_name_downcase, #demodulize_class, #get_oauth_link, #pluralize_model, #relationship_ids

Methods included from BreadcrumbsHelper

#breadcrumb_add, #render_breadcrumb

Methods included from SessionsHelper

#current_user, #current_user=, #sign_in, #sign_out, #signed_in?

Class Method Details

.display_nameObject



44
45
46
# File 'app/models/adminpanel/permission.rb', line 44

def self.display_name
  'Permiso' #singular
end

.form_attributesObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/models/adminpanel/permission.rb', line 15

def self.form_attributes
  [
    {
      'rol_id' => {
        'type' => 'belongs_to',
        'label' => 'rol',
        'placeholder' => 'rol',
        'model' => 'Adminpanel::Rol',
        # 'remote_resource' => false
      }
    },
    {
      'action' => {
        'type' => 'enum_field',
        'label' => 'action',
        'placeholder' => 'action',
      }
    },
    {
      'resource' => {
        'type' => 'resource_select',
        'label' => 'resource',
        'placeholder' => 'resource',
      }
    },

  ]
end

.iconObject



48
49
50
# File 'app/models/adminpanel/permission.rb', line 48

def self.icon
  "gavel" # fa-{icon}
end

Instance Method Details

#nameObject



11
12
13
# File 'app/models/adminpanel/permission.rb', line 11

def name
  "#{I18n.t('enum.' + action.to_s)} #{symbol_class(self.resource).display_name}"
end