Class: Adminpanel::Permission
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Adminpanel::Permission
- Includes:
- ApplicationHelper, Base
- Defined in:
- app/models/adminpanel/permission.rb
Class Method Summary collapse
- .display_name ⇒ Object
-
.form_attributes ⇒ Object
def resource symbol_class(self).display_name.to_s.pluralize(I18n.default_locale) end.
- .icon ⇒ Object
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, #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_name ⇒ Object
50 51 52 |
# File 'app/models/adminpanel/permission.rb', line 50 def self.display_name 'Permiso' #singular end |
.form_attributes ⇒ Object
def resource
symbol_class(self['resource']).display_name.to_s.pluralize(I18n.default_locale)
end
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/models/adminpanel/permission.rb', line 25 def self.form_attributes [ { 'rol_id' => { 'type' => 'belongs_to', 'label' => I18n.t('permission.rol'), 'model' => 'Adminpanel::Rol', # 'remote_resource' => false } }, { 'action' => { 'type' => 'enum_field', 'label' => I18n.t('permission.action'), } }, { 'resource' => { 'type' => 'resource_select', 'label' => I18n.t('permission.resource'), } }, ] end |
.icon ⇒ Object
54 55 56 |
# File 'app/models/adminpanel/permission.rb', line 54 def self.icon "gavel" # fa-{icon} end |
Instance Method Details
#name ⇒ Object
11 12 13 |
# File 'app/models/adminpanel/permission.rb', line 11 def name "#{action} #{symbol_class(self['resource']).display_name}" end |